[gnome-photos/wip/baedert/gtkimageview: 46/47] Revert "Foo"



commit 667ca781ad8ebf41627c1608fff868a82526c170
Author: Timm Bäder <mail baedert org>
Date:   Thu Apr 14 19:32:41 2016 +0200

    Revert "Foo"
    
    This reverts commit 3f5732fb6ed0d8b531acd325e6e8d182cab64600.

 src/photos-gegl-image.c          |  103 ++++++--------------------------------
 src/photos-gegl-image.h          |    7 +--
 src/photos-preview-nav-buttons.c |    3 +-
 3 files changed, 17 insertions(+), 96 deletions(-)
---
diff --git a/src/photos-gegl-image.c b/src/photos-gegl-image.c
index d17c224..1c38699 100644
--- a/src/photos-gegl-image.c
+++ b/src/photos-gegl-image.c
@@ -27,14 +27,11 @@ photos_gegl_image_render_surface (PhotosGeglImage *image)
 {
   GeglRectangle roi = image->roi;
 
-  g_message ("rendering for scale %f", image->view_scale);
-
   roi.x *= image->view_scale;
   roi.y *= image->view_scale;
 
   gegl_node_blit (image->node,
                   image->view_scale,
-                  /*image->rendered_scale,*/
                   &roi,
                   image->format,
                   image->buf,
@@ -43,16 +40,13 @@ photos_gegl_image_render_surface (PhotosGeglImage *image)
 
   /*if (!image->surface)*/
     /*{*/
-  g_message ("Surface size: %d, %d", (int)(image->width * image->view_scale), (int)(image->height * 
image->view_scale));
       image->surface = cairo_image_surface_create_for_data (image->buf,
                                                             CAIRO_FORMAT_ARGB32,
-                                                            image->width * image->view_scale,
-                                                            image->height * image->view_scale,
+                                                            image->width,
+                                                            image->height,
                                                             image->stride);
     /*}*/
 
-  image->rendered_scale = image->view_scale;
-
   g_signal_emit_by_name (G_OBJECT (image), "changed", 0);
 }
 
@@ -61,13 +55,9 @@ photos_gegl_image_draw (GtkAbstractImage *_image, cairo_t *ct)
 {
   PhotosGeglImage *image = PHOTOS_GEGL_IMAGE (_image);
 
-  g_message ("View scale: %f, rendered scale: %f", image->view_scale, image->rendered_scale);
-
   if (image->surface)
     {
-      /*cairo_pattern_set_filter (cairo_get_source (ct), CAIRO_FILTER_FAST);*/
-      cairo_scale (ct, 1.0 / image->rendered_scale, 1.0 / image->rendered_scale);
-      /*cairo_scale (ct, 1.0 / image->view_scale, 1.0 / image->view_scale);*/
+      cairo_scale (ct, 1.0 / image->view_scale, 1.0 / image->view_scale);
       cairo_set_source_surface (ct, image->surface, 0, 0);
     }
 }
@@ -82,83 +72,40 @@ photos_gegl_image_update_bbox (PhotosGeglImage *image)
 
   box = gegl_node_get_bounding_box (image->node);
 
-  g_message ("%s: %d, %d, %d, %d", __FUNCTION__, box.x, box.y, box.width, box.height);
-
 #if 0
   g_message ("old size: %d, %d; new size: %d, %d", image->width, image->height,
              box.width, box.height);
   g_message ("bbox: %d, %d, %d, %d", box.x, box.y, box.width, box.height);
 #endif
 
-
-  image->width = box.width;
-  image->height = box.height;
-
-  box.width  *= image->view_scale;
-  box.height *= image->view_scale;
-
-  /*if (image->roi.width != box.width || image->roi.height != box.height ||*/
-      /*image->roi.x != box.x         || image->roi.y  != box.y)*/
+  /*if (image->width != box.width || image->height != box.height ||*/
+      /*image->roi.x != box.x     || image->roi.y != box.y)*/
     /*{*/
-      /*image->width  = box.width / image->view_scale;*/
-      /*image->height = box.height / image->view_scale;*/
-
-      image->roi.x = box.x;// * image->view_scale;
-      image->roi.y = box.y;// * image->view_scale;
-      image->roi.width  = box.width;//  * /*image->scale_factor **/ image->view_scale;
-      image->roi.height = box.height;// * /*image->scale_factor **/ image->view_scale;
-
-
-      /*image->roi.x = box.x * image->rendered_scale;*/
-      /*image->roi.y = box.y * image->rendered_scale;*/
-      /*image->roi.width  = box.width [> * image->scale_factor <]* image->rendered_scale;*/
-      /*image->roi.height = box.height[> * image->scale_factor <]* image->rendered_scale;*/
-
-
+      image->width  = box.width;
+      image->height = box.height;
 
+      image->roi.x = box.x * image->view_scale;
+      image->roi.y = box.y * image->view_scale;
+      image->roi.width  = box.width  * image->scale_factor * image->view_scale;
+      image->roi.height = box.height * image->scale_factor * image->view_scale;
 
       image->stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, image->roi.width);
 
       g_clear_pointer (&image->buf, g_free);
-      g_clear_pointer (&image->surface, cairo_surface_destroy);
+      g_clear_pointer (&image->buf, cairo_surface_destroy);
 
-      /*image->buf = g_malloc (image->stride * image->roi.height * image->view_scale);*/
-      /*image->buf = g_malloc (image->stride * image->roi.height * image->rendered_scale);*/
-      image->buf = g_malloc (image->stride * image->roi.height);
+      image->buf = g_malloc (image->stride * image->roi.height * image->view_scale);
     /*}*/
 }
 
-
-static gboolean
-redraw_image_cb (gpointer data)
-{
-  PhotosGeglImage *image = data;
-
-  photos_gegl_image_update_bbox (image);
-  photos_gegl_image_render_surface (image);
-
-  image->redraw_id = 0;
-
-  return G_SOURCE_REMOVE;
-}
 static void
 photos_gegl_image_computed (PhotosGeglImage *image)
 {
-  g_message (__FUNCTION__);
-
   photos_gegl_image_update_bbox (image);
-
-  if (image->redraw_id != 0)
-    {
-      g_source_remove (image->redraw_id);
-      image->redraw_id = 0;
-    }
-
-  image->redraw_id = g_timeout_add (500, redraw_image_cb, image);
+  photos_gegl_image_render_surface (image);
 }
 
 
-
 PhotosGeglImage *
 photos_gegl_image_new (GeglNode *node, int scale_factor)
 {
@@ -172,9 +119,6 @@ photos_gegl_image_new (GeglNode *node, int scale_factor)
   photos_gegl_image_update_bbox (image);
   photos_gegl_image_render_surface (image);
 
-
-  g_message ("-----------------------------------");
-
   return image;
 }
 
@@ -183,7 +127,6 @@ photos_gegl_image_init (PhotosGeglImage *image)
 {
   image->surface = NULL;
   image->view_scale = 1.0;
-  image->rendered_scale = 1.0;
 }
 
 static void
@@ -214,25 +157,9 @@ photos_gegl_image_class_init (PhotosGeglImageClass *klass)
   image_class->get_scale_factor = photos_gegl_image_get_scale_factor;
 }
 
-
-
 void
 photos_gegl_image_set_view_scale (PhotosGeglImage *image, double view_scale)
 {
-
-  if (view_scale == image->view_scale)
-    return;
-
-  g_message ("%s: New view scale: %f", __FUNCTION__, view_scale);
   image->view_scale = view_scale;
-  photos_gegl_image_update_bbox (image);
-
-  if (image->redraw_id != 0)
-    {
-      g_source_remove (image->redraw_id);
-      image->redraw_id = 0;
-    }
-
-  image->redraw_id = g_timeout_add (1000, redraw_image_cb, image);
+  photos_gegl_image_render_surface (image);
 }
-
diff --git a/src/photos-gegl-image.h b/src/photos-gegl-image.h
index 82c4275..57c8e05 100644
--- a/src/photos-gegl-image.h
+++ b/src/photos-gegl-image.h
@@ -19,18 +19,13 @@ struct _PhotosGeglImage
   GeglNode *node;
   int width;
   int height;
+  double view_scale;
   cairo_surface_t *surface;
   guchar *buf;
   const Babl *format;
   GeglRectangle roi;
   int stride;
   int scale_factor;
-
-
-  double view_scale;
-  double rendered_scale;
-
-  guint redraw_id;
 };
 
 struct _PhotosGeglImageClass
diff --git a/src/photos-preview-nav-buttons.c b/src/photos-preview-nav-buttons.c
index df8a7e8..166e8d8 100644
--- a/src/photos-preview-nav-buttons.c
+++ b/src/photos-preview-nav-buttons.c
@@ -114,8 +114,7 @@ photos_preview_nav_buttons_fade_in_button (PhotosPreviewNavButtons *self, GtkWid
     return;
 
   gtk_widget_show_all (widget);
-  /*gtk_revealer_set_reveal_child (GTK_REVEALER (widget), TRUE);*/
-  gtk_revealer_set_reveal_child (GTK_REVEALER (widget), FALSE);
+  gtk_revealer_set_reveal_child (GTK_REVEALER (widget), TRUE);
 }
 
 


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