Introduce temp_buf_get_data_size() and use it.

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

svn path=/trunk/; revision=27783
This commit is contained in:
Martin Nordholts 2008-12-13 10:51:16 +00:00
parent ddaa0b48ec
commit 4cb231f53b
5 changed files with 53 additions and 42 deletions

View File

@ -1,3 +1,11 @@
2008-12-13 Martin Nordholts <martinn@svn.gnome.org>
Introduce temp_buf_get_data_size() and use it.
* app/base/temp-buf.[ch]
* app/widgets/gimpbrushselect.c
* app/widgets/gimppatternselect.c
2008-12-13 Martin Nordholts <martinn@svn.gnome.org>
s/temp_buf_data/temp_buf_get_data/

View File

@ -196,7 +196,7 @@ temp_buf_copy (TempBuf *src,
{
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 @@ temp_buf_get_data (TempBuf *buf)
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 @@ gsize
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;
}

View File

@ -33,43 +33,44 @@ struct _TempBuf
/* 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);
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_demultiply (TempBuf *buf);
void temp_buf_free (TempBuf *buf);
guchar * temp_buf_get_data (TempBuf *buf);
guchar * temp_buf_data_clear (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__ */

View File

@ -263,9 +263,7 @@ gimp_brush_select_run_callback (GimpPdbDialog *dialog,
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 =

View File

@ -113,9 +113,7 @@ gimp_pattern_select_run_callback (GimpPdbDialog *dialog,
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 =