From 95e25df61d01762c530263f3bbe7f4a47efa57c4 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Mon, 3 Aug 2009 09:02:49 -0500 Subject: [PATCH] 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; -- 1.5.4.3