Vincent Povirk : gdiplus: Fix rectangles of horizontal and vertical gradients.
Alexandre Julliard
julliard at winehq.org
Tue Aug 4 12:24:48 CDT 2009
Module: wine
Branch: master
Commit: ee74501102c530cda4d6bbd83a1bf44d6036f5a4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ee74501102c530cda4d6bbd83a1bf44d6036f5a4
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Mon Aug 3 09:02:49 2009 -0500
gdiplus: Fix rectangles of horizontal and vertical gradients.
---
dlls/gdiplus/brush.c | 11 +++++++++++
dlls/gdiplus/tests/brush.c | 8 ++++----
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c
index bb19e43..be4298e 100644
--- a/dlls/gdiplus/brush.c
+++ b/dlls/gdiplus/brush.c
@@ -261,6 +261,17 @@ GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF* startpoint,
(*line)->rect.Width = fabs(startpoint->X - endpoint->X);
(*line)->rect.Height = fabs(startpoint->Y - endpoint->Y);
+ if ((*line)->rect.Width == 0)
+ {
+ (*line)->rect.X -= (*line)->rect.Height / 2.0f;
+ (*line)->rect.Width = (*line)->rect.Height;
+ }
+ else if ((*line)->rect.Height == 0)
+ {
+ (*line)->rect.Y -= (*line)->rect.Width / 2.0f;
+ (*line)->rect.Height = (*line)->rect.Width;
+ }
+
(*line)->blendcount = 1;
(*line)->blendfac = GdipAlloc(sizeof(REAL));
(*line)->blendpos = GdipAlloc(sizeof(REAL));
diff --git a/dlls/gdiplus/tests/brush.c b/dlls/gdiplus/tests/brush.c
index 7993d60..e0515f4 100644
--- a/dlls/gdiplus/tests/brush.c
+++ b/dlls/gdiplus/tests/brush.c
@@ -310,9 +310,9 @@ static void test_gradientgetrect(void)
memset(&rectf, 0, sizeof(GpRectF));
status = GdipGetLineRect(brush, &rectf);
expect(Ok, status);
- todo_wine expectf(-5.0, rectf.X);
+ expectf(-5.0, rectf.X);
expectf(0.0, rectf.Y);
- todo_wine expectf(10.0, rectf.Width);
+ expectf(10.0, rectf.Width);
expectf(10.0, rectf.Height);
status = GdipDeleteBrush((GpBrush*)brush);
/* horizontal gradient */
@@ -324,9 +324,9 @@ static void test_gradientgetrect(void)
status = GdipGetLineRect(brush, &rectf);
expect(Ok, status);
expectf(0.0, rectf.X);
- todo_wine expectf(-5.0, rectf.Y);
+ expectf(-5.0, rectf.Y);
expectf(10.0, rectf.Width);
- todo_wine expectf(10.0, rectf.Height);
+ expectf(10.0, rectf.Height);
status = GdipDeleteBrush((GpBrush*)brush);
/* slope = -1 */
pt1.X = pt1.Y = 0.0;
More information about the wine-cvs
mailing list