From: Bartosz Kosiorek gang65@poczta.onet.pl
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=52196 --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/pen.c | 14 +++++++++++++- dlls/gdiplus/tests/pen.c | 22 +++++++++++++++++++--- include/gdiplusflat.h | 1 + 4 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 15d9b5d81e8..d4545abf319 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -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) diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c index 99eefdced6d..1d05c4b0da0 100644 --- a/dlls/gdiplus/pen.c +++ b/dlls/gdiplus/pen.c @@ -195,7 +195,8 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen) { TRACE("(%p)\n", pen);
- if(!pen) return InvalidParameter; + if(!pen) + return InvalidParameter;
GdipDeleteBrush(pen->brush); GdipDeleteCustomLineCap(pen->customstart); @@ -526,6 +527,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) + memcpy(compoundarray, pen->compound_array, count * sizeof(REAL)); + return Ok; +} + GpStatus WINGDIPAPI GdipGetPenCompoundCount(GpPen *pen, INT *count) { TRACE("(%p, %p)\n", pen, count); diff --git a/dlls/gdiplus/tests/pen.c b/dlls/gdiplus/tests/pen.c index 545e27aa9b2..ca977e7e9dc 100644 --- a/dlls/gdiplus/tests/pen.c +++ b/dlls/gdiplus/tests/pen.c @@ -350,9 +350,10 @@ 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, 2.8}; + static const REAL negativeValues[] = {-1.2, 0.4, 0.6, 0.8}; static const REAL tooLargeValues[] = {0.2, 0.4, 0.6, 2.8}; INT count;
@@ -398,10 +399,25 @@ 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, "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"); + + free(returnvalues); GdipDeletePen(pen); }
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 5c9600ed30b..10f4d435a85 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -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**);