[gimp] app: allow to set an angle on a GimpCanvasHandle in GIMP_HANDLE_CROSS mode



commit 495f90e6e294ce4cc40e3efac611a3c3a782579f
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jun 13 23:16:09 2017 +0200

    app: allow to set an angle on a GimpCanvasHandle in GIMP_HANDLE_CROSS mode

 app/display/gimpcanvashandle.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/app/display/gimpcanvashandle.c b/app/display/gimpcanvashandle.c
index 378351a..d4ca99d 100644
--- a/app/display/gimpcanvashandle.c
+++ b/app/display/gimpcanvashandle.c
@@ -309,6 +309,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
     case GIMP_HANDLE_FILLED_SQUARE:
     case GIMP_HANDLE_DIAMOND:
     case GIMP_HANDLE_FILLED_DIAMOND:
+    case GIMP_HANDLE_CROSS:
       cairo_save (cr);
       cairo_translate (cr, tx, ty);
       cairo_rotate (cr, private->start_angle);
@@ -320,10 +321,12 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
           cairo_rectangle (cr, x, y, private->width - 1.0, private->height - 1.0);
           _gimp_canvas_item_stroke (item, cr);
           break;
+
         case GIMP_HANDLE_FILLED_SQUARE:
           cairo_rectangle (cr, x - 0.5, y - 0.5, private->width, private->height);
           _gimp_canvas_item_fill (item, cr);
           break;
+
         case GIMP_HANDLE_DIAMOND:
         case GIMP_HANDLE_FILLED_DIAMOND:
           cairo_move_to (cr, x, y - (gdouble) private->height / 2.0);
@@ -336,9 +339,19 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
           else
             _gimp_canvas_item_fill (item, cr);
           break;
+
+        case GIMP_HANDLE_CROSS:
+          cairo_move_to (cr, x - private->width / 2, y);
+          cairo_line_to (cr, x + private->width / 2 - 0.5, y);
+          cairo_move_to (cr, x, y - private->height / 2);
+          cairo_line_to (cr, x, y + private->height / 2 - 0.5);
+          _gimp_canvas_item_stroke (item, cr);
+          break;
+
         default:
           g_assert_not_reached ();
         }
+
       cairo_restore (cr);
       break;
 
@@ -360,16 +373,6 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
       _gimp_canvas_item_fill (item, cr);
       break;
 
-    case GIMP_HANDLE_CROSS:
-      cairo_move_to (cr, x - private->width / 2, y);
-      cairo_line_to (cr, x + private->width / 2 - 0.5, y);
-
-      cairo_move_to (cr, x, y - private->height / 2);
-      cairo_line_to (cr, x, y + private->height / 2 - 0.5);
-
-      _gimp_canvas_item_stroke (item, cr);
-      break;
-
     case GIMP_HANDLE_CROSSHAIR:
       cairo_move_to (cr, x - private->width / 2, y);
       cairo_line_to (cr, x - private->width * 0.4, y);


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