[gthumb] image selector: fixed display of the image selection



commit f2c7075c5a1733c866ab795b292a23ce57aaa5c2
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon May 16 21:59:56 2011 +0200

    image selector: fixed display of the image selection

 extensions/file_tools/gth-image-rotator.c |    3 ---
 gthumb/cairo-utils.c                      |   14 +++++++++++---
 gthumb/gth-image-selector.c               |   15 +++++++++------
 3 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/extensions/file_tools/gth-image-rotator.c b/extensions/file_tools/gth-image-rotator.c
index 228d77a..02cef83 100644
--- a/extensions/file_tools/gth-image-rotator.c
+++ b/extensions/file_tools/gth-image-rotator.c
@@ -314,9 +314,6 @@ paint_grid (GthImageRotator *self,
 
 	cairo_scale (cr, self->priv->preview_zoom, self->priv->preview_zoom);
 
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 2)
-	/*cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);*/
-#endif
 	grid = self->priv->crop_region;
 	grid.x += self->priv->clip_area.x / self->priv->preview_zoom;
 	grid.y += self->priv->clip_area.y / self->priv->preview_zoom;
diff --git a/gthumb/cairo-utils.c b/gthumb/cairo-utils.c
index 5d3f43d..81fb662 100644
--- a/gthumb/cairo-utils.c
+++ b/gthumb/cairo-utils.c
@@ -780,15 +780,23 @@ _cairo_paint_grid (cairo_t      *cr,
 	cairo_device_to_user_distance (cr, &ux, &uy);
 	cairo_set_line_width (cr, MAX (ux, uy));
 
-	cairo_rectangle (cr, rectangle->x - ux, rectangle->y - uy, rectangle->width + (ux * 2), rectangle->height + (uy * 2));
+	cairo_rectangle (cr, rectangle->x - ux + 0.5, rectangle->y - uy + 0.5, rectangle->width + (ux * 2), rectangle->height + (uy * 2));
 	cairo_clip (cr);
 
-	cairo_rectangle (cr, rectangle->x, rectangle->y, rectangle->width, rectangle->height);
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 2)
+	/* cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE); */
+#endif
+
+	cairo_rectangle (cr, rectangle->x + 0.5, rectangle->y + 0.5, rectangle->width, rectangle->height);
 	cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
 	cairo_stroke (cr);
 
-	if (grid_type == GTH_GRID_NONE)
+	if (grid_type == GTH_GRID_NONE) {
+		cairo_restore (cr);
 		return;
+	}
+
+	cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
 
 	if (grid_type == GTH_GRID_THIRDS) {
 		int i;
diff --git a/gthumb/gth-image-selector.c b/gthumb/gth-image-selector.c
index 7bf3432..fff7daf 100644
--- a/gthumb/gth-image-selector.c
+++ b/gthumb/gth-image-selector.c
@@ -639,13 +639,16 @@ paint_selection (GthImageSelector *self,
 
 	cairo_save (cr);
 
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 2)
-	/*cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);*/
-#endif
+	cairo_rectangle (cr,
+			 selection_area.x + 0.5,
+			 selection_area.y + 0.5,
+			 selection_area.width,
+			 selection_area.height);
+	cairo_clip (cr);
+
 	_cairo_paint_grid (cr, &selection_area, self->priv->grid_type);
 
 	cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0);
-
 	cairo_rectangle (cr,
 			 selection_area.x + 0.5,
 			 selection_area.y + 0.5,
@@ -653,8 +656,8 @@ paint_selection (GthImageSelector *self,
 			 selection_area.height - 1);
 	if ((self->priv->current_area != NULL) && (self->priv->current_area->id != C_SELECTION_AREA))
 		cairo_rectangle (cr,
-				 self->priv->current_area->area.x + self->priv->viewer->image_area.x + 0.5,
-				 self->priv->current_area->area.y + self->priv->viewer->image_area.y + 0.5,
+				 self->priv->current_area->area.x + self->priv->viewer->image_area.x - self->priv->viewer->x_offset + 0.5,
+				 self->priv->current_area->area.y + self->priv->viewer->image_area.y - self->priv->viewer->y_offset + 0.5,
 				 self->priv->current_area->area.width - 1,
 				 self->priv->current_area->area.height - 1);
 



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