Commit ffd4bb25 authored by Jeff Smith's avatar Jeff Smith Committed by Alexandre Julliard

gdiplus: Each pen dash array element must be greater than zero.

parent 843e8e07
......@@ -598,13 +598,10 @@ GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
for(i = 0; i < count; i++){
sum += dash[i];
if(dash[i] < 0.0)
if(dash[i] <= 0.0)
return InvalidParameter;
}
if(sum == 0.0 && count)
return InvalidParameter;
heap_free(pen->dashes);
pen->dashes = NULL;
......
......@@ -175,7 +175,7 @@ static void test_dasharray(void)
dashes[4] = 14.0;
dashes[5] = -100.0;
dashes[6] = -100.0;
dashes[7] = dashes[8] = dashes[9] = dashes[10] = dashes[11] = 0.0;
dashes[7] = dashes[8] = dashes[9] = dashes[10] = dashes[11] = 1.0;
/* setting the array sets the type to custom */
GdipGetPenDashStyle(pen, &style);
......@@ -218,10 +218,13 @@ static void test_dasharray(void)
/* Some invalid array values. */
status = GdipSetPenDashArray(pen, &dashes[7], 5);
expect(InvalidParameter, status);
expect(Ok, status);
dashes[9] = -1.0;
status = GdipSetPenDashArray(pen, &dashes[7], 5);
expect(InvalidParameter, status);
dashes[9] = 0.0;
status = GdipSetPenDashArray(pen, &dashes[7], 5);
expect(InvalidParameter, status);
/* Try to set with count = 0. */
GdipSetPenDashStyle(pen, DashStyleDot);
......
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