gimp r25245 - in trunk: . app/display



Author: mitch
Date: Wed Mar 26 16:33:04 2008
New Revision: 25245
URL: http://svn.gnome.org/viewvc/gimp?rev=25245&view=rev

Log:
2008-03-26  Michael Natterer  <mitch gimp org>

	* app/display/gimpcanvas.c (gimp_canvas_draw_drop_zone): fix scaling.



Modified:
   trunk/ChangeLog
   trunk/app/display/gimpcanvas.c

Modified: trunk/app/display/gimpcanvas.c
==============================================================================
--- trunk/app/display/gimpcanvas.c	(original)
+++ trunk/app/display/gimpcanvas.c	Wed Mar 26 16:33:04 2008
@@ -828,22 +828,29 @@
 gimp_canvas_draw_drop_zone (GimpCanvas *canvas,
                             cairo_t    *cr)
 {
+  static gint wilber_width  = 0;
+  static gint wilber_height = 0;
+
   GtkWidget *widget = GTK_WIDGET (canvas);
-  gdouble    x1, y1;
-  gdouble    x2, y2;
-  gint       wilber_width;
-  gint       wilber_height;
   gint       width;
   gint       height;
   gint       side;
-  gint       factor;
+  gdouble    factor;
 
   /* first get the extents */
-  gimp_cairo_wilber (cr);
-  cairo_fill_extents (cr, &x1, &y1, &x2, &y2);
+  if (! wilber_width)
+    {
+      cairo_t *foo = gdk_cairo_create (widget->window);
+      gdouble  x1, y1;
+      gdouble  x2, y2;
+
+      gimp_cairo_wilber (foo);
+      cairo_fill_extents (foo, &x1, &y1, &x2, &y2);
+      cairo_destroy (foo);
 
-  wilber_width  = (x2 - x1) / 2;
-  wilber_height = (y2 - y1) / 2;
+      wilber_width  = (x2 - x1) / 2;
+      wilber_height = (y2 - y1) / 2;
+    }
 
   side = MIN (MIN (widget->allocation.width,
                    widget->allocation.height),
@@ -856,12 +863,13 @@
   factor = MIN ((gdouble) width  / wilber_width,
                 (gdouble) height / wilber_height);
 
+  cairo_scale (cr, factor, factor);
+
   /*  magic factors depend on the image used, everything else is generic
    */
   cairo_translate (cr,
-                   wilber_width * 0.6,
-                   widget->allocation.height / factor - wilber_height * 1.1);
-  cairo_scale (cr, factor, factor);
+                   - wilber_width * 1.5,
+                   widget->allocation.height / factor - wilber_height * 1.7);
 
   gimp_cairo_wilber (cr);
 



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