[gimp/gimp-2-10] app: in GimpTileHandlerValidate, clear data when allocating tile



commit cf0abb0ed9337fbdc8e9c4dddf843c05988aa792
Author: Ell <ell_se yahoo com>
Date:   Fri Aug 3 11:58:01 2018 -0400

    app: in GimpTileHandlerValidate, clear data when allocating tile
    
    In GimpTileHandlerValidate, when allocating a new tile upon a
    TILE_GET command, but not rendering the whole tile, clear the tile
    data before rendering, so that the unrendered regions of the tile
    contain zeros, rather than junk.
    
    (cherry picked from commit e1e4ba9c8b18c860ceed0cedf21a793517da3d06)

 app/gegl/gimptilehandlervalidate.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/app/gegl/gimptilehandlervalidate.c b/app/gegl/gimptilehandlervalidate.c
index e9b6d953a1..eb0debd712 100644
--- a/app/gegl/gimptilehandlervalidate.c
+++ b/app/gegl/gimptilehandlervalidate.c
@@ -260,15 +260,20 @@ gimp_tile_handler_validate_validate (GeglTileSource *source,
           gint n_rects;
           gint i;
 
-          if (! tile)
-            tile = gegl_tile_handler_create_tile (GEGL_TILE_HANDLER (source),
-                                                  x, y, 0);
-
           cairo_region_subtract_rectangle (validate->dirty_region, &tile_rect);
 
           tile_bpp    = babl_format_get_bytes_per_pixel (validate->format);
           tile_stride = tile_bpp * validate->tile_width;
 
+          if (! tile)
+            {
+              tile = gegl_tile_handler_create_tile (GEGL_TILE_HANDLER (source),
+                                                    x, y, 0);
+
+              memset (gegl_tile_get_data (tile),
+                      0, tile_stride * validate->tile_height);
+            }
+
           gegl_tile_lock (tile);
 
           n_rects = cairo_region_num_rectangles (tile_region);


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