[gthumb] crop tool: use low quality zoom for higher precision



commit f01a9f2794ef9b2fca2887fc7e001705b2b72bda
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Jul 15 10:41:14 2011 +0200

    crop tool: use low quality zoom for higher precision
    
    [bug #654553]

 extensions/file_tools/gth-file-tool-crop.c |    2 ++
 gthumb/gth-image-dragger.c                 |   11 +----------
 gthumb/gth-image-selector.c                |    6 +++---
 gthumb/gth-image-viewer.c                  |   17 +++++++++++++++++
 gthumb/gth-image-viewer.h                  |    1 +
 5 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/extensions/file_tools/gth-file-tool-crop.c b/extensions/file_tools/gth-file-tool-crop.c
index f5f82a7..d24180a 100644
--- a/extensions/file_tools/gth-file-tool-crop.c
+++ b/extensions/file_tools/gth-file-tool-crop.c
@@ -530,6 +530,7 @@ gth_file_tool_crop_get_options (GthFileTool *base)
 			  self);
 
 	gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), (GthImageViewerTool *) self->priv->selector);
+	gth_image_viewer_set_zoom_quality (GTH_IMAGE_VIEWER (viewer), GTH_ZOOM_QUALITY_LOW);
 	gth_image_viewer_set_fit_mode (GTH_IMAGE_VIEWER (viewer), GTH_FIT_SIZE_IF_LARGER);
 	ratio_combobox_changed_cb (NULL, self);
 
@@ -576,6 +577,7 @@ gth_file_tool_crop_destroy_options (GthFileTool *base)
 	viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
 	viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
 	gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), NULL);
+	gth_image_viewer_set_zoom_quality (GTH_IMAGE_VIEWER (viewer), eel_gconf_get_enum (PREF_ZOOM_QUALITY, GTH_TYPE_ZOOM_QUALITY, GTH_ZOOM_QUALITY_HIGH));
 }
 
 
diff --git a/gthumb/gth-image-dragger.c b/gthumb/gth-image-dragger.c
index 1cc5a76..2c9b27c 100644
--- a/gthumb/gth-image-dragger.c
+++ b/gthumb/gth-image-dragger.c
@@ -155,7 +155,6 @@ gth_image_dragger_expose (GthImageViewerTool *self,
 {
 	GthImageDragger *dragger;
 	GthImageViewer  *viewer;
-	cairo_filter_t   filter;
 
 	dragger = (GthImageDragger *) self;
 	viewer = dragger->priv->viewer;
@@ -165,14 +164,6 @@ gth_image_dragger_expose (GthImageViewerTool *self,
 	if (gth_image_viewer_get_current_image (viewer) == NULL)
 		return;
 
-	if (gth_image_viewer_get_zoom_quality (viewer) == GTH_ZOOM_QUALITY_LOW)
-		filter = CAIRO_FILTER_FAST;
-	else
-		filter = CAIRO_FILTER_BEST;
-
-	if (gth_image_viewer_get_zoom (viewer) == 1.0)
-		filter = CAIRO_FILTER_FAST;
-
 	gth_image_viewer_paint_region (viewer,
 				       cr,
 				       gth_image_viewer_get_current_image (viewer),
@@ -180,7 +171,7 @@ gth_image_dragger_expose (GthImageViewerTool *self,
 				       viewer->y_offset - viewer->image_area.y,
 				       &viewer->image_area,
 				       event->region,
-				       filter);
+				       gth_image_viewer_get_zoom_quality_filter (viewer));
 
 	gth_image_viewer_apply_painters (viewer, event, cr);
 }
diff --git a/gthumb/gth-image-selector.c b/gthumb/gth-image-selector.c
index 5c37517..a55a2cb 100644
--- a/gthumb/gth-image-selector.c
+++ b/gthumb/gth-image-selector.c
@@ -609,7 +609,7 @@ paint_background (GthImageSelector *self,
 				       self->priv->viewer->y_offset - self->priv->viewer->image_area.y,
 				       &self->priv->viewer->image_area,
 				       event->region,
-				       CAIRO_FILTER_GOOD);
+				       gth_image_viewer_get_zoom_quality_filter (self->priv->viewer));
 
 	/* make the background darker */
 	{
@@ -653,7 +653,7 @@ paint_selection (GthImageSelector *self,
 					       self->priv->viewer->y_offset - self->priv->viewer->image_area.y,
 					       &selection_area,
 					       event->region,
-					       CAIRO_FILTER_GOOD);
+					       gth_image_viewer_get_zoom_quality_filter (self->priv->viewer));
 
 	cairo_save (cr);
 
@@ -695,7 +695,7 @@ paint_image (GthImageSelector *self,
 				       self->priv->viewer->y_offset - self->priv->viewer->image_area.y,
 				       &self->priv->viewer->image_area,
 				       event->region,
-				       CAIRO_FILTER_GOOD);
+				       gth_image_viewer_get_zoom_quality_filter (self->priv->viewer));
 }
 
 
diff --git a/gthumb/gth-image-viewer.c b/gthumb/gth-image-viewer.c
index 916e63e..0f9ed46 100644
--- a/gthumb/gth-image-viewer.c
+++ b/gthumb/gth-image-viewer.c
@@ -2030,6 +2030,23 @@ gth_image_viewer_get_zoom_quality (GthImageViewer *self)
 }
 
 
+cairo_filter_t
+gth_image_viewer_get_zoom_quality_filter (GthImageViewer *viewer)
+{
+	cairo_filter_t filter;
+
+	if (gth_image_viewer_get_zoom_quality (viewer) == GTH_ZOOM_QUALITY_LOW)
+		filter = CAIRO_FILTER_FAST;
+	else
+		filter = CAIRO_FILTER_BEST;
+
+	if (gth_image_viewer_get_zoom (viewer) == 1.0)
+		filter = CAIRO_FILTER_FAST;
+
+	return filter;
+}
+
+
 void
 gth_image_viewer_set_zoom_change (GthImageViewer *self,
 				  GthZoomChange   zoom_change)
diff --git a/gthumb/gth-image-viewer.h b/gthumb/gth-image-viewer.h
index f9b63ec..1d13999 100644
--- a/gthumb/gth-image-viewer.h
+++ b/gthumb/gth-image-viewer.h
@@ -217,6 +217,7 @@ gdouble        gth_image_viewer_get_zoom                 (GthImageViewer     *vi
 void           gth_image_viewer_set_zoom_quality         (GthImageViewer     *viewer,
 							  GthZoomQuality      quality);
 GthZoomQuality gth_image_viewer_get_zoom_quality         (GthImageViewer     *viewer);
+cairo_filter_t gth_image_viewer_get_zoom_quality_filter  (GthImageViewer     *viewer);
 void           gth_image_viewer_set_zoom_change          (GthImageViewer     *viewer,
 							  GthZoomChange       zoom_change);
 GthZoomChange  gth_image_viewer_get_zoom_change          (GthImageViewer     *viewer);



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