Commit 42a5f01b authored by Michael Natterer's avatar Michael Natterer 😴

app: rename TempBuf to GimpTempBuf

parent 9285529f
......@@ -53,7 +53,7 @@ typedef struct _PixelRegionHolder PixelRegionHolder;
typedef struct _SioxState SioxState;
typedef struct _TempBuf TempBuf;
typedef struct _GimpTempBuf GimpTempBuf;
typedef struct _Tile Tile;
typedef struct _TileManager TileManager;
......
......@@ -84,7 +84,7 @@ pixel_region_init (PixelRegion *PR,
void
pixel_region_init_temp_buf (PixelRegion *PR,
TempBuf *temp_buf,
GimpTempBuf *temp_buf,
gint x,
gint y,
gint w,
......
......@@ -66,7 +66,7 @@ void pixel_region_init (PixelRegion *PR,
gint h,
gboolean dirty);
void pixel_region_init_temp_buf (PixelRegion *PR,
TempBuf *temp_buf,
GimpTempBuf *temp_buf,
gint x,
gint y,
gint w,
......
......@@ -32,17 +32,17 @@
#include "temp-buf.h"
TempBuf *
GimpTempBuf *
temp_buf_new (gint width,
gint height,
const Babl *format)
{
TempBuf *temp;
GimpTempBuf *temp;
g_return_val_if_fail (width > 0 && height > 0, NULL);
g_return_val_if_fail (format != NULL, NULL);
temp = g_slice_new (TempBuf);
temp = g_slice_new (GimpTempBuf);
temp->format = format;
temp->width = width;
......@@ -57,10 +57,10 @@ temp_buf_new (gint width,
return temp;
}
TempBuf *
temp_buf_copy (TempBuf *src)
GimpTempBuf *
temp_buf_copy (GimpTempBuf *src)
{
TempBuf *dest;
GimpTempBuf *dest;
g_return_val_if_fail (src != NULL, NULL);
......@@ -76,12 +76,12 @@ temp_buf_copy (TempBuf *src)
return dest;
}
TempBuf *
temp_buf_scale (TempBuf *src,
gint new_width,
gint new_height)
GimpTempBuf *
temp_buf_scale (GimpTempBuf *src,
gint new_width,
gint new_height)
{
TempBuf *dest;
GimpTempBuf *dest;
const guchar *src_data;
guchar *dest_data;
gdouble x_ratio;
......@@ -132,10 +132,10 @@ temp_buf_scale (TempBuf *src,
* temp_buf_demultiply:
* @buf:
*
* Converts a TempBuf with pre-multiplied alpha to a 'normal' TempBuf.
* Converts a GimpTempBuf with pre-multiplied alpha to a 'normal' GimpTempBuf.
*/
void
temp_buf_demultiply (TempBuf *buf)
temp_buf_demultiply (GimpTempBuf *buf)
{
guchar *data;
gint pixels;
......@@ -181,30 +181,30 @@ temp_buf_demultiply (TempBuf *buf)
}
void
temp_buf_free (TempBuf *buf)
temp_buf_free (GimpTempBuf *buf)
{
g_return_if_fail (buf != NULL);
if (buf->data)
g_free (buf->data);
g_slice_free (TempBuf, buf);
g_slice_free (GimpTempBuf, buf);
}
guchar *
temp_buf_get_data (const TempBuf *buf)
temp_buf_get_data (const GimpTempBuf *buf)
{
return buf->data;
}
gsize
temp_buf_get_data_size (TempBuf *buf)
temp_buf_get_data_size (GimpTempBuf *buf)
{
return babl_format_get_bytes_per_pixel (buf->format) * buf->width * buf->height;
}
guchar *
temp_buf_data_clear (TempBuf *buf)
temp_buf_data_clear (GimpTempBuf *buf)
{
memset (buf->data, 0, temp_buf_get_data_size (buf));
......@@ -212,10 +212,10 @@ temp_buf_data_clear (TempBuf *buf)
}
gsize
temp_buf_get_memsize (TempBuf *buf)
temp_buf_get_memsize (GimpTempBuf *buf)
{
if (buf)
return (sizeof (TempBuf) + temp_buf_get_data_size (buf));
return (sizeof (GimpTempBuf) + temp_buf_get_data_size (buf));
return 0;
}
......@@ -226,11 +226,11 @@ temp_buf_get_memsize (TempBuf *buf)
* @buf:
* @file:
*
* Dumps a TempBuf to a raw RGB image that is easy to analyze, for
* Dumps a GimpTempBuf to a raw RGB image that is easy to analyze, for
* example with GIMP.
**/
void
temp_buf_dump (TempBuf *buf,
temp_buf_dump (GimpTempBuf *buf,
const gchar *filename)
{
gint fd = g_open (filename, O_CREAT | O_TRUNC | O_WRONLY, 0666);
......@@ -245,8 +245,8 @@ temp_buf_dump (TempBuf *buf,
}
GeglBuffer *
gimp_temp_buf_create_buffer (TempBuf *temp_buf,
gboolean take_ownership)
gimp_temp_buf_create_buffer (GimpTempBuf *temp_buf,
gboolean take_ownership)
{
GeglBuffer *buffer;
......
......@@ -19,7 +19,7 @@
#define __TEMP_BUF_H__
struct _TempBuf
struct _GimpTempBuf
{
const Babl *format; /* pixel format */
gint width;
......@@ -32,27 +32,27 @@ struct _TempBuf
/* The temp buffer functions */
TempBuf * temp_buf_new (gint width,
gint height,
const Babl *fomat);
TempBuf * temp_buf_copy (TempBuf *src);
TempBuf * temp_buf_scale (TempBuf *buf,
gint width,
gint height) G_GNUC_WARN_UNUSED_RESULT;
GimpTempBuf * temp_buf_new (gint width,
gint height,
const Babl *fomat);
GimpTempBuf * temp_buf_copy (GimpTempBuf *src);
GimpTempBuf * temp_buf_scale (GimpTempBuf *buf,
gint width,
gint height) G_GNUC_WARN_UNUSED_RESULT;
void temp_buf_demultiply (TempBuf *buf);
void temp_buf_demultiply (GimpTempBuf *buf);
void temp_buf_free (TempBuf *buf);
guchar * temp_buf_get_data (const TempBuf *buf);
gsize temp_buf_get_data_size (TempBuf *buf);
guchar * temp_buf_data_clear (TempBuf *buf);
void temp_buf_free (GimpTempBuf *buf);
guchar * temp_buf_get_data (const GimpTempBuf *buf);
gsize temp_buf_get_data_size (GimpTempBuf *buf);
guchar * temp_buf_data_clear (GimpTempBuf *buf);
gsize temp_buf_get_memsize (TempBuf *buf);
void temp_buf_dump (TempBuf *buf,
const gchar *filename);
gsize temp_buf_get_memsize (GimpTempBuf *buf);
void temp_buf_dump (GimpTempBuf *buf,
const gchar *filename);
GeglBuffer * gimp_temp_buf_create_buffer (TempBuf *temp_buf,
gboolean take_ownership);
GeglBuffer * gimp_temp_buf_create_buffer (GimpTempBuf *temp_buf,
gboolean take_ownership);
#endif /* __TEMP_BUF_H__ */
......@@ -31,16 +31,16 @@
#include "tile-manager-preview.h"
static TempBuf * tile_manager_create_preview (TileManager *tiles,
gint src_x,
gint src_y,
gint src_width,
gint src_height,
gint dest_width,
gint dest_height);
static GimpTempBuf * tile_manager_create_preview (TileManager *tiles,
gint src_x,
gint src_y,
gint src_width,
gint src_height,
gint dest_width,
gint dest_height);
TempBuf *
GimpTempBuf *
tile_manager_get_preview (TileManager *tiles,
gint width,
gint height)
......@@ -55,7 +55,7 @@ tile_manager_get_preview (TileManager *tiles,
width, height);
}
TempBuf *
GimpTempBuf *
tile_manager_get_sub_preview (TileManager *tiles,
gint src_x,
gint src_y,
......@@ -84,7 +84,7 @@ tile_manager_get_sub_preview (TileManager *tiles,
dest_width, dest_height);
}
static TempBuf *
static GimpTempBuf *
tile_manager_create_preview (TileManager *tiles,
gint src_x,
gint src_y,
......@@ -93,7 +93,7 @@ tile_manager_create_preview (TileManager *tiles,
gint dest_width,
gint dest_height)
{
TempBuf *preview;
GimpTempBuf *preview;
PixelRegion srcPR;
PixelRegion destPR;
gint subsample = 1;
......
......@@ -19,16 +19,16 @@
#define __TILE_MANAGER_PREVIEW_H__
TempBuf * tile_manager_get_preview (TileManager *tiles,
gint width,
gint height);
TempBuf * tile_manager_get_sub_preview (TileManager *tiles,
gint src_x,
gint src_y,
gint src_width,
gint src_height,
gint dest_width,
gint dest_height);
GimpTempBuf * tile_manager_get_preview (TileManager *tiles,
gint width,
gint height);
GimpTempBuf * tile_manager_get_sub_preview (TileManager *tiles,
gint src_x,
gint src_y,
gint src_width,
gint src_height,
gint dest_width,
gint dest_height);
#endif /* __TILE_MANAGER_PREVIEW_H__ */
......@@ -37,7 +37,7 @@ gimp_brush_transform_boundary_exact (GimpBrush *brush,
gdouble angle,
gdouble hardness)
{
const TempBuf *mask;
const GimpTempBuf *mask;
mask = gimp_brush_transform_mask (brush,
scale, aspect_ratio, angle, hardness);
......@@ -48,7 +48,7 @@ gimp_brush_transform_boundary_exact (GimpBrush *brush,
GimpBoundSeg *bound_segs;
gint n_bound_segs;
buffer = gimp_temp_buf_create_buffer ((TempBuf *) mask, FALSE);
buffer = gimp_temp_buf_create_buffer ((GimpTempBuf *) mask, FALSE);
bound_segs = gimp_boundary_find (buffer, NULL,
GIMP_BOUNDARY_WITHIN_BOUNDS,
......
......@@ -39,7 +39,7 @@
/* local function prototypes */
static void gimp_brush_transform_bounding_box (TempBuf *brush,
static void gimp_brush_transform_bounding_box (GimpTempBuf *brush,
const GimpMatrix3 *matrix,
gint *x,
gint *y,
......@@ -100,15 +100,15 @@ gimp_brush_real_transform_size (GimpBrush *brush,
* Some variables end with the suffix _i to indicate they have been
* premultiplied by int_multiple
*/
TempBuf *
GimpTempBuf *
gimp_brush_real_transform_mask (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gdouble hardness)
{
TempBuf *result;
TempBuf *source;
GimpTempBuf *result;
GimpTempBuf *source;
guchar *dest;
const guchar *src;
GimpMatrix3 matrix;
......@@ -328,7 +328,7 @@ gimp_brush_real_transform_mask (GimpBrush *brush,
if (hardness < 1.0)
{
TempBuf *blur_src;
GimpTempBuf *blur_src;
GeglBuffer *src_buffer;
GeglBuffer *dest_buffer;
gint kernel_size =
......@@ -395,15 +395,15 @@ gimp_brush_real_transform_mask (GimpBrush *brush,
* Some variables end with the suffix _i to indicate they have been
* premultiplied by int_multiple
*/
TempBuf *
GimpTempBuf *
gimp_brush_real_transform_pixmap (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gdouble hardness)
{
TempBuf *result;
TempBuf *source;
GimpTempBuf *result;
GimpTempBuf *source;
guchar *dest;
const guchar *src;
GimpMatrix3 matrix;
......@@ -628,7 +628,7 @@ gimp_brush_real_transform_pixmap (GimpBrush *brush,
if (hardness < 1.0)
{
TempBuf *blur_src;
GimpTempBuf *blur_src;
GeglBuffer *src_buffer;
GeglBuffer *dest_buffer;
gint kernel_size =
......@@ -700,7 +700,7 @@ gimp_brush_transform_matrix (gdouble width,
/* private functions */
static void
gimp_brush_transform_bounding_box (TempBuf *brush,
gimp_brush_transform_bounding_box (GimpTempBuf *brush,
const GimpMatrix3 *matrix,
gint *x,
gint *y,
......
......@@ -23,29 +23,29 @@
/* virtual functions of GimpBrush, don't call directly */
void gimp_brush_real_transform_size (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gint *scaled_width,
gint *scaled_height);
TempBuf * gimp_brush_real_transform_mask (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gdouble hardness);
TempBuf * gimp_brush_real_transform_pixmap (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gdouble hardness);
void gimp_brush_real_transform_size (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gint *scaled_width,
gint *scaled_height);
GimpTempBuf * gimp_brush_real_transform_mask (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gdouble hardness);
GimpTempBuf * gimp_brush_real_transform_pixmap (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gdouble hardness);
void gimp_brush_transform_matrix (gdouble width,
gdouble height,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
GimpMatrix3 *matrix);
void gimp_brush_transform_matrix (gdouble width,
gdouble height,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
GimpMatrix3 *matrix);
#endif /* __GIMP_BRUSH_TRANSFORM_H__ */
......@@ -71,7 +71,7 @@ static gint64 gimp_brush_get_memsize (GimpObject *obj
static gboolean gimp_brush_get_size (GimpViewable *viewable,
gint *width,
gint *height);
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
static GimpTempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
......@@ -275,23 +275,23 @@ gimp_brush_get_size (GimpViewable *viewable,
return TRUE;
}
static TempBuf *
static GimpTempBuf *
gimp_brush_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
{
GimpBrush *brush = GIMP_BRUSH (viewable);
const TempBuf *mask_buf = NULL;
gboolean free_mask = FALSE;
const TempBuf *pixmap_buf = NULL;
TempBuf *return_buf = NULL;
gint mask_width;
gint mask_height;
guchar *mask;
guchar *buf;
gint x, y;
gboolean scaled = FALSE;
GimpBrush *brush = GIMP_BRUSH (viewable);
const GimpTempBuf *mask_buf = NULL;
gboolean free_mask = FALSE;
const GimpTempBuf *pixmap_buf = NULL;
GimpTempBuf *return_buf = NULL;
gint mask_width;
gint mask_height;
guchar *mask;
guchar *buf;
gint x, y;
gboolean scaled = FALSE;
mask_buf = brush->mask;
pixmap_buf = brush->pixmap;
......@@ -315,7 +315,7 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
if (! mask_buf)
{
mask_buf = temp_buf_new (1, 1, babl_format ("Y u8"));
temp_buf_data_clear ((TempBuf *) mask_buf);
temp_buf_data_clear ((GimpTempBuf *) mask_buf);
free_mask = TRUE;
}
......@@ -369,7 +369,7 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
if (scaled)
{
if (free_mask)
temp_buf_free ((TempBuf *) mask_buf);
temp_buf_free ((GimpTempBuf *) mask_buf);
gimp_brush_end_use (brush);
}
......@@ -590,16 +590,16 @@ gimp_brush_transform_size (GimpBrush *brush,
width, height);
}
const TempBuf *
const GimpTempBuf *
gimp_brush_transform_mask (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gdouble hardness)
{
const TempBuf *mask;
gint width;
gint height;
const GimpTempBuf *mask;
gint width;
gint height;
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
g_return_val_if_fail (scale > 0.0, NULL);
......@@ -639,16 +639,16 @@ gimp_brush_transform_mask (GimpBrush *brush,
return mask;
}
const TempBuf *
const GimpTempBuf *
gimp_brush_transform_pixmap (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gdouble hardness)
{
const TempBuf *pixmap;
gint width;
gint height;
const GimpTempBuf *pixmap;
gint width;
gint height;
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
g_return_val_if_fail (brush->pixmap != NULL, NULL);
......@@ -739,7 +739,7 @@ gimp_brush_transform_boundary (GimpBrush *brush,
return boundary;
}
TempBuf *
GimpTempBuf *
gimp_brush_get_mask (const GimpBrush *brush)
{
g_return_val_if_fail (brush != NULL, NULL);
......@@ -748,7 +748,7 @@ gimp_brush_get_mask (const GimpBrush *brush)
return brush->mask;
}
TempBuf *
GimpTempBuf *
gimp_brush_get_pixmap (const GimpBrush *brush)
{
g_return_val_if_fail (brush != NULL, NULL);
......
......@@ -36,8 +36,8 @@ struct _GimpBrush
{
GimpData parent_instance;
TempBuf *mask; /* the actual mask */
TempBuf *pixmap; /* optional pixmap data */
GimpTempBuf *mask; /* the actual mask */
GimpTempBuf *pixmap; /* optional pixmap data */
gint spacing; /* brush's spacing */
GimpVector2 x_axis; /* for calculating brush spacing */
......@@ -68,12 +68,12 @@ struct _GimpBrushClass
gdouble angle,
gint *width,
gint *height);
TempBuf * (* transform_mask) (GimpBrush *brush,
GimpTempBuf * (* transform_mask) (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gdouble hardness);
TempBuf * (* transform_pixmap) (GimpBrush *brush,
GimpTempBuf * (* transform_pixmap) (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
......@@ -116,12 +116,12 @@ void gimp_brush_transform_size (GimpBrush *brush,
gdouble angle,
gint *width,
gint *height);
const TempBuf * gimp_brush_transform_mask (GimpBrush *brush,
const GimpTempBuf * gimp_brush_transform_mask (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gdouble hardness);
const TempBuf * gimp_brush_transform_pixmap (GimpBrush *brush,
const GimpTempBuf * gimp_brush_transform_pixmap (GimpBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
......@@ -134,8 +134,8 @@ const GimpBezierDesc * gimp_brush_transform_boundary (GimpBrush *brush,
gint *width,
gint *height);
TempBuf * gimp_brush_get_mask (const GimpBrush *brush);
TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);
GimpTempBuf * gimp_brush_get_mask (const GimpBrush *brush);
GimpTempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);
gint gimp_brush_get_spacing (const GimpBrush *brush);
void gimp_brush_set_spacing (GimpBrush *brush,
......
......@@ -71,13 +71,13 @@ static void gimp_brush_generated_transform_size(GimpBrush *gbrush,
gdouble angle,
gint *width,
gint *height);
static TempBuf * gimp_brush_generated_transform_mask(GimpBrush *gbrush,
static GimpTempBuf * gimp_brush_generated_transform_mask(GimpBrush *gbrush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gdouble hardness);
static TempBuf * gimp_brush_generated_calc (GimpBrushGenerated *brush,
static GimpTempBuf * gimp_brush_generated_calc (GimpBrushGenerated *brush,
GimpBrushGeneratedShape shape,
gfloat radius,
gint spikes,
......@@ -336,7 +336,7 @@ gimp_brush_generated_transform_size (GimpBrush *gbrush,
*height = half_height * 2 + 1;
}
static TempBuf *
static GimpTempBuf *
gimp_brush_generated_transform_mask (GimpBrush *gbrush,
gdouble scale,
gdouble aspect_ratio,
......@@ -450,7 +450,7 @@ gimp_brush_generated_calc_lut (gdouble radius,
return lookup;
}
static TempBuf *
static GimpTempBuf *
gimp_brush_generated_calc (GimpBrushGenerated *brush,
GimpBrushGeneratedShape shape,
gfloat radius,
......@@ -470,7 +470,7 @@ gimp_brush_generated_calc (GimpBrushGenerated *brush,
gdouble c, s, cs, ss;
GimpVector2 x_axis;
GimpVector2 y_axis;
TempBuf *mask;
GimpTempBuf *mask;
gimp_brush_generated_get_half_size (brush,
shape,
......
......@@ -31,32 +31,32 @@
#include "gimpimage.h"
static void gimp_buffer_finalize (GObject *object);
static gint64 gimp_buffer_get_memsize (GimpObject *object,
gint64 *gui_size);
static gboolean gimp_buffer_get_size (GimpViewable *viewable,
gint *width,
gint *height);
static void gimp_buffer_get_preview_size (GimpViewable *viewable,
gint size,
gboolean is_popup,
gboolean dot_for_dot,
gint *popup_width,
gint *popup_height);
static gboolean gimp_buffer_get_popup_size (GimpViewable *viewable,
gint width,
gint height,
gboolean dot_for_dot,
gint *popup_width,
gint *popup_height);
static TempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
static gchar * gimp_buffer_get_description (GimpViewable *viewable,
gchar **tooltip);
static void gimp_buffer_finalize (GObject *object);
static gint64 gimp_buffer_get_memsize (GimpObject *object,
gint64 *gui_size);
static gboolean gimp_buffer_get_size (GimpViewable *viewable,
gint *width,
gint *height);
static void gimp_buffer_get_preview_size (GimpViewable *viewable,
gint size,
gboolean is_popup,
gboolean dot_for_dot,
gint *popup_width,
gint *popup_height);
static gboolean gimp_buffer_get_popup_size (GimpViewable *viewable,
gint width,
gint height,
gboolean dot_for_dot,
gint *popup_width,
gint *popup_height);
static GimpTempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
static gchar * gimp_buffer_get_description (GimpViewable *viewable,
gchar **tooltip);
G_DEFINE_TYPE (GimpBuffer, gimp_buffer, GIMP_TYPE_VIEWABLE)
......@@ -189,14 +189,14 @@ gimp_buffer_get_popup_size (GimpViewable *viewable,
return FALSE;
}
static TempBuf *
static GimpTempBuf *
gimp_buffer_get_new_preview (GimpViewable *viewable,
GimpContext *context,