From fadc8f8aaa65eecc855350a1dea9cfc8c255620f Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 26 Oct 2009 14:55:55 +0000 Subject: [PATCH 1/3] Fix bluriness in level bar, and popup By shifting the top-left coordinates by half a pixel, to match the cairo grid. This makes the outter border of the popup, as well as the level bar's borders much sharper. https://bugzilla.gnome.org/show_bug.cgi?id=567249 --- plugins/media-keys/gsd-media-keys-window.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/media-keys/gsd-media-keys-window.c b/plugins/media-keys/gsd-media-keys-window.c index 9306b92..f890344 100644 --- a/plugins/media-keys/gsd-media-keys-window.c +++ b/plugins/media-keys/gsd-media-keys-window.c @@ -610,7 +610,11 @@ draw_volume_boxes (GsdMediaKeysWindow *window, GdkColor color; double r, g, b; - x1 = width * percentage; + x0 += 0.5; + y0 += 0.5; + height = round (height) - 1; + width = round (width) - 1; + x1 = round ((width - 1) * percentage); /* bar background */ color = GTK_WIDGET (window)->style->dark [GTK_STATE_NORMAL]; @@ -636,7 +640,7 @@ draw_volume_boxes (GsdMediaKeysWindow *window, r = (float)color.red / 65535.0; g = (float)color.green / 65535.0; b = (float)color.blue / 65535.0; - cairo_rectangle (cr, x0, y0, x1, height); + cairo_rectangle (cr, x0 + 0.5, y0 + 0.5, x1, height - 1); cairo_set_source_rgba (cr, r, g, b, FG_ALPHA); cairo_fill (cr); } @@ -659,15 +663,15 @@ draw_action_volume (GsdMediaKeysWindow *window, gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height); - icon_box_width = window_width * 0.65; - icon_box_height = window_height * 0.65; + icon_box_width = round (window_width * 0.65); + icon_box_height = round (window_height * 0.65); volume_box_width = icon_box_width; - volume_box_height = window_height * 0.05; + volume_box_height = round (window_height * 0.05); icon_box_x0 = (window_width - icon_box_width) / 2; icon_box_y0 = (window_height - icon_box_height - volume_box_height) / 2; - volume_box_x0 = icon_box_x0; - volume_box_y0 = icon_box_height + icon_box_y0; + volume_box_x0 = round (icon_box_x0); + volume_box_y0 = round (icon_box_height + icon_box_y0); #if 0 g_message ("icon box: w=%f h=%f x0=%f y0=%f", -- 1.6.5.rc2