2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-25 06:05:25 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-25 06:05:25 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
#ifndef __GIMP_BRUSH_TOOL_H__
|
|
|
|
#define __GIMP_BRUSH_TOOL_H__
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
#include "gimppainttool.h"
|
2001-02-27 13:21:12 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
#define GIMP_TYPE_BRUSH_TOOL (gimp_brush_tool_get_type ())
|
|
|
|
#define GIMP_BRUSH_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_BRUSH_TOOL, GimpBrushTool))
|
|
|
|
#define GIMP_BRUSH_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_TOOL, GimpBrushToolClass))
|
|
|
|
#define GIMP_IS_BRUSH_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_BRUSH_TOOL))
|
|
|
|
#define GIMP_IS_BRUSH_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_TOOL))
|
|
|
|
#define GIMP_BRUSH_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BRUSH_TOOL, GimpBrushToolClass))
|
2001-02-28 03:18:01 +08:00
|
|
|
|
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
typedef struct _GimpBrushToolClass GimpBrushToolClass;
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
struct _GimpBrushTool
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
Bug 795257 - Segmentation fault crash using the clone tool
Commit f5cb1fed85341a9d0a46fb1391b19fa9ea3ccb42, which performed
brush outline generation in GimpPaintTool in synchrony with the
paint thread, wasn't enough, since GimpSourceTool could still call
gimp_brush_tool_create_outline() directly during its
GimpDrawTool::draw() method, leading to the same race condition
when executed concurrently with the paint thread.
Partially revert the above commit, so that outline generation is
handled as before, as far as GimpPaintTool is concenered. Instead,
add GimpPaintTool::{start,end,flush}_paint() virtual functions; the
first two are called when starting/ending painting using the paint
thread, while the third is called during the display-update
timeout, while the main thread and the paint thread are
synchronized. This allows subclasses to perform non-thread-safe
actions while the threads are synchronized.
Override these functions in GimpBrushTool, and cache the brush
boundary in the flush() function. Use the cached boundary in
gimp_brush_tool_create_outline() while painting, to avoid the above
race condition, both when this function is called through
GimpPaintTool, and through GimpSourceTool.
2018-04-14 21:48:10 +08:00
|
|
|
GimpPaintTool parent_instance;
|
|
|
|
|
|
|
|
GimpBezierDesc *boundary;
|
|
|
|
gint boundary_width;
|
|
|
|
gint boundary_height;
|
2018-04-15 05:55:44 +08:00
|
|
|
gdouble boundary_scale;
|
|
|
|
gdouble boundary_aspect_ratio;
|
|
|
|
gdouble boundary_angle;
|
|
|
|
gboolean boundary_reflect;
|
|
|
|
gdouble boundary_hardness;
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
struct _GimpBrushToolClass
|
2001-02-27 13:21:12 +08:00
|
|
|
{
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpPaintToolClass parent_class;
|
2001-02-27 13:21:12 +08:00
|
|
|
};
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2011-05-05 05:25:55 +08:00
|
|
|
GType gimp_brush_tool_get_type (void) G_GNUC_CONST;
|
2007-05-07 18:19:04 +08:00
|
|
|
|
2011-05-05 05:25:55 +08:00
|
|
|
GimpCanvasItem * gimp_brush_tool_create_outline (GimpBrushTool *brush_tool,
|
|
|
|
GimpDisplay *display,
|
|
|
|
gdouble x,
|
2014-04-09 20:30:46 +08:00
|
|
|
gdouble y);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
#endif /* __GIMP_BRUSH_TOOL_H__ */
|