[gnome-photos] image-view: Prefer speed over quality during zoom animation



commit 4c0ff2db6089c38a1c7d9e01e688bcc0791cc8bc
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Jul 8 15:19:41 2018 +0200

    image-view: Prefer speed over quality during zoom animation
    
    Nearest neighbour interpolation is the fastest and lowest quality
    algorithm supported by GeglBuffer.

 src/photos-image-view.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-image-view.c b/src/photos-image-view.c
index 5ecf205a..cea011e0 100644
--- a/src/photos-image-view.c
+++ b/src/photos-image-view.c
@@ -532,6 +532,7 @@ static void
 photos_image_view_draw_node (PhotosImageView *self, cairo_t *cr, GdkRectangle *rect)
 {
   const Babl *format;
+  GeglAbyssPolicy buffer_flags;
   GeglRectangle roi;
   cairo_surface_t *surface = NULL;
   gint scale_factor;
@@ -562,6 +563,11 @@ photos_image_view_draw_node (PhotosImageView *self, cairo_t *cr, GdkRectangle *r
 
   format = babl_format ("cairo-ARGB32");
 
+  if (self->zoom_animation == NULL)
+    buffer_flags = GEGL_ABYSS_NONE | GEGL_BUFFER_FILTER_AUTO;
+  else
+    buffer_flags = GEGL_ABYSS_NONE | GEGL_BUFFER_FILTER_NEAREST;
+
   start = g_get_monotonic_time ();
 
   gegl_buffer_get (self->buffer,
@@ -570,15 +576,16 @@ photos_image_view_draw_node (PhotosImageView *self, cairo_t *cr, GdkRectangle *r
                    format,
                    self->surface_memory,
                    stride,
-                   GEGL_ABYSS_NONE);
+                   buffer_flags);
 
   end = g_get_monotonic_time ();
   photos_debug (PHOTOS_DEBUG_GEGL,
-                "PhotosImageView: Node Blit: %d, %d, %d×%d, %" G_GINT64_FORMAT,
+                "PhotosImageView: Node Blit: %d, %d, %d×%d, %d, %" G_GINT64_FORMAT,
                 rect->x,
                 rect->y,
                 rect->width,
                 rect->height,
+                buffer_flags,
                 end - start);
 
   surface = cairo_image_surface_create_for_data (self->surface_memory,


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