[gegl/gsoc2009-gpu] gegl-buffer-access.c: handle the case where the first tile is also the last tile to be accessed



commit 9bc3c65d64412e2d21ba6bb95343ebc01e3dc2d4
Author: Jerson Michael Perpetua <jersonperpetua gmail com>
Date:   Sun Aug 23 00:30:05 2009 +0800

    gegl-buffer-access.c: handle the case where the first tile is also the last tile to be accessed

 gegl/buffer/gegl-buffer-access.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index a0be283..9d499f7 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -814,7 +814,9 @@ gegl_buffer_gpu_iterate (GeglBuffer          *buffer,
   for (tile_index_y       = first_tile_index_y,
          tile_offset_y    = first_tile_offset_y,
          texture_y        = first_texture_y,
-         copy_area_height = tile_height - tile_offset_y;
+         copy_area_height = tile_index_y < last_tile_index_y
+                              ? tile_height - tile_offset_y
+                              : last_tile_offset_y - tile_offset_y + 1;
 
        tile_index_y <= last_tile_index_y;
 
@@ -828,7 +830,9 @@ gegl_buffer_gpu_iterate (GeglBuffer          *buffer,
       for (tile_index_x      = first_tile_index_x,
              tile_offset_x   = first_tile_offset_x,
              texture_x       = first_texture_x,
-             copy_area_width = tile_width - tile_offset_x;
+             copy_area_width = tile_index_x < last_tile_index_x
+                                 ? tile_width - tile_offset_x
+                                 : last_tile_offset_x - tile_offset_x + 1;
 
            tile_index_x <= last_tile_index_x;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]