gdiplus: Fix brush transform created with GdipCreateLineBrushFromRect().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6906117bc3
commit
0937186f7d
|
@ -408,9 +408,7 @@ GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect,
|
|||
ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap,
|
||||
GpLineGradient **line)
|
||||
{
|
||||
GpPointF start, end;
|
||||
GpStatus stat;
|
||||
float far_x, far_y;
|
||||
float angle;
|
||||
|
||||
TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
|
||||
wrap, line);
|
||||
|
@ -418,45 +416,25 @@ GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect,
|
|||
if(!line || !rect)
|
||||
return InvalidParameter;
|
||||
|
||||
far_x = rect->X + rect->Width;
|
||||
far_y = rect->Y + rect->Height;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case LinearGradientModeHorizontal:
|
||||
start.X = min(rect->X, far_x);
|
||||
start.Y = rect->Y;
|
||||
end.X = max(rect->X, far_x);
|
||||
end.Y = rect->Y;
|
||||
angle = 0.0f;
|
||||
break;
|
||||
case LinearGradientModeVertical:
|
||||
start.X = rect->X;
|
||||
start.Y = min(rect->Y, far_y);
|
||||
end.X = rect->X;
|
||||
end.Y = max(rect->Y, far_y);
|
||||
angle = 90.0f;
|
||||
break;
|
||||
case LinearGradientModeForwardDiagonal:
|
||||
start.X = min(rect->X, far_x);
|
||||
start.Y = min(rect->Y, far_y);
|
||||
end.X = max(rect->X, far_x);
|
||||
end.Y = max(rect->Y, far_y);
|
||||
angle = 45.0f;
|
||||
break;
|
||||
case LinearGradientModeBackwardDiagonal:
|
||||
start.X = max(rect->X, far_x);
|
||||
start.Y = min(rect->Y, far_y);
|
||||
end.X = min(rect->X, far_x);
|
||||
end.Y = max(rect->Y, far_y);
|
||||
angle = 135.0f;
|
||||
break;
|
||||
default:
|
||||
return InvalidParameter;
|
||||
}
|
||||
|
||||
stat = GdipCreateLineBrush(&start, &end, startcolor, endcolor, wrap, line);
|
||||
|
||||
if (stat == Ok)
|
||||
(*line)->rect = *rect;
|
||||
|
||||
return stat;
|
||||
return GdipCreateLineBrushFromRectWithAngle(rect, startcolor, endcolor, angle, TRUE, wrap, line);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect,
|
||||
|
|
|
@ -764,15 +764,11 @@ static void test_gradientgetrect(void)
|
|||
|
||||
#define expectf2(expected, got) ok(fabs(expected - got) < 0.001, "%u: expected %.3f, got %.3f.\n", i, expected, got)
|
||||
expectf2(create_from_rect[i].transform[0], elements[0]);
|
||||
todo_wine_if(create_from_rect[i].mode == LinearGradientModeVertical) {
|
||||
expectf2(create_from_rect[i].transform[1], elements[1]);
|
||||
expectf2(create_from_rect[i].transform[2], elements[2]);
|
||||
}
|
||||
expectf2(create_from_rect[i].transform[3], elements[3]);
|
||||
todo_wine_if(create_from_rect[i].mode == LinearGradientModeVertical) {
|
||||
expectf2(create_from_rect[i].transform[4], elements[4]);
|
||||
expectf2(create_from_rect[i].transform[5], elements[5]);
|
||||
}
|
||||
#undef expectf2
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue