Commit 23cfde41 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

removed enum GimpPaintCoreFlags and member GimpPaintCore::flags. Added

2004-05-27  Michael Natterer  <mitch@gimp.org>

	* app/paint/gimppaintcore.[ch]: removed enum GimpPaintCoreFlags
	and member GimpPaintCore::flags. Added "gboolean traces_on_window"
	to GimpPaintCoreClass (defaults to FALSE).

	* app/paint/gimpclone.c: set traces_on_window = TRUE.

	* app/paint/gimpbrushcore.[ch]: added
	"gboolean handles_changing_brush" to GimpBrushCoreClass (defaults
	to FALSE).

	* app/paint/gimpclone.c
	* app/paint/gimpdodgeburn.c
	* app/paint/gimperaser.c
	* app/paint/gimppaintbrush.c
	* app/paint/gimppaintcore.c: set handles_changing_brush = TRUE.

	* app/tools/gimppainttool.c: changed accordingly.
parent c18a6a14
2004-05-27 Michael Natterer <mitch@gimp.org>
* app/paint/gimppaintcore.[ch]: removed enum GimpPaintCoreFlags
and member GimpPaintCore::flags. Added "gboolean traces_on_window"
to GimpPaintCoreClass (defaults to FALSE).
* app/paint/gimpclone.c: set traces_on_window = TRUE.
* app/paint/gimpbrushcore.[ch]: added
"gboolean handles_changing_brush" to GimpBrushCoreClass (defaults
to FALSE).
* app/paint/gimpclone.c
* app/paint/gimpdodgeburn.c
* app/paint/gimperaser.c
* app/paint/gimppaintbrush.c
* app/paint/gimppaintcore.c: set handles_changing_brush = TRUE.
* app/tools/gimppainttool.c: changed accordingly.
2004-05-27 Maurits Rijk <m.rijk@chello.nl>
* plug-ins/common/ccanalyze.c: code clean-up. Improved speed a lot
......
......@@ -162,6 +162,7 @@ gimp_brush_core_class_init (GimpBrushCoreClass *klass)
paint_core_class->interpolate = gimp_brush_core_interpolate;
paint_core_class->get_paint_area = gimp_brush_core_get_paint_area;
klass->handles_changing_brush = FALSE;
klass->use_scale = TRUE;
}
......@@ -291,7 +292,7 @@ gimp_brush_core_pre_paint (GimpPaintCore *paint_core,
return FALSE;
}
if (paint_core->flags & CORE_HANDLES_CHANGING_BRUSH)
if (GIMP_BRUSH_CORE_GET_CLASS (paint_core)->handles_changing_brush)
{
core->brush = gimp_brush_select_brush (core->brush,
&paint_core->last_coords,
......
......@@ -79,6 +79,10 @@ struct _GimpBrushCoreClass
{
GimpPaintCoreClass parent_class;
/* Set for tools that don't mind if the brush changes while painting */
gboolean handles_changing_brush;
/* Scale the brush mask depending on pressure */
gboolean use_scale;
};
......
......@@ -121,20 +121,19 @@ static void
gimp_clone_class_init (GimpCloneClass *klass)
{
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
GimpBrushCoreClass *brush_core_class = GIMP_BRUSH_CORE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
paint_core_class->paint = gimp_clone_paint;
paint_core_class->traces_on_window = TRUE;
paint_core_class->paint = gimp_clone_paint;
brush_core_class->handles_changing_brush = TRUE;
}
static void
gimp_clone_init (GimpClone *clone)
{
GimpPaintCore *paint_core = GIMP_PAINT_CORE (clone);
paint_core->flags |= CORE_HANDLES_CHANGING_BRUSH;
paint_core->flags |= CORE_TRACES_ON_WINDOW;
clone->set_source = FALSE;
clone->src_drawable = NULL;
......
......@@ -120,20 +120,20 @@ gimp_dodge_burn_class_init (GimpDodgeBurnClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
GimpBrushCoreClass *brush_core_class = GIMP_BRUSH_CORE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_dodge_burn_finalize;
paint_core_class->paint = gimp_dodge_burn_paint;
brush_core_class->handles_changing_brush = TRUE;
}
static void
gimp_dodge_burn_init (GimpDodgeBurn *dodgeburn)
{
GimpPaintCore *paint_core = GIMP_PAINT_CORE (dodgeburn);
paint_core->flags |= CORE_HANDLES_CHANGING_BRUSH;
}
static void
......
......@@ -96,18 +96,18 @@ static void
gimp_eraser_class_init (GimpEraserClass *klass)
{
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
GimpBrushCoreClass *brush_core_class = GIMP_BRUSH_CORE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
paint_core_class->paint = gimp_eraser_paint;
brush_core_class->handles_changing_brush = TRUE;
}
static void
gimp_eraser_init (GimpEraser *eraser)
{
GimpPaintCore *paint_core = GIMP_PAINT_CORE (eraser);
paint_core->flags |= CORE_HANDLES_CHANGING_BRUSH;
}
static void
......
......@@ -97,18 +97,18 @@ static void
gimp_paintbrush_class_init (GimpPaintbrushClass *klass)
{
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
GimpBrushCoreClass *brush_core_class = GIMP_BRUSH_CORE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
paint_core_class->paint = gimp_paintbrush_paint;
brush_core_class->handles_changing_brush = TRUE;
}
static void
gimp_paintbrush_init (GimpPaintbrush *paintbrush)
{
GimpPaintCore *paint_core = GIMP_PAINT_CORE (paintbrush);
paint_core->flags |= CORE_HANDLES_CHANGING_BRUSH;
}
static void
......
......@@ -123,13 +123,14 @@ gimp_paint_core_class_init (GimpPaintCoreClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_paint_core_finalize;
klass->start = gimp_paint_core_real_start;
klass->pre_paint = gimp_paint_core_real_pre_paint;
klass->paint = gimp_paint_core_real_paint;
klass->interpolate = gimp_paint_core_real_interpolate;
klass->get_paint_area = gimp_paint_core_real_get_paint_area;
object_class->finalize = gimp_paint_core_finalize;
klass->traces_on_window = FALSE;
klass->start = gimp_paint_core_real_start;
klass->pre_paint = gimp_paint_core_real_pre_paint;
klass->paint = gimp_paint_core_real_paint;
klass->interpolate = gimp_paint_core_real_interpolate;
klass->get_paint_area = gimp_paint_core_real_get_paint_area;
}
static void
......@@ -143,7 +144,6 @@ gimp_paint_core_init (GimpPaintCore *core)
core->x2 = 0;
core->y2 = 0;
core->flags = 0;
core->use_pressure = FALSE;
core->undo_tiles = NULL;
......
......@@ -38,24 +38,6 @@ typedef enum
*/
} GimpPaintCoreState;
typedef enum
{
CORE_HANDLES_CHANGING_BRUSH = 0x1 << 0, /* Set for tools that don't
* mind if the brush
* changes while painting.
*/
CORE_TRACES_ON_WINDOW = 0x1 << 1 /* Set for tools that
* perform temporary
* rendering directly to
* the window. These
* require sequencing with
* gdisplay_flush()
* routines. See
* gimpclone.c for example.
*/
} GimpPaintCoreFlags;
#define GIMP_TYPE_PAINT_CORE (gimp_paint_core_get_type ())
#define GIMP_PAINT_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PAINT_CORE, GimpPaintCore))
......@@ -69,39 +51,43 @@ typedef struct _GimpPaintCoreClass GimpPaintCoreClass;
struct _GimpPaintCore
{
GimpObject parent_instance;
GimpObject parent_instance;
gint ID; /* unique instance ID */
gint ID; /* unique instance ID */
GimpCoords start_coords; /* starting coords (for undo only) */
GimpCoords start_coords; /* starting coords (for undo only) */
GimpCoords cur_coords; /* current coords */
GimpCoords last_coords; /* last coords */
GimpCoords cur_coords; /* current coords */
GimpCoords last_coords; /* last coords */
GimpVector2 last_paint; /* last point that was painted */
GimpVector2 last_paint; /* last point that was painted */
gdouble distance; /* distance traveled by brush */
gdouble pixel_dist; /* distance in pixels */
gdouble distance; /* distance traveled by brush */
gdouble pixel_dist; /* distance in pixels */
gint x1, y1; /* undo extents in image coords */
gint x2, y2; /* undo extents in image coords */
gint x1, y1; /* undo extents in image coords */
gint x2, y2; /* undo extents in image coords */
GimpPaintCoreFlags flags; /* tool flags, see ToolFlags above */
gboolean use_pressure; /* look at coords->pressure */
gboolean use_pressure; /* look at coords->pressure */
/* undo blocks variables */
TileManager *undo_tiles;
TileManager *canvas_tiles;
TileManager *undo_tiles; /* tiles which have been modified */
TileManager *canvas_tiles; /* the mask used for painting */
TempBuf *orig_buf; /* the unmodified drawable pixels */
TempBuf *canvas_buf; /* the buffer to paint to */
/* paint buffers variables */
TempBuf *orig_buf;
TempBuf *canvas_buf;
};
struct _GimpPaintCoreClass
{
GimpObjectClass parent_class;
/* Set for tools that perform temporary rendering directly to the
* window. These require sequencing with gimp_display_flush().
* See gimpclone.c for example.
*/
gboolean traces_on_window;
/* virtual functions */
gboolean (* start) (GimpPaintCore *core,
GimpDrawable *drawable,
......
......@@ -121,20 +121,19 @@ static void
gimp_clone_class_init (GimpCloneClass *klass)
{
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
GimpBrushCoreClass *brush_core_class = GIMP_BRUSH_CORE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
paint_core_class->paint = gimp_clone_paint;
paint_core_class->traces_on_window = TRUE;
paint_core_class->paint = gimp_clone_paint;
brush_core_class->handles_changing_brush = TRUE;
}
static void
gimp_clone_init (GimpClone *clone)
{
GimpPaintCore *paint_core = GIMP_PAINT_CORE (clone);
paint_core->flags |= CORE_HANDLES_CHANGING_BRUSH;
paint_core->flags |= CORE_TRACES_ON_WINDOW;
clone->set_source = FALSE;
clone->src_drawable = NULL;
......
......@@ -431,7 +431,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
if (GIMP_IS_BRUSH_CORE (core))
current_brush = GIMP_BRUSH_CORE (core)->brush;
if (core->flags & CORE_TRACES_ON_WINDOW)
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
gimp_paint_core_paint (core, drawable, paint_options, PRETRACE_PAINT, time);
/* Paint to the image */
......@@ -446,7 +446,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
gimp_display_flush_now (gdisp);
if (core->flags & CORE_TRACES_ON_WINDOW)
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
gimp_paint_core_paint (core, drawable, paint_options, POSTTRACE_PAINT, time);
/* restore the current brush pointer */
......@@ -522,14 +522,14 @@ gimp_paint_tool_motion (GimpTool *tool,
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
return;
if (core->flags & CORE_TRACES_ON_WINDOW)
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
gimp_paint_core_paint (core, drawable, paint_options, PRETRACE_PAINT, time);
gimp_paint_core_interpolate (core, drawable, paint_options, time);
gimp_display_flush_now (gdisp);
if (core->flags & CORE_TRACES_ON_WINDOW)
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
gimp_paint_core_paint (core, drawable, paint_options, POSTTRACE_PAINT, time);
}
......
......@@ -431,7 +431,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
if (GIMP_IS_BRUSH_CORE (core))
current_brush = GIMP_BRUSH_CORE (core)->brush;
if (core->flags & CORE_TRACES_ON_WINDOW)
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
gimp_paint_core_paint (core, drawable, paint_options, PRETRACE_PAINT, time);
/* Paint to the image */
......@@ -446,7 +446,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
gimp_display_flush_now (gdisp);
if (core->flags & CORE_TRACES_ON_WINDOW)
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
gimp_paint_core_paint (core, drawable, paint_options, POSTTRACE_PAINT, time);
/* restore the current brush pointer */
......@@ -522,14 +522,14 @@ gimp_paint_tool_motion (GimpTool *tool,
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
return;
if (core->flags & CORE_TRACES_ON_WINDOW)
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
gimp_paint_core_paint (core, drawable, paint_options, PRETRACE_PAINT, time);
gimp_paint_core_interpolate (core, drawable, paint_options, time);
gimp_display_flush_now (gdisp);
if (core->flags & CORE_TRACES_ON_WINDOW)
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
gimp_paint_core_paint (core, drawable, paint_options, POSTTRACE_PAINT, time);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment