gimp r27783 - in trunk: . app/base app/widgets



Author: martinn
Date: Sat Dec 13 10:51:16 2008
New Revision: 27783
URL: http://svn.gnome.org/viewvc/gimp?rev=27783&view=rev

Log:
Introduce temp_buf_get_data_size() and use it.

* app/base/temp-buf.[ch]
* app/widgets/gimpbrushselect.c
* app/widgets/gimppatternselect.c


Modified:
   trunk/ChangeLog
   trunk/app/base/temp-buf.c
   trunk/app/base/temp-buf.h
   trunk/app/widgets/gimpbrushselect.c
   trunk/app/widgets/gimppatternselect.c

Modified: trunk/app/base/temp-buf.c
==============================================================================
--- trunk/app/base/temp-buf.c	(original)
+++ trunk/app/base/temp-buf.c	Sat Dec 13 10:51:16 2008
@@ -196,7 +196,7 @@
     {
       memcpy (temp_buf_get_data (dest),
               temp_buf_get_data (src),
-              src->width * src->height * src->bytes);
+              temp_buf_get_data_size (src));
     }
 
   return dest;
@@ -413,6 +413,12 @@
   return buf->data;
 }
 
+gsize
+temp_buf_get_data_size (TempBuf *buf)
+{
+  return buf->bytes * buf->width * buf->height;
+}
+
 guchar *
 temp_buf_data_clear (TempBuf *buf)
 {
@@ -425,7 +431,7 @@
 temp_buf_get_memsize (TempBuf *buf)
 {
   if (buf)
-    return (sizeof (TempBuf) + buf->bytes * buf->width * buf->height);
+    return (sizeof (TempBuf) + temp_buf_get_data_size (buf));
 
   return 0;
 }

Modified: trunk/app/base/temp-buf.h
==============================================================================
--- trunk/app/base/temp-buf.h	(original)
+++ trunk/app/base/temp-buf.h	Sat Dec 13 10:51:16 2008
@@ -33,43 +33,44 @@
 
 /*  The temp buffer functions  */
 
-TempBuf * temp_buf_new         (gint           width,
-                                gint           height,
-                                gint           bytes,
-                                gint           x,
-                                gint           y,
-                                const guchar  *color);
-TempBuf * temp_buf_new_check   (gint           width,
-                                gint           height,
-                                GimpCheckType  check_type,
-                                GimpCheckSize  check_size);
-TempBuf * temp_buf_copy        (TempBuf       *src,
-                                TempBuf       *dest);
-TempBuf * temp_buf_resize      (TempBuf       *buf,
-                                gint           bytes,
-                                gint           x,
-                                gint           y,
-                                gint           width,
-                                gint           height);
-TempBuf * temp_buf_scale       (TempBuf       *buf,
-                                gint           width,
-                                gint           height) G_GNUC_WARN_UNUSED_RESULT;
-TempBuf * temp_buf_copy_area   (TempBuf       *src,
-                                TempBuf       *dest,
-                                gint           x,
-                                gint           y,
-                                gint           width,
-                                gint           height,
-                                gint           dest_x,
-                                gint           dest_y);
-
-void      temp_buf_demultiply  (TempBuf       *buf);
-
-void      temp_buf_free        (TempBuf       *buf);
-guchar  * temp_buf_get_data    (TempBuf       *buf);
-guchar  * temp_buf_data_clear  (TempBuf       *buf);
+TempBuf * temp_buf_new           (gint           width,
+                                  gint           height,
+                                  gint           bytes,
+                                  gint           x,
+                                  gint           y,
+                                  const guchar  *color);
+TempBuf * temp_buf_new_check     (gint           width,
+                                  gint           height,
+                                  GimpCheckType  check_type,
+                                  GimpCheckSize  check_size);
+TempBuf * temp_buf_copy          (TempBuf       *src,
+                                  TempBuf       *dest);
+TempBuf * temp_buf_resize        (TempBuf       *buf,
+                                  gint           bytes,
+                                  gint           x,
+                                  gint           y,
+                                  gint           width,
+                                  gint           height);
+TempBuf * temp_buf_scale         (TempBuf       *buf,
+                                  gint           width,
+                                  gint           height) G_GNUC_WARN_UNUSED_RESULT;
+TempBuf * temp_buf_copy_area     (TempBuf       *src,
+                                  TempBuf       *dest,
+                                  gint           x,
+                                  gint           y,
+                                  gint           width,
+                                  gint           height,
+                                  gint           dest_x,
+                                  gint           dest_y);
+
+void      temp_buf_demultiply    (TempBuf       *buf);
+
+void      temp_buf_free          (TempBuf       *buf);
+guchar  * temp_buf_get_data      (TempBuf       *buf);
+gsize     temp_buf_get_data_size (TempBuf       *buf);
+guchar  * temp_buf_data_clear    (TempBuf       *buf);
 
-gsize     temp_buf_get_memsize (TempBuf       *buf);
+gsize     temp_buf_get_memsize   (TempBuf       *buf);
 
 
 #endif  /*  __TEMP_BUF_H__  */

Modified: trunk/app/widgets/gimpbrushselect.c
==============================================================================
--- trunk/app/widgets/gimpbrushselect.c	(original)
+++ trunk/app/widgets/gimpbrushselect.c	Sat Dec 13 10:51:16 2008
@@ -263,9 +263,7 @@
   GValueArray *return_vals;
 
   array = gimp_array_new (temp_buf_get_data (brush->mask),
-                          brush->mask->width *
-                          brush->mask->height *
-                          brush->mask->bytes,
+                          temp_buf_get_data_size (brush->mask),
                           TRUE);
 
   return_vals =

Modified: trunk/app/widgets/gimppatternselect.c
==============================================================================
--- trunk/app/widgets/gimppatternselect.c	(original)
+++ trunk/app/widgets/gimppatternselect.c	Sat Dec 13 10:51:16 2008
@@ -113,9 +113,7 @@
   GValueArray *return_vals;
 
   array = gimp_array_new (temp_buf_get_data (pattern->mask),
-                          pattern->mask->width *
-                          pattern->mask->height *
-                          pattern->mask->bytes,
+                          temp_buf_get_data_size (pattern->mask),
                           TRUE);
 
   return_vals =



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