gdiplus: Implement GdipGetPathGradientBlend with basic tests.

This commit is contained in:
Nikolay Sivov 2008-07-21 23:30:50 +04:00 committed by Alexandre Julliard
parent 01abb3d1dc
commit 48e914b519
4 changed files with 56 additions and 1 deletions

View File

@ -549,6 +549,23 @@ GpStatus WINGDIPAPI GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapm
return Ok;
}
GpStatus WINGDIPAPI GdipGetPathGradientBlend(GpPathGradient *brush, REAL *blend,
REAL *positions, INT count)
{
if(!brush || !blend || !positions || count <= 0)
return InvalidParameter;
if(count < brush->blendcount)
return InsufficientBuffer;
memcpy(blend, brush->blendfac, count*sizeof(REAL));
if(brush->blendcount > 1){
memcpy(positions, brush->blendpos, count*sizeof(REAL));
}
return Ok;
}
GpStatus WINGDIPAPI GdipGetPathGradientBlendCount(GpPathGradient *brush, INT *count)
{
if(!brush || !count)

View File

@ -325,7 +325,7 @@
@ stdcall GdipGetPageUnit(ptr ptr)
@ stdcall GdipGetPathData(ptr ptr)
@ stdcall GdipGetPathFillMode(ptr ptr)
@ stub GdipGetPathGradientBlend
@ stdcall GdipGetPathGradientBlend(ptr ptr ptr long)
@ stdcall GdipGetPathGradientBlendCount(ptr ptr)
@ stub GdipGetPathGradientCenterColor
@ stdcall GdipGetPathGradientCenterPoint(ptr ptr)

View File

@ -21,8 +21,10 @@
#include "windows.h"
#include "gdiplus.h"
#include "wine/test.h"
#include <math.h>
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
static void test_constructor_destructor(void)
{
@ -79,6 +81,40 @@ static void test_gradientblendcount(void)
GdipDeleteBrush((GpBrush*) brush);
}
static GpPointF getblend_ptf[] = {{0.0, 0.0},
{50.0, 50.0}};
static void test_getblend(void)
{
GpStatus status;
GpPathGradient *brush;
REAL blends[4];
REAL pos[4];
status = GdipCreatePathGradient(getblend_ptf, 2, WrapModeClamp, &brush);
expect(Ok, status);
/* check some invalid parameters combinations */
status = GdipGetPathGradientBlend(NULL, NULL, NULL, -1);
expect(InvalidParameter, status);
status = GdipGetPathGradientBlend(brush,NULL, NULL, -1);
expect(InvalidParameter, status);
status = GdipGetPathGradientBlend(NULL, blends,NULL, -1);
expect(InvalidParameter, status);
status = GdipGetPathGradientBlend(NULL, NULL, pos, -1);
expect(InvalidParameter, status);
status = GdipGetPathGradientBlend(NULL, NULL, NULL, 1);
expect(InvalidParameter, status);
blends[0] = (REAL)0xdeadbeef;
pos[0] = (REAL)0xdeadbeef;
status = GdipGetPathGradientBlend(brush, blends, pos, 1);
expect(Ok, status);
expectf(1.0, blends[0]);
expectf((REAL)0xdeadbeef, pos[0]);
GdipDeleteBrush((GpBrush*) brush);
}
START_TEST(brush)
{
struct GdiplusStartupInput gdiplusStartupInput;
@ -94,6 +130,7 @@ START_TEST(brush)
test_constructor_destructor();
test_type();
test_gradientblendcount();
test_getblend();
GdiplusShutdown(gdiplusToken);
}

View File

@ -199,6 +199,7 @@ GpStatus WINGDIPAPI GdipGetLineWrapMode(GpLineGradient*,GpWrapMode*);
GpStatus WINGDIPAPI GdipGetLineRect(GpLineGradient*,GpRectF*);
GpStatus WINGDIPAPI GdipGetLineRectI(GpLineGradient*,GpRect*);
GpStatus WINGDIPAPI GdipGetLineColors(GpLineGradient*,ARGB*);
GpStatus WINGDIPAPI GdipGetPathGradientBlend(GpPathGradient*,REAL*,REAL*,INT);
GpStatus WINGDIPAPI GdipGetPathGradientBlendCount(GpPathGradient*,INT*);
GpStatus WINGDIPAPI GdipGetPathGradientCenterColor(GpPathGradient*,ARGB*);
GpStatus WINGDIPAPI GdipGetPathGradientCenterPoint(GpPathGradient*,GpPointF*);