Commit 9d5d4dba authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

gdiplus: Add GdipSetPenCompoundArray implementation.

parent 4e734f48
......@@ -235,6 +235,8 @@ struct GpPen{
GpBrush *brush;
GpPenAlignment align;
GpMatrix transform;
REAL *compound_array;
INT compound_array_size;
};
struct GpGraphics{
......
......@@ -2356,6 +2356,9 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix,
if (pen->align != PenAlignmentCenter)
FIXME("unimplemented pen alignment %d\n", pen->align);
if (pen->compound_array_size != 0)
FIXME("unimplemented pen compoundline. Solid line will be drawn instead: %d\n", pen->compound_array_size);
for (i=0; i < flat_path->pathdata.Count; i++)
{
if ((types[i]&PathPointTypePathTypeMask) == PathPointTypeStart)
......
......@@ -171,6 +171,8 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
gp_pen->offset = 0.0;
gp_pen->customstart = NULL;
gp_pen->customend = NULL;
gp_pen->compound_array = NULL;
gp_pen->compound_array_size = 0;
GdipSetMatrixElements(&gp_pen->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) {
......@@ -198,6 +200,7 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
GdipDeleteBrush(pen->brush);
GdipDeleteCustomLineCap(pen->customstart);
GdipDeleteCustomLineCap(pen->customend);
heap_free(pen->compound_array);
heap_free(pen->dashes);
heap_free(pen);
......@@ -533,15 +536,30 @@ GpStatus WINGDIPAPI GdipGetPenCompoundCount(GpPen *pen, INT *count)
return NotImplemented;
}
GpStatus WINGDIPAPI GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *dash,
GpStatus WINGDIPAPI GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *compoundarray,
INT count)
{
FIXME("(%p, %p, %i): stub\n", pen, dash, count);
INT i;
REAL *tmp;
TRACE("(%p, %p, %i)\n", pen, compoundarray, count);
if (!pen || !dash || count < 2 || count%2 == 1)
if(!pen || !compoundarray || count < 2 || count%2 == 1 || *compoundarray < 0.0 || *compoundarray > 1.0)
return InvalidParameter;
return NotImplemented;
for(i = 1; i<count; i++)
{
if((compoundarray[i] < compoundarray[i - 1]) || (compoundarray[i] > 1.0))
return InvalidParameter;
}
tmp = heap_alloc_zero(count * sizeof(REAL));
if(!tmp)
return OutOfMemory;
heap_free(pen->compound_array);
pen->compound_array = tmp;
memcpy(pen->compound_array, compoundarray, count * sizeof(REAL));
pen->compound_array_size = count;
return Ok;
}
GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap)
......
......@@ -351,6 +351,9 @@ static void test_compoundarray(void)
GpStatus status;
GpPen *pen;
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};
static const REAL tooLargeValues[] = {0.2, 0.4, 0.6, 2.8};
INT count;
status = GdipSetPenCompoundArray(NULL, testvalues, 4);
......@@ -382,8 +385,15 @@ todo_wine {
status = GdipSetPenCompoundArray(pen, testvalues, -2);
expect(InvalidParameter, status);
status = GdipSetPenCompoundArray(pen, notSortedValues, 4);
expect(InvalidParameter, status);
status = GdipSetPenCompoundArray(pen, negativeValues, 4);
expect(InvalidParameter, status);
status = GdipSetPenCompoundArray(pen, tooLargeValues, 4);
expect(InvalidParameter, status);
status = GdipSetPenCompoundArray(pen, testvalues, 4);
todo_wine expect(Ok, status);
expect(Ok, status);
status = GdipSetPenCompoundArray(pen, NULL, 0);
expect(InvalidParameter, status);
......
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