app: remove "x" and "y" members from GimpTempBuf

and generally clean up things a bit.
This commit is contained in:
Michael Natterer 2012-04-10 15:51:33 +02:00
parent 1bcab234ab
commit 324f594fa9
2 changed files with 15 additions and 18 deletions

View File

@ -44,8 +44,6 @@ gimp_temp_buf_new (gint width,
temp->format = format;
temp->width = width;
temp->height = height;
temp->x = 0;
temp->y = 0;
temp->data = g_new (guchar,
width * height *
@ -55,7 +53,7 @@ gimp_temp_buf_new (gint width,
}
GimpTempBuf *
gimp_temp_buf_copy (GimpTempBuf *src)
gimp_temp_buf_copy (const GimpTempBuf *src)
{
GimpTempBuf *dest;
@ -98,9 +96,9 @@ gimp_temp_buf_unref (GimpTempBuf *buf)
}
GimpTempBuf *
gimp_temp_buf_scale (GimpTempBuf *src,
gint new_width,
gint new_height)
gimp_temp_buf_scale (const GimpTempBuf *src,
gint new_width,
gint new_height)
{
GimpTempBuf *dest;
const guchar *src_data;
@ -114,6 +112,9 @@ gimp_temp_buf_scale (GimpTempBuf *src,
g_return_val_if_fail (src != NULL, NULL);
g_return_val_if_fail (new_width > 0 && new_height > 0, NULL);
if (new_width == src->width && new_height == src->height)
return gimp_temp_buf_copy (src);
dest = gimp_temp_buf_new (new_width,
new_height,
src->format);
@ -156,7 +157,7 @@ gimp_temp_buf_get_data (const GimpTempBuf *buf)
}
gsize
gimp_temp_buf_get_data_size (GimpTempBuf *buf)
gimp_temp_buf_get_data_size (const GimpTempBuf *buf)
{
return babl_format_get_bytes_per_pixel (buf->format) * buf->width * buf->height;
}
@ -170,7 +171,7 @@ gimp_temp_buf_data_clear (GimpTempBuf *buf)
}
gsize
gimp_temp_buf_get_memsize (GimpTempBuf *buf)
gimp_temp_buf_get_memsize (const GimpTempBuf *buf)
{
if (buf)
return (sizeof (GimpTempBuf) + gimp_temp_buf_get_data_size (buf));

View File

@ -22,34 +22,30 @@
struct _GimpTempBuf
{
gint ref_count;
const Babl *format; /* pixel format */
const Babl *format;
gint width;
gint height;
gint x, y; /* origin of data source */
guchar *data; /* The data buffer. Do never access this field
directly, use temp_buf_get_data() instead !! */
guchar *data;
};
/* The temp buffer functions */
GimpTempBuf * gimp_temp_buf_new (gint width,
gint height,
const Babl *fomat) G_GNUC_WARN_UNUSED_RESULT;
GimpTempBuf * gimp_temp_buf_copy (GimpTempBuf *src) G_GNUC_WARN_UNUSED_RESULT;
GimpTempBuf * gimp_temp_buf_copy (const GimpTempBuf *src) G_GNUC_WARN_UNUSED_RESULT;
GimpTempBuf * gimp_temp_buf_ref (GimpTempBuf *buf);
void gimp_temp_buf_unref (GimpTempBuf *buf);
GimpTempBuf * gimp_temp_buf_scale (GimpTempBuf *buf,
GimpTempBuf * gimp_temp_buf_scale (const GimpTempBuf *buf,
gint width,
gint height) G_GNUC_WARN_UNUSED_RESULT;
guchar * gimp_temp_buf_get_data (const GimpTempBuf *buf);
gsize gimp_temp_buf_get_data_size (GimpTempBuf *buf);
gsize gimp_temp_buf_get_data_size (const GimpTempBuf *buf);
guchar * gimp_temp_buf_data_clear (GimpTempBuf *buf);
gsize gimp_temp_buf_get_memsize (GimpTempBuf *buf);
gsize gimp_temp_buf_get_memsize (const GimpTempBuf *buf);
GeglBuffer * gimp_temp_buf_create_buffer (GimpTempBuf *temp_buf) G_GNUC_WARN_UNUSED_RESULT;