[gtk+/gtk-style-context] Atempt to fix stretched 9slice rendering



commit 3b9e3f742957ebc5f017f5c18ceff5e9b0afa479
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Nov 23 16:14:13 2010 -0500

    Atempt to fix stretched 9slice rendering

 gtk/gtk9slice.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtk9slice.c b/gtk/gtk9slice.c
index cb0285a..6200899 100644
--- a/gtk/gtk9slice.c
+++ b/gtk/gtk9slice.c
@@ -213,6 +213,7 @@ render_border (cairo_t              *cr,
       cairo_pattern_destroy (pattern);
 
       cairo_rectangle (cr, x, y, width, height);
+      cairo_fill (cr);
     }
   else
     {
@@ -222,24 +223,22 @@ render_border (cairo_t              *cr,
         {
           d = cairo_image_surface_get_width (surface);
 
-          cairo_translate (cr, x + (width / 2), y);
-          cairo_scale (cr, width / d, 1);
-          cairo_set_source_surface (cr, surface, - d / 2, 0);
-          cairo_rectangle (cr, - width / 2, 0, width, height);
+          cairo_translate (cr, x, y);
+          cairo_scale (cr, width / d, 1.0);
+          cairo_set_source_surface (cr, surface, 0.0, 0.0);
+          cairo_paint (cr);
         }
       else
         {
           d = cairo_image_surface_get_height (surface);
 
-          cairo_translate (cr, x, y + (height / 2));
-          cairo_scale (cr, 1, height / d);
-          cairo_set_source_surface (cr, surface, 0, - d / 2);
-          cairo_rectangle (cr, 0, - height / 2, width, height);
+          cairo_translate (cr, x, y);
+          cairo_scale (cr, 1.0, height / d);
+          cairo_set_source_surface (cr, surface, 0.0, 0.0);
+          cairo_paint (cr);
         }
     }
 
-  cairo_fill (cr);
-
   cairo_restore (cr);
 }
 
@@ -282,7 +281,7 @@ gtk_9slice_render (Gtk9Slice *slice,
 
   render_border (cr, surface, SIDE_TOP,
                  x + slice->distances[SIDE_LEFT], y,
-                 (gdouble) width - slice->distances[SIDE_LEFT] - slice->distances[SIDE_RIGHT],
+                 width - slice->distances[SIDE_LEFT] - slice->distances[SIDE_RIGHT],
                  (gdouble) img_height,
                  slice->modifiers[SIDE_TOP]);
 
@@ -292,7 +291,7 @@ gtk_9slice_render (Gtk9Slice *slice,
 
   render_border (cr, surface, SIDE_BOTTOM,
                  x + slice->distances[SIDE_LEFT], y + height - img_height,
-                 (gdouble) width - slice->distances[SIDE_LEFT] - slice->distances[SIDE_RIGHT],
+                 width - slice->distances[SIDE_LEFT] - slice->distances[SIDE_RIGHT],
                  (gdouble) img_height,
                  slice->modifiers[SIDE_BOTTOM]);
 
@@ -303,7 +302,7 @@ gtk_9slice_render (Gtk9Slice *slice,
   render_border (cr, surface, SIDE_LEFT,
                  x, y + slice->distances[SIDE_TOP],
                  (gdouble) img_width,
-                 (gdouble) height - slice->distances[SIDE_TOP] - slice->distances[SIDE_BOTTOM],
+                 height - slice->distances[SIDE_TOP] - slice->distances[SIDE_BOTTOM],
                  slice->modifiers[SIDE_LEFT]);
 
   /* Right side */
@@ -312,7 +311,8 @@ gtk_9slice_render (Gtk9Slice *slice,
 
   render_border (cr, surface, SIDE_RIGHT,
                  x + width - img_width, y + slice->distances[SIDE_TOP],
-                 (gdouble) img_width, height - slice->distances[SIDE_TOP] - slice->distances[SIDE_BOTTOM],
+                 (gdouble) img_width,
+                 height - slice->distances[SIDE_TOP] - slice->distances[SIDE_BOTTOM],
                  slice->modifiers[SIDE_RIGHT]);
 
   /* Top/Left corner */



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