Commit ee745011 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Fix rectangles of horizontal and vertical gradients.

parent b05ebca6
......@@ -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));
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment