[glom] ImageGlom: Another scaling fix.



commit dd1bacfd88bb984b9dde60e5ea313ecc42138e81
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jul 14 10:55:01 2011 +0200

    ImageGlom: Another scaling fix.
    
    * glom/utility_widgets/imageglom.cc: get_scaled_image(): Don't return
    an empty pixbuf just because the pixbuf doesn't not need to change.

 ChangeLog                         |    7 +++++++
 glom/utility_widgets/imageglom.cc |    7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4f92751..f8c3312 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-07-14  Murray Cumming  <murrayc murrayc com>
 
+	ImageGlom: Another scaling fix.
+
+	* glom/utility_widgets/imageglom.cc: get_scaled_image(): Don't return 
+	an empty pixbuf just because the pixbuf doesn't not need to change.
+
+2011-07-14  Murray Cumming  <murrayc murrayc com>
+
 	ImageGlom: Remove limits so we always scale, and use on_size_allocate().
 
 	* glom/utility_widgets/imageglom.[h|cc]: Use on_size_allocate() instead of 
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index d0e86b5..d93eed0 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -413,7 +413,7 @@ Glib::RefPtr<Gdk::Pixbuf> ImageGlom::get_scaled_image()
       Glib::RefPtr<Gdk::Pixbuf> pixbuf_scaled = Utils::image_scale_keeping_ratio(pixbuf, allocation_height, allocation_width);
       
       //Don't set a new pixbuf if the dimensions have not changed:
-      Glib::RefPtr<const Gdk::Pixbuf> pixbuf_in_image;
+      Glib::RefPtr<Gdk::Pixbuf> pixbuf_in_image;
 
       if(m_image.get_storage_type() == Gtk::IMAGE_PIXBUF) //Prevent warning.
         pixbuf_in_image = m_image.get_pixbuf();
@@ -432,7 +432,10 @@ Glib::RefPtr<Gdk::Pixbuf> ImageGlom::get_scaled_image()
       }
       else
       {
-        //std::cout << "scaled image not used." << std::endl;
+        //Return the existing one, 
+        //instead of a new one with the same contents,
+        //so no unnecessary changes will be triggered.
+        return pixbuf_in_image;
       }
     }
   }



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