[gimp/goat-invasion: 391/418] app: replace GimpPaintCore::get_paint_area() by ::get_paint_buffer()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 391/418] app: replace GimpPaintCore::get_paint_area() by ::get_paint_buffer()
- Date: Wed, 4 Apr 2012 10:58:40 +0000 (UTC)
commit 064e47e471ef3e1d860bcac32cf48628f853a70b
Author: Michael Natterer <mitch gimp org>
Date: Sun Apr 1 21:20:12 2012 +0200
app: replace GimpPaintCore::get_paint_area() by ::get_paint_buffer()
and remove the public TempBuf based get_paint_area() API.
app/paint/gimpbrushcore.c | 26 +++++++-----
app/paint/gimpink.c | 92 +++++++++++++++++++++++---------------------
app/paint/gimppaintcore.c | 56 ++++++++++++---------------
app/paint/gimppaintcore.h | 78 ++++++++++++++++++-------------------
4 files changed, 125 insertions(+), 127 deletions(-)
---
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index 1bee5f2..23d72dd 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -82,10 +82,12 @@ static void gimp_brush_core_interpolate (GimpPaintCore *core,
GimpPaintOptions *paint_options,
guint32 time);
-static TempBuf * gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
+static GeglBuffer * gimp_brush_core_get_paint_buffer(GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
- const GimpCoords *coords);
+ const GimpCoords *coords,
+ gint *paint_buffer_x,
+ gint *paint_buffer_y);
static void gimp_brush_core_real_set_brush (GimpBrushCore *core,
GimpBrush *brush);
@@ -165,7 +167,7 @@ gimp_brush_core_class_init (GimpBrushCoreClass *klass)
paint_core_class->pre_paint = gimp_brush_core_pre_paint;
paint_core_class->post_paint = gimp_brush_core_post_paint;
paint_core_class->interpolate = gimp_brush_core_interpolate;
- paint_core_class->get_paint_area = gimp_brush_core_get_paint_area;
+ paint_core_class->get_paint_buffer = gimp_brush_core_get_paint_buffer;
klass->handles_changing_brush = FALSE;
klass->handles_transforming_brush = TRUE;
@@ -786,11 +788,13 @@ gimp_brush_core_interpolate (GimpPaintCore *paint_core,
paint_core->pixel_dist = pixel_initial + pixel_dist;
}
-static TempBuf *
-gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords)
+static GeglBuffer *
+gimp_brush_core_get_paint_buffer (GimpPaintCore *paint_core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ gint *paint_buffer_x,
+ gint *paint_buffer_y)
{
GimpBrushCore *core = GIMP_BRUSH_CORE (paint_core);
gint x, y;
@@ -832,8 +836,8 @@ gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
x1, y1,
(x2 - x1), (y2 - y1));
- paint_core->paint_buffer_x = x1;
- paint_core->paint_buffer_y = y1;
+ *paint_buffer_x = x1;
+ *paint_buffer_y = y1;
if (paint_core->paint_buffer)
g_object_unref (paint_core->paint_buffer);
@@ -841,7 +845,7 @@ gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
paint_core->paint_buffer =
gimp_temp_buf_create_buffer (paint_core->paint_area, format);
- return paint_core->paint_area;
+ return paint_core->paint_buffer;
}
return NULL;
diff --git a/app/paint/gimpink.c b/app/paint/gimpink.c
index 912cb49..2061a90 100644
--- a/app/paint/gimpink.c
+++ b/app/paint/gimpink.c
@@ -47,38 +47,40 @@
/* local function prototypes */
-static void gimp_ink_finalize (GObject *object);
-
-static void gimp_ink_paint (GimpPaintCore *paint_core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- GimpPaintState paint_state,
- guint32 time);
-static TempBuf * gimp_ink_get_paint_area (GimpPaintCore *paint_core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords);
-static GimpUndo * gimp_ink_push_undo (GimpPaintCore *core,
- GimpImage *image,
- const gchar *undo_desc);
-
-static void gimp_ink_motion (GimpPaintCore *paint_core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- guint32 time);
-
-static GimpBlob * ink_pen_ellipse (GimpInkOptions *options,
- gdouble x_center,
- gdouble y_center,
- gdouble pressure,
- gdouble xtilt,
- gdouble ytilt,
- gdouble velocity);
-
-static void render_blob (GimpBlob *blob,
- PixelRegion *dest);
+static void gimp_ink_finalize (GObject *object);
+
+static void gimp_ink_paint (GimpPaintCore *paint_core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ GimpPaintState paint_state,
+ guint32 time);
+static GeglBuffer * gimp_ink_get_paint_buffer (GimpPaintCore *paint_core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ gint *paint_buffer_x,
+ gint *paint_buffer_y);
+static GimpUndo * gimp_ink_push_undo (GimpPaintCore *core,
+ GimpImage *image,
+ const gchar *undo_desc);
+
+static void gimp_ink_motion (GimpPaintCore *paint_core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ guint32 time);
+
+static GimpBlob * ink_pen_ellipse (GimpInkOptions *options,
+ gdouble x_center,
+ gdouble y_center,
+ gdouble pressure,
+ gdouble xtilt,
+ gdouble ytilt,
+ gdouble velocity);
+
+static void render_blob (GimpBlob *blob,
+ PixelRegion *dest);
G_DEFINE_TYPE (GimpInk, gimp_ink, GIMP_TYPE_PAINT_CORE)
@@ -104,11 +106,11 @@ gimp_ink_class_init (GimpInkClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
- object_class->finalize = gimp_ink_finalize;
+ object_class->finalize = gimp_ink_finalize;
- paint_core_class->paint = gimp_ink_paint;
- paint_core_class->get_paint_area = gimp_ink_get_paint_area;
- paint_core_class->push_undo = gimp_ink_push_undo;
+ paint_core_class->paint = gimp_ink_paint;
+ paint_core_class->get_paint_buffer = gimp_ink_get_paint_buffer;
+ paint_core_class->push_undo = gimp_ink_push_undo;
}
static void
@@ -191,11 +193,13 @@ gimp_ink_paint (GimpPaintCore *paint_core,
}
}
-static TempBuf *
-gimp_ink_get_paint_area (GimpPaintCore *paint_core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords)
+static GeglBuffer *
+gimp_ink_get_paint_buffer (GimpPaintCore *paint_core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ gint *paint_buffer_x,
+ gint *paint_buffer_y)
{
GimpInk *ink = GIMP_INK (paint_core);
gint x, y;
@@ -223,8 +227,8 @@ gimp_ink_get_paint_area (GimpPaintCore *paint_core,
x1, y1,
(x2 - x1), (y2 - y1));
- paint_core->paint_buffer_x = x1;
- paint_core->paint_buffer_y = y1;
+ *paint_buffer_x = x1;
+ *paint_buffer_y = y1;
if (paint_core->paint_buffer)
g_object_unref (paint_core->paint_buffer);
@@ -232,7 +236,7 @@ gimp_ink_get_paint_area (GimpPaintCore *paint_core,
paint_core->paint_buffer =
gimp_temp_buf_create_buffer (paint_core->paint_area, format);
- return paint_core->paint_area;
+ return paint_core->paint_buffer;
}
return NULL;
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index fc5d836..f123ec5 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -95,10 +95,13 @@ static void gimp_paint_core_real_interpolate (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *options,
guint32 time);
-static TempBuf * gimp_paint_core_real_get_paint_area (GimpPaintCore *core,
+static GeglBuffer *
+ gimp_paint_core_real_get_paint_buffer (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *options,
- const GimpCoords *coords);
+ const GimpCoords *coords,
+ gint *paint_buffer_x,
+ gint *paint_buffer_y);
static GimpUndo* gimp_paint_core_real_push_undo (GimpPaintCore *core,
GimpImage *image,
const gchar *undo_desc);
@@ -133,7 +136,7 @@ gimp_paint_core_class_init (GimpPaintCoreClass *klass)
klass->paint = gimp_paint_core_real_paint;
klass->post_paint = gimp_paint_core_real_post_paint;
klass->interpolate = gimp_paint_core_real_interpolate;
- klass->get_paint_area = gimp_paint_core_real_get_paint_area;
+ klass->get_paint_buffer = gimp_paint_core_real_get_paint_buffer;
klass->push_undo = gimp_paint_core_real_push_undo;
g_object_class_install_property (object_class, PROP_UNDO_DESC,
@@ -260,11 +263,13 @@ gimp_paint_core_real_interpolate (GimpPaintCore *core,
core->last_coords = core->cur_coords;
}
-static TempBuf *
-gimp_paint_core_real_get_paint_area (GimpPaintCore *core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords)
+static GeglBuffer *
+gimp_paint_core_real_get_paint_buffer (GimpPaintCore *core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ gint *paint_buffer_x,
+ gint *paint_buffer_y)
{
return NULL;
}
@@ -660,23 +665,6 @@ gimp_paint_core_round_line (GimpPaintCore *core,
/* protected functions */
-TempBuf *
-gimp_paint_core_get_paint_area (GimpPaintCore *core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords)
-{
- g_return_val_if_fail (GIMP_IS_PAINT_CORE (core), NULL);
- g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
- g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
- g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), NULL);
- g_return_val_if_fail (coords != NULL, NULL);
-
- return GIMP_PAINT_CORE_GET_CLASS (core)->get_paint_area (core, drawable,
- paint_options,
- coords);
-}
-
GeglBuffer *
gimp_paint_core_get_paint_buffer (GimpPaintCore *core,
GimpDrawable *drawable,
@@ -685,6 +673,8 @@ gimp_paint_core_get_paint_buffer (GimpPaintCore *core,
gint *paint_buffer_x,
gint *paint_buffer_y)
{
+ GeglBuffer *paint_buffer;
+
g_return_val_if_fail (GIMP_IS_PAINT_CORE (core), NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
@@ -693,15 +683,17 @@ gimp_paint_core_get_paint_buffer (GimpPaintCore *core,
g_return_val_if_fail (paint_buffer_x != NULL, NULL);
g_return_val_if_fail (paint_buffer_y != NULL, NULL);
- if (gimp_paint_core_get_paint_area (core, drawable, paint_options, coords))
- {
- *paint_buffer_x = core->paint_buffer_x;
- *paint_buffer_y = core->paint_buffer_y;
+ paint_buffer =
+ GIMP_PAINT_CORE_GET_CLASS (core)->get_paint_buffer (core, drawable,
+ paint_options,
+ coords,
+ paint_buffer_x,
+ paint_buffer_y);
- return core->paint_buffer;
- }
+ core->paint_buffer_x = *paint_buffer_x;
+ core->paint_buffer_y = *paint_buffer_y;
- return NULL;
+ return paint_buffer;
}
GeglBuffer *
diff --git a/app/paint/gimppaintcore.h b/app/paint/gimppaintcore.h
index 9761bea..8251517 100644
--- a/app/paint/gimppaintcore.h
+++ b/app/paint/gimppaintcore.h
@@ -72,42 +72,44 @@ struct _GimpPaintCoreClass
GimpObjectClass parent_class;
/* virtual functions */
- gboolean (* start) (GimpPaintCore *core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- GError **error);
-
- gboolean (* pre_paint) (GimpPaintCore *core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- GimpPaintState paint_state,
- guint32 time);
- void (* paint) (GimpPaintCore *core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- GimpPaintState paint_state,
- guint32 time);
- void (* post_paint) (GimpPaintCore *core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- GimpPaintState paint_state,
- guint32 time);
-
- void (* interpolate) (GimpPaintCore *core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- guint32 time);
-
- TempBuf * (* get_paint_area) (GimpPaintCore *core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords);
-
- GimpUndo * (* push_undo) (GimpPaintCore *core,
- GimpImage *image,
- const gchar *undo_desc);
+ gboolean (* start) (GimpPaintCore *core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ GError **error);
+
+ gboolean (* pre_paint) (GimpPaintCore *core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ GimpPaintState paint_state,
+ guint32 time);
+ void (* paint) (GimpPaintCore *core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ GimpPaintState paint_state,
+ guint32 time);
+ void (* post_paint) (GimpPaintCore *core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ GimpPaintState paint_state,
+ guint32 time);
+
+ void (* interpolate) (GimpPaintCore *core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ guint32 time);
+
+ GeglBuffer * (* get_paint_buffer) (GimpPaintCore *core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ gint *paint_buffer_x,
+ gint *paint_buffer_y);
+
+ GimpUndo * (* push_undo) (GimpPaintCore *core,
+ GimpImage *image,
+ const gchar *undo_desc);
};
@@ -154,10 +156,6 @@ void gimp_paint_core_round_line (GimpPaintCore *core,
/* protected functions */
-TempBuf * gimp_paint_core_get_paint_area (GimpPaintCore *core,
- GimpDrawable *drawable,
- GimpPaintOptions *options,
- const GimpCoords *coords);
GeglBuffer * gimp_paint_core_get_paint_buffer (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *options,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]