[gnome-themes-standard] notebook: fix scaling of rendered background



commit e3a6a0e2f90b64444e5e38b9156f57eafb69eaf8
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 19 20:13:12 2012 -0400

    notebook: fix scaling of rendered background
    
    The background was rendered with the wrong height, which made the
    linear gradient end abruptly.
    
    Spotted by Jack Gandy <scionicspectre gmail com>
    https://bugzilla.gnome.org/show_bug.cgi?id=672280

 src/adwaita_engine.c |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/src/adwaita_engine.c b/src/adwaita_engine.c
index 3217f20..44b6253 100644
--- a/src/adwaita_engine.c
+++ b/src/adwaita_engine.c
@@ -240,45 +240,49 @@ render_notebook_extension (GtkThemingEngine *engine,
   cairo_save (cr);
   cairo_set_line_width (cr, border_width);
 
-  if (gap_side == GTK_POS_TOP)
-    {
-      angle = G_PI;
-      cairo_translate (cr, width, height);
-    }
-
   if (gap_side == GTK_POS_BOTTOM)
     x += border_width / 2;
   else if (gap_side == GTK_POS_TOP)
     x -= border_width / 2;
 
-  width -= border_width;
+  if (gap_side == GTK_POS_TOP)
+    {
+      angle = G_PI;
+      cairo_translate (cr, x + width, y + height - NOTEBOOK_TAB_TOP_MARGIN - border_width);
+    }
+  else
+    {
+      cairo_translate (cr, x, y + NOTEBOOK_TAB_TOP_MARGIN + border_width);
+    }
 
-  cairo_translate (cr, x, y);
   cairo_rotate (cr, angle);
 
+  width -= border_width;
+  height -= NOTEBOOK_TAB_TOP_MARGIN + border_width;
+
   /* draw the tab shape and clip the background inside it */
   cairo_save (cr);
   draw_tab_shape (cr, tab_curvature, 
-                  0, NOTEBOOK_TAB_TOP_MARGIN + border_width + 0.5,
+                  0, 0.5,
                   width, is_active ? (height + 1.0) : (height));
   cairo_clip (cr);
 
   GTK_THEMING_ENGINE_CLASS (adwaita_engine_parent_class)->render_background
-    (engine, cr, 0, NOTEBOOK_TAB_TOP_MARGIN + border_width + 0.5,
+    (engine, cr, 0, 0.5,
      width, is_active ? (height + 1.0) : (height));
 
   cairo_restore (cr);
 
   /* now draw the border */
   draw_tab_shape (cr, tab_curvature,
-                  0, NOTEBOOK_TAB_TOP_MARGIN + border_width,
+                  0, 0,
                   width, height);
 
   if (pattern && (state & GTK_STATE_FLAG_ACTIVE))
     {
-      cairo_scale (cr, width, height - NOTEBOOK_TAB_TOP_MARGIN);
+      cairo_scale (cr, width, height);
       cairo_set_source (cr, pattern);
-      cairo_scale (cr, 1.0 / width, 1.0 / (height - NOTEBOOK_TAB_TOP_MARGIN));
+      cairo_scale (cr, 1.0 / width, 1.0 / height);
     }
   else
     {



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