[gnome-photos/wip/baedert/gtkimageview: 37/39] tool-crop: Fix redraw_damaged_area



commit ba4078df99d2244f84b21e14b3021a224c2ba2ba
Author: Timm Bäder <mail baedert org>
Date:   Sat Apr 16 20:11:45 2016 +0200

    tool-crop: Fix redraw_damaged_area

 src/photos-tool-crop.c |   16 ++--------------
 1 files changed, 2 insertions(+), 14 deletions(-)
---
diff --git a/src/photos-tool-crop.c b/src/photos-tool-crop.c
index 7120e77..59ab660 100644
--- a/src/photos-tool-crop.c
+++ b/src/photos-tool-crop.c
@@ -197,19 +197,14 @@ photos_tool_crop_find_constraint (PhotosToolCrop *self, gdouble aspect_ratio)
 static void
 photos_tool_crop_redraw_damaged_area (PhotosToolCrop *self)
 {
-  gtk_widget_queue_draw (GTK_WIDGET (self->view));
-#if 0
   cairo_rectangle_int_t area;
   cairo_region_t *region;
   gdouble damage_offset = HANDLE_OFFSET + HANDLE_RADIUS;
   gdouble x;
   gdouble y;
 
-  x = (gdouble) photos_image_view_get_x (PHOTOS_IMAGE_VIEW (self->view));
-  /*x = -x + self->crop_x - damage_offset;*/
-
-  y = (gdouble) photos_image_view_get_y (PHOTOS_IMAGE_VIEW (self->view));
-  /*y = -y + self->crop_y - damage_offset;*/
+  x = photos_image_view_get_x (PHOTOS_IMAGE_VIEW (self->view)) + self->crop_x - damage_offset;
+  y = photos_image_view_get_y (PHOTOS_IMAGE_VIEW (self->view)) + self->crop_y - damage_offset;
 
   area.height = (gint) (self->crop_height + 2 * damage_offset + 0.5) + 2;
   area.width = (gint) (self->crop_width + 2 * damage_offset + 0.5) + 2;
@@ -219,7 +214,6 @@ photos_tool_crop_redraw_damaged_area (PhotosToolCrop *self)
   region = cairo_region_create_rectangle (&area);
   gtk_widget_queue_draw_region (self->view, region);
   cairo_region_destroy (region);
-#endif
 }
 
 
@@ -866,7 +860,6 @@ photos_tool_crop_set_active (PhotosToolCrop *self, gint active)
 static void
 photos_tool_crop_size_allocate (PhotosToolCrop *self, GdkRectangle *allocation)
 {
-#if 1
   gdouble crop_height_ratio;
   gdouble crop_width_ratio;
   gdouble crop_x_ratio;
@@ -885,7 +878,6 @@ photos_tool_crop_size_allocate (PhotosToolCrop *self, GdkRectangle *allocation)
   self->crop_y = crop_y_ratio * (gdouble) self->bbox_zoomed.height;
 
   photos_tool_crop_surface_draw (self);
-#endif
 }
 
 
@@ -1024,10 +1016,6 @@ photos_tool_crop_deactivate (PhotosTool *tool)
        * so, in practice, the conversion is unnecessary.
        */
 
-      g_message ("Zoom: %f", zoom);
-      g_message ("unscaled: %f, %f, %f, %f", self->crop_x, self->crop_y, self->crop_width, 
self->crop_height);
-      g_message ("caled   : %f, %f, %f, %f", self->crop_x / zoom, self->crop_y / zoom, self->crop_width / 
zoom, self->crop_height / zoom);
-
       parameter_type = g_variant_type_new ("a{sd}");
       g_variant_builder_init (&parameter, parameter_type);
       g_variant_builder_add (&parameter, "{sd}", "x", self->crop_x / zoom);


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