mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[0.4.9][GDIPLUS] Fix a regression painting gradient CORE-15479
patch is import of Wine commit 0937186f7d15fed60f77fa2014d650f4d0b6b20b by Nikolay Sivov regression was introduced by SVN r75872 == git 0.4.7-dev-344-gc6f32e4a5f
fix cherry picked from 0.4.12-dev-360-gdaadcc6141
This commit is contained in:
parent
2b20379851
commit
d172937b63
1 changed files with 37 additions and 36 deletions
|
@ -428,8 +428,8 @@ GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect,
|
||||||
GpLineGradient **line)
|
GpLineGradient **line)
|
||||||
{
|
{
|
||||||
GpPointF start, end;
|
GpPointF start, end;
|
||||||
|
float far_x, angle;
|
||||||
GpStatus stat;
|
GpStatus stat;
|
||||||
float far_x, far_y;
|
|
||||||
|
|
||||||
TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
|
TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
|
||||||
wrap, line);
|
wrap, line);
|
||||||
|
@ -437,45 +437,33 @@ GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect,
|
||||||
if(!line || !rect)
|
if(!line || !rect)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
far_x = rect->X + rect->Width;
|
|
||||||
far_y = rect->Y + rect->Height;
|
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
case LinearGradientModeVertical:
|
||||||
|
angle = 90.0f;
|
||||||
|
break;
|
||||||
|
case LinearGradientModeForwardDiagonal:
|
||||||
|
angle = 45.0f;
|
||||||
|
break;
|
||||||
|
case LinearGradientModeBackwardDiagonal:
|
||||||
|
angle = 135.0f;
|
||||||
|
break;
|
||||||
case LinearGradientModeHorizontal:
|
case LinearGradientModeHorizontal:
|
||||||
|
far_x = rect->X + rect->Width;
|
||||||
|
|
||||||
start.X = min(rect->X, far_x);
|
start.X = min(rect->X, far_x);
|
||||||
start.Y = rect->Y;
|
start.Y = rect->Y;
|
||||||
end.X = max(rect->X, far_x);
|
end.X = max(rect->X, far_x);
|
||||||
end.Y = rect->Y;
|
end.Y = rect->Y;
|
||||||
break;
|
stat = GdipCreateLineBrush(&start, &end, startcolor, endcolor, wrap, line);
|
||||||
case LinearGradientModeVertical:
|
if (stat == Ok)
|
||||||
start.X = rect->X;
|
(*line)->rect = *rect;
|
||||||
start.Y = min(rect->Y, far_y);
|
return stat;
|
||||||
end.X = rect->X;
|
|
||||||
end.Y = max(rect->Y, far_y);
|
|
||||||
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);
|
|
||||||
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);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
stat = GdipCreateLineBrush(&start, &end, startcolor, endcolor, wrap, line);
|
return GdipCreateLineBrushFromRectWithAngle(rect, startcolor, endcolor, angle, TRUE, wrap, line);
|
||||||
|
|
||||||
if (stat == Ok)
|
|
||||||
(*line)->rect = *rect;
|
|
||||||
|
|
||||||
return stat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect,
|
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect,
|
||||||
|
@ -503,9 +491,9 @@ GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect
|
||||||
GpLineGradient **line)
|
GpLineGradient **line)
|
||||||
{
|
{
|
||||||
GpStatus stat;
|
GpStatus stat;
|
||||||
LinearGradientMode mode;
|
REAL exofs, eyofs, far_x, far_y;
|
||||||
REAL exofs, eyofs;
|
|
||||||
REAL sin_angle, cos_angle, sin_cos_angle;
|
REAL sin_angle, cos_angle, sin_cos_angle;
|
||||||
|
GpPointF start, end;
|
||||||
|
|
||||||
TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
|
TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
|
||||||
wrap, line);
|
wrap, line);
|
||||||
|
@ -544,12 +532,25 @@ GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect
|
||||||
cos_angle = cosf(angle);
|
cos_angle = cosf(angle);
|
||||||
sin_cos_angle = sin_angle * cos_angle;
|
sin_cos_angle = sin_angle * cos_angle;
|
||||||
|
|
||||||
if (sin_cos_angle >= 0)
|
far_x = rect->X + rect->Width;
|
||||||
mode = LinearGradientModeForwardDiagonal;
|
far_y = rect->Y + rect->Height;
|
||||||
else
|
|
||||||
mode = LinearGradientModeBackwardDiagonal;
|
|
||||||
|
|
||||||
stat = GdipCreateLineBrushFromRect(rect, startcolor, endcolor, mode, wrap, line);
|
if (sin_cos_angle >= 0)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
stat = GdipCreateLineBrush(&start, &end, startcolor, endcolor, wrap, line);
|
||||||
|
|
||||||
if (stat == Ok)
|
if (stat == Ok)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue