summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2012-03-19 20:13:12 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2012-03-19 20:13:12 -0400
commite3a6a0e2f90b64444e5e38b9156f57eafb69eaf8 (patch)
tree9edd9c3099215088df4daa066d432dbf9316bf87
parent5847b1305ecc82f023869e2380a31be2f65ff06c (diff)
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
-rw-r--r--src/adwaita_engine.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/adwaita_engine.c b/src/adwaita_engine.c
index 3217f20c..44b62530 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
{