app: remove "x" and "y" members from GimpTempBuf
and generally clean up things a bit.
This commit is contained in:
@ -44,8 +44,6 @@ gimp_temp_buf_new (gint width,
|
|||||||
temp->format = format;
|
temp->format = format;
|
||||||
temp->width = width;
|
temp->width = width;
|
||||||
temp->height = height;
|
temp->height = height;
|
||||||
temp->x = 0;
|
|
||||||
temp->y = 0;
|
|
||||||
|
|
||||||
temp->data = g_new (guchar,
|
temp->data = g_new (guchar,
|
||||||
width * height *
|
width * height *
|
||||||
@ -55,7 +53,7 @@ gimp_temp_buf_new (gint width,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GimpTempBuf *
|
GimpTempBuf *
|
||||||
gimp_temp_buf_copy (GimpTempBuf *src)
|
gimp_temp_buf_copy (const GimpTempBuf *src)
|
||||||
{
|
{
|
||||||
GimpTempBuf *dest;
|
GimpTempBuf *dest;
|
||||||
|
|
||||||
@ -98,9 +96,9 @@ gimp_temp_buf_unref (GimpTempBuf *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GimpTempBuf *
|
GimpTempBuf *
|
||||||
gimp_temp_buf_scale (GimpTempBuf *src,
|
gimp_temp_buf_scale (const GimpTempBuf *src,
|
||||||
gint new_width,
|
gint new_width,
|
||||||
gint new_height)
|
gint new_height)
|
||||||
{
|
{
|
||||||
GimpTempBuf *dest;
|
GimpTempBuf *dest;
|
||||||
const guchar *src_data;
|
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 (src != NULL, NULL);
|
||||||
g_return_val_if_fail (new_width > 0 && new_height > 0, 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,
|
dest = gimp_temp_buf_new (new_width,
|
||||||
new_height,
|
new_height,
|
||||||
src->format);
|
src->format);
|
||||||
@ -156,7 +157,7 @@ gimp_temp_buf_get_data (const GimpTempBuf *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gsize
|
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;
|
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
|
gsize
|
||||||
gimp_temp_buf_get_memsize (GimpTempBuf *buf)
|
gimp_temp_buf_get_memsize (const GimpTempBuf *buf)
|
||||||
{
|
{
|
||||||
if (buf)
|
if (buf)
|
||||||
return (sizeof (GimpTempBuf) + gimp_temp_buf_get_data_size (buf));
|
return (sizeof (GimpTempBuf) + gimp_temp_buf_get_data_size (buf));
|
||||||
|
@ -22,34 +22,30 @@
|
|||||||
struct _GimpTempBuf
|
struct _GimpTempBuf
|
||||||
{
|
{
|
||||||
gint ref_count;
|
gint ref_count;
|
||||||
const Babl *format; /* pixel format */
|
const Babl *format;
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
gint x, y; /* origin of data source */
|
guchar *data;
|
||||||
guchar *data; /* The data buffer. Do never access this field
|
|
||||||
directly, use temp_buf_get_data() instead !! */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* The temp buffer functions */
|
|
||||||
|
|
||||||
GimpTempBuf * gimp_temp_buf_new (gint width,
|
GimpTempBuf * gimp_temp_buf_new (gint width,
|
||||||
gint height,
|
gint height,
|
||||||
const Babl *fomat) G_GNUC_WARN_UNUSED_RESULT;
|
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);
|
GimpTempBuf * gimp_temp_buf_ref (GimpTempBuf *buf);
|
||||||
void gimp_temp_buf_unref (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 width,
|
||||||
gint height) G_GNUC_WARN_UNUSED_RESULT;
|
gint height) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
guchar * gimp_temp_buf_get_data (const GimpTempBuf *buf);
|
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);
|
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;
|
GeglBuffer * gimp_temp_buf_create_buffer (GimpTempBuf *temp_buf) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user