gdiplus: Fix rectangles of horizontal and vertical gradients.

This commit is contained in:
Vincent Povirk 2009-08-03 09:02:49 -05:00 committed by Alexandre Julliard
parent b05ebca618
commit ee74501102
2 changed files with 15 additions and 4 deletions

View File

@ -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));

View File

@ -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;