maintain an is_drawn boolean which indicates whether the drawn stuff is

2007-01-21  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimpdrawtool.[ch]: maintain an is_drawn boolean which
	indicates whether the drawn stuff is currently visible. Added
	gimp_draw_tool_is_drawn() to obtain it.

	* app/tools/gimpbrushtool.c (gimp_brush_tool_draw): don't create
	the brush outline segments for the purpose of undrawing (if we
	don't have the segments, we can hardly have drawn them before).
	Fixes artifacts when the brush is being scaled or changed.

	* app/core/gimpbrush.c: don't call brush_scale_mask() and
	brush_scale_pixmap() with zero width or height. Fixes warnings
	from these functions.


svn path=/trunk/; revision=21749
This commit is contained in:
Michael Natterer 2007-01-21 19:54:57 +00:00 committed by Michael Natterer
parent 37661ec884
commit 8398ed8735
5 changed files with 43 additions and 4 deletions

View File

@ -1,3 +1,18 @@
2007-01-21 Michael Natterer <mitch@gimp.org>
* app/tools/gimpdrawtool.[ch]: maintain an is_drawn boolean which
indicates whether the drawn stuff is currently visible. Added
gimp_draw_tool_is_drawn() to obtain it.
* app/tools/gimpbrushtool.c (gimp_brush_tool_draw): don't create
the brush outline segments for the purpose of undrawing (if we
don't have the segments, we can hardly have drawn them before).
Fixes artifacts when the brush is being scaled or changed.
* app/core/gimpbrush.c: don't call brush_scale_mask() and
brush_scale_pixmap() with zero width or height. Fixes warnings
from these functions.
2007-01-21 Tor Lillqvist <tml@novell.com>
* configure.in: Add AC_MSG_RESULT([no]) to the fail branch of

View File

@ -373,7 +373,10 @@ gimp_brush_real_scale_mask (GimpBrush *brush,
width = (gint) (brush->mask->width * scale + 0.5);
height = (gint) (brush->mask->height * scale + 0.5);
return brush_scale_mask (brush->mask, width, height);
if (width > 0 && height > 0)
return brush_scale_mask (brush->mask, width, height);
return NULL;
}
static TempBuf *
@ -386,7 +389,10 @@ gimp_brush_real_scale_pixmap (GimpBrush *brush,
width = (gint) (brush->pixmap->width * scale + 0.5);
height = (gint) (brush->pixmap->height * scale + 0.5);
return brush_scale_pixmap (brush->pixmap, width, height);
if (width > 0 && height > 0)
return brush_scale_pixmap (brush->pixmap, width, height);
return NULL;
}

View File

@ -263,7 +263,11 @@ gimp_brush_tool_draw (GimpDrawTool *draw_tool)
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (draw_tool);
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
if (! brush_core->brush_bound_segs && brush_core->main_brush)
/* don't create the segments for the purpose of undrawing (if we
* don't have the segments, we can hardly have drawn them before)
*/
if (! brush_core->brush_bound_segs && brush_core->main_brush &&
! gimp_draw_tool_is_drawn (draw_tool))
{
gimp_brush_core_create_bound_segs (brush_core, paint_options);
}

View File

@ -98,6 +98,7 @@ gimp_draw_tool_init (GimpDrawTool *draw_tool)
draw_tool->display = NULL;
draw_tool->paused_count = 0;
draw_tool->is_drawn = FALSE;
draw_tool->vectors = NULL;
draw_tool->transform = NULL;
@ -187,6 +188,8 @@ gimp_draw_tool_draw (GimpDrawTool *draw_tool)
if (draw_tool->paused_count == 0 && draw_tool->display)
{
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool);
draw_tool->is_drawn = ! draw_tool->is_drawn;
}
}
@ -301,6 +304,14 @@ gimp_draw_tool_resume (GimpDrawTool *draw_tool)
}
}
gboolean
gimp_draw_tool_is_drawn (GimpDrawTool *draw_tool)
{
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), FALSE);
return draw_tool->is_drawn;
}
void
gimp_draw_tool_set_vectors (GimpDrawTool *draw_tool,
GList *vectors)

View File

@ -52,9 +52,10 @@ struct _GimpDrawTool
*/
gint paused_count; /* count to keep track of multiple pauses */
gboolean is_drawn; /* is the stuff we draw currently visible */
GList *vectors; /* GimpVectors to render */
GimpMatrix3 *transform; /* Transformation matrix fof the vectors */
GimpMatrix3 *transform; /* Transformation matrix of the vectors */
};
struct _GimpDrawToolClass
@ -78,6 +79,8 @@ gboolean gimp_draw_tool_is_active (GimpDrawTool *draw_tool)
void gimp_draw_tool_pause (GimpDrawTool *draw_tool);
void gimp_draw_tool_resume (GimpDrawTool *draw_tool);
gboolean gimp_draw_tool_is_drawn (GimpDrawTool *draw_tool);
void gimp_draw_tool_set_vectors (GimpDrawTool *draw_tool,
GList *vectors);
void gimp_draw_tool_set_transform (GimpDrawTool *draw_tool,