[gimp] app: clean up the new brush outline stuff a bit



commit 8b57ef51ccf17eda3c23d5ea811fdd9a723eb0ab
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jun 30 09:27:43 2011 +0200

    app: clean up the new brush outline stuff a bit

 app/display/display-enums.h             |    3 ++-
 app/display/gimpcanvaspath.c            |   18 ++++++++++--------
 app/display/gimpcanvaspath.h            |    4 ++--
 app/display/gimpdisplayshell-handlers.c |    4 ++--
 app/display/gimpdisplayshell-style.c    |    4 ++--
 app/tools/gimpbrushtool.c               |    3 ++-
 app/tools/gimpdrawtool.c                |    2 +-
 7 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/app/display/display-enums.h b/app/display/display-enums.h
index eb2236e..11c5cba 100644
--- a/app/display/display-enums.h
+++ b/app/display/display-enums.h
@@ -77,13 +77,14 @@ typedef enum
   GIMP_HANDLE_ANCHOR_EAST
 } GimpHandleAnchor;
 
+
 #define GIMP_TYPE_PATH_STYLE (gimp_path_style_get_type ())
 
 GType gimp_path_style_get_type (void) G_GNUC_CONST;
 
 typedef enum
 {
-  GIMP_PATH_STYLE_DEFAULT = 0,
+  GIMP_PATH_STYLE_DEFAULT,
   GIMP_PATH_STYLE_VECTORS,
   GIMP_PATH_STYLE_OUTLINE
 } GimpPathStyle;
diff --git a/app/display/gimpcanvaspath.c b/app/display/gimpcanvaspath.c
index fabb9c0..c478355 100644
--- a/app/display/gimpcanvaspath.c
+++ b/app/display/gimpcanvaspath.c
@@ -56,7 +56,7 @@ struct _GimpCanvasPathPrivate
   gdouble       x;
   gdouble       y;
   gboolean      filled;
-  GimpPathStyle  path_style;
+  GimpPathStyle path_style;
 };
 
 #define GET_PRIVATE(path) \
@@ -302,9 +302,9 @@ gimp_canvas_path_stroke (GimpCanvasItem   *item,
   gboolean               active;
   cairo_pattern_t       *pattern;
 
-    switch (private->path_style)
+  switch (private->path_style)
     {
-     case GIMP_PATH_STYLE_VECTORS:
+    case GIMP_PATH_STYLE_VECTORS:
       active = gimp_canvas_item_get_highlight (item);
 
       gimp_display_shell_set_vectors_bg_style (shell, cr, active);
@@ -313,14 +313,16 @@ gimp_canvas_path_stroke (GimpCanvasItem   *item,
       gimp_display_shell_set_vectors_fg_style (shell, cr, active);
       cairo_stroke (cr);
       break;
-     case GIMP_PATH_STYLE_OUTLINE:
+
+    case GIMP_PATH_STYLE_OUTLINE:
       gimp_display_shell_set_outline_bg_style (shell, cr);
       cairo_stroke_preserve (cr);
 
       gimp_display_shell_set_outline_fg_style (shell, cr);
       cairo_stroke (cr);
       break;
-     case GIMP_PATH_STYLE_DEFAULT:
+
+    case GIMP_PATH_STYLE_DEFAULT:
       GIMP_CANVAS_ITEM_CLASS (parent_class)->stroke (item, shell, cr);
       break;
     }
@@ -329,20 +331,20 @@ gimp_canvas_path_stroke (GimpCanvasItem   *item,
 GimpCanvasItem *
 gimp_canvas_path_new (GimpDisplayShell     *shell,
                       const GimpBezierDesc *bezier,
-                      GimpPathStyle          path_style,
                       gdouble               x,
                       gdouble               y,
-                      gboolean              filled)
+                      gboolean              filled,
+                      GimpPathStyle         style)
 {
   g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
 
   return g_object_new (GIMP_TYPE_CANVAS_PATH,
                        "shell",      shell,
                        "path",       bezier,
-                       "path-style", path_style,
                        "x",          x,
                        "y",          y,
                        "filled",     filled,
+                       "path-style", style,
                        NULL);
 }
 
diff --git a/app/display/gimpcanvaspath.h b/app/display/gimpcanvaspath.h
index 905b441..803962b 100644
--- a/app/display/gimpcanvaspath.h
+++ b/app/display/gimpcanvaspath.h
@@ -51,10 +51,10 @@ GType            gimp_canvas_path_get_type (void) G_GNUC_CONST;
 
 GimpCanvasItem * gimp_canvas_path_new      (GimpDisplayShell     *shell,
                                             const GimpBezierDesc *bezier,
-                                            GimpPathStyle        type,
                                             gdouble               x,
                                             gdouble               y,
-                                            gboolean              filled);
+                                            gboolean              filled,
+                                            GimpPathStyle         style);
 
 void             gimp_canvas_path_set      (GimpCanvasItem       *path,
                                             const GimpBezierDesc *bezier);
diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c
index 8c670eb..37248a0 100644
--- a/app/display/gimpdisplayshell-handlers.c
+++ b/app/display/gimpdisplayshell-handlers.c
@@ -875,9 +875,9 @@ gimp_display_shell_vectors_add_handler (GimpContainer    *container,
 
   item = gimp_canvas_path_new (shell,
                                gimp_vectors_get_bezier (vectors),
-                               GIMP_PATH_STYLE_VECTORS,
                                0, 0,
-                               FALSE);
+                               FALSE,
+                               GIMP_PATH_STYLE_VECTORS);
   gimp_canvas_item_set_visible (item,
                                 gimp_item_get_visible (GIMP_ITEM (vectors)));
 
diff --git a/app/display/gimpdisplayshell-style.c b/app/display/gimpdisplayshell-style.c
index 8e86658..56a263a 100644
--- a/app/display/gimpdisplayshell-style.c
+++ b/app/display/gimpdisplayshell-style.c
@@ -315,14 +315,14 @@ void
 gimp_display_shell_set_outline_fg_style (GimpDisplayShell *shell,
                                          cairo_t          *cr)
 {
-  static const double dashes[] = {4.0, 4.0};
+  static const double dashes[] = { 4.0, 4.0 };
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
   g_return_if_fail (cr != NULL);
 
   cairo_set_line_width (cr, 1.0);
   gimp_cairo_set_source_rgba (cr, &outline_fg);
-  cairo_set_dash(cr, dashes, 2, 0);
+  cairo_set_dash (cr, dashes, G_N_ELEMENTS (dashes), 0);
 }
 
 void
diff --git a/app/tools/gimpbrushtool.c b/app/tools/gimpbrushtool.c
index 43dfc2f..a794415 100644
--- a/app/tools/gimpbrushtool.c
+++ b/app/tools/gimpbrushtool.c
@@ -356,7 +356,8 @@ gimp_brush_tool_create_outline (GimpBrushTool *brush_tool,
 #undef EPSILON
         }
 
-      return gimp_canvas_path_new (shell, boundary, GIMP_PATH_STYLE_OUTLINE, x, y, FALSE);
+      return gimp_canvas_path_new (shell, boundary, x, y, FALSE,
+                                   GIMP_PATH_STYLE_OUTLINE);
     }
   else if (draw_fallback)
     {
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index d29547f..c41816b 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -774,7 +774,7 @@ gimp_draw_tool_add_path (GimpDrawTool         *draw_tool,
   g_return_val_if_fail (desc != NULL, NULL);
 
   item = gimp_canvas_path_new (gimp_display_get_shell (draw_tool->display),
-                               desc, GIMP_PATH_STYLE_DEFAULT, x, y, FALSE);
+                               desc, x, y, FALSE, GIMP_PATH_STYLE_DEFAULT);
 
   gimp_draw_tool_add_item (draw_tool, item);
   g_object_unref (item);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]