gnome-utils r7924 - in trunk/baobab: . src



Author: acastro
Date: Thu May  8 18:36:39 2008
New Revision: 7924
URL: http://svn.gnome.org/viewvc/gnome-utils?rev=7924&view=rev

Log:

        Patch cotributed by Victor Jaquez <vjaquez igalia com>

        * src/baobab-ringschart.c (bug #528165):
        (baobab_ringschart_expose): Added code to control Enhance the
        scale operation of the screenshot image, not it scales properly.



Modified:
   trunk/baobab/ChangeLog
   trunk/baobab/src/baobab-ringschart.c

Modified: trunk/baobab/src/baobab-ringschart.c
==============================================================================
--- trunk/baobab/src/baobab-ringschart.c	(original)
+++ trunk/baobab/src/baobab-ringschart.c	Thu May  8 18:36:39 2008
@@ -625,12 +625,25 @@
           h = cairo_image_surface_get_height (priv->memento);
 
           cairo_clip (cr);
+          
+          if (w > 0 && h > 0 &&
+	      !(rchart->allocation.width == w &&
+                rchart->allocation.height == h))
+            {
+              gdouble p, sx, sy;
+	  
+              /* minimal available proportion */
+              p = MIN (rchart->allocation.width / (1.0 * w),
+                       rchart->allocation.height / (1.0 * h));
+              
+              sx = (gdouble) (rchart->allocation.width - w * p) / 2.0;
+              sy = (gdouble) (rchart->allocation.height - h * p) / 2.0;
 
-          cairo_scale (cr, 
-                       (gdouble) rchart->allocation.width/w,
-                       (gdouble) rchart->allocation.height/h);
- 
-          cairo_set_source_surface (cr, 
+              cairo_translate (cr, sx, sy);
+              cairo_scale (cr, p, p);
+            }
+
+          cairo_set_source_surface (cr,
                                     priv->memento,
                                     0, 0);
           cairo_paint (cr);



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