[gimp] app: add an own GimpCanvasItem API for transforming coords



commit 64c929a1d192e1d029363697abd3b296bc240451
Author: Michael Natterer <mitch gimp org>
Date:   Thu Apr 18 13:53:42 2013 +0200

    app: add an own GimpCanvasItem API for transforming coords
    
    and use it in all subclasses. Removes all gimpdisplayshell-transform
    dependency from all item implementations.

 app/display/gimpcanvasarc.c              |  32 ++++----
 app/display/gimpcanvasboundary.c         |  49 ++++++------
 app/display/gimpcanvascorner.c           |  40 +++++-----
 app/display/gimpcanvascursor.c           |   1 -
 app/display/gimpcanvasgrid.c             |  26 +++----
 app/display/gimpcanvasgroup.c            |   1 -
 app/display/gimpcanvasguide.c            |  13 ++--
 app/display/gimpcanvashandle.c           |  42 +++++------
 app/display/gimpcanvasitem.c             |  58 +++++++++++++++
 app/display/gimpcanvasitem.h             |  14 ++++
 app/display/gimpcanvaslayerboundary.c    |   1 -
 app/display/gimpcanvasline.c             |  28 ++++---
 app/display/gimpcanvaspath.c             |   1 -
 app/display/gimpcanvaspen.c              |   1 -
 app/display/gimpcanvaspolygon.c          |  20 +++--
 app/display/gimpcanvasprogress.c         |  28 +++----
 app/display/gimpcanvasproxygroup.c       |   1 -
 app/display/gimpcanvasrectangle.c        |  40 +++++-----
 app/display/gimpcanvasrectangleguides.c  |  40 +++++-----
 app/display/gimpcanvassamplepoint.c      |  20 +++--
 app/display/gimpcanvastextcursor.c       |  40 +++++-----
 app/display/gimpcanvastransformguides.c  | 124 +++++++++++++++----------------
 app/display/gimpcanvastransformpreview.c |  36 +++++----
 23 files changed, 352 insertions(+), 304 deletions(-)
---
diff --git a/app/display/gimpcanvasarc.c b/app/display/gimpcanvasarc.c
index 45d30e8..9d81d86 100644
--- a/app/display/gimpcanvasarc.c
+++ b/app/display/gimpcanvasarc.c
@@ -32,7 +32,6 @@
 
 #include "gimpcanvasarc.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
@@ -224,25 +223,24 @@ gimp_canvas_arc_get_property (GObject    *object,
 }
 
 static void
-gimp_canvas_arc_transform (GimpCanvasItem   *item,
-                           GimpDisplayShell *shell,
-                           gdouble          *center_x,
-                           gdouble          *center_y,
-                           gdouble          *radius_x,
-                           gdouble          *radius_y)
+gimp_canvas_arc_transform (GimpCanvasItem *item,
+                           gdouble        *center_x,
+                           gdouble        *center_y,
+                           gdouble        *radius_x,
+                           gdouble        *radius_y)
 {
   GimpCanvasArcPrivate *private = GET_PRIVATE (item);
   gdouble               x1, y1;
   gdouble               x2, y2;
 
-  gimp_display_shell_transform_xy_f (shell,
-                                     private->center_x - private->radius_x,
-                                     private->center_y - private->radius_y,
-                                     &x1, &y1);
-  gimp_display_shell_transform_xy_f (shell,
-                                     private->center_x + private->radius_x,
-                                     private->center_y + private->radius_y,
-                                     &x2, &y2);
+  gimp_canvas_item_transform_xy_f (item,
+                                   private->center_x - private->radius_x,
+                                   private->center_y - private->radius_y,
+                                   &x1, &y1);
+  gimp_canvas_item_transform_xy_f (item,
+                                   private->center_x + private->radius_x,
+                                   private->center_y + private->radius_y,
+                                   &x2, &y2);
 
   x1 = floor (x1);
   y1 = floor (y1);
@@ -271,7 +269,7 @@ gimp_canvas_arc_draw (GimpCanvasItem   *item,
   gdouble               center_x, center_y;
   gdouble               radius_x, radius_y;
 
-  gimp_canvas_arc_transform (item, shell,
+  gimp_canvas_arc_transform (item,
                              &center_x, &center_y,
                              &radius_x, &radius_y);
 
@@ -298,7 +296,7 @@ gimp_canvas_arc_get_extents (GimpCanvasItem   *item,
   gdouble                center_x, center_y;
   gdouble                radius_x, radius_y;
 
-  gimp_canvas_arc_transform (item, shell,
+  gimp_canvas_arc_transform (item,
                              &center_x, &center_y,
                              &radius_x, &radius_y);
 
diff --git a/app/display/gimpcanvasboundary.c b/app/display/gimpcanvasboundary.c
index 3075003..ff19bb1 100644
--- a/app/display/gimpcanvasboundary.c
+++ b/app/display/gimpcanvasboundary.c
@@ -34,7 +34,6 @@
 
 #include "gimpcanvasboundary.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
@@ -217,9 +216,8 @@ gimp_canvas_boundary_get_property (GObject    *object,
 }
 
 static void
-gimp_canvas_boundary_transform (GimpCanvasItem   *item,
-                                GimpDisplayShell *shell,
-                                GimpSegment      *segs)
+gimp_canvas_boundary_transform (GimpCanvasItem *item,
+                                GimpSegment    *segs)
 {
   GimpCanvasBoundaryPrivate *private = GET_PRIVATE (item);
   gint                       i;
@@ -231,32 +229,39 @@ gimp_canvas_boundary_transform (GimpCanvasItem   *item,
           gdouble tx, ty;
 
           gimp_matrix3_transform_point (private->transform,
-                                        private->segs[i].x1, private->segs[i].y1,
+                                        private->segs[i].x1,
+                                        private->segs[i].y1,
                                         &tx, &ty);
-          gimp_display_shell_transform_xy (shell,
-                                           tx + private->offset_x,
-                                           ty + private->offset_y,
-                                           &segs[i].x1, &segs[i].y1);
+          gimp_canvas_item_transform_xy (item,
+                                         tx + private->offset_x,
+                                         ty + private->offset_y,
+                                         &segs[i].x1, &segs[i].y1);
 
           gimp_matrix3_transform_point (private->transform,
-                                        private->segs[i].x2, private->segs[i].y2,
+                                        private->segs[i].x2,
+                                        private->segs[i].y2,
                                         &tx, &ty);
-          gimp_display_shell_transform_xy (shell,
-                                           tx + private->offset_x,
-                                           ty + private->offset_y,
-                                           &segs[i].x2, &segs[i].y2);
+          gimp_canvas_item_transform_xy (item,
+                                         tx + private->offset_x,
+                                         ty + private->offset_y,
+                                         &segs[i].x2, &segs[i].y2);
         }
     }
   else
     {
-      gimp_display_shell_transform_segments (shell,
-                                             private->segs, segs,
-                                             private->n_segs,
-                                             private->offset_x,
-                                             private->offset_y);
-
       for (i = 0; i < private->n_segs; i++)
         {
+          gimp_canvas_item_transform_xy (item,
+                                         private->segs[i].x1 + private->offset_x,
+                                         private->segs[i].y1 + private->offset_y,
+                                         &segs[i].x1,
+                                         &segs[i].y1);
+          gimp_canvas_item_transform_xy (item,
+                                         private->segs[i].x2 + private->offset_x,
+                                         private->segs[i].y2 + private->offset_y,
+                                         &segs[i].x2,
+                                         &segs[i].y2);
+
           /*  If this segment is a closing segment && the segments lie inside
            *  the region, OR if this is an opening segment and the segments
            *  lie outside the region...
@@ -290,7 +295,7 @@ gimp_canvas_boundary_draw (GimpCanvasItem   *item,
 
   segs = g_new0 (GimpSegment, private->n_segs);
 
-  gimp_canvas_boundary_transform (item, shell, segs);
+  gimp_canvas_boundary_transform (item, segs);
 
   gimp_cairo_add_segments (cr, segs, private->n_segs);
 
@@ -311,7 +316,7 @@ gimp_canvas_boundary_get_extents (GimpCanvasItem   *item,
 
   segs = g_new0 (GimpSegment, private->n_segs);
 
-  gimp_canvas_boundary_transform (item, shell, segs);
+  gimp_canvas_boundary_transform (item, segs);
 
   x1 = MIN (segs[0].x1, segs[0].x2);
   y1 = MIN (segs[0].y1, segs[0].y2);
diff --git a/app/display/gimpcanvascorner.c b/app/display/gimpcanvascorner.c
index 687d779..166f171 100644
--- a/app/display/gimpcanvascorner.c
+++ b/app/display/gimpcanvascorner.c
@@ -30,7 +30,6 @@
 
 #include "gimpcanvascorner.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
@@ -238,12 +237,11 @@ gimp_canvas_corner_get_property (GObject    *object,
 }
 
 static void
-gimp_canvas_corner_transform (GimpCanvasItem   *item,
-                              GimpDisplayShell *shell,
-                              gdouble          *x,
-                              gdouble          *y,
-                              gdouble          *w,
-                              gdouble          *h)
+gimp_canvas_corner_transform (GimpCanvasItem *item,
+                              gdouble        *x,
+                              gdouble        *y,
+                              gdouble        *w,
+                              gdouble        *h)
 {
   GimpCanvasCornerPrivate *private = GET_PRIVATE (item);
   gdouble                  rx, ry;
@@ -251,18 +249,18 @@ gimp_canvas_corner_transform (GimpCanvasItem   *item,
   gint                     top_and_bottom_handle_x_offset;
   gint                     left_and_right_handle_y_offset;
 
-  gimp_display_shell_transform_xy_f (shell,
-                                     MIN (private->x,
-                                          private->x + private->width),
-                                     MIN (private->y,
-                                          private->y + private->height),
-                                     &rx, &ry);
-  gimp_display_shell_transform_xy_f (shell,
-                                     MAX (private->x,
-                                          private->x + private->width),
-                                     MAX (private->y,
-                                          private->y + private->height),
-                                     &rw, &rh);
+  gimp_canvas_item_transform_xy_f (item,
+                                   MIN (private->x,
+                                        private->x + private->width),
+                                   MIN (private->y,
+                                        private->y + private->height),
+                                   &rx, &ry);
+  gimp_canvas_item_transform_xy_f (item,
+                                   MAX (private->x,
+                                        private->x + private->width),
+                                   MAX (private->y,
+                                        private->y + private->height),
+                                   &rw, &rh);
 
   rw -= rx;
   rh -= ry;
@@ -401,7 +399,7 @@ gimp_canvas_corner_draw (GimpCanvasItem   *item,
   gdouble x, y;
   gdouble w, h;
 
-  gimp_canvas_corner_transform (item, shell, &x, &y, &w, &h);
+  gimp_canvas_corner_transform (item, &x, &y, &w, &h);
 
   cairo_rectangle (cr, x, y, w, h);
 
@@ -416,7 +414,7 @@ gimp_canvas_corner_get_extents (GimpCanvasItem   *item,
   gdouble               x, y;
   gdouble               w, h;
 
-  gimp_canvas_corner_transform (item, shell, &x, &y, &w, &h);
+  gimp_canvas_corner_transform (item, &x, &y, &w, &h);
 
   rectangle.x      = floor (x - 1.5);
   rectangle.y      = floor (y - 1.5);
diff --git a/app/display/gimpcanvascursor.c b/app/display/gimpcanvascursor.c
index 5e2c3e1..43f4fd8 100644
--- a/app/display/gimpcanvascursor.c
+++ b/app/display/gimpcanvascursor.c
@@ -32,7 +32,6 @@
 
 #include "gimpcanvascursor.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 #define GIMP_CURSOR_SIZE 7
diff --git a/app/display/gimpcanvasgrid.c b/app/display/gimpcanvasgrid.c
index 9f3304c..f71c917 100644
--- a/app/display/gimpcanvasgrid.c
+++ b/app/display/gimpcanvasgrid.c
@@ -33,10 +33,8 @@
 #include "core/gimpimage.h"
 
 #include "gimpcanvasgrid.h"
-#include "gimpdisplay.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-style.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
@@ -193,7 +191,7 @@ gimp_canvas_grid_draw (GimpCanvasItem   *item,
                        cairo_t          *cr)
 {
   GimpCanvasGridPrivate *private = GET_PRIVATE (item);
-  GimpImage             *image   = gimp_display_get_image (shell->display);
+  GimpImage             *image   = gimp_canvas_item_get_image (item);
   gdouble                x, y;
   gdouble                dx1, dy1, dx2, dy2;
   gint                   x0, x1, x2, x3;
@@ -239,7 +237,7 @@ gimp_canvas_grid_draw (GimpCanvasItem   *item,
           if (x < 0)
             continue;
 
-          gimp_display_shell_transform_xy (shell, x, 0, &x_real, &y_real);
+          gimp_canvas_item_transform_xy (item, x, 0, &x_real, &y_real);
 
           if (x_real < x1 || x_real >= x2)
             continue;
@@ -249,7 +247,7 @@ gimp_canvas_grid_draw (GimpCanvasItem   *item,
               if (y < 0)
                 continue;
 
-              gimp_display_shell_transform_xy (shell, x, y, &x_real, &y_real);
+              gimp_canvas_item_transform_xy (item, x, y, &x_real, &y_real);
 
               if (y_real >= y1 && y_real < y2)
                 {
@@ -266,7 +264,7 @@ gimp_canvas_grid_draw (GimpCanvasItem   *item,
           if (x < 0)
             continue;
 
-          gimp_display_shell_transform_xy (shell, x, 0, &x_real, &y_real);
+          gimp_canvas_item_transform_xy (item, x, 0, &x_real, &y_real);
 
           if (x_real + CROSSHAIR < x1 || x_real - CROSSHAIR >= x2)
             continue;
@@ -276,7 +274,7 @@ gimp_canvas_grid_draw (GimpCanvasItem   *item,
               if (y < 0)
                 continue;
 
-              gimp_display_shell_transform_xy (shell, x, y, &x_real, &y_real);
+              gimp_canvas_item_transform_xy (item, x, y, &x_real, &y_real);
 
               if (y_real + CROSSHAIR < y1 || y_real - CROSSHAIR >= y2)
                 continue;
@@ -311,15 +309,15 @@ gimp_canvas_grid_draw (GimpCanvasItem   *item,
     case GIMP_GRID_ON_OFF_DASH:
     case GIMP_GRID_DOUBLE_DASH:
     case GIMP_GRID_SOLID:
-      gimp_display_shell_transform_xy (shell, 0, 0, &x0, &y0);
-      gimp_display_shell_transform_xy (shell, width, height, &x3, &y3);
+      gimp_canvas_item_transform_xy (item, 0, 0, &x0, &y0);
+      gimp_canvas_item_transform_xy (item, width, height, &x3, &y3);
 
       for (x = x_offset; x < width; x += private->grid->xspacing)
         {
           if (x < 0)
             continue;
 
-          gimp_display_shell_transform_xy (shell, x, 0, &x_real, &y_real);
+          gimp_canvas_item_transform_xy (item, x, 0, &x_real, &y_real);
 
           if (x_real >= x1 && x_real < x2)
             {
@@ -333,7 +331,7 @@ gimp_canvas_grid_draw (GimpCanvasItem   *item,
           if (y < 0)
             continue;
 
-          gimp_display_shell_transform_xy (shell, 0, y, &x_real, &y_real);
+          gimp_canvas_item_transform_xy (item, 0, y, &x_real, &y_real);
 
           if (y_real >= y1 && y_real < y2)
             {
@@ -351,7 +349,7 @@ static cairo_region_t *
 gimp_canvas_grid_get_extents (GimpCanvasItem   *item,
                               GimpDisplayShell *shell)
 {
-  GimpImage             *image = gimp_display_get_image (shell->display);
+  GimpImage             *image = gimp_canvas_item_get_image (item);
   cairo_rectangle_int_t  rectangle;
   gdouble                x1, y1;
   gdouble                x2, y2;
@@ -363,8 +361,8 @@ gimp_canvas_grid_get_extents (GimpCanvasItem   *item,
   w = gimp_image_get_width  (image);
   h = gimp_image_get_height (image);
 
-  gimp_display_shell_transform_xy_f (shell, 0, 0, &x1, &y1);
-  gimp_display_shell_transform_xy_f (shell, w, h, &x2, &y2);
+  gimp_canvas_item_transform_xy_f (item, 0, 0, &x1, &y1);
+  gimp_canvas_item_transform_xy_f (item, w, h, &x2, &y2);
 
   rectangle.x      = floor (x1);
   rectangle.y      = floor (y1);
diff --git a/app/display/gimpcanvasgroup.c b/app/display/gimpcanvasgroup.c
index efbfd44..7eaf294 100644
--- a/app/display/gimpcanvasgroup.c
+++ b/app/display/gimpcanvasgroup.c
@@ -30,7 +30,6 @@
 
 #include "gimpcanvasgroup.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
diff --git a/app/display/gimpcanvasguide.c b/app/display/gimpcanvasguide.c
index e47bef5..1cbac34 100644
--- a/app/display/gimpcanvasguide.c
+++ b/app/display/gimpcanvasguide.c
@@ -31,7 +31,6 @@
 #include "gimpcanvasguide.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-style.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
@@ -176,17 +175,17 @@ gimp_canvas_guide_get_property (GObject    *object,
 
 static void
 gimp_canvas_guide_transform (GimpCanvasItem   *item,
-                             GimpDisplayShell *shell,
                              gdouble          *x1,
                              gdouble          *y1,
                              gdouble          *x2,
                              gdouble          *y2)
 {
   GimpCanvasGuidePrivate *private = GET_PRIVATE (item);
+  GtkWidget              *canvas  = gimp_canvas_item_get_canvas (item);
   GtkAllocation           allocation;
   gint                    x, y;
 
-  gtk_widget_get_allocation (shell->canvas, &allocation);
+  gtk_widget_get_allocation (canvas, &allocation);
 
   *x1 = 0;
   *y1 = 0;
@@ -196,12 +195,12 @@ gimp_canvas_guide_transform (GimpCanvasItem   *item,
   switch (private->orientation)
     {
     case GIMP_ORIENTATION_HORIZONTAL:
-      gimp_display_shell_transform_xy (shell, 0, private->position, &x, &y);
+      gimp_canvas_item_transform_xy (item, 0, private->position, &x, &y);
       *y1 = *y2 = y + 0.5;
       break;
 
     case GIMP_ORIENTATION_VERTICAL:
-      gimp_display_shell_transform_xy (shell, private->position, 0, &x, &y);
+      gimp_canvas_item_transform_xy (item, private->position, 0, &x, &y);
       *x1 = *x2 = x + 0.5;
       break;
 
@@ -218,7 +217,7 @@ gimp_canvas_guide_draw (GimpCanvasItem   *item,
   gdouble x1, y1;
   gdouble x2, y2;
 
-  gimp_canvas_guide_transform (item, shell, &x1, &y1, &x2, &y2);
+  gimp_canvas_guide_transform (item, &x1, &y1, &x2, &y2);
 
   cairo_move_to (cr, x1, y1);
   cairo_line_to (cr, x2, y2);
@@ -234,7 +233,7 @@ gimp_canvas_guide_get_extents (GimpCanvasItem   *item,
   gdouble               x1, y1;
   gdouble               x2, y2;
 
-  gimp_canvas_guide_transform (item, shell, &x1, &y1, &x2, &y2);
+  gimp_canvas_guide_transform (item, &x1, &y1, &x2, &y2);
 
   rectangle.x      = MIN (x1, x2) - 1.5;
   rectangle.y      = MIN (y1, y2) - 1.5;
diff --git a/app/display/gimpcanvashandle.c b/app/display/gimpcanvashandle.c
index 2d65db1..167b164 100644
--- a/app/display/gimpcanvashandle.c
+++ b/app/display/gimpcanvashandle.c
@@ -33,7 +33,6 @@
 #include "gimpcanvashandle.h"
 #include "gimpcanvasitem-utils.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
@@ -252,16 +251,15 @@ gimp_canvas_handle_get_property (GObject    *object,
 }
 
 static void
-gimp_canvas_handle_transform (GimpCanvasItem   *item,
-                              GimpDisplayShell *shell,
-                              gdouble          *x,
-                              gdouble          *y)
+gimp_canvas_handle_transform (GimpCanvasItem *item,
+                              gdouble        *x,
+                              gdouble        *y)
 {
   GimpCanvasHandlePrivate *private = GET_PRIVATE (item);
 
-  gimp_display_shell_transform_xy_f (shell,
-                                     private->x, private->y,
-                                     x, y);
+  gimp_canvas_item_transform_xy_f (item,
+                                   private->x, private->y,
+                                   x, y);
 
   switch (private->type)
     {
@@ -302,10 +300,11 @@ gimp_canvas_handle_draw (GimpCanvasItem   *item,
   GimpCanvasHandlePrivate *private = GET_PRIVATE (item);
   gdouble                  x, y, tx, ty;
 
-  gimp_canvas_handle_transform (item, shell, &x, &y);
-  gimp_display_shell_transform_xy_f (shell,
-                                     private->x, private->y,
-                                     &tx, &ty);
+  gimp_canvas_handle_transform (item, &x, &y);
+
+  gimp_canvas_item_transform_xy_f (item,
+                                   private->x, private->y,
+                                   &tx, &ty);
 
   switch (private->type)
     {
@@ -388,7 +387,7 @@ gimp_canvas_handle_get_extents (GimpCanvasItem   *item,
   gdouble                  x, y;
   gdouble                  w, h;
 
-  gimp_canvas_handle_transform (item, shell, &x, &y);
+  gimp_canvas_handle_transform (item, &x, &y);
 
   switch (private->type)
     {
@@ -429,14 +428,15 @@ gimp_canvas_handle_hit (GimpCanvasItem   *item,
   GimpCanvasHandlePrivate *private = GET_PRIVATE (item);
   gdouble                  handle_tx, handle_ty;
   gdouble                  mx, my, tx, ty, mmx, mmy;
-  gdouble                  diamond_offset_x = 0.0, diamond_offset_y = 0.0;
+  gdouble                  diamond_offset_x = 0.0;
+  gdouble                  diamond_offset_y = 0.0;
   gdouble                  angle = -private->start_angle;
 
-  gimp_canvas_handle_transform (item, shell, &handle_tx, &handle_ty);
+  gimp_canvas_handle_transform (item, &handle_tx, &handle_ty);
 
-  gimp_display_shell_transform_xy_f (shell,
-                                     x, y,
-                                     &mx, &my);
+  gimp_canvas_item_transform_xy_f (item,
+                                   x, y,
+                                   &mx, &my);
 
   switch (private->type)
     {
@@ -447,9 +447,9 @@ gimp_canvas_handle_hit (GimpCanvasItem   *item,
       diamond_offset_y = private->height / 2.0;
     case GIMP_HANDLE_SQUARE:
     case GIMP_HANDLE_FILLED_SQUARE:
-      gimp_display_shell_transform_xy_f (shell,
-                                         private->x, private->y,
-                                         &tx, &ty);
+      gimp_canvas_item_transform_xy_f (item,
+                                       private->x, private->y,
+                                       &tx, &ty);
       mmx = mx - tx; mmy = my - ty;
       mx = cos (angle) * mmx - sin (angle) * mmy + tx + diamond_offset_x;
       my = sin (angle) * mmx + cos (angle) * mmy + ty + diamond_offset_y;
diff --git a/app/display/gimpcanvasitem.c b/app/display/gimpcanvasitem.c
index 8301e21..1ddc3ba 100644
--- a/app/display/gimpcanvasitem.c
+++ b/app/display/gimpcanvasitem.c
@@ -30,8 +30,10 @@
 #include "core/gimpmarshal.h"
 
 #include "gimpcanvasitem.h"
+#include "gimpdisplay.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-style.h"
+#include "gimpdisplayshell-transform.h"
 
 
 enum
@@ -334,6 +336,30 @@ gimp_canvas_item_real_hit (GimpCanvasItem   *item,
 
 /*  public functions  */
 
+GimpImage *
+gimp_canvas_item_get_image (GimpCanvasItem *item)
+{
+  GimpCanvasItemPrivate *private;
+
+  g_return_val_if_fail (GIMP_IS_CANVAS_ITEM (item), NULL);
+
+  private = GET_PRIVATE (item);
+
+  return gimp_display_get_image (private->shell->display);
+}
+
+GtkWidget *
+gimp_canvas_item_get_canvas (GimpCanvasItem *item)
+{
+  GimpCanvasItemPrivate *private;
+
+  g_return_val_if_fail (GIMP_IS_CANVAS_ITEM (item), NULL);
+
+  private = GET_PRIVATE (item);
+
+  return private->shell->canvas;
+}
+
 void
 gimp_canvas_item_draw (GimpCanvasItem *item,
                        cairo_t        *cr)
@@ -580,6 +606,38 @@ gimp_canvas_item_resume_filling (GimpCanvasItem *item)
   private->suspend_filling--;
 }
 
+void
+gimp_canvas_item_transform_xy (GimpCanvasItem *item,
+                               gdouble         x,
+                               gdouble         y,
+                               gint           *tx,
+                               gint           *ty)
+{
+  GimpCanvasItemPrivate *private;
+
+  g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
+
+  private = GET_PRIVATE (item);
+
+  gimp_display_shell_transform_xy (private->shell, x, y, tx, ty);
+}
+
+void
+gimp_canvas_item_transform_xy_f (GimpCanvasItem *item,
+                                 gdouble         x,
+                                 gdouble         y,
+                                 gdouble        *tx,
+                                 gdouble        *ty)
+{
+  GimpCanvasItemPrivate *private;
+
+  g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
+
+  private = GET_PRIVATE (item);
+
+  gimp_display_shell_transform_xy_f (private->shell, x, y, tx, ty);
+}
+
 
 /*  protected functions  */
 
diff --git a/app/display/gimpcanvasitem.h b/app/display/gimpcanvasitem.h
index 492df6c..4bfd5eb 100644
--- a/app/display/gimpcanvasitem.h
+++ b/app/display/gimpcanvasitem.h
@@ -71,6 +71,9 @@ struct _GimpCanvasItemClass
 
 GType            gimp_canvas_item_get_type         (void) G_GNUC_CONST;
 
+GimpImage      * gimp_canvas_item_get_image        (GimpCanvasItem   *item);
+GtkWidget      * gimp_canvas_item_get_canvas       (GimpCanvasItem   *item);
+
 void             gimp_canvas_item_draw             (GimpCanvasItem   *item,
                                                     cairo_t          *cr);
 cairo_region_t * gimp_canvas_item_get_extents      (GimpCanvasItem   *item);
@@ -99,6 +102,17 @@ void             gimp_canvas_item_resume_stroking  (GimpCanvasItem   *item);
 void             gimp_canvas_item_suspend_filling  (GimpCanvasItem   *item);
 void             gimp_canvas_item_resume_filling   (GimpCanvasItem   *item);
 
+void             gimp_canvas_item_transform_xy     (GimpCanvasItem   *item,
+                                                    gdouble           x,
+                                                    gdouble           y,
+                                                    gint             *tx,
+                                                    gint             *ty);
+void             gimp_canvas_item_transform_xy_f   (GimpCanvasItem   *item,
+                                                    gdouble           x,
+                                                    gdouble           y,
+                                                    gdouble          *tx,
+                                                    gdouble          *ty);
+
 
 /*  protected  */
 
diff --git a/app/display/gimpcanvaslayerboundary.c b/app/display/gimpcanvaslayerboundary.c
index 78918bb..ac218bf 100644
--- a/app/display/gimpcanvaslayerboundary.c
+++ b/app/display/gimpcanvaslayerboundary.c
@@ -36,7 +36,6 @@
 #include "gimpcanvaslayerboundary.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-style.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
diff --git a/app/display/gimpcanvasline.c b/app/display/gimpcanvasline.c
index 1aee4fe..4bf0630 100644
--- a/app/display/gimpcanvasline.c
+++ b/app/display/gimpcanvasline.c
@@ -30,7 +30,6 @@
 
 #include "gimpcanvasline.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
@@ -184,21 +183,20 @@ gimp_canvas_line_get_property (GObject    *object,
 }
 
 static void
-gimp_canvas_line_transform (GimpCanvasItem   *item,
-                            GimpDisplayShell *shell,
-                            gdouble          *x1,
-                            gdouble          *y1,
-                            gdouble          *x2,
-                            gdouble          *y2)
+gimp_canvas_line_transform (GimpCanvasItem *item,
+                            gdouble        *x1,
+                            gdouble        *y1,
+                            gdouble        *x2,
+                            gdouble        *y2)
 {
   GimpCanvasLinePrivate *private = GET_PRIVATE (item);
 
-  gimp_display_shell_transform_xy_f (shell,
-                                     private->x1, private->y1,
-                                     x1, y1);
-  gimp_display_shell_transform_xy_f (shell,
-                                     private->x2, private->y2,
-                                     x2, y2);
+  gimp_canvas_item_transform_xy_f (item,
+                                   private->x1, private->y1,
+                                   x1, y1);
+  gimp_canvas_item_transform_xy_f (item,
+                                   private->x2, private->y2,
+                                   x2, y2);
 
   *x1 = floor (*x1) + 0.5;
   *y1 = floor (*y1) + 0.5;
@@ -214,7 +212,7 @@ gimp_canvas_line_draw (GimpCanvasItem   *item,
   gdouble x1, y1;
   gdouble x2, y2;
 
-  gimp_canvas_line_transform (item, shell, &x1, &y1, &x2, &y2);
+  gimp_canvas_line_transform (item, &x1, &y1, &x2, &y2);
 
   cairo_move_to (cr, x1, y1);
   cairo_line_to (cr, x2, y2);
@@ -230,7 +228,7 @@ gimp_canvas_line_get_extents (GimpCanvasItem   *item,
   gdouble               x1, y1;
   gdouble               x2, y2;
 
-  gimp_canvas_line_transform (item, shell, &x1, &y1, &x2, &y2);
+  gimp_canvas_line_transform (item, &x1, &y1, &x2, &y2);
 
   if (x1 == x2 || y1 == y2)
     {
diff --git a/app/display/gimpcanvaspath.c b/app/display/gimpcanvaspath.c
index 224b903..33e09bc 100644
--- a/app/display/gimpcanvaspath.c
+++ b/app/display/gimpcanvaspath.c
@@ -34,7 +34,6 @@
 #include "gimpcanvaspath.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-style.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
diff --git a/app/display/gimpcanvaspen.c b/app/display/gimpcanvaspen.c
index 8ce318e..5fd93b9 100644
--- a/app/display/gimpcanvaspen.c
+++ b/app/display/gimpcanvaspen.c
@@ -35,7 +35,6 @@
 #include "gimpcanvaspen.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-style.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
diff --git a/app/display/gimpcanvaspolygon.c b/app/display/gimpcanvaspolygon.c
index 022150d..65c218b 100644
--- a/app/display/gimpcanvaspolygon.c
+++ b/app/display/gimpcanvaspolygon.c
@@ -32,7 +32,6 @@
 
 #include "gimpcanvaspolygon.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
@@ -198,20 +197,19 @@ gimp_canvas_polygon_get_property (GObject    *object,
 }
 
 static void
-gimp_canvas_polygon_transform (GimpCanvasItem   *item,
-                               GimpDisplayShell *shell,
-                               GimpVector2      *points)
+gimp_canvas_polygon_transform (GimpCanvasItem *item,
+                               GimpVector2    *points)
 {
   GimpCanvasPolygonPrivate *private = GET_PRIVATE (item);
   gint                      i;
 
   for (i = 0; i < private->n_points; i++)
     {
-      gimp_display_shell_transform_xy_f (shell,
-                                         private->points[i].x,
-                                         private->points[i].y,
-                                         &points[i].x,
-                                         &points[i].y);
+      gimp_canvas_item_transform_xy_f (item,
+                                       private->points[i].x,
+                                       private->points[i].y,
+                                       &points[i].x,
+                                       &points[i].y);
 
       points[i].x = floor (points[i].x) + 0.5;
       points[i].y = floor (points[i].y) + 0.5;
@@ -229,7 +227,7 @@ gimp_canvas_polygon_draw (GimpCanvasItem   *item,
 
   points = g_new0 (GimpVector2, private->n_points);
 
-  gimp_canvas_polygon_transform (item, shell, points);
+  gimp_canvas_polygon_transform (item, points);
 
   cairo_move_to (cr, points[0].x, points[0].y);
 
@@ -258,7 +256,7 @@ gimp_canvas_polygon_get_extents (GimpCanvasItem   *item,
 
   points = g_new0 (GimpVector2, private->n_points);
 
-  gimp_canvas_polygon_transform (item, shell, points);
+  gimp_canvas_polygon_transform (item, points);
 
   x1 = floor (points[0].x - 1.5);
   y1 = floor (points[0].y - 1.5);
diff --git a/app/display/gimpcanvasprogress.c b/app/display/gimpcanvasprogress.c
index 7315852..272a174 100644
--- a/app/display/gimpcanvasprogress.c
+++ b/app/display/gimpcanvasprogress.c
@@ -34,7 +34,6 @@
 #include "gimpcanvasitem-utils.h"
 #include "gimpcanvasprogress.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 #include "gimpdisplayshell-style.h"
 
 
@@ -233,17 +232,17 @@ gimp_canvas_progress_get_property (GObject    *object,
 }
 
 static PangoLayout *
-gimp_canvas_progress_transform (GimpCanvasItem   *item,
-                                GimpDisplayShell *shell,
-                                gdouble          *x,
-                                gdouble          *y,
-                                gint             *width,
-                                gint             *height)
+gimp_canvas_progress_transform (GimpCanvasItem *item,
+                                gdouble        *x,
+                                gdouble        *y,
+                                gint           *width,
+                                gint           *height)
 {
   GimpCanvasProgressPrivate *private = GET_PRIVATE (item);
+  GtkWidget                 *canvas  = gimp_canvas_item_get_canvas (item);
   PangoLayout               *layout;
 
-  layout = gimp_canvas_get_layout (GIMP_CANVAS (shell->canvas), "%s",
+  layout = gimp_canvas_get_layout (GIMP_CANVAS (canvas), "%s",
                                    private->text);
 
   pango_layout_get_pixel_size (layout, width, height);
@@ -251,9 +250,9 @@ gimp_canvas_progress_transform (GimpCanvasItem   *item,
   *width  += 2 * BORDER;
   *height += 3 * BORDER + 2 * RADIUS;
 
-  gimp_display_shell_transform_xy_f (shell,
-                                     private->x, private->y,
-                                     x, y);
+  gimp_canvas_item_transform_xy_f (item,
+                                   private->x, private->y,
+                                   x, y);
 
   gimp_canvas_item_shift_to_north_west (private->anchor,
                                         *x, *y,
@@ -273,10 +272,11 @@ gimp_canvas_progress_draw (GimpCanvasItem   *item,
                            cairo_t          *cr)
 {
   GimpCanvasProgressPrivate *private = GET_PRIVATE (item);
+  GtkWidget                 *canvas  = gimp_canvas_item_get_canvas (item);
   gdouble                    x, y;
   gint                       width, height;
 
-  gimp_canvas_progress_transform (item, shell, &x, &y, &width, &height);
+  gimp_canvas_progress_transform (item, &x, &y, &width, &height);
 
   cairo_move_to (cr, x, y);
   cairo_line_to (cr, x + width, y);
@@ -291,7 +291,7 @@ gimp_canvas_progress_draw (GimpCanvasItem   *item,
   cairo_move_to (cr, x + BORDER, y + BORDER);
   cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
   pango_cairo_show_layout (cr,
-                           gimp_canvas_get_layout (GIMP_CANVAS (shell->canvas),
+                           gimp_canvas_get_layout (GIMP_CANVAS (canvas),
                                                    "%s", private->text));
 
   gimp_display_shell_set_tool_bg_style (shell, cr);
@@ -314,7 +314,7 @@ gimp_canvas_progress_get_extents (GimpCanvasItem   *item,
   gdouble               x, y;
   gint                  width, height;
 
-  gimp_canvas_progress_transform (item, shell, &x, &y, &width, &height);
+  gimp_canvas_progress_transform (item, &x, &y, &width, &height);
 
   /*  add 1px on each side because fill()'s default impl does the same  */
   rectangle.x      = (gint) x - 1;
diff --git a/app/display/gimpcanvasproxygroup.c b/app/display/gimpcanvasproxygroup.c
index f06f134..78f4026 100644
--- a/app/display/gimpcanvasproxygroup.c
+++ b/app/display/gimpcanvasproxygroup.c
@@ -32,7 +32,6 @@
 #include "gimpcanvasproxygroup.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-style.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
diff --git a/app/display/gimpcanvasrectangle.c b/app/display/gimpcanvasrectangle.c
index ce0a4b1..5000e6d 100644
--- a/app/display/gimpcanvasrectangle.c
+++ b/app/display/gimpcanvasrectangle.c
@@ -30,7 +30,6 @@
 
 #include "gimpcanvasrectangle.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
@@ -198,29 +197,28 @@ gimp_canvas_rectangle_get_property (GObject    *object,
 }
 
 static void
-gimp_canvas_rectangle_transform (GimpCanvasItem   *item,
-                                 GimpDisplayShell *shell,
-                                 gdouble          *x,
-                                 gdouble          *y,
-                                 gdouble          *w,
-                                 gdouble          *h)
+gimp_canvas_rectangle_transform (GimpCanvasItem *item,
+                                 gdouble        *x,
+                                 gdouble        *y,
+                                 gdouble        *w,
+                                 gdouble        *h)
 {
   GimpCanvasRectanglePrivate *private = GET_PRIVATE (item);
   gdouble                     x1, y1;
   gdouble                     x2, y2;
 
-  gimp_display_shell_transform_xy_f (shell,
-                                     MIN (private->x,
-                                          private->x + private->width),
-                                     MIN (private->y,
-                                          private->y + private->height),
-                                     &x1, &y1);
-  gimp_display_shell_transform_xy_f (shell,
-                                     MAX (private->x,
-                                          private->x + private->width),
-                                     MAX (private->y,
-                                          private->y + private->height),
-                                     &x2, &y2);
+  gimp_canvas_item_transform_xy_f (item,
+                                   MIN (private->x,
+                                        private->x + private->width),
+                                   MIN (private->y,
+                                        private->y + private->height),
+                                   &x1, &y1);
+  gimp_canvas_item_transform_xy_f (item,
+                                   MAX (private->x,
+                                        private->x + private->width),
+                                   MAX (private->y,
+                                        private->y + private->height),
+                                   &x2, &y2);
 
   x1 = floor (x1);
   y1 = floor (y1);
@@ -255,7 +253,7 @@ gimp_canvas_rectangle_draw (GimpCanvasItem   *item,
   gdouble                     x, y;
   gdouble                     w, h;
 
-  gimp_canvas_rectangle_transform (item, shell, &x, &y, &w, &h);
+  gimp_canvas_rectangle_transform (item, &x, &y, &w, &h);
 
   cairo_rectangle (cr, x, y, w, h);
 
@@ -274,7 +272,7 @@ gimp_canvas_rectangle_get_extents (GimpCanvasItem   *item,
   gdouble                     x, y;
   gdouble                     w, h;
 
-  gimp_canvas_rectangle_transform (item, shell, &x, &y, &w, &h);
+  gimp_canvas_rectangle_transform (item, &x, &y, &w, &h);
 
   if (private->filled)
     {
diff --git a/app/display/gimpcanvasrectangleguides.c b/app/display/gimpcanvasrectangleguides.c
index 364e732..cca5ac6 100644
--- a/app/display/gimpcanvasrectangleguides.c
+++ b/app/display/gimpcanvasrectangleguides.c
@@ -30,7 +30,6 @@
 
 #include "gimpcanvasrectangleguides.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 #define SQRT5 2.236067977
@@ -215,27 +214,26 @@ gimp_canvas_rectangle_guides_get_property (GObject    *object,
 }
 
 static void
-gimp_canvas_rectangle_guides_transform (GimpCanvasItem   *item,
-                                        GimpDisplayShell *shell,
-                                        gdouble          *x1,
-                                        gdouble          *y1,
-                                        gdouble          *x2,
-                                        gdouble          *y2)
+gimp_canvas_rectangle_guides_transform (GimpCanvasItem *item,
+                                        gdouble        *x1,
+                                        gdouble        *y1,
+                                        gdouble        *x2,
+                                        gdouble        *y2)
 {
   GimpCanvasRectangleGuidesPrivate *private = GET_PRIVATE (item);
 
-  gimp_display_shell_transform_xy_f (shell,
-                                     MIN (private->x,
-                                          private->x + private->width),
-                                     MIN (private->y,
-                                          private->y + private->height),
-                                     x1, y1);
-  gimp_display_shell_transform_xy_f (shell,
-                                     MAX (private->x,
-                                          private->x + private->width),
-                                     MAX (private->y,
-                                          private->y + private->height),
-                                     x2, y2);
+  gimp_canvas_item_transform_xy_f (item,
+                                   MIN (private->x,
+                                        private->x + private->width),
+                                   MIN (private->y,
+                                        private->y + private->height),
+                                   x1, y1);
+  gimp_canvas_item_transform_xy_f (item,
+                                   MAX (private->x,
+                                        private->x + private->width),
+                                   MAX (private->y,
+                                        private->y + private->height),
+                                   x2, y2);
 
   *x1 = floor (*x1) + 0.5;
   *y1 = floor (*y1) + 0.5;
@@ -280,7 +278,7 @@ gimp_canvas_rectangle_guides_draw (GimpCanvasItem   *item,
   gdouble                           x2, y2;
   gint                              i;
 
-  gimp_canvas_rectangle_guides_transform (item, shell, &x1, &y1, &x2, &y2);
+  gimp_canvas_rectangle_guides_transform (item, &x1, &y1, &x2, &y2);
 
   switch (private->type)
     {
@@ -371,7 +369,7 @@ gimp_canvas_rectangle_guides_get_extents (GimpCanvasItem   *item,
       gdouble               x1, y1;
       gdouble               x2, y2;
 
-      gimp_canvas_rectangle_guides_transform (item, shell, &x1, &y1, &x2, &y2);
+      gimp_canvas_rectangle_guides_transform (item, &x1, &y1, &x2, &y2);
 
       rectangle.x      = floor (x1 - 1.5);
       rectangle.y      = floor (y1 - 1.5);
diff --git a/app/display/gimpcanvassamplepoint.c b/app/display/gimpcanvassamplepoint.c
index 15de64b..8cd421c 100644
--- a/app/display/gimpcanvassamplepoint.c
+++ b/app/display/gimpcanvassamplepoint.c
@@ -32,7 +32,6 @@
 #include "gimpcanvassamplepoint.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-style.h"
-#include "gimpdisplayshell-transform.h"
 
 
 #define GIMP_SAMPLE_POINT_DRAW_SIZE 10
@@ -197,17 +196,16 @@ gimp_canvas_sample_point_get_property (GObject    *object,
 }
 
 static void
-gimp_canvas_sample_point_transform (GimpCanvasItem   *item,
-                                    GimpDisplayShell *shell,
-                                    gdouble          *x,
-                                    gdouble          *y)
+gimp_canvas_sample_point_transform (GimpCanvasItem *item,
+                                    gdouble        *x,
+                                    gdouble        *y)
 {
   GimpCanvasSamplePointPrivate *private = GET_PRIVATE (item);
 
-  gimp_display_shell_transform_xy_f (shell,
-                                     private->x + 0.5,
-                                     private->y + 0.5,
-                                     x, y);
+  gimp_canvas_item_transform_xy_f (item,
+                                   private->x + 0.5,
+                                   private->y + 0.5,
+                                   x, y);
 
   *x = floor (*x) + 0.5;
   *y = floor (*y) + 0.5;
@@ -225,7 +223,7 @@ gimp_canvas_sample_point_draw (GimpCanvasItem   *item,
   gdouble                       x, y;
   gint                          x1, x2, y1, y2;
 
-  gimp_canvas_sample_point_transform (item, shell, &x, &y);
+  gimp_canvas_sample_point_transform (item, &x, &y);
 
   x1 = x - GIMP_SAMPLE_POINT_DRAW_SIZE;
   x2 = x + GIMP_SAMPLE_POINT_DRAW_SIZE;
@@ -265,7 +263,7 @@ gimp_canvas_sample_point_get_extents (GimpCanvasItem   *item,
   gdouble               x, y;
   gint                  x1, x2, y1, y2;
 
-  gimp_canvas_sample_point_transform (item, shell, &x, &y);
+  gimp_canvas_sample_point_transform (item, &x, &y);
 
   x1 = floor (x - GIMP_SAMPLE_POINT_DRAW_SIZE);
   x2 = ceil  (x + GIMP_SAMPLE_POINT_DRAW_SIZE);
diff --git a/app/display/gimpcanvastextcursor.c b/app/display/gimpcanvastextcursor.c
index a5b1ca0..8e02981 100644
--- a/app/display/gimpcanvastextcursor.c
+++ b/app/display/gimpcanvastextcursor.c
@@ -30,7 +30,6 @@
 
 #include "gimpcanvastextcursor.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 enum
@@ -198,27 +197,26 @@ gimp_canvas_text_cursor_get_property (GObject    *object,
 }
 
 static void
-gimp_canvas_text_cursor_transform (GimpCanvasItem   *item,
-                                   GimpDisplayShell *shell,
-                                   gdouble          *x,
-                                   gdouble          *y,
-                                   gdouble          *w,
-                                   gdouble          *h)
+gimp_canvas_text_cursor_transform (GimpCanvasItem *item,
+                                   gdouble        *x,
+                                   gdouble        *y,
+                                   gdouble        *w,
+                                   gdouble        *h)
 {
   GimpCanvasTextCursorPrivate *private = GET_PRIVATE (item);
 
-  gimp_display_shell_transform_xy_f (shell,
-                                     MIN (private->x,
-                                          private->x + private->width),
-                                     MIN (private->y,
-                                          private->y + private->height),
-                                     x, y);
-  gimp_display_shell_transform_xy_f (shell,
-                                     MAX (private->x,
-                                          private->x + private->width),
-                                     MAX (private->y,
-                                          private->y + private->height),
-                                     w, h);
+  gimp_canvas_item_transform_xy_f (item,
+                                   MIN (private->x,
+                                        private->x + private->width),
+                                   MIN (private->y,
+                                        private->y + private->height),
+                                   x, y);
+  gimp_canvas_item_transform_xy_f (item,
+                                   MAX (private->x,
+                                        private->x + private->width),
+                                   MAX (private->y,
+                                        private->y + private->height),
+                                   w, h);
 
   *w -= *x;
   *h -= *y;
@@ -247,7 +245,7 @@ gimp_canvas_text_cursor_draw (GimpCanvasItem   *item,
   gdouble                      x, y;
   gdouble                      w, h;
 
-  gimp_canvas_text_cursor_transform (item, shell, &x, &y, &w, &h);
+  gimp_canvas_text_cursor_transform (item, &x, &y, &w, &h);
 
   if (private->overwrite)
     {
@@ -277,7 +275,7 @@ gimp_canvas_text_cursor_get_extents (GimpCanvasItem   *item,
   gdouble                      x, y;
   gdouble                      w, h;
 
-  gimp_canvas_text_cursor_transform (item, shell, &x, &y, &w, &h);
+  gimp_canvas_text_cursor_transform (item, &x, &y, &w, &h);
 
   if (private->overwrite)
     {
diff --git a/app/display/gimpcanvastransformguides.c b/app/display/gimpcanvastransformguides.c
index 60b4862..f2389e0 100644
--- a/app/display/gimpcanvastransformguides.c
+++ b/app/display/gimpcanvastransformguides.c
@@ -29,11 +29,10 @@
 #include "display-types.h"
 
 #include "core/gimp-transform-utils.h"
+#include "core/gimp-utils.h"
 
 #include "gimpcanvastransformguides.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
-#include "core/gimp-utils.h"
 
 
 #define SQRT5 2.236067977
@@ -257,16 +256,15 @@ gimp_canvas_transform_guides_get_property (GObject    *object,
 }
 
 static gboolean
-gimp_canvas_transform_guides_transform (GimpCanvasItem   *item,
-                                        GimpDisplayShell *shell,
-                                        gdouble          *tx1,
-                                        gdouble          *ty1,
-                                        gdouble          *tx2,
-                                        gdouble          *ty2,
-                                        gdouble          *tx3,
-                                        gdouble          *ty3,
-                                        gdouble          *tx4,
-                                        gdouble          *ty4)
+gimp_canvas_transform_guides_transform (GimpCanvasItem *item,
+                                        gdouble        *tx1,
+                                        gdouble        *ty1,
+                                        gdouble        *tx2,
+                                        gdouble        *ty2,
+                                        gdouble        *tx3,
+                                        gdouble        *ty3,
+                                        gdouble        *tx4,
+                                        gdouble        *ty4)
 {
   GimpCanvasTransformGuidesPrivate *private = GET_PRIVATE (item);
 
@@ -290,19 +288,19 @@ gimp_canvas_transform_guides_transform (GimpCanvasItem   *item,
 }
 
 static void
-draw_line (cairo_t          *cr,
-           GimpDisplayShell *shell,
-           GimpMatrix3      *transform,
-           gdouble           x1,
-           gdouble           y1,
-           gdouble           x2,
-           gdouble           y2)
+draw_line (cairo_t        *cr,
+           GimpCanvasItem *item,
+           GimpMatrix3    *transform,
+           gdouble         x1,
+           gdouble         y1,
+           gdouble         x2,
+           gdouble         y2)
 {
   gimp_matrix3_transform_point (transform, x1, y1, &x1, &y1);
   gimp_matrix3_transform_point (transform, x2, y2, &x2, &y2);
 
-  gimp_display_shell_transform_xy_f (shell, x1, y1, &x1, &y1);
-  gimp_display_shell_transform_xy_f (shell, x2, y2, &x2, &y2);
+  gimp_canvas_item_transform_xy_f (item, x1, y1, &x1, &y1);
+  gimp_canvas_item_transform_xy_f (item, x2, y2, &x2, &y2);
 
   x1 = floor (x1) + 0.5;
   y1 = floor (y1) + 0.5;
@@ -314,25 +312,25 @@ draw_line (cairo_t          *cr,
 }
 
 static void
-draw_hline (cairo_t          *cr,
-            GimpDisplayShell *shell,
-            GimpMatrix3      *transform,
-            gdouble           x1,
-            gdouble           x2,
-            gdouble           y)
+draw_hline (cairo_t        *cr,
+            GimpCanvasItem *item,
+            GimpMatrix3    *transform,
+            gdouble         x1,
+            gdouble         x2,
+            gdouble         y)
 {
-  draw_line (cr, shell, transform, x1, y, x2, y);
+  draw_line (cr, item, transform, x1, y, x2, y);
 }
 
 static void
-draw_vline (cairo_t          *cr,
-            GimpDisplayShell *shell,
-            GimpMatrix3      *transform,
-            gdouble           y1,
-            gdouble           y2,
-            gdouble           x)
+draw_vline (cairo_t        *cr,
+            GimpCanvasItem *item,
+            GimpMatrix3    *transform,
+            gdouble         y1,
+            gdouble         y2,
+            gdouble         x)
 {
-  draw_line (cr, shell, transform, x, y1, x, y2);
+  draw_line (cr, item, transform, x, y1, x, y2);
 }
 
 static void
@@ -348,16 +346,16 @@ gimp_canvas_transform_guides_draw (GimpCanvasItem   *item,
   gboolean                          convex;
   gint                              i;
 
-  convex = gimp_canvas_transform_guides_transform (item, shell,
+  convex = gimp_canvas_transform_guides_transform (item,
                                                    &x1, &y1,
                                                    &x2, &y2,
                                                    &x3, &y3,
                                                    &x4, &y4);
 
-  gimp_display_shell_transform_xy_f (shell, x1, y1, &x1, &y1);
-  gimp_display_shell_transform_xy_f (shell, x2, y2, &x2, &y2);
-  gimp_display_shell_transform_xy_f (shell, x3, y3, &x3, &y3);
-  gimp_display_shell_transform_xy_f (shell, x4, y4, &x4, &y4);
+  gimp_canvas_item_transform_xy_f (item, x1, y1, &x1, &y1);
+  gimp_canvas_item_transform_xy_f (item, x2, y2, &x2, &y2);
+  gimp_canvas_item_transform_xy_f (item, x3, y3, &x3, &y3);
+  gimp_canvas_item_transform_xy_f (item, x4, y4, &x4, &y4);
 
   x1 = floor (x1) + 0.5;
   y1 = floor (y1) + 0.5;
@@ -386,48 +384,48 @@ gimp_canvas_transform_guides_draw (GimpCanvasItem   *item,
       break;
 
     case GIMP_GUIDES_CENTER_LINES:
-      draw_hline (cr, shell, &private->transform,
+      draw_hline (cr, item, &private->transform,
                   private->x1, private->x2, (private->y1 + private->y2) / 2);
-      draw_vline (cr, shell, &private->transform,
+      draw_vline (cr, item, &private->transform,
                   private->y1, private->y2, (private->x1 + private->x2) / 2);
       break;
 
     case GIMP_GUIDES_THIRDS:
-      draw_hline (cr, shell, &private->transform,
+      draw_hline (cr, item, &private->transform,
                   private->x1, private->x2, (2 * private->y1 + private->y2) / 3);
-      draw_hline (cr, shell, &private->transform,
+      draw_hline (cr, item, &private->transform,
                   private->x1, private->x2, (private->y1 + 2 * private->y2) / 3);
 
-      draw_vline (cr, shell, &private->transform,
+      draw_vline (cr, item, &private->transform,
                   private->y1, private->y2, (2 * private->x1 + private->x2) / 3);
-      draw_vline (cr, shell, &private->transform,
+      draw_vline (cr, item, &private->transform,
                   private->y1, private->y2, (private->x1 + 2 * private->x2) / 3);
       break;
 
     case GIMP_GUIDES_FIFTHS:
       for (i = 0; i < 5; i++)
         {
-          draw_hline (cr, shell, &private->transform,
+          draw_hline (cr, item, &private->transform,
                       private->x1, private->x2,
                       private->y1 + i * (private->y2 - private->y1) / 5);
-          draw_vline (cr, shell, &private->transform,
+          draw_vline (cr, item, &private->transform,
                       private->y1, private->y2,
                       private->x1 + i * (private->x2 - private->x1) / 5);
         }
       break;
 
     case GIMP_GUIDES_GOLDEN:
-      draw_hline (cr, shell, &private->transform,
+      draw_hline (cr, item, &private->transform,
                   private->x1, private->x2,
                   (2 * private->y1 + (1 + SQRT5) * private->y2) / (3 + SQRT5));
-      draw_hline (cr, shell, &private->transform,
+      draw_hline (cr, item, &private->transform,
                   private->x1, private->x2,
                   ((1 + SQRT5) * private->y1 + 2 * private->y2) / (3 + SQRT5));
 
-      draw_vline (cr, shell, &private->transform,
+      draw_vline (cr, item, &private->transform,
                   private->y1, private->y2,
                   (2 * private->x1 + (1 + SQRT5) * private->x2) / (3 + SQRT5));
-      draw_vline (cr, shell, &private->transform,
+      draw_vline (cr, item, &private->transform,
                   private->y1, private->y2,
                   ((1 + SQRT5) * private->x1 + 2 * private->x2) / (3 + SQRT5));
       break;
@@ -444,25 +442,25 @@ gimp_canvas_transform_guides_draw (GimpCanvasItem   *item,
                                          private->y2 - private->y1);
 
         /* diagonal from the top-left edge */
-        draw_line (cr, shell, &private->transform,
+        draw_line (cr, item, &private->transform,
                    private->x1, private->y1,
                    private->x1 + square_side,
                    private->y1 + square_side);
 
         /* diagonal from the top-right edge */
-        draw_line (cr, shell, &private->transform,
+        draw_line (cr, item, &private->transform,
                    private->x2, private->y1,
                    private->x2 - square_side,
                    private->y1 + square_side);
 
         /* diagonal from the bottom-left edge */
-        draw_line (cr, shell, &private->transform,
+        draw_line (cr, item, &private->transform,
                    private->x1, private->y2,
                    private->x1 + square_side,
                    private->y2 - square_side);
 
         /* diagonal from the bottom-right edge */
-        draw_line (cr, shell, &private->transform,
+        draw_line (cr, item, &private->transform,
                    private->x2, private->y2,
                    private->x2 - square_side,
                    private->y2 - square_side);
@@ -504,7 +502,7 @@ gimp_canvas_transform_guides_draw (GimpCanvasItem   *item,
             gdouble x = private->x1 + (((gdouble) i) / (ngx + 1) *
                                        (private->x2 - private->x1));
 
-            draw_line (cr, shell, &private->transform,
+            draw_line (cr, item, &private->transform,
                        x, private->y1,
                        x, private->y2);
           }
@@ -514,7 +512,7 @@ gimp_canvas_transform_guides_draw (GimpCanvasItem   *item,
             gdouble y = private->y1 + (((gdouble) i) / (ngy + 1) *
                                        (private->y2 - private->y1));
 
-            draw_line (cr, shell, &private->transform,
+            draw_line (cr, item, &private->transform,
                        private->x1, y,
                        private->x2, y);
           }
@@ -534,16 +532,16 @@ gimp_canvas_transform_guides_get_extents (GimpCanvasItem   *item,
   gdouble               x4, y4;
   cairo_rectangle_int_t extents;
 
-  gimp_canvas_transform_guides_transform (item, shell,
+  gimp_canvas_transform_guides_transform (item,
                                           &x1, &y1,
                                           &x2, &y2,
                                           &x3, &y3,
                                           &x4, &y4);
 
-  gimp_display_shell_transform_xy_f (shell, x1, y1, &x1, &y1);
-  gimp_display_shell_transform_xy_f (shell, x2, y2, &x2, &y2);
-  gimp_display_shell_transform_xy_f (shell, x3, y3, &x3, &y3);
-  gimp_display_shell_transform_xy_f (shell, x4, y4, &x4, &y4);
+  gimp_canvas_item_transform_xy_f (item, x1, y1, &x1, &y1);
+  gimp_canvas_item_transform_xy_f (item, x2, y2, &x2, &y2);
+  gimp_canvas_item_transform_xy_f (item, x3, y3, &x3, &y3);
+  gimp_canvas_item_transform_xy_f (item, x4, y4, &x4, &y4);
 
   extents.x      = (gint) floor (MIN4 (x1, x2, x3, x4) - 1.5);
   extents.y      = (gint) floor (MIN4 (y1, y2, y3, y4) - 1.5);
diff --git a/app/display/gimpcanvastransformpreview.c b/app/display/gimpcanvastransformpreview.c
index c53807a..517c09c 100644
--- a/app/display/gimpcanvastransformpreview.c
+++ b/app/display/gimpcanvastransformpreview.c
@@ -38,7 +38,6 @@
 #include "gimpcanvas.h"
 #include "gimpcanvastransformpreview.h"
 #include "gimpdisplayshell.h"
-#include "gimpdisplayshell-transform.h"
 
 
 #define INT_MULT(a,b,t)    ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
@@ -344,7 +343,6 @@ gimp_canvas_transform_preview_get_property (GObject    *object,
 
 static gboolean
 gimp_canvas_transform_preview_transform (GimpCanvasItem        *item,
-                                         GimpDisplayShell      *shell,
                                          cairo_rectangle_int_t *extents)
 {
   GimpCanvasTransformPreviewPrivate *private = GET_PRIVATE (item);
@@ -379,18 +377,18 @@ gimp_canvas_transform_preview_transform (GimpCanvasItem        *item,
       gdouble dx3, dy3;
       gdouble dx4, dy4;
 
-      gimp_display_shell_transform_xy_f (shell,
-                                         tx1, ty1,
-                                         &dx1, &dy1);
-      gimp_display_shell_transform_xy_f (shell,
-                                         tx2, ty2,
-                                         &dx2, &dy2);
-      gimp_display_shell_transform_xy_f (shell,
-                                         tx3, ty3,
-                                         &dx3, &dy3);
-      gimp_display_shell_transform_xy_f (shell,
-                                         tx4, ty4,
-                                         &dx4, &dy4);
+      gimp_canvas_item_transform_xy_f (item,
+                                       tx1, ty1,
+                                       &dx1, &dy1);
+      gimp_canvas_item_transform_xy_f (item,
+                                       tx2, ty2,
+                                       &dx2, &dy2);
+      gimp_canvas_item_transform_xy_f (item,
+                                       tx3, ty3,
+                                       &dx3, &dy3);
+      gimp_canvas_item_transform_xy_f (item,
+                                       tx4, ty4,
+                                       &dx4, &dy4);
 
       extents->x      = (gint) floor (MIN4 (dx1, dx2, dx3, dx4));
       extents->y      = (gint) floor (MIN4 (dy1, dy2, dy3, dy4));
@@ -431,7 +429,7 @@ gimp_canvas_transform_preview_draw (GimpCanvasItem   *item,
   opacity = private->opacity * 255.999;
 
   /* only draw convex polygons */
-  if (! gimp_canvas_transform_preview_transform (item, shell, NULL))
+  if (! gimp_canvas_transform_preview_transform (item, NULL))
     return;
 
   mask      = NULL;
@@ -485,9 +483,9 @@ gimp_canvas_transform_preview_draw (GimpCanvasItem   *item,
                                   tx2, ty2,                     \
                                   &tx1, &ty1);                  \
                                                                 \
-    gimp_display_shell_transform_xy_f (shell,                   \
-                                       tx1, ty1,                \
-                                       &tx2, &ty2);             \
+    gimp_canvas_item_transform_xy_f (item,                      \
+                                     tx1, ty1,                  \
+                                     &tx2, &ty2);               \
     x[sub][index] = (gint) tx2;                                 \
     y[sub][index] = (gint) ty2;                                 \
                                                                 \
@@ -568,7 +566,7 @@ gimp_canvas_transform_preview_get_extents (GimpCanvasItem   *item,
 {
   cairo_rectangle_int_t rectangle;
 
-  if (gimp_canvas_transform_preview_transform (item, shell, &rectangle))
+  if (gimp_canvas_transform_preview_transform (item, &rectangle))
     return cairo_region_create_rectangle (&rectangle);
 
   return NULL;


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