[gthumb: 54/129] image navigator: create a small version of the image instead of scaling in the expose event handler
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb: 54/129] image navigator: create a small version of the image instead of scaling in the expose event handler
- Date: Wed, 27 Apr 2011 20:54:55 +0000 (UTC)
commit ba1b9f3b36502d59b63b255bbd653ddc0d368db3
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Apr 20 18:26:56 2011 +0200
image navigator: create a small version of the image instead of scaling in the expose event handler
gthumb/gth-image-navigator.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gthumb/gth-image-navigator.c b/gthumb/gth-image-navigator.c
index 2cb8f6f..98b03db 100644
--- a/gthumb/gth-image-navigator.c
+++ b/gthumb/gth-image-navigator.c
@@ -22,6 +22,7 @@
#include <config.h>
#include <math.h>
#include <gdk/gdkkeysyms.h>
+#include "cairo-utils.h"
#include "gth-image-navigator.h"
#include "gth-image-viewer.h"
#include "gtk-utils.h"
@@ -163,7 +164,10 @@ update_popup_geometry (NavigatorPopup *nav_popup)
nav_popup->popup_height = MAX ((int) floor (nav_popup->zoom_factor * zoomed_height + 0.5), 1);
cairo_surface_destroy (nav_popup->image);
- nav_popup->image = cairo_surface_reference (gth_image_viewer_get_current_image (nav_popup->viewer));
+ nav_popup->image = _cairo_image_surface_scale_to (gth_image_viewer_get_current_image (nav_popup->viewer),
+ nav_popup->popup_width,
+ nav_popup->popup_height,
+ CAIRO_FILTER_GOOD);
/* visible area size */
@@ -300,7 +304,6 @@ navigator_popup_expose_event_cb (GtkWidget *widget,
NavigatorPopup *nav_popup)
{
cairo_t *cr;
- double zoom;
if (nav_popup->image == NULL)
return FALSE;
@@ -311,10 +314,8 @@ navigator_popup_expose_event_cb (GtkWidget *widget,
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
- zoom = (double) nav_popup->popup_width / nav_popup->image_width;
cairo_save (cr);
- cairo_scale (cr, zoom, zoom);
cairo_set_source_surface (cr, nav_popup->image, 0, 0);
cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_FAST);
cairo_rectangle (cr, 0, 0, nav_popup->image_width, nav_popup->image_height);
@@ -335,7 +336,6 @@ navigator_popup_expose_event_cb (GtkWidget *widget,
nav_popup->visible_area.width,
nav_popup->visible_area.height);
cairo_clip (cr);
- cairo_scale (cr, zoom, zoom);
cairo_set_source_surface (cr, nav_popup->image, 0, 0);
cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_FAST);
cairo_rectangle (cr, 0, 0, nav_popup->image_width, nav_popup->image_width);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]