[gimp] app: remove XOR drawing code paths which are now dead



commit 41c338ce93f28979a2e67a3af330681672701827
Author: Michael Natterer <mitch gimp org>
Date:   Fri Sep 24 02:11:04 2010 +0200

    app: remove XOR drawing code paths which are now dead

 app/display/gimpcanvas.c |   28 ---------
 app/display/gimpcanvas.h |    6 --
 app/tools/gimpdrawtool.c |  144 ++++-----------------------------------------
 3 files changed, 13 insertions(+), 165 deletions(-)
---
diff --git a/app/display/gimpcanvas.c b/app/display/gimpcanvas.c
index c6d1c5c..377c7a2 100644
--- a/app/display/gimpcanvas.c
+++ b/app/display/gimpcanvas.c
@@ -257,7 +257,6 @@ gimp_canvas_gc_new (GimpCanvas      *canvas,
   switch (style)
     {
     case GIMP_CANVAS_STYLE_XOR_DOTTED:
-    case GIMP_CANVAS_STYLE_XOR_DASHED:
       mask |= GDK_GC_LINE_STYLE;
       values.line_style = GDK_LINE_ON_OFF_DASH;
       /*  fallthrough  */
@@ -293,7 +292,6 @@ gimp_canvas_gc_new (GimpCanvas      *canvas,
       return gc;
 
     case GIMP_CANVAS_STYLE_XOR_DOTTED:
-    case GIMP_CANVAS_STYLE_XOR_DASHED:
     case GIMP_CANVAS_STYLE_XOR:
       break;
     }
@@ -457,32 +455,6 @@ gimp_canvas_draw_arc (GimpCanvas      *canvas,
 }
 
 /**
- * gimp_canvas_draw_polygon:
- * @canvas:     a #GimpCanvas widget
- * @style:      one of the enumerated #GimpCanvasStyle's.
- * @filled:     if %TRUE, fill the polygon.
- * @points:     a #GdkPoint array.
- * @num_points: the number of points in the array.
- *
- * Draws a polygon connecting the specified points, in the specified
- * style.
- **/
-void
-gimp_canvas_draw_polygon (GimpCanvas      *canvas,
-                          GimpCanvasStyle  style,
-                          gboolean         filled,
-                          GdkPoint        *points,
-                          gint             num_points)
-{
-  if (! gimp_canvas_ensure_style (canvas, style))
-    return;
-
-  gdk_draw_polygon (gtk_widget_get_window (GTK_WIDGET (canvas)),
-                    canvas->gc[style],
-                    filled, points, num_points);
-}
-
-/**
  * gimp_canvas_draw_segments:
  * @canvas:       a #GimpCanvas widget
  * @style:        one of the enumerated #GimpCanvasStyle's.
diff --git a/app/display/gimpcanvas.h b/app/display/gimpcanvas.h
index 4203b8f..88ef513 100644
--- a/app/display/gimpcanvas.h
+++ b/app/display/gimpcanvas.h
@@ -25,7 +25,6 @@
 typedef enum
 {
   GIMP_CANVAS_STYLE_XOR,
-  GIMP_CANVAS_STYLE_XOR_DASHED,
   GIMP_CANVAS_STYLE_XOR_DOTTED,
   GIMP_CANVAS_NUM_STYLES
 } GimpCanvasStyle;
@@ -103,11 +102,6 @@ void         gimp_canvas_draw_arc          (GimpCanvas         *canvas,
                                             gint                height,
                                             gint                angle1,
                                             gint                angle2);
-void         gimp_canvas_draw_polygon      (GimpCanvas         *canvas,
-                                            GimpCanvasStyle     style,
-                                            gboolean            filled,
-                                            GdkPoint           *points,
-                                            gint                num_points);
 void         gimp_canvas_draw_segments     (GimpCanvas         *canvas,
                                             GimpCanvasStyle     style,
                                             GdkSegment         *segments,
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index a1609eb..3b66fc9 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -507,37 +507,14 @@ gimp_draw_tool_draw_dashed_line (GimpDrawTool *draw_tool,
                                  gdouble       x2,
                                  gdouble       y2)
 {
-  GimpDisplayShell *shell;
-  gdouble           tx1, ty1;
-  gdouble           tx2, ty2;
+  GimpCanvasItem *item;
 
   g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
 
-  if (draw_tool->use_cairo)
-    {
-      GimpCanvasItem *item;
-
-      item = gimp_canvas_line_new (x1, y1, x2, y2);
-      gimp_canvas_item_set_highlight (item, TRUE);
-
-      draw_tool->items = g_list_append (draw_tool->items, item);
+  item = gimp_canvas_line_new (x1, y1, x2, y2);
+  gimp_canvas_item_set_highlight (item, TRUE);
 
-      return;
-    }
-
-  shell = gimp_display_get_shell (draw_tool->display);
-
-  gimp_display_shell_transform_xy_f (shell,
-                                     x1, y1,
-                                     &tx1, &ty1);
-  gimp_display_shell_transform_xy_f (shell,
-                                     x2, y2,
-                                     &tx2, &ty2);
-
-  gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas),
-                         GIMP_CANVAS_STYLE_XOR_DASHED,
-                         PROJ_ROUND (tx1), PROJ_ROUND (ty1),
-                         PROJ_ROUND (tx2), PROJ_ROUND (ty2));
+  draw_tool->items = g_list_append (draw_tool->items, item);
 }
 
 /**
@@ -553,48 +530,13 @@ gimp_draw_tool_draw_guide_line (GimpDrawTool        *draw_tool,
                                 GimpOrientationType  orientation,
                                 gint                 position)
 {
-  GimpDisplayShell *shell;
-  gint              x1, y1, x2, y2;
-  gint              x, y;
+  GimpCanvasItem *item;
 
   g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
 
-  if (draw_tool->use_cairo)
-    {
-      GimpCanvasItem *item;
-
-      item = gimp_canvas_guide_new (orientation, position);
-
-      draw_tool->items = g_list_append (draw_tool->items, item);
-
-      return;
-    }
-
-  shell = gimp_display_get_shell (draw_tool->display);
-
-  x1 = 0;
-  y1 = 0;
-
-  gdk_drawable_get_size (gtk_widget_get_window (shell->canvas), &x2, &y2);
-
-  switch (orientation)
-    {
-    case GIMP_ORIENTATION_HORIZONTAL:
-      gimp_display_shell_transform_xy (shell, 0, position, &x, &y);
-      y1 = y2 = y;
-      break;
-
-    case GIMP_ORIENTATION_VERTICAL:
-      gimp_display_shell_transform_xy (shell, position, 0, &x, &y);
-      x1 = x2 = x;
-      break;
-
-    case GIMP_ORIENTATION_UNKNOWN:
-      return;
-    }
+  item = gimp_canvas_guide_new (orientation, position);
 
-  gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR,
-                         x1, y1, x2, y2);
+  draw_tool->items = g_list_append (draw_tool->items, item);
 }
 
 /**
@@ -1371,46 +1313,16 @@ gimp_draw_tool_draw_lines (GimpDrawTool      *draw_tool,
                            gint               n_points,
                            gboolean           filled)
 {
-  GimpDisplayShell *shell;
-  GdkPoint         *coords;
+  GimpCanvasItem *item;
 
   g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
 
   if (points == NULL || n_points < 2)
     return;
 
-  if (draw_tool->use_cairo)
-    {
-      GimpCanvasItem *item;
-
-      item = gimp_canvas_polygon_new (points, n_points, filled);
-
-      draw_tool->items = g_list_append (draw_tool->items, item);
-
-      return;
-    }
-
-  shell = gimp_display_get_shell (draw_tool->display);
-
-  coords = g_new (GdkPoint, n_points);
-
-  gimp_display_shell_transform_points (shell,
-                                       points, coords, n_points);
-
-  if (filled)
-    {
-      gimp_canvas_draw_polygon (GIMP_CANVAS (shell->canvas),
-                                GIMP_CANVAS_STYLE_XOR,
-                                TRUE, coords, n_points);
-    }
-  else
-    {
-      gimp_canvas_draw_lines (GIMP_CANVAS (shell->canvas),
-                              GIMP_CANVAS_STYLE_XOR,
-                              coords, n_points);
-    }
+  item = gimp_canvas_polygon_new (points, n_points, filled);
 
-  g_free (coords);
+  draw_tool->items = g_list_append (draw_tool->items, item);
 }
 
 void
@@ -1419,46 +1331,16 @@ gimp_draw_tool_draw_strokes (GimpDrawTool     *draw_tool,
                              gint              n_points,
                              gboolean          filled)
 {
-  GimpDisplayShell *shell;
-  GdkPoint         *coords;
+  GimpCanvasItem *item;
 
   g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
 
   if (points == NULL || n_points < 2)
     return;
 
-  if (draw_tool->use_cairo)
-    {
-      GimpCanvasItem *item;
-
-      item = gimp_canvas_polygon_new_from_coords (points, n_points, filled);
-
-      draw_tool->items = g_list_append (draw_tool->items, item);
-
-      return;
-    }
-
-  shell = gimp_display_get_shell (draw_tool->display);
-
-  coords = g_new (GdkPoint, n_points);
-
-  gimp_display_shell_transform_coords (shell,
-                                       points, coords, n_points);
-
-  if (filled)
-    {
-      gimp_canvas_draw_polygon (GIMP_CANVAS (shell->canvas),
-                                GIMP_CANVAS_STYLE_XOR,
-                                TRUE, coords, n_points);
-    }
-  else
-    {
-      gimp_canvas_draw_lines (GIMP_CANVAS (shell->canvas),
-                              GIMP_CANVAS_STYLE_XOR,
-                              coords, n_points);
-    }
+  item = gimp_canvas_polygon_new_from_coords (points, n_points, filled);
 
-  g_free (coords);
+  draw_tool->items = g_list_append (draw_tool->items, item);
 }
 
 /**



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