gimp r24839 - in trunk: . app/widgets



Author: mitch
Date: Sat Feb  9 11:14:40 2008
New Revision: 24839
URL: http://svn.gnome.org/viewvc/gimp?rev=24839&view=rev

Log:
2008-02-09  Michael Natterer  <mitch gimp org>

	* app/widgets/gimpcurveview.[ch]: port internal cursor stuff to
	gdouble, fix off-by-one in curve drawing, fix drawing artefact in
	handle drawing by starting drawing on the handle's outline and not
	its center.



Modified:
   trunk/ChangeLog
   trunk/app/widgets/gimpcurveview.c
   trunk/app/widgets/gimpcurveview.h

Modified: trunk/app/widgets/gimpcurveview.c
==============================================================================
--- trunk/app/widgets/gimpcurveview.c	(original)
+++ trunk/app/widgets/gimpcurveview.c	Sat Feb  9 11:14:40 2008
@@ -126,8 +126,8 @@
   view->last_y      = 0.0;
   view->cursor_type = -1;
   view->xpos        = -1.0;
-  view->cursor_x    = -1;
-  view->cursor_y    = -1;
+  view->cursor_x    = -1.0;
+  view->cursor_y    = -1.0;
 
   GTK_WIDGET_SET_FLAGS (view, GTK_CAN_FOCUS);
 
@@ -322,7 +322,7 @@
   y = 1.0 - view->curve->points[i][1];
 
   cairo_move_to (cr,
-                 border + (gdouble) width  * x,
+                 border + (gdouble) width  * x + 3,
                  border + (gdouble) height * y);
   cairo_arc (cr,
              border + (gdouble) width  * x,
@@ -351,8 +351,8 @@
 
   border = GIMP_HISTOGRAM_VIEW (view)->border_width;
 
-  width  = widget->allocation.width  - 2 * border;
-  height = widget->allocation.height - 2 * border;
+  width  = widget->allocation.width  - 2 * border - 1;
+  height = widget->allocation.height - 2 * border - 1;
 
   cr = gdk_cairo_create (widget->window);
 
@@ -448,8 +448,8 @@
       cairo_fill (cr);
     }
 
-  if (view->cursor_x >= 0 && view->cursor_x <= 255 &&
-      view->cursor_y >= 0 && view->cursor_y <= 255)
+  if (view->cursor_x >= 0.0 && view->cursor_x <= 1.0 &&
+      view->cursor_y >= 0.0 && view->cursor_y <= 1.0)
     {
       gchar buf[32];
       gint  w, h;
@@ -478,7 +478,8 @@
       cairo_stroke (cr);
 
       g_snprintf (buf, sizeof (buf), "x:%3d y:%3d",
-                  view->cursor_x, 255 - view->cursor_y);
+                  (gint) (view->cursor_x * 255.999),
+                  (gint) ((1.0 - view->cursor_y) * 255.999));
       pango_layout_set_text (view->cursor_layout, buf, -1);
 
       gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
@@ -881,8 +882,8 @@
                             gdouble        x,
                             gdouble        y)
 {
-  view->cursor_x = x * 255.999;
-  view->cursor_y = y * 255.999;
+  view->cursor_x = x;
+  view->cursor_y = y;
 
   gtk_widget_queue_draw (GTK_WIDGET (view));
 }
@@ -890,8 +891,8 @@
 static void
 gimp_curve_view_unset_cursor (GimpCurveView *view)
 {
-  view->cursor_x = -1;
-  view->cursor_y = -1;
+  view->cursor_x = -1.0;
+  view->cursor_y = -1.0;
 
   gtk_widget_queue_draw (GTK_WIDGET (view));
 }

Modified: trunk/app/widgets/gimpcurveview.h
==============================================================================
--- trunk/app/widgets/gimpcurveview.h	(original)
+++ trunk/app/widgets/gimpcurveview.h	Sat Feb  9 11:14:40 2008
@@ -55,8 +55,8 @@
   gdouble            xpos;
   PangoLayout       *xpos_layout;
 
-  gint               cursor_x;
-  gint               cursor_y;
+  gdouble            cursor_x;
+  gdouble            cursor_y;
   PangoLayout       *cursor_layout;
   PangoRectangle     cursor_rect;
 };



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