[pango] Win32: Draw background box in correct color
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango] Win32: Draw background box in correct color
- Date: Sat, 8 Apr 2017 01:54:55 +0000 (UTC)
commit 3166cbf809d5b005b587319ee2ef3e73e00d466e
Author: Nicolas Hake <nh nosebud de>
Date: Mon Jul 11 13:26:44 2016 +0200
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
pango/pangowin32.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index 04e0d51..1abe333 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]