gdiplus: Implemented GdipGetCustomLineCapWidthScale with some tests.

This commit is contained in:
Nikolay Sivov 2008-07-26 12:48:16 +04:00 committed by Alexandre Julliard
parent 6c6e8f489e
commit ce2aee4859
5 changed files with 48 additions and 1 deletions

View File

@ -101,6 +101,7 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath
(*customCap)->inset = baseInset;
(*customCap)->cap = baseCap;
(*customCap)->join = LineJoinMiter;
(*customCap)->scale = 1.0;
return Ok;
}
@ -128,6 +129,17 @@ GpStatus WINGDIPAPI GdipGetCustomLineCapStrokeJoin(GpCustomLineCap* customCap,
return Ok;
}
GpStatus WINGDIPAPI GdipGetCustomLineCapWidthScale(GpCustomLineCap* custom,
REAL* widthScale)
{
if(!custom || !widthScale)
return InvalidParameter;
*widthScale = custom->scale;
return Ok;
}
GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeCaps(GpCustomLineCap* custom,
GpLineCap start, GpLineCap end)
{

View File

@ -254,7 +254,7 @@
@ stub GdipGetCustomLineCapStrokeCaps
@ stdcall GdipGetCustomLineCapStrokeJoin(ptr ptr)
@ stub GdipGetCustomLineCapType
@ stub GdipGetCustomLineCapWidthScale
@ stdcall GdipGetCustomLineCapWidthScale(ptr ptr)
@ stdcall GdipGetDC(ptr ptr)
@ stdcall GdipGetDpiX(ptr ptr)
@ stdcall GdipGetDpiY(ptr ptr)

View File

@ -150,6 +150,7 @@ struct GpCustomLineCap{
GpLineCap cap; /* as far as I can tell, this value is ignored */
REAL inset; /* how much to adjust the end of the line */
GpLineJoin join;
REAL scale;
};
struct GpImage{

View File

@ -149,6 +149,38 @@ static void test_inset(void)
GdipDeletePath(path);
}
static void test_scale(void)
{
GpCustomLineCap *custom;
GpPath *path;
REAL scale;
GpStatus stat;
stat = GdipCreatePath(FillModeAlternate, &path);
expect(Ok, stat);
stat = GdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
expect(Ok, stat);
stat = GdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, &custom);
expect(Ok, stat);
/* NULL args */
stat = GdipGetCustomLineCapWidthScale(NULL, NULL);
expect(InvalidParameter, stat);
stat = GdipGetCustomLineCapWidthScale(NULL, &scale);
expect(InvalidParameter, stat);
stat = GdipGetCustomLineCapWidthScale(custom, NULL);
expect(InvalidParameter, stat);
/* valid args */
scale = (REAL)0xdeadbeef;
stat = GdipGetCustomLineCapWidthScale(custom, &scale);
expect(Ok, stat);
expectf(1.0, scale);
GdipDeleteCustomLineCap(custom);
GdipDeletePath(path);
}
START_TEST(customlinecap)
{
struct GdiplusStartupInput gdiplusStartupInput;
@ -164,6 +196,7 @@ START_TEST(customlinecap)
test_constructor_destructor();
test_linejoin();
test_inset();
test_scale();
GdiplusShutdown(gdiplusToken);
}

View File

@ -329,6 +329,7 @@ GpStatus WINGDIPAPI GdipGetCustomLineCapBaseCap(GpCustomLineCap*,GpLineCap*);
GpStatus WINGDIPAPI GdipGetCustomLineCapBaseInset(GpCustomLineCap*,REAL*);
GpStatus WINGDIPAPI GdipGetCustomLineCapStrokeJoin(GpCustomLineCap*,GpLineJoin*);
GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeJoin(GpCustomLineCap*,GpLineJoin);
GpStatus WINGDIPAPI GdipGetCustomLineCapWidthScale(GpCustomLineCap*,REAL*);
GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap*,INT,INT,ARGB*);
GpStatus WINGDIPAPI GdipBitmapSetPixel(GpBitmap*,INT,INT,ARGB);