From dd767bca37be8e2399effe31ca657d42554024a0 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 9 Apr 2014 15:41:56 +0200 Subject: [PATCH] app: use gimp_paint_tool_set_draw_circle() in the MyPaint brush tool --- app/tools/gimpmybrushtool.c | 19 +++++++++++++++++++ app/tools/gimpmybrushtool.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/app/tools/gimpmybrushtool.c b/app/tools/gimpmybrushtool.c index 678d1371ab..406bd648cd 100644 --- a/app/tools/gimpmybrushtool.c +++ b/app/tools/gimpmybrushtool.c @@ -20,6 +20,7 @@ #include #include +#include "libgimpmath/gimpmath.h" #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" @@ -40,6 +41,9 @@ G_DEFINE_TYPE (GimpMybrushTool, gimp_mybrush_tool, GIMP_TYPE_PAINT_TOOL) #define parent_class gimp_mybrush_tool_parent_class +static void gimp_mybrush_tool_draw (GimpDrawTool *draw_tool); + + void gimp_mybrush_tool_register (GimpToolRegisterCallback callback, gpointer data) @@ -63,6 +67,9 @@ gimp_mybrush_tool_register (GimpToolRegisterCallback callback, static void gimp_mybrush_tool_class_init (GimpMybrushToolClass *klass) { + GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); + + draw_tool_class->draw = gimp_mybrush_tool_draw; } static void @@ -75,3 +82,15 @@ gimp_mybrush_tool_init (GimpMybrushTool *mybrush_tool) gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (mybrush_tool), GIMP_COLOR_PICK_MODE_FOREGROUND); } + +static void +gimp_mybrush_tool_draw (GimpDrawTool *draw_tool) +{ + GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (draw_tool); + GimpMybrushOptions *options = GIMP_MYBRUSH_TOOL_GET_OPTIONS (draw_tool); + + gimp_paint_tool_set_draw_circle (paint_tool, TRUE, + exp (options->radius)); + + GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool); +} diff --git a/app/tools/gimpmybrushtool.h b/app/tools/gimpmybrushtool.h index f4413cb4d4..15ed40f0b1 100644 --- a/app/tools/gimpmybrushtool.h +++ b/app/tools/gimpmybrushtool.h @@ -29,6 +29,8 @@ #define GIMP_IS_MYBRUSH_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MYBRUSH_TOOL)) #define GIMP_MYBRUSH_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MYBRUSH_TOOL, GimpMybrushToolClass)) +#define GIMP_MYBRUSH_TOOL_GET_OPTIONS(t) (GIMP_MYBRUSH_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t)))) + typedef struct _GimpMybrushTool GimpMybrushTool; typedef struct _GimpMybrushToolClass GimpMybrushToolClass;