summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Hake <nh@nosebud.de>2016-07-11 13:26:44 +0200
committerMatthias Clasen <mclasen@redhat.com>2017-04-07 21:54:29 -0400
commit3166cbf809d5b005b587319ee2ef3e73e00d466e (patch)
treebcb118fc598a5db59473e4b2f139e24f7c962f78
parent72e16506d6bd43efe4db24ebc3f69537f7208b1a (diff)
downloadpango-3166cbf809d5b005b587319ee2ef3e73e00d466e.tar.gz
Win32: Draw background box in correct color
Adding 128 to the component value would overflow in colors with full brightness and set the component to 0. https://bugzilla.gnome.org/show_bug.cgi?id=768679
-rw-r--r--pango/pangowin32.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index 04e0d51e..1abe3335 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -1029,7 +1029,6 @@ pango_win32_render_layout_line (HDC hdc,
while (tmp_list)
{
COLORREF oldfg = 0;
- HBRUSH brush = NULL;
HPEN uline_pen, old_pen;
POINT points[2];
PangoUnderline uline = PANGO_UNDERLINE_NONE;
@@ -1052,18 +1051,19 @@ pango_win32_render_layout_line (HDC hdc,
if (bg_set)
{
- HBRUSH oldbrush;
-
- brush = CreateSolidBrush (RGB ((bg_color.color.red + 128) >> 8,
- (bg_color.color.green + 128) >> 8,
- (bg_color.color.blue + 128) >> 8));
- oldbrush = SelectObject (hdc, brush);
+ COLORREF bg_col = RGB ((bg_color.color.red) >> 8,
+ (bg_color.color.green) >> 8,
+ (bg_color.color.blue) >> 8);
+ HBRUSH bg_brush = CreateSolidBrush (bg_col);
+ HBRUSH old_brush = SelectObject (hdc, bg_brush);
+ old_pen = SelectObject (hdc, GetStockObject (NULL_PEN));
Rectangle (hdc, x + PANGO_PIXELS (x_off + logical_rect.x),
y + PANGO_PIXELS (overall_rect.y),
PANGO_PIXELS (logical_rect.width),
PANGO_PIXELS (overall_rect.height));
- SelectObject (hdc, oldbrush);
- DeleteObject (brush);
+ SelectObject (hdc, old_brush);
+ DeleteObject (bg_brush);
+ SelectObject (hdc, old_pen);
}
if (fg_set)