[gimp/goat-invasion: 449/608] app: remove x, y and color parameters from temp_buf_new()



commit e5a03fc58a3169d93a7cfe0b25ba1186d31aab92
Author: Michael Natterer <mitch gimp org>
Date:   Sat Apr 7 23:46:43 2012 +0200

    app: remove x, y and color parameters from temp_buf_new()
    
    Fix the places that passed the color by either temp_buf_data_clear()
    or memset(), and assign x and y manually, they are going to vanish
    completely soon.

 app/base/temp-buf.c                    |   65 +++++---------------------------
 app/base/temp-buf.h                    |    5 +--
 app/base/tile-manager-preview.c        |    2 +-
 app/core/gimpbrush-load.c              |    9 ++--
 app/core/gimpbrush-transform.c         |    4 +-
 app/core/gimpbrush.c                   |    7 ++-
 app/core/gimpbrushclipboard.c          |    9 ++--
 app/core/gimpbrushgenerated.c          |    5 +-
 app/core/gimpbuffer.c                  |    3 +-
 app/core/gimpdrawable-preview.c        |    2 +-
 app/core/gimpgradient.c                |    2 +-
 app/core/gimppalette.c                 |    4 +-
 app/core/gimppattern-load.c            |    5 +-
 app/core/gimppattern.c                 |    5 +-
 app/core/gimppatternclipboard.c        |    7 +--
 app/core/gimppreviewcache.c            |    2 +-
 app/core/gimpviewable.c                |    4 +-
 app/paint/gimpbrushcore.c              |   18 +++-----
 app/paint/gimpconvolve.c               |    3 +-
 app/paint/gimpink.c                    |    3 +-
 app/paint/gimpsmudge.c                 |    3 +-
 app/text/gimpfont.c                    |    4 +-
 app/vectors/gimpvectors-preview.c      |    4 +-
 app/widgets/gimpviewrendererdrawable.c |    6 +-
 24 files changed, 61 insertions(+), 120 deletions(-)
---
diff --git a/app/base/temp-buf.c b/app/base/temp-buf.c
index 8837539..9eb1307 100644
--- a/app/base/temp-buf.c
+++ b/app/base/temp-buf.c
@@ -47,10 +47,7 @@ static void  temp_buf_to_gray  (TempBuf *src_buf,
 TempBuf *
 temp_buf_new (gint          width,
               gint          height,
-              gint          bytes,
-              gint          x,
-              gint          y,
-              const guchar *color)
+              gint          bytes)
 {
   TempBuf *temp;
 
@@ -62,52 +59,11 @@ temp_buf_new (gint          width,
   temp->bytes   = bytes;
   temp->width   = width;
   temp->height  = height;
-  temp->x       = x;
-  temp->y       = y;
+  temp->x       = 0;
+  temp->y       = 0;
 
   temp->data = g_new (guchar, width * height * bytes);
 
-  /*  initialize the data  */
-  if (color)
-    {
-      glong i;
-
-      /* First check if we can save a lot of work */
-      for (i = 1; i < bytes; i++)
-        {
-          if (color[0] != color[i])
-            break;
-        }
-
-      if (i == bytes)
-        {
-          memset (temp->data, *color, width * height * bytes);
-        }
-      else /* No, we cannot */
-        {
-          guchar *dptr = temp->data;
-
-          /* Fill the first row */
-          for (i = width - 1; i >= 0; --i)
-            {
-              const guchar *c = color;
-              gint          j = bytes;
-
-              while (j--)
-                *dptr++ = *c++;
-            }
-
-          /* Now copy from it (we set bytes to bytes-per-row now) */
-          bytes *= width;
-
-          while (--height)
-            {
-              memcpy (dptr, temp->data, bytes);
-              dptr += bytes;
-            }
-        }
-    }
-
   return temp;
 }
 
@@ -120,7 +76,7 @@ temp_buf_copy (TempBuf *src,
                                    dest->height == src->height), NULL);
 
   if (! dest)
-    dest = temp_buf_new (src->width, src->height, src->bytes, 0, 0, NULL);
+    dest = temp_buf_new (src->width, src->height, src->bytes);
 
   if (! dest)
     return NULL;
@@ -160,7 +116,9 @@ temp_buf_resize (TempBuf *buf,
 
   if (! buf)
     {
-      buf = temp_buf_new (width, height, bytes, x, y, NULL);
+      buf = temp_buf_new (width, height, bytes);
+      buf->x = x;
+      buf->y = y;
     }
   else
     {
@@ -199,8 +157,7 @@ temp_buf_scale (TempBuf *src,
 
   dest = temp_buf_new (new_width,
                        new_height,
-                       src->bytes,
-                       0, 0, NULL);
+                       src->bytes);
 
   src_data  = temp_buf_get_data (src);
   dest_data = temp_buf_get_data (dest);
@@ -244,7 +201,6 @@ temp_buf_copy_area (TempBuf *src,
   TempBuf     *new;
   PixelRegion  srcPR  = { 0, };
   PixelRegion  destPR = { 0, };
-  guchar       empty[MAX_CHANNELS] = { 0, 0, 0, 0 };
   gint         x1, y1, x2, y2;
 
   g_return_val_if_fail (src != NULL, dest);
@@ -272,9 +228,8 @@ temp_buf_copy_area (TempBuf *src,
     {
       new = temp_buf_new (width  + dest_x,
                           height + dest_y,
-                          src->bytes,
-                          0, 0,
-                          empty);
+                          src->bytes);
+      temp_buf_data_clear (new);
     }
   else
     {
diff --git a/app/base/temp-buf.h b/app/base/temp-buf.h
index fd31fe5..e0b785f 100644
--- a/app/base/temp-buf.h
+++ b/app/base/temp-buf.h
@@ -34,10 +34,7 @@ struct _TempBuf
 
 TempBuf * temp_buf_new           (gint           width,
                                   gint           height,
-                                  gint           bytes,
-                                  gint           x,
-                                  gint           y,
-                                  const guchar  *color);
+                                  gint           bytes);
 TempBuf * temp_buf_copy          (TempBuf       *src,
                                   TempBuf       *dest);
 TempBuf * temp_buf_resize        (TempBuf       *buf,
diff --git a/app/base/tile-manager-preview.c b/app/base/tile-manager-preview.c
index 2577e01..ce60fc3 100644
--- a/app/base/tile-manager-preview.c
+++ b/app/base/tile-manager-preview.c
@@ -97,7 +97,7 @@ tile_manager_create_preview (TileManager *tiles,
   gint         subsample = 1;
 
   preview = temp_buf_new (dest_width, dest_height,
-                          tile_manager_bpp (tiles), 0, 0, NULL);
+                          tile_manager_bpp (tiles));
 
   pixel_region_init (&srcPR, tiles, src_x, src_y, src_width, src_height, FALSE);
 
diff --git a/app/core/gimpbrush-load.c b/app/core/gimpbrush-load.c
index 57fb2ce..bfb7820 100644
--- a/app/core/gimpbrush-load.c
+++ b/app/core/gimpbrush-load.c
@@ -291,7 +291,7 @@ gimp_brush_load_brush (GimpContext  *context,
                         NULL);
   g_free (name);
 
-  brush->mask = temp_buf_new (header.width, header.height, 1, 0, 0, NULL);
+  brush->mask = temp_buf_new (header.width, header.height, 1);
 
   mask = temp_buf_get_data (brush->mask);
   size = header.width * header.height * header.bytes;
@@ -345,8 +345,7 @@ gimp_brush_load_brush (GimpContext  *context,
       {
         guchar buf[8 * 1024];
 
-        brush->pixmap = temp_buf_new (header.width, header.height,
-                                      3, 0, 0, NULL);
+        brush->pixmap = temp_buf_new (header.width, header.height, 3);
         pixmap = temp_buf_get_data (brush->pixmap);
 
         for (i = 0; success && i < size;)
@@ -649,7 +648,7 @@ gimp_brush_load_abr_brush_v12 (FILE         *file,
         brush->x_axis.y = 0.0;
         brush->y_axis.x = 0.0;
         brush->y_axis.y = height / 2.0;
-        brush->mask     = temp_buf_new (width, height, 1, 0, 0, NULL);
+        brush->mask     = temp_buf_new (width, height, 1);
 
         mask = temp_buf_get_data (brush->mask);
         size = width * height * bytes;
@@ -756,7 +755,7 @@ gimp_brush_load_abr_brush_v6 (FILE         *file,
   brush->x_axis.y = 0.0;
   brush->y_axis.x = 0.0;
   brush->y_axis.y = height / 2.0;
-  brush->mask     = temp_buf_new (width, height, 1, 0, 0, NULL);
+  brush->mask     = temp_buf_new (width, height, 1);
 
   mask = temp_buf_get_data (brush->mask);
 
diff --git a/app/core/gimpbrush-transform.c b/app/core/gimpbrush-transform.c
index b8256a7..cf5778e 100644
--- a/app/core/gimpbrush-transform.c
+++ b/app/core/gimpbrush-transform.c
@@ -190,7 +190,7 @@ gimp_brush_real_transform_mask (GimpBrush *brush,
   gimp_matrix3_translate (&matrix, -x, -y);
   gimp_matrix3_invert (&matrix);
 
-  result = temp_buf_new (dest_width, dest_height, 1, 0, 0, NULL);
+  result = temp_buf_new (dest_width, dest_height, 1);
 
   dest = temp_buf_get_data (result);
   src  = temp_buf_get_data (source);
@@ -486,7 +486,7 @@ gimp_brush_real_transform_pixmap (GimpBrush *brush,
   gimp_matrix3_translate (&matrix, -x, -y);
   gimp_matrix3_invert (&matrix);
 
-  result = temp_buf_new (dest_width, dest_height, 3, 0, 0, NULL);
+  result = temp_buf_new (dest_width, dest_height, 3);
 
   dest = temp_buf_get_data (result);
   src  = temp_buf_get_data (source);
diff --git a/app/core/gimpbrush.c b/app/core/gimpbrush.c
index 088e584..a156e5e 100644
--- a/app/core/gimpbrush.c
+++ b/app/core/gimpbrush.c
@@ -288,7 +288,6 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
   TempBuf       *return_buf  = NULL;
   gint           mask_width;
   gint           mask_height;
-  guchar         transp[4]   = { 0, 0, 0, 0 };
   guchar        *mask;
   guchar        *buf;
   gint           x, y;
@@ -315,7 +314,8 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
 
           if (! mask_buf)
             {
-              mask_buf = temp_buf_new (1, 1, 1, 0, 0, transp);
+              mask_buf = temp_buf_new (1, 1, 1);
+              temp_buf_data_clear ((TempBuf *) mask_buf);
               free_mask = TRUE;
             }
 
@@ -330,7 +330,8 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
         }
     }
 
-  return_buf = temp_buf_new (mask_width, mask_height, 4, 0, 0, transp);
+  return_buf = temp_buf_new (mask_width, mask_height, 4);
+  temp_buf_data_clear (return_buf);
 
   mask = temp_buf_get_data (mask_buf);
   buf  = temp_buf_get_data (return_buf);
diff --git a/app/core/gimpbrushclipboard.c b/app/core/gimpbrushclipboard.c
index b952b97..be772c1 100644
--- a/app/core/gimpbrushclipboard.c
+++ b/app/core/gimpbrushclipboard.c
@@ -203,8 +203,8 @@ gimp_brush_clipboard_buffer_changed (Gimp      *gimp,
       width  = MIN (gimp_buffer_get_width  (gimp->global_buffer), 512);
       height = MIN (gimp_buffer_get_height (gimp->global_buffer), 512);
 
-      brush->mask   = temp_buf_new (width, height, 1, 0, 0, NULL);
-      brush->pixmap = temp_buf_new (width, height, 3, 0, 0, NULL);
+      brush->mask   = temp_buf_new (width, height, 1);
+      brush->pixmap = temp_buf_new (width, height, 3);
 
       /*  copy the alpha channel into the brush's mask  */
       if (babl_format_has_alpha (format))
@@ -232,12 +232,11 @@ gimp_brush_clipboard_buffer_changed (Gimp      *gimp,
     }
   else
     {
-      guchar color = 0;
-
       width  = 17;
       height = 17;
 
-      brush->mask = temp_buf_new (width, height, 1, 0, 0, &color);
+      brush->mask = temp_buf_new (width, height, 1);
+      temp_buf_data_clear (brush->mask);
     }
 
   brush->x_axis.x = width / 2;
diff --git a/app/core/gimpbrushgenerated.c b/app/core/gimpbrushgenerated.c
index b5c5bc8..add12a7 100644
--- a/app/core/gimpbrushgenerated.c
+++ b/app/core/gimpbrushgenerated.c
@@ -483,8 +483,9 @@ gimp_brush_generated_calc (GimpBrushGenerated      *brush,
                                       &s, &c, &x_axis, &y_axis);
 
   mask = temp_buf_new (half_width  * 2 + 1,
-                       half_height * 2 + 1,
-                       1, half_width, half_height, NULL);
+                       half_height * 2 + 1, 1);
+  mask->x = half_width;
+  mask->y = half_height;
 
   centerp = temp_buf_get_data (mask) + half_height * mask->width + half_width;
 
diff --git a/app/core/gimpbuffer.c b/app/core/gimpbuffer.c
index 724960b..e164378 100644
--- a/app/core/gimpbuffer.c
+++ b/app/core/gimpbuffer.c
@@ -200,8 +200,7 @@ gimp_buffer_get_new_preview (GimpViewable *viewable,
   TempBuf    *preview;
 
   preview = temp_buf_new (width, height,
-                          babl_format_get_bytes_per_pixel (format),
-                          0, 0, NULL);
+                          babl_format_get_bytes_per_pixel (format));
 
   gegl_buffer_get (buffer->buffer, NULL,
                    MIN ((gdouble) width  / (gdouble) gimp_buffer_get_width (buffer),
diff --git a/app/core/gimpdrawable-preview.c b/app/core/gimpdrawable-preview.c
index 166eb7e..06be6a8 100644
--- a/app/core/gimpdrawable-preview.c
+++ b/app/core/gimpdrawable-preview.c
@@ -218,7 +218,7 @@ gimp_drawable_indexed_preview (GimpDrawable *drawable,
                      src_x, src_y, src_width, src_height,
                      FALSE);
 
-  preview_buf = temp_buf_new (dest_width, dest_height, bytes, 0, 0, NULL);
+  preview_buf = temp_buf_new (dest_width, dest_height, bytes);
 
   pixel_region_init_temp_buf (&destPR, preview_buf,
                               0, 0, dest_width, dest_height);
diff --git a/app/core/gimpgradient.c b/app/core/gimpgradient.c
index 3b7be8d..3174388 100644
--- a/app/core/gimpgradient.c
+++ b/app/core/gimpgradient.c
@@ -220,7 +220,7 @@ gimp_gradient_get_new_preview (GimpViewable *viewable,
       cur_x += dx;
     }
 
-  temp_buf = temp_buf_new (width, height, 4, 0, 0, NULL);
+  temp_buf = temp_buf_new (width, height, 4);
 
   buf = temp_buf_get_data (temp_buf);
 
diff --git a/app/core/gimppalette.c b/app/core/gimppalette.c
index 662342d..21357ea 100644
--- a/app/core/gimppalette.c
+++ b/app/core/gimppalette.c
@@ -206,13 +206,13 @@ gimp_palette_get_new_preview (GimpViewable *viewable,
   guchar      *buf;
   guchar      *b;
   GList       *list;
-  guchar       white[3] = { 255, 255, 255 };
   gint         columns;
   gint         rows;
   gint         cell_size;
   gint         x, y;
 
-  temp_buf = temp_buf_new (width, height, 3, 0, 0, white);
+  temp_buf = temp_buf_new (width, height, 3);
+  memset (temp_buf_get_data (temp_buf), 255, width * height * 3);
 
   if (palette->n_columns > 1)
     cell_size = MAX (4, width / palette->n_columns);
diff --git a/app/core/gimppattern-load.c b/app/core/gimppattern-load.c
index ef84855..0ff399e 100644
--- a/app/core/gimppattern-load.c
+++ b/app/core/gimppattern-load.c
@@ -154,8 +154,7 @@ gimp_pattern_load (GimpContext  *context,
 
   g_free (name);
 
-  pattern->mask = temp_buf_new (header.width, header.height, header.bytes,
-                                0, 0, NULL);
+  pattern->mask = temp_buf_new (header.width, header.height, header.bytes);
   if (read (fd, temp_buf_get_data (pattern->mask),
             header.width * header.height * header.bytes) <
       header.width * header.height * header.bytes)
@@ -224,7 +223,7 @@ gimp_pattern_load_pixbuf (GimpContext  *context,
   bytes     = gdk_pixbuf_get_n_channels (pixbuf);
   rowstride = gdk_pixbuf_get_rowstride (pixbuf);
 
-  pattern->mask = temp_buf_new (width, height, bytes, 0, 0, NULL);
+  pattern->mask = temp_buf_new (width, height, bytes);
 
   pat_data = gdk_pixbuf_get_pixels (pixbuf);
   buf_data = temp_buf_get_data (pattern->mask);
diff --git a/app/core/gimppattern.c b/app/core/gimppattern.c
index f3f1c41..0772857 100644
--- a/app/core/gimppattern.c
+++ b/app/core/gimppattern.c
@@ -153,8 +153,7 @@ gimp_pattern_get_new_preview (GimpViewable *viewable,
   copy_height = MIN (height, pattern->mask->height);
 
   temp_buf = temp_buf_new (copy_width, copy_height,
-                           pattern->mask->bytes,
-                           0, 0, NULL);
+                           pattern->mask->bytes);
 
   temp_buf_copy_area (pattern->mask, temp_buf,
                       0, 0, copy_width, copy_height, 0, 0);
@@ -225,7 +224,7 @@ gimp_pattern_new (GimpContext *context,
                           "name", name,
                           NULL);
 
-  pattern->mask = temp_buf_new (32, 32, 3, 0, 0, NULL);
+  pattern->mask = temp_buf_new (32, 32, 3);
 
   data = temp_buf_get_data (pattern->mask);
 
diff --git a/app/core/gimppatternclipboard.c b/app/core/gimppatternclipboard.c
index 54e6cd9..2c65cf3 100644
--- a/app/core/gimppatternclipboard.c
+++ b/app/core/gimppatternclipboard.c
@@ -198,7 +198,7 @@ gimp_pattern_clipboard_buffer_changed (Gimp        *gimp,
       height = MIN (gimp_buffer_get_height (buffer), 512);
       bytes  = babl_format_get_bytes_per_pixel (format);
 
-      pattern->mask = temp_buf_new (width, height, bytes, 0, 0, NULL);
+      pattern->mask = temp_buf_new (width, height, bytes);
 
       gegl_buffer_get (gimp_buffer_get_buffer (buffer),
                        GEGL_RECTANGLE (0, 0, width, height), 1.0,
@@ -208,9 +208,8 @@ gimp_pattern_clipboard_buffer_changed (Gimp        *gimp,
     }
   else
     {
-      guchar color[3] = { 255, 255, 255 };
-
-      pattern->mask = temp_buf_new (16, 16, 3, 0, 0, color);
+      pattern->mask = temp_buf_new (16, 16, 3);
+      memset (temp_buf_get_data (pattern->mask), 255, 16 * 16 * 3);
     }
 
   gimp_data_dirty (GIMP_DATA (pattern));
diff --git a/app/core/gimppreviewcache.c b/app/core/gimppreviewcache.c
index 17cb03d..f3af22e 100644
--- a/app/core/gimppreviewcache.c
+++ b/app/core/gimppreviewcache.c
@@ -228,7 +228,7 @@ gimp_preview_cache_get (GSList **plist,
       pheight = pn.buf->height;
 
       /* Now get the real one and add to cache */
-      preview = temp_buf_new (width, height, pn.buf->bytes, 0, 0, NULL);
+      preview = temp_buf_new (width, height, pn.buf->bytes);
 
       /* preview from nearest bigger one */
       if (width)
diff --git a/app/core/gimpviewable.c b/app/core/gimpviewable.c
index 712aa34..8b46d0d 100644
--- a/app/core/gimpviewable.c
+++ b/app/core/gimpviewable.c
@@ -368,7 +368,7 @@ gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable,
 
           color_bytes = (bytes == 2) ? 4 : 3;
 
-          color_buf = temp_buf_new (width, height, color_bytes, 0, 0, NULL);
+          color_buf = temp_buf_new (width, height, color_bytes);
           temp_buf_copy (temp_buf, color_buf);
 
           temp_buf = color_buf;
@@ -829,7 +829,7 @@ gimp_viewable_get_dummy_preview (GimpViewable  *viewable,
 
   pixbuf = gimp_viewable_get_dummy_pixbuf (viewable, width, height, bpp);
 
-  buf = temp_buf_new (width, height, bpp, 0, 0, NULL);
+  buf = temp_buf_new (width, height, bpp);
 
   src  = gdk_pixbuf_get_pixels (pixbuf);
   dest = temp_buf_get_data (buf);
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index f3fb9fb..f23d602 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -831,8 +831,7 @@ gimp_brush_core_get_paint_buffer (GimpPaintCore    *paint_core,
       gint        bytes  = babl_format_get_bytes_per_pixel (format);
       TempBuf    *temp_buf;
 
-      temp_buf = temp_buf_new ((x2 - x1), (y2 - y1), bytes,
-                               0, 0, NULL);
+      temp_buf = temp_buf_new ((x2 - x1), (y2 - y1), bytes);
 
       *paint_buffer_x = x1;
       *paint_buffer_y = y1;
@@ -1067,7 +1066,6 @@ gimp_brush_core_subsample_mask (GimpBrushCore *core,
   gint          i, j;
   gint          r, s;
   gulong       *accum[KERNEL_HEIGHT];
-  const guchar  empty = TRANSPARENT_OPACITY;
   gint          offs;
 
   while (x < 0)
@@ -1129,8 +1127,8 @@ gimp_brush_core_subsample_mask (GimpBrushCore *core,
     }
 
   dest = temp_buf_new (mask->width  + 2,
-                       mask->height + 2,
-                       1, 0, 0, &empty);
+                       mask->height + 2, 1);
+  temp_buf_data_clear (dest);
 
   /* Allocate and initialize the accum buffer */
   for (i = 0; i < KERNEL_HEIGHT ; i++)
@@ -1194,7 +1192,6 @@ gimp_brush_core_pressurize_mask (GimpBrushCore *core,
   const guchar  *source;
   guchar        *dest;
   const TempBuf *subsample_mask;
-  const guchar   empty = TRANSPARENT_OPACITY;
   gint           i;
 
   /* Get the raw subsampled mask */
@@ -1210,8 +1207,8 @@ gimp_brush_core_pressurize_mask (GimpBrushCore *core,
     temp_buf_free (core->pressure_brush);
 
   core->pressure_brush = temp_buf_new (brush_mask->width  + 2,
-                                       brush_mask->height + 2,
-                                       1, 0, 0, &empty);
+                                       brush_mask->height + 2, 1);
+  temp_buf_data_clear (core->pressure_brush);
 
 #ifdef FANCY_PRESSURE
 
@@ -1310,7 +1307,6 @@ gimp_brush_core_solidify_mask (GimpBrushCore *core,
   gint          dest_offset_x = 0;
   gint          dest_offset_y = 0;
   gint          i, j;
-  const guchar  empty         = TRANSPARENT_OPACITY;
 
   if ((brush_mask->width % 2) == 0)
     {
@@ -1351,8 +1347,8 @@ gimp_brush_core_solidify_mask (GimpBrushCore *core,
     }
 
   dest = temp_buf_new (brush_mask->width  + 2,
-                       brush_mask->height + 2,
-                       1, 0, 0, &empty);
+                       brush_mask->height + 2, 1);
+  temp_buf_data_clear (dest);
 
   core->solid_brushes[dest_offset_y][dest_offset_x] = dest;
 
diff --git a/app/paint/gimpconvolve.c b/app/paint/gimpconvolve.c
index 571aa4d..7c0cce5 100644
--- a/app/paint/gimpconvolve.c
+++ b/app/paint/gimpconvolve.c
@@ -186,8 +186,7 @@ gimp_convolve_motion (GimpPaintCore    *paint_core,
 
   convolve_temp = temp_buf_new (gegl_buffer_get_width  (paint_buffer),
                                 gegl_buffer_get_height (paint_buffer),
-                                babl_format_get_bytes_per_pixel (format),
-                                0, 0, NULL);
+                                babl_format_get_bytes_per_pixel (format));
 
   convolve_buffer = gimp_temp_buf_create_buffer (convolve_temp, format, TRUE);
 
diff --git a/app/paint/gimpink.c b/app/paint/gimpink.c
index 83878ee..dd61198 100644
--- a/app/paint/gimpink.c
+++ b/app/paint/gimpink.c
@@ -224,8 +224,7 @@ gimp_ink_get_paint_buffer (GimpPaintCore    *paint_core,
       gint        bytes  = babl_format_get_bytes_per_pixel (format);
       TempBuf    *temp_buf;
 
-      temp_buf = temp_buf_new ((x2 - x1), (y2 - y1), bytes,
-                               0, 0, NULL);
+      temp_buf = temp_buf_new ((x2 - x1), (y2 - y1), bytes);
 
       *paint_buffer_x = x1;
       *paint_buffer_y = y1;
diff --git a/app/paint/gimpsmudge.c b/app/paint/gimpsmudge.c
index e7943e7..9959c91 100644
--- a/app/paint/gimpsmudge.c
+++ b/app/paint/gimpsmudge.c
@@ -186,8 +186,7 @@ gimp_smudge_start (GimpPaintCore    *paint_core,
 
   /*  Allocate the accumulation buffer */
   accum_temp = temp_buf_new (accum_size, accum_size,
-                             gimp_drawable_bytes (drawable),
-                             0, 0, NULL);
+                             gimp_drawable_bytes (drawable));
 
   smudge->accum_buffer =
     gimp_temp_buf_create_buffer (accum_temp,
diff --git a/app/text/gimpfont.c b/app/text/gimpfont.c
index aa5f3ba..7944726 100644
--- a/app/text/gimpfont.c
+++ b/app/text/gimpfont.c
@@ -246,7 +246,6 @@ gimp_font_get_new_preview (GimpViewable *viewable,
   TempBuf         *temp_buf;
   cairo_t         *cr;
   cairo_surface_t *surface;
-  guchar           white = 255;
 
   if (! font->pango_context)
     return NULL;
@@ -284,7 +283,8 @@ gimp_font_get_new_preview (GimpViewable *viewable,
 
   width = cairo_format_stride_for_width (CAIRO_FORMAT_A8, width);
 
-  temp_buf = temp_buf_new (width, height, 1, 0, 0, &white);
+  temp_buf = temp_buf_new (width, height, 1);
+  memset (temp_buf_get_data (temp_buf), 255, width * height);
 
   surface = cairo_image_surface_create_for_data (temp_buf_get_data (temp_buf),
                                                  CAIRO_FORMAT_A8,
diff --git a/app/vectors/gimpvectors-preview.c b/app/vectors/gimpvectors-preview.c
index bdbac7c..7c4bfdb 100644
--- a/app/vectors/gimpvectors-preview.c
+++ b/app/vectors/gimpvectors-preview.c
@@ -48,7 +48,6 @@ gimp_vectors_get_new_preview (GimpViewable *viewable,
   gdouble      xscale, yscale;
   guchar      *data;
   TempBuf     *temp_buf;
-  guchar       white[1] = { 255 };
 
   vectors = GIMP_VECTORS (viewable);
   item    = GIMP_ITEM (viewable);
@@ -56,8 +55,9 @@ gimp_vectors_get_new_preview (GimpViewable *viewable,
   xscale = ((gdouble) width)  / gimp_image_get_width  (gimp_item_get_image (item));
   yscale = ((gdouble) height) / gimp_image_get_height (gimp_item_get_image (item));
 
-  temp_buf = temp_buf_new (width, height, 1, 0, 0, white);
+  temp_buf = temp_buf_new (width, height, 1);
   data = temp_buf_get_data (temp_buf);
+  memset (data, 255, width * height);
 
   for (cur_stroke = gimp_vectors_stroke_get_next (vectors, NULL);
        cur_stroke;
diff --git a/app/widgets/gimpviewrendererdrawable.c b/app/widgets/gimpviewrendererdrawable.c
index ad6885f..01c5648 100644
--- a/app/widgets/gimpviewrendererdrawable.c
+++ b/app/widgets/gimpviewrendererdrawable.c
@@ -164,10 +164,10 @@ gimp_view_renderer_drawable_render (GimpViewRenderer *renderer,
             }
           else
             {
-              gint   bytes    = gimp_drawable_preview_bytes (drawable);
-              guchar empty[4] = { 0, 0, 0, 0 };
+              gint bytes = gimp_drawable_preview_bytes (drawable);
 
-              render_buf = temp_buf_new (1, 1, bytes, 0, 0, empty);
+              render_buf = temp_buf_new (1, 1, bytes);
+              temp_buf_data_clear (render_buf);
             }
         }
       else



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