Commit 2f26b02f authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

gdiplus: Add GdipGetPenCompoundArray implementation.

parent e2e8487b
......@@ -334,7 +334,7 @@
334 stdcall GdipGetPathWorldBoundsI(ptr ptr ptr ptr)
335 stdcall GdipGetPenBrushFill(ptr ptr)
336 stdcall GdipGetPenColor(ptr ptr)
337 stub GdipGetPenCompoundArray
337 stdcall GdipGetPenCompoundArray(ptr ptr long)
338 stdcall GdipGetPenCompoundCount(ptr ptr)
339 stdcall GdipGetPenCustomEndCap(ptr ptr)
340 stdcall GdipGetPenCustomStartCap(ptr ptr)
......
......@@ -526,6 +526,17 @@ GpStatus WINGDIPAPI GdipSetPenColor(GpPen *pen, ARGB argb)
return GdipSetSolidFillColor(((GpSolidFill*)pen->brush), argb);
}
GpStatus WINGDIPAPI GdipGetPenCompoundArray(GpPen *pen, REAL *compoundarray, INT count)
{
TRACE("(%p, %p, %i)\n", pen, compoundarray, count);
if (!pen || !compoundarray || count > pen->compound_array_size)
return InvalidParameter;
if (pen->compound_array && count > 0)
memcpy(compoundarray, pen->compound_array, count * sizeof(REAL));
return Ok;
}
GpStatus WINGDIPAPI GdipGetPenCompoundCount(GpPen *pen, INT *count)
{
TRACE("(%p, %p)\n", pen, count);
......
......@@ -350,6 +350,7 @@ static void test_compoundarray(void)
{
GpStatus status;
GpPen *pen;
REAL *returnvalues;
static const REAL testvalues[] = {0.2, 0.4, 0.6, 0.8};
static const REAL notSortedValues[] = {0.2, 0.6, 0.4, 0.8};
static const REAL negativeValues[] = {-1.2, 0.4, 0.6, 0.8};
......@@ -398,10 +399,29 @@ static void test_compoundarray(void)
count = 0;
status = GdipGetPenCompoundCount(pen, &count);
todo_wine {
expect(Ok, status);
ok(count == 4, "Unexpected compound count %d\n", count);
}
returnvalues = calloc(5, sizeof(REAL));
/* When count larger than stored array return error */
status = GdipGetPenCompoundArray(pen, returnvalues, 40);
expect(InvalidParameter, status);
status = GdipGetPenCompoundArray(NULL, returnvalues, 4);
expect(InvalidParameter, status);
/* When count is zero, it should do nothing */
status = GdipGetPenCompoundArray(pen, returnvalues, 0);
expect(Ok, status);
ok(returnvalues[0] == 0.0, "Unexpected compound array %f\n", returnvalues[0]);
status = GdipGetPenCompoundArray(pen, returnvalues, 4);
expect(Ok, status);
ok(memcmp(returnvalues, testvalues, 4 * sizeof(REAL)) == 0, "Unexpected compound array\n");
status = GdipGetPenCompoundArray(pen, returnvalues, -10);
expect(Ok, status);
ok(memcmp(returnvalues, testvalues, 4 * sizeof(REAL)) == 0, "Unexpected compound array\n");
free(returnvalues);
GdipDeletePen(pen);
}
......
......@@ -629,6 +629,7 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush*,REAL,GpUnit,GpPen**);
GpStatus WINGDIPAPI GdipDeletePen(GpPen*);
GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen*,GpBrush**);
GpStatus WINGDIPAPI GdipGetPenColor(GpPen*,ARGB*);
GpStatus WINGDIPAPI GdipGetPenCompoundArray(GpPen*,REAL*,INT);
GpStatus WINGDIPAPI GdipGetPenCompoundCount(GpPen*,INT*);
GpStatus WINGDIPAPI GdipGetPenCustomStartCap(GpPen*,GpCustomLineCap**);
GpStatus WINGDIPAPI GdipGetPenCustomEndCap(GpPen*,GpCustomLineCap**);
......
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