gdiplus: Implemented GdipGetPathGradientRect with test.
This commit is contained in:
parent
ff870e0132
commit
74dc990bbf
@ -641,6 +641,51 @@ GpStatus WINGDIPAPI GdipGetPathGradientPointCount(GpPathGradient *grad,
|
|||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GpStatus WINGDIPAPI GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect)
|
||||||
|
{
|
||||||
|
GpRectF r;
|
||||||
|
GpPath* path;
|
||||||
|
GpStatus stat;
|
||||||
|
|
||||||
|
if(!brush || !rect)
|
||||||
|
return InvalidParameter;
|
||||||
|
|
||||||
|
stat = GdipCreatePath2(brush->pathdata.Points, brush->pathdata.Types,
|
||||||
|
brush->pathdata.Count, FillModeAlternate, &path);
|
||||||
|
if(stat != Ok) return stat;
|
||||||
|
|
||||||
|
stat = GdipGetPathWorldBounds(path, &r, NULL, NULL);
|
||||||
|
if(stat != Ok){
|
||||||
|
GdipDeletePath(path);
|
||||||
|
return stat;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(rect, &r, sizeof(GpRectF));
|
||||||
|
|
||||||
|
GdipDeletePath(path);
|
||||||
|
|
||||||
|
return Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
GpStatus WINGDIPAPI GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect)
|
||||||
|
{
|
||||||
|
GpRectF rectf;
|
||||||
|
GpStatus stat;
|
||||||
|
|
||||||
|
if(!brush || !rect)
|
||||||
|
return InvalidParameter;
|
||||||
|
|
||||||
|
stat = GdipGetPathGradientRect(brush, &rectf);
|
||||||
|
if(stat != Ok) return stat;
|
||||||
|
|
||||||
|
rect->X = roundr(rectf.X);
|
||||||
|
rect->Y = roundr(rectf.Y);
|
||||||
|
rect->Width = roundr(rectf.Width);
|
||||||
|
rect->Height = roundr(rectf.Height);
|
||||||
|
|
||||||
|
return Ok;
|
||||||
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient
|
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient
|
||||||
*grad, ARGB *argb, INT *count)
|
*grad, ARGB *argb, INT *count)
|
||||||
{
|
{
|
||||||
|
@ -336,8 +336,8 @@
|
|||||||
@ stdcall GdipGetPathGradientPointCount(ptr ptr)
|
@ stdcall GdipGetPathGradientPointCount(ptr ptr)
|
||||||
@ stub GdipGetPathGradientPresetBlend
|
@ stub GdipGetPathGradientPresetBlend
|
||||||
@ stub GdipGetPathGradientPresetBlendCount
|
@ stub GdipGetPathGradientPresetBlendCount
|
||||||
@ stub GdipGetPathGradientRect
|
@ stdcall GdipGetPathGradientRect(ptr ptr)
|
||||||
@ stub GdipGetPathGradientRectI
|
@ stdcall GdipGetPathGradientRectI(ptr ptr)
|
||||||
@ stub GdipGetPathGradientSurroundColorCount
|
@ stub GdipGetPathGradientSurroundColorCount
|
||||||
@ stdcall GdipGetPathGradientSurroundColorsWithCount(ptr ptr ptr)
|
@ stdcall GdipGetPathGradientSurroundColorsWithCount(ptr ptr ptr)
|
||||||
@ stub GdipGetPathGradientTransform
|
@ stub GdipGetPathGradientTransform
|
||||||
|
@ -115,6 +115,36 @@ static void test_getblend(void)
|
|||||||
GdipDeleteBrush((GpBrush*) brush);
|
GdipDeleteBrush((GpBrush*) brush);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GpPointF getbounds_ptf[] = {{0.0, 20.0},
|
||||||
|
{50.0, 50.0},
|
||||||
|
{21.0, 25.0},
|
||||||
|
{25.0, 46.0}};
|
||||||
|
static void test_getbounds(void)
|
||||||
|
{
|
||||||
|
GpStatus status;
|
||||||
|
GpPathGradient *brush;
|
||||||
|
GpRectF bounds;
|
||||||
|
|
||||||
|
status = GdipCreatePathGradient(getbounds_ptf, 4, WrapModeClamp, &brush);
|
||||||
|
expect(Ok, status);
|
||||||
|
|
||||||
|
status = GdipGetPathGradientRect(NULL, NULL);
|
||||||
|
expect(InvalidParameter, status);
|
||||||
|
status = GdipGetPathGradientRect(brush, NULL);
|
||||||
|
expect(InvalidParameter, status);
|
||||||
|
status = GdipGetPathGradientRect(NULL, &bounds);
|
||||||
|
expect(InvalidParameter, status);
|
||||||
|
|
||||||
|
status = GdipGetPathGradientRect(brush, &bounds);
|
||||||
|
expect(Ok, status);
|
||||||
|
expectf(0.0, bounds.X);
|
||||||
|
expectf(20.0, bounds.Y);
|
||||||
|
expectf(50.0, bounds.Width);
|
||||||
|
expectf(30.0, bounds.Height);
|
||||||
|
|
||||||
|
GdipDeleteBrush((GpBrush*) brush);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(brush)
|
START_TEST(brush)
|
||||||
{
|
{
|
||||||
struct GdiplusStartupInput gdiplusStartupInput;
|
struct GdiplusStartupInput gdiplusStartupInput;
|
||||||
@ -131,6 +161,7 @@ START_TEST(brush)
|
|||||||
test_type();
|
test_type();
|
||||||
test_gradientblendcount();
|
test_gradientblendcount();
|
||||||
test_getblend();
|
test_getblend();
|
||||||
|
test_getbounds();
|
||||||
|
|
||||||
GdiplusShutdown(gdiplusToken);
|
GdiplusShutdown(gdiplusToken);
|
||||||
}
|
}
|
||||||
|
@ -207,6 +207,8 @@ GpStatus WINGDIPAPI GdipGetPathGradientCenterPointI(GpPathGradient*,GpPoint*);
|
|||||||
GpStatus WINGDIPAPI GdipGetPathGradientFocusScales(GpPathGradient*,REAL*,REAL*);
|
GpStatus WINGDIPAPI GdipGetPathGradientFocusScales(GpPathGradient*,REAL*,REAL*);
|
||||||
GpStatus WINGDIPAPI GdipGetPathGradientGammaCorrection(GpPathGradient*,BOOL*);
|
GpStatus WINGDIPAPI GdipGetPathGradientGammaCorrection(GpPathGradient*,BOOL*);
|
||||||
GpStatus WINGDIPAPI GdipGetPathGradientPointCount(GpPathGradient*,INT*);
|
GpStatus WINGDIPAPI GdipGetPathGradientPointCount(GpPathGradient*,INT*);
|
||||||
|
GpStatus WINGDIPAPI GdipGetPathGradientRect(GpPathGradient*,GpRectF*);
|
||||||
|
GpStatus WINGDIPAPI GdipGetPathGradientRectI(GpPathGradient*,GpRect*);
|
||||||
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient*,
|
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient*,
|
||||||
ARGB*,INT*);
|
ARGB*,INT*);
|
||||||
GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient*,GpWrapMode*);
|
GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient*,GpWrapMode*);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user