From c60db90ff75d7b12b7a4e47da59f754358b59856 Mon Sep 17 00:00:00 2001 From: "Garry R. Osgood" Date: Sat, 25 Dec 1999 21:32:52 +0000 Subject: [PATCH] Season's Greetings! app/clone.c app/paint_core.c app/paint_core.h Updated 1999-12-25 Garry R. Osgood Season's Greetings! * app/clone.c * app/paint_core.c * app/paint_core.h * MAINTAINERS MAINTAINERS: Updated my entry (it wasn't there ;) app/paint_core.[ch] supplied new PaintTool states to clone_paint_func() so that writes of temporary markings made directly to the window are not clobbered by buffered writes stemming from gdisplay_flush_xxx() routines. clone_tool_paint_func() has been modified to take advantage of these new states, retiring bug #2184 in a way that does not change user interface semantics. There are small additions to the PaintCore interface that do not affect clientele unaware of added semantics. These changes are detailed at http://idt.net/~gosgood/gimp-patch/patch03.html. --- ChangeLog | 17 +++++++++++++++++ MAINTAINERS | 9 +++++++++ app/clone.c | 16 +++++++++------- app/paint/gimpclone.c | 16 +++++++++------- app/paint/gimpsourcecore.c | 16 +++++++++------- app/paint_core.c | 10 +++++++++- app/paint_core.h | 27 ++++++++++++++++++--------- app/tools/clone.c | 16 +++++++++------- app/tools/gimpclonetool.c | 16 +++++++++------- app/tools/gimpsourcetool.c | 16 +++++++++------- app/tools/paint_core.c | 10 +++++++++- app/tools/paint_core.h | 27 ++++++++++++++++++--------- 12 files changed, 134 insertions(+), 62 deletions(-) diff --git a/ChangeLog b/ChangeLog index e27915231c..871bf1d343 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +1999-12-25 Garry R. Osgood + Season's Greetings! + * app/clone.c + * app/paint_core.c + * app/paint_core.h + * MAINTAINERS + + MAINTAINERS: Updated my entry (it wasn't there ;) + app/paint_core.[ch] supplied new PaintTool states to clone_paint_func() so that + writes of temporary markings made directly to the window are not + clobbered by buffered writes stemming from gdisplay_flush_xxx() + routines. clone_tool_paint_func() has been modified to take advantage + of these new states, retiring bug #2184 in a way that does not change + user interface semantics. There are small additions to the PaintCore + interface that do not affect clientele unaware of added semantics. + These changes are detailed at http://idt.net/~gosgood/gimp-patch/patch03.html. + Sat Dec 25 04:14:03 CET 1999 Marc Lehmann * gimp1_1_splash.ppm: Crappy it is, but at least temporary! Feel diff --git a/MAINTAINERS b/MAINTAINERS index d85c7cd242..af3947a067 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -192,3 +192,12 @@ expertise: GUI, Help System, Context System current work: commit access: yes +Name: Garry R. Osgood +Email: gosgood@idt.net +url: http://idt.net/~gosgood/ +ircnick: +expertise: Bug fixing. +current work: I fell into this rabbit hole by writing highly verbose patch documentation, +which just goes to show that succinctness is its own reward. My patch documentation +archive is http://idt.net/~gosgood/gimp-patch/ +commit access: yes diff --git a/app/clone.c b/app/clone.c index 99324ed954..4e2c4b1246 100644 --- a/app/clone.c +++ b/app/clone.c @@ -84,7 +84,6 @@ static int non_gui_offset_x; static int non_gui_offset_y; static CloneType non_gui_type; - /* forward function declarations */ static void clone_draw (Tool *); @@ -259,6 +258,9 @@ clone_paint_func (PaintCore *paint_core, switch (state) { + case PRETRACE_PAINT : + draw_core_pause (paint_core->core, active_tool); + break; case MOTION_PAINT : x1 = paint_core->curx; y1 = paint_core->cury; @@ -298,7 +300,6 @@ clone_paint_func (PaintCore *paint_core, clone_options->type, offset_x, offset_y); } - draw_core_pause (paint_core->core, active_tool); break; case INIT_PAINT : @@ -343,17 +344,17 @@ clone_paint_func (PaintCore *paint_core, src_gdisp = the_src_gdisp; } - /* Find the target cursor's location onscreen */ - gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); - if (state == INIT_PAINT) /* Initialize the tool drawing core */ draw_core_start (paint_core->core, src_gdisp->canvas->window, active_tool); - else if (state == MOTION_PAINT) + else if (state == POSTTRACE_PAINT) + { + /* Find the target cursor's location onscreen */ + gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); draw_core_resume (paint_core->core, active_tool); - + } return NULL; } @@ -427,6 +428,7 @@ tools_new_clone () private = (PaintCore *) tool->private; private->paint_func = clone_paint_func; private->core->draw_func = clone_draw; + private->flags |= TOOL_TRACES_ON_WINDOW; return tool; } diff --git a/app/paint/gimpclone.c b/app/paint/gimpclone.c index 99324ed954..4e2c4b1246 100644 --- a/app/paint/gimpclone.c +++ b/app/paint/gimpclone.c @@ -84,7 +84,6 @@ static int non_gui_offset_x; static int non_gui_offset_y; static CloneType non_gui_type; - /* forward function declarations */ static void clone_draw (Tool *); @@ -259,6 +258,9 @@ clone_paint_func (PaintCore *paint_core, switch (state) { + case PRETRACE_PAINT : + draw_core_pause (paint_core->core, active_tool); + break; case MOTION_PAINT : x1 = paint_core->curx; y1 = paint_core->cury; @@ -298,7 +300,6 @@ clone_paint_func (PaintCore *paint_core, clone_options->type, offset_x, offset_y); } - draw_core_pause (paint_core->core, active_tool); break; case INIT_PAINT : @@ -343,17 +344,17 @@ clone_paint_func (PaintCore *paint_core, src_gdisp = the_src_gdisp; } - /* Find the target cursor's location onscreen */ - gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); - if (state == INIT_PAINT) /* Initialize the tool drawing core */ draw_core_start (paint_core->core, src_gdisp->canvas->window, active_tool); - else if (state == MOTION_PAINT) + else if (state == POSTTRACE_PAINT) + { + /* Find the target cursor's location onscreen */ + gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); draw_core_resume (paint_core->core, active_tool); - + } return NULL; } @@ -427,6 +428,7 @@ tools_new_clone () private = (PaintCore *) tool->private; private->paint_func = clone_paint_func; private->core->draw_func = clone_draw; + private->flags |= TOOL_TRACES_ON_WINDOW; return tool; } diff --git a/app/paint/gimpsourcecore.c b/app/paint/gimpsourcecore.c index 99324ed954..4e2c4b1246 100644 --- a/app/paint/gimpsourcecore.c +++ b/app/paint/gimpsourcecore.c @@ -84,7 +84,6 @@ static int non_gui_offset_x; static int non_gui_offset_y; static CloneType non_gui_type; - /* forward function declarations */ static void clone_draw (Tool *); @@ -259,6 +258,9 @@ clone_paint_func (PaintCore *paint_core, switch (state) { + case PRETRACE_PAINT : + draw_core_pause (paint_core->core, active_tool); + break; case MOTION_PAINT : x1 = paint_core->curx; y1 = paint_core->cury; @@ -298,7 +300,6 @@ clone_paint_func (PaintCore *paint_core, clone_options->type, offset_x, offset_y); } - draw_core_pause (paint_core->core, active_tool); break; case INIT_PAINT : @@ -343,17 +344,17 @@ clone_paint_func (PaintCore *paint_core, src_gdisp = the_src_gdisp; } - /* Find the target cursor's location onscreen */ - gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); - if (state == INIT_PAINT) /* Initialize the tool drawing core */ draw_core_start (paint_core->core, src_gdisp->canvas->window, active_tool); - else if (state == MOTION_PAINT) + else if (state == POSTTRACE_PAINT) + { + /* Find the target cursor's location onscreen */ + gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); draw_core_resume (paint_core->core, active_tool); - + } return NULL; } @@ -427,6 +428,7 @@ tools_new_clone () private = (PaintCore *) tool->private; private->paint_func = clone_paint_func; private->core->draw_func = clone_draw; + private->flags |= TOOL_TRACES_ON_WINDOW; return tool; } diff --git a/app/paint_core.c b/app/paint_core.c index 920b006f1b..df71378dcd 100644 --- a/app/paint_core.c +++ b/app/paint_core.c @@ -336,8 +336,12 @@ paint_core_button_press (Tool *tool, (* paint_core->paint_func) (paint_core, drawable, MOTION_PAINT); } } - + if (paint_core->flags & TOOL_TRACES_ON_WINDOW) + (* paint_core->paint_func) (paint_core, drawable, PRETRACE_PAINT); gdisplay_flush_now (gdisp); + if (paint_core->flags & TOOL_TRACES_ON_WINDOW) + (* paint_core->paint_func) (paint_core, drawable, POSTTRACE_PAINT); + } void @@ -403,7 +407,11 @@ paint_core_motion (Tool *tool, paint_core_interpolate (paint_core, gimage_active_drawable (gdisp->gimage)); + if (paint_core->flags & TOOL_TRACES_ON_WINDOW) + (* paint_core->paint_func) (paint_core, gimage_active_drawable, PRETRACE_PAINT); gdisplay_flush_now (gdisp); + if (paint_core->flags & TOOL_TRACES_ON_WINDOW) + (* paint_core->paint_func) (paint_core, gimage_active_drawable, POSTTRACE_PAINT); paint_core->lastx = paint_core->curx; paint_core->lasty = paint_core->cury; diff --git a/app/paint_core.h b/app/paint_core.h index 1cb24936c6..ee57fbfff0 100644 --- a/app/paint_core.h +++ b/app/paint_core.h @@ -25,18 +25,27 @@ #include "gimpdrawableF.h" /* the different states that the painting function can be called with */ -#define INIT_PAINT 0 -#define MOTION_PAINT 1 -#define PAUSE_PAINT 2 -#define RESUME_PAINT 3 -#define FINISH_PAINT 4 + +#define INIT_PAINT 0 /* Setup PaintFunc internals */ +#define MOTION_PAINT 1 /* PaintFunc performs motion-related rendering */ +#define PAUSE_PAINT 2 /* Unused. Reserved */ +#define RESUME_PAINT 3 /* Unused. Reserved */ +#define FINISH_PAINT 4 /* Cleanup and/or reset PaintFunc operation */ +#define PRETRACE_PAINT 5 /* PaintFunc performs window tracing activity prior to rendering */ +#define POSTTRACE_PAINT 6 /* PaintFunc performs window tracing activity following rendering */ typedef enum /*< skip >*/ { - TOOL_CAN_HANDLE_CHANGING_BRUSH = 0x0001 /* Set for tools that don't mind - * if the brush changes while - * painting. - */ + TOOL_CAN_HANDLE_CHANGING_BRUSH = 0x0001, /* Set for tools that don't mind + * if the brush changes while + * painting. + */ + + TOOL_TRACES_ON_WINDOW /* Set for tools that perform temporary + * rendering directly to the window. These + * require sequencing with gdisplay_flush() + * routines. See clone.c for example. + */ } ToolFlags; typedef void * (* PaintFunc) (PaintCore *, GimpDrawable *, int); diff --git a/app/tools/clone.c b/app/tools/clone.c index 99324ed954..4e2c4b1246 100644 --- a/app/tools/clone.c +++ b/app/tools/clone.c @@ -84,7 +84,6 @@ static int non_gui_offset_x; static int non_gui_offset_y; static CloneType non_gui_type; - /* forward function declarations */ static void clone_draw (Tool *); @@ -259,6 +258,9 @@ clone_paint_func (PaintCore *paint_core, switch (state) { + case PRETRACE_PAINT : + draw_core_pause (paint_core->core, active_tool); + break; case MOTION_PAINT : x1 = paint_core->curx; y1 = paint_core->cury; @@ -298,7 +300,6 @@ clone_paint_func (PaintCore *paint_core, clone_options->type, offset_x, offset_y); } - draw_core_pause (paint_core->core, active_tool); break; case INIT_PAINT : @@ -343,17 +344,17 @@ clone_paint_func (PaintCore *paint_core, src_gdisp = the_src_gdisp; } - /* Find the target cursor's location onscreen */ - gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); - if (state == INIT_PAINT) /* Initialize the tool drawing core */ draw_core_start (paint_core->core, src_gdisp->canvas->window, active_tool); - else if (state == MOTION_PAINT) + else if (state == POSTTRACE_PAINT) + { + /* Find the target cursor's location onscreen */ + gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); draw_core_resume (paint_core->core, active_tool); - + } return NULL; } @@ -427,6 +428,7 @@ tools_new_clone () private = (PaintCore *) tool->private; private->paint_func = clone_paint_func; private->core->draw_func = clone_draw; + private->flags |= TOOL_TRACES_ON_WINDOW; return tool; } diff --git a/app/tools/gimpclonetool.c b/app/tools/gimpclonetool.c index 99324ed954..4e2c4b1246 100644 --- a/app/tools/gimpclonetool.c +++ b/app/tools/gimpclonetool.c @@ -84,7 +84,6 @@ static int non_gui_offset_x; static int non_gui_offset_y; static CloneType non_gui_type; - /* forward function declarations */ static void clone_draw (Tool *); @@ -259,6 +258,9 @@ clone_paint_func (PaintCore *paint_core, switch (state) { + case PRETRACE_PAINT : + draw_core_pause (paint_core->core, active_tool); + break; case MOTION_PAINT : x1 = paint_core->curx; y1 = paint_core->cury; @@ -298,7 +300,6 @@ clone_paint_func (PaintCore *paint_core, clone_options->type, offset_x, offset_y); } - draw_core_pause (paint_core->core, active_tool); break; case INIT_PAINT : @@ -343,17 +344,17 @@ clone_paint_func (PaintCore *paint_core, src_gdisp = the_src_gdisp; } - /* Find the target cursor's location onscreen */ - gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); - if (state == INIT_PAINT) /* Initialize the tool drawing core */ draw_core_start (paint_core->core, src_gdisp->canvas->window, active_tool); - else if (state == MOTION_PAINT) + else if (state == POSTTRACE_PAINT) + { + /* Find the target cursor's location onscreen */ + gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); draw_core_resume (paint_core->core, active_tool); - + } return NULL; } @@ -427,6 +428,7 @@ tools_new_clone () private = (PaintCore *) tool->private; private->paint_func = clone_paint_func; private->core->draw_func = clone_draw; + private->flags |= TOOL_TRACES_ON_WINDOW; return tool; } diff --git a/app/tools/gimpsourcetool.c b/app/tools/gimpsourcetool.c index 99324ed954..4e2c4b1246 100644 --- a/app/tools/gimpsourcetool.c +++ b/app/tools/gimpsourcetool.c @@ -84,7 +84,6 @@ static int non_gui_offset_x; static int non_gui_offset_y; static CloneType non_gui_type; - /* forward function declarations */ static void clone_draw (Tool *); @@ -259,6 +258,9 @@ clone_paint_func (PaintCore *paint_core, switch (state) { + case PRETRACE_PAINT : + draw_core_pause (paint_core->core, active_tool); + break; case MOTION_PAINT : x1 = paint_core->curx; y1 = paint_core->cury; @@ -298,7 +300,6 @@ clone_paint_func (PaintCore *paint_core, clone_options->type, offset_x, offset_y); } - draw_core_pause (paint_core->core, active_tool); break; case INIT_PAINT : @@ -343,17 +344,17 @@ clone_paint_func (PaintCore *paint_core, src_gdisp = the_src_gdisp; } - /* Find the target cursor's location onscreen */ - gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); - if (state == INIT_PAINT) /* Initialize the tool drawing core */ draw_core_start (paint_core->core, src_gdisp->canvas->window, active_tool); - else if (state == MOTION_PAINT) + else if (state == POSTTRACE_PAINT) + { + /* Find the target cursor's location onscreen */ + gdisplay_transform_coords (src_gdisp, src_x, src_y, &trans_tx, &trans_ty, 1); draw_core_resume (paint_core->core, active_tool); - + } return NULL; } @@ -427,6 +428,7 @@ tools_new_clone () private = (PaintCore *) tool->private; private->paint_func = clone_paint_func; private->core->draw_func = clone_draw; + private->flags |= TOOL_TRACES_ON_WINDOW; return tool; } diff --git a/app/tools/paint_core.c b/app/tools/paint_core.c index 920b006f1b..df71378dcd 100644 --- a/app/tools/paint_core.c +++ b/app/tools/paint_core.c @@ -336,8 +336,12 @@ paint_core_button_press (Tool *tool, (* paint_core->paint_func) (paint_core, drawable, MOTION_PAINT); } } - + if (paint_core->flags & TOOL_TRACES_ON_WINDOW) + (* paint_core->paint_func) (paint_core, drawable, PRETRACE_PAINT); gdisplay_flush_now (gdisp); + if (paint_core->flags & TOOL_TRACES_ON_WINDOW) + (* paint_core->paint_func) (paint_core, drawable, POSTTRACE_PAINT); + } void @@ -403,7 +407,11 @@ paint_core_motion (Tool *tool, paint_core_interpolate (paint_core, gimage_active_drawable (gdisp->gimage)); + if (paint_core->flags & TOOL_TRACES_ON_WINDOW) + (* paint_core->paint_func) (paint_core, gimage_active_drawable, PRETRACE_PAINT); gdisplay_flush_now (gdisp); + if (paint_core->flags & TOOL_TRACES_ON_WINDOW) + (* paint_core->paint_func) (paint_core, gimage_active_drawable, POSTTRACE_PAINT); paint_core->lastx = paint_core->curx; paint_core->lasty = paint_core->cury; diff --git a/app/tools/paint_core.h b/app/tools/paint_core.h index 1cb24936c6..ee57fbfff0 100644 --- a/app/tools/paint_core.h +++ b/app/tools/paint_core.h @@ -25,18 +25,27 @@ #include "gimpdrawableF.h" /* the different states that the painting function can be called with */ -#define INIT_PAINT 0 -#define MOTION_PAINT 1 -#define PAUSE_PAINT 2 -#define RESUME_PAINT 3 -#define FINISH_PAINT 4 + +#define INIT_PAINT 0 /* Setup PaintFunc internals */ +#define MOTION_PAINT 1 /* PaintFunc performs motion-related rendering */ +#define PAUSE_PAINT 2 /* Unused. Reserved */ +#define RESUME_PAINT 3 /* Unused. Reserved */ +#define FINISH_PAINT 4 /* Cleanup and/or reset PaintFunc operation */ +#define PRETRACE_PAINT 5 /* PaintFunc performs window tracing activity prior to rendering */ +#define POSTTRACE_PAINT 6 /* PaintFunc performs window tracing activity following rendering */ typedef enum /*< skip >*/ { - TOOL_CAN_HANDLE_CHANGING_BRUSH = 0x0001 /* Set for tools that don't mind - * if the brush changes while - * painting. - */ + TOOL_CAN_HANDLE_CHANGING_BRUSH = 0x0001, /* Set for tools that don't mind + * if the brush changes while + * painting. + */ + + TOOL_TRACES_ON_WINDOW /* Set for tools that perform temporary + * rendering directly to the window. These + * require sequencing with gdisplay_flush() + * routines. See clone.c for example. + */ } ToolFlags; typedef void * (* PaintFunc) (PaintCore *, GimpDrawable *, int);