Huw Davies : gdi32: Add support for drawing vertical patterned lines.
Alexandre Julliard
julliard at winehq.org
Fri May 6 13:44:08 CDT 2011
Module: wine
Branch: master
Commit: 72804fca54923e92a2e5114c6a6b68d6142804ec
URL: http://source.winehq.org/git/wine.git/?a=commit;h=72804fca54923e92a2e5114c6a6b68d6142804ec
Author: Huw Davies <huw at codeweavers.com>
Date: Fri May 6 11:53:51 2011 +0100
gdi32: Add support for drawing vertical patterned lines.
---
dlls/gdi32/dibdrv/objects.c | 77 +++++++++++++++++++++++++++++++++++++++++++
dlls/gdi32/tests/dib.c | 18 ++++++++++
2 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
index cb58f4b..f58d9c2 100644
--- a/dlls/gdi32/dibdrv/objects.c
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -670,6 +670,83 @@ static BOOL dashed_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end)
pdev->dash_pos = start_pos;
skip_dash(pdev, right - left + 1);
}
+ else if(start->x == end->x) /* vline */
+ {
+ BOOL t_to_b;
+ INT top, bottom, cur_y;
+
+ rect.left = start->x;
+ rect.right = start->x + 1;
+
+ if(start->y <= end->y)
+ {
+ top = start->y;
+ bottom = end->y - 1;
+ t_to_b = TRUE;
+ }
+ else
+ {
+ top = end->y + 1;
+ bottom = start->y;
+ t_to_b = FALSE;
+ }
+
+ for(i = 0; i < clip->numRects; i++)
+ {
+ if(clip->rects[i].top > bottom) break;
+ if(clip->rects[i].bottom <= top) continue;
+ if(clip->rects[i].right > start->x && clip->rects[i].left <= start->x)
+ {
+ int clipped_top = max(clip->rects[i].top, top);
+ int clipped_bottom = min(clip->rects[i].bottom - 1, bottom);
+
+ pdev->dash_pos = start_pos;
+
+ if(t_to_b)
+ {
+ cur_y = clipped_top;
+ if(cur_y != top)
+ skip_dash(pdev, clipped_top - top);
+
+ while(cur_y <= clipped_bottom)
+ {
+ get_dash_colors(pdev, &and, &xor);
+ dash_len = pdev->dash_pos.left_in_dash;
+ if(cur_y + dash_len > clipped_bottom + 1)
+ dash_len = clipped_bottom - cur_y + 1;
+ rect.top = cur_y;
+ rect.bottom = cur_y + dash_len;
+
+ pdev->dib.funcs->solid_rects(&pdev->dib, 1, &rect, and, xor);
+ cur_y += dash_len;
+ skip_dash(pdev, dash_len);
+ }
+ }
+ else
+ {
+ cur_y = clipped_bottom;
+ if(cur_y != bottom)
+ skip_dash(pdev, bottom - clipped_bottom);
+
+ while(cur_y >= clipped_top)
+ {
+ get_dash_colors(pdev, &and, &xor);
+ dash_len = pdev->dash_pos.left_in_dash;
+ if(cur_y - dash_len < clipped_top - 1)
+ dash_len = cur_y - clipped_top + 1;
+ rect.top = cur_y - dash_len + 1;
+ rect.bottom = cur_y + 1;
+
+ pdev->dib.funcs->solid_rects(&pdev->dib, 1, &rect, and, xor);
+ cur_y -= dash_len;
+ skip_dash(pdev, dash_len);
+ }
+ }
+ }
+ }
+ pdev->dash_pos = start_pos;
+ skip_dash(pdev, bottom - top + 1);
+ }
else
{
ret = FALSE;
diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c
index 6b7a0bf..c6b2c90 100644
--- a/dlls/gdi32/tests/dib.c
+++ b/dlls/gdi32/tests/dib.c
@@ -86,6 +86,8 @@ static const char *sha1_graphics_a8r8g8b8[] =
"f2af53dd073a09b1031d0032d28da35c82adc566",
"eb5a963a6f7b25533ddfb8915e70865d037bd156",
"c387917268455017aa0b28bed73aa6554044bbb3",
+ "dcae44fee010dbf7a107797a503923fd8b1abe2e",
+ "6c530622a025d872a642e8f950867884d7b136cb",
NULL
};
@@ -375,6 +377,22 @@ static void draw_graphics(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char ***sh
compare_hash(bmi, bits, sha1, "clipped dashed hlines r -> l");
memset(bits, 0xcc, dib_size);
+ for(i = 0; i < sizeof(vline_clips)/sizeof(vline_clips[0]); i++)
+ {
+ MoveToEx(hdc, vline_clips[i].left, vline_clips[i].top, NULL);
+ LineTo(hdc, vline_clips[i].right, vline_clips[i].bottom);
+ }
+ compare_hash(bmi, bits, sha1, "clipped dashed vlines");
+ memset(bits, 0xcc, dib_size);
+
+ for(i = 0; i < sizeof(vline_clips)/sizeof(vline_clips[0]); i++)
+ {
+ MoveToEx(hdc, vline_clips[i].right, vline_clips[i].bottom - 1, NULL);
+ LineTo(hdc, vline_clips[i].left, vline_clips[i].top - 1);
+ }
+ compare_hash(bmi, bits, sha1, "clipped dashed vlines b -> t");
+ memset(bits, 0xcc, dib_size);
+
ExtSelectClipRgn(hdc, NULL, RGN_COPY);
SelectObject(hdc, orig_brush);
More information about the wine-cvs
mailing list