gdiplus: Use FromRect constructor in LinearGradientBrush deserialization.

Signed-off-by: Shawn M. Chapla <schapla@codeweavers.com>
Signed-off-by: Esme Povirk <esme@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Shawn M. Chapla 2020-07-22 23:08:12 -04:00 committed by Alexandre Julliard
parent 6c787852c4
commit d3de57c2b3
2 changed files with 10 additions and 9 deletions

View File

@ -2202,7 +2202,7 @@ static GpStatus metafile_deserialize_brush(const BYTE *record_data, UINT data_si
case BrushTypeLinearGradient:
{
GpLineGradient *gradient = NULL;
GpPointF startpoint, endpoint;
GpRectF rect;
UINT position_count = 0;
offset = header_size + FIELD_OFFSET(EmfPlusLinearGradientBrushData, OptionalData);
@ -2240,13 +2240,14 @@ static GpStatus metafile_deserialize_brush(const BYTE *record_data, UINT data_si
return InvalidParameter;
}
startpoint.X = data->BrushData.lineargradient.RectF.X;
startpoint.Y = data->BrushData.lineargradient.RectF.Y;
endpoint.X = startpoint.X + data->BrushData.lineargradient.RectF.Width;
endpoint.Y = startpoint.Y + data->BrushData.lineargradient.RectF.Height;
rect.X = data->BrushData.lineargradient.RectF.X;
rect.Y = data->BrushData.lineargradient.RectF.Y;
rect.Width = data->BrushData.lineargradient.RectF.Width;
rect.Height = data->BrushData.lineargradient.RectF.Height;
status = GdipCreateLineBrush(&startpoint, &endpoint, data->BrushData.lineargradient.StartColor,
data->BrushData.lineargradient.EndColor, data->BrushData.lineargradient.WrapMode, &gradient);
status = GdipCreateLineBrushFromRect(&rect, data->BrushData.lineargradient.StartColor,
data->BrushData.lineargradient.EndColor, LinearGradientModeHorizontal,
data->BrushData.lineargradient.WrapMode, &gradient);
if (status == Ok)
{
if (transform)

View File

@ -3377,7 +3377,7 @@ static void test_lineargradient(void)
stat = GdipBitmapGetPixel(bitmap, 18, 10, &color);
expect(Ok, stat);
todo_wine expect(0xff990066, color);
expect(0xff990066, color);
/* Verify vertical gradient fill. */
stat = GdipBitmapGetPixel(bitmap, 50, 10, &color);
@ -3395,7 +3395,7 @@ static void test_lineargradient(void)
stat = GdipBitmapGetPixel(bitmap, 18, 50, &color);
expect(Ok, stat);
todo_wine expect(0xff4700b8, color);
expect(0xff4700b8, color);
/* Verify preset color gradient fill. */
stat = GdipBitmapGetPixel(bitmap, 50, 50, &color);