Commit 74dc990b authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdiplus: Implemented GdipGetPathGradientRect with test.

parent ff870e01
......@@ -641,6 +641,51 @@ GpStatus WINGDIPAPI GdipGetPathGradientPointCount(GpPathGradient *grad,
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
*grad, ARGB *argb, INT *count)
{
......
......@@ -336,8 +336,8 @@
@ stdcall GdipGetPathGradientPointCount(ptr ptr)
@ stub GdipGetPathGradientPresetBlend
@ stub GdipGetPathGradientPresetBlendCount
@ stub GdipGetPathGradientRect
@ stub GdipGetPathGradientRectI
@ stdcall GdipGetPathGradientRect(ptr ptr)
@ stdcall GdipGetPathGradientRectI(ptr ptr)
@ stub GdipGetPathGradientSurroundColorCount
@ stdcall GdipGetPathGradientSurroundColorsWithCount(ptr ptr ptr)
@ stub GdipGetPathGradientTransform
......
......@@ -115,6 +115,36 @@ static void test_getblend(void)
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)
{
struct GdiplusStartupInput gdiplusStartupInput;
......@@ -131,6 +161,7 @@ START_TEST(brush)
test_type();
test_gradientblendcount();
test_getblend();
test_getbounds();
GdiplusShutdown(gdiplusToken);
}
......@@ -207,6 +207,8 @@ GpStatus WINGDIPAPI GdipGetPathGradientCenterPointI(GpPathGradient*,GpPoint*);
GpStatus WINGDIPAPI GdipGetPathGradientFocusScales(GpPathGradient*,REAL*,REAL*);
GpStatus WINGDIPAPI GdipGetPathGradientGammaCorrection(GpPathGradient*,BOOL*);
GpStatus WINGDIPAPI GdipGetPathGradientPointCount(GpPathGradient*,INT*);
GpStatus WINGDIPAPI GdipGetPathGradientRect(GpPathGradient*,GpRectF*);
GpStatus WINGDIPAPI GdipGetPathGradientRectI(GpPathGradient*,GpRect*);
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient*,
ARGB*,INT*);
GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient*,GpWrapMode*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment