gdiplus: Made Graphics calls check for busy state.
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 7bc0f03..bff1c86 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -908,6 +908,9 @@
if(!graphics || !pen || width <= 0 || height <= 0)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
num_pts = arc2polybezier(points, x, y, width, height, startAngle, sweepAngle);
save_state = prepare_dc(graphics, pen);
@@ -935,6 +938,9 @@
if(!graphics || !pen)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
pt[0].X = x1;
pt[0].Y = y1;
pt[1].X = x2;
@@ -963,6 +969,9 @@
if(!graphics || !pen)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
pt[0].X = x1;
pt[0].Y = y1;
pt[1].X = x2;
@@ -990,6 +999,9 @@
if(!graphics || !pen || !points || (count <= 0))
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
for(i = 0; i < floor(count / 4); i++){
ret = GdipDrawBezier(graphics, pen,
points[4*i].X, points[4*i].Y,
@@ -1013,6 +1025,9 @@
if(!graphics || !pen || !points || (count <= 0))
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
pts = GdipAlloc(sizeof(GpPointF) * count);
if(!pts)
return OutOfMemory;
@@ -1050,6 +1065,9 @@
if(!graphics || !pen || !points || count <= 0)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
/* make a full points copy.. */
ptf = GdipAlloc(sizeof(GpPointF)*(count+1));
if(!ptf)
@@ -1136,6 +1154,9 @@
if(!graphics || !pen)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
pt = GdipAlloc(len_pt * sizeof(GpPointF));
tension = tension * TENSION_CONST;
@@ -1211,6 +1232,9 @@
if(!graphics || !pen)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
ptf[0].X = x;
ptf[0].Y = y;
ptf[1].X = x + width;
@@ -1415,6 +1439,9 @@
if(!pen || !graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
pt[0].X = x1;
pt[0].Y = y1;
pt[1].X = x2;
@@ -1439,6 +1466,9 @@
if(!pen || !graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
pt[0].X = (REAL)x1;
pt[0].Y = (REAL)y1;
pt[1].X = (REAL)x2;
@@ -1462,6 +1492,9 @@
if(!pen || !graphics || (count < 2))
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
save_state = prepare_dc(graphics, pen);
retval = draw_polyline(graphics, pen, points, count, TRUE);
@@ -1482,6 +1515,9 @@
if(!pen || !graphics || (count < 2))
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
ptf = GdipAlloc(count * sizeof(GpPointF));
if(!ptf) return OutOfMemory;
@@ -1508,6 +1544,9 @@
if(!pen || !graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
save_state = prepare_dc(graphics, pen);
retval = draw_poly(graphics, pen, path->pathdata.Points,
@@ -1526,6 +1565,9 @@
if(!graphics || !pen)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
save_state = prepare_dc(graphics, pen);
SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH));
@@ -1552,6 +1594,9 @@
if(!pen || !graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
ptf[0].X = x;
ptf[0].Y = y;
ptf[1].X = x + width;
@@ -1588,6 +1633,9 @@
if(!graphics || !pen || !rects || count < 1)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
ptf = GdipAlloc(4 * count * sizeof(GpPointF));
pti = GdipAlloc(4 * count * sizeof(POINT));
@@ -1811,6 +1859,9 @@
if(!graphics || !brush || !points)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
stat = GdipCreatePath(fill, &path);
if(stat != Ok)
return stat;
@@ -1868,6 +1919,9 @@
if(!graphics || !brush)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
ptf[0].X = x;
ptf[0].Y = y;
ptf[1].X = x + width;
@@ -1901,6 +1955,9 @@
if(!brush || !graphics || !path)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
save_state = SaveDC(graphics->hdc);
EndPath(graphics->hdc);
SelectObject(graphics->hdc, brush->gdibrush);
@@ -1933,6 +1990,9 @@
if(!graphics || !brush)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
save_state = SaveDC(graphics->hdc);
EndPath(graphics->hdc);
SelectObject(graphics->hdc, brush->gdibrush);
@@ -1962,6 +2022,9 @@
if(!graphics || !brush || !points || !count)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
ptf = GdipAlloc(count * sizeof(GpPointF));
pti = GdipAlloc(count * sizeof(POINT));
if(!ptf || !pti){
@@ -2001,6 +2064,9 @@
if(!graphics || !brush || !points || !count)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
ptf = GdipAlloc(count * sizeof(GpPointF));
pti = GdipAlloc(count * sizeof(POINT));
if(!ptf || !pti){
@@ -2054,6 +2120,9 @@
if(!graphics || !brush)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
ptf[0].X = x;
ptf[0].Y = y;
ptf[1].X = x + width;
@@ -2087,6 +2156,9 @@
if(!graphics || !brush)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
ptf[0].X = x;
ptf[0].Y = y;
ptf[1].X = x + width;
@@ -2160,6 +2232,9 @@
if (!(graphics && brush && region))
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
FIXME("(%p, %p, %p): stub\n", graphics, brush, region);
return NotImplemented;
@@ -2172,6 +2247,9 @@
if(!graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
if(!(calls++))
FIXME("not implemented\n");
@@ -2185,6 +2263,9 @@
if(!graphics || !mode)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
*mode = graphics->compmode;
return Ok;
@@ -2197,6 +2278,9 @@
if(!graphics || !quality)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
*quality = graphics->compqual;
return Ok;
@@ -2209,6 +2293,9 @@
if(!graphics || !mode)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
*mode = graphics->interpolation;
return Ok;
@@ -2219,6 +2306,9 @@
if(!graphics || !scale)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
*scale = graphics->scale;
return Ok;
@@ -2229,6 +2319,9 @@
if(!graphics || !unit)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
*unit = graphics->unit;
return Ok;
@@ -2241,6 +2334,9 @@
if(!graphics || !mode)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
*mode = graphics->pixeloffset;
return Ok;
@@ -2252,6 +2348,9 @@
if(!graphics || !mode)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
*mode = graphics->smoothing;
return Ok;
@@ -2264,6 +2363,9 @@
if(!graphics || !hint)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
*hint = graphics->texthint;
return Ok;
@@ -2274,6 +2376,9 @@
if(!graphics || !matrix)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
*matrix = *graphics->worldtrans;
return Ok;
}
@@ -2405,6 +2510,9 @@
if(!graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
graphics->worldtrans->matrix[0] = 1.0;
graphics->worldtrans->matrix[1] = 0.0;
graphics->worldtrans->matrix[2] = 0.0;
@@ -2434,6 +2542,9 @@
if(!graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
return GdipRotateMatrix(graphics->worldtrans, angle, order);
}
@@ -2456,6 +2567,9 @@
if(!graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
return GdipScaleMatrix(graphics->worldtrans, sx, sy, order);
}
@@ -2465,6 +2579,9 @@
if(!graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
graphics->compmode = mode;
return Ok;
@@ -2476,6 +2593,9 @@
if(!graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
graphics->compqual = quality;
return Ok;
@@ -2487,6 +2607,9 @@
if(!graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
graphics->interpolation = mode;
return Ok;
@@ -2497,6 +2620,9 @@
if(!graphics || (scale <= 0.0))
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
graphics->scale = scale;
return Ok;
@@ -2504,7 +2630,13 @@
GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
{
- if(!graphics || (unit == UnitWorld))
+ if(!graphics)
+ return InvalidParameter;
+
+ if(graphics->busy)
+ return ObjectBusy;
+
+ if(unit == UnitWorld)
return InvalidParameter;
graphics->unit = unit;
@@ -2518,6 +2650,9 @@
if(!graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
graphics->pixeloffset = mode;
return Ok;
@@ -2528,6 +2663,9 @@
if(!graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
graphics->smoothing = mode;
return Ok;
@@ -2539,6 +2677,9 @@
if(!graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
graphics->texthint = hint;
return Ok;
@@ -2549,6 +2690,9 @@
if(!graphics || !matrix)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
GdipDeleteMatrix(graphics->worldtrans);
return GdipCloneMatrix(matrix, &graphics->worldtrans);
}
@@ -2559,6 +2703,9 @@
if(!graphics)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
return GdipTranslateMatrix(graphics->worldtrans, dx, dy, order);
}
@@ -2568,6 +2715,12 @@
{
static int calls;
+ if(!graphics)
+ return InvalidParameter;
+
+ if(graphics->busy)
+ return ObjectBusy;
+
if(!(calls++))
FIXME("not implemented\n");
@@ -2605,6 +2758,9 @@
if(!graphics || !pen || count<=0)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
pti = GdipAlloc(sizeof(POINT) * count);
save_state = prepare_dc(graphics, pen);
@@ -2645,6 +2801,9 @@
if(!graphics || !dpi)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
*dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSX);
return Ok;
@@ -2655,6 +2814,9 @@
if(!graphics || !dpi)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
*dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSY);
return Ok;
@@ -2669,6 +2831,9 @@
if(!graphics || !matrix)
return InvalidParameter;
+ if(graphics->busy)
+ return ObjectBusy;
+
m = *(graphics->worldtrans);
ret = GdipMultiplyMatrix(&m, (GpMatrix*)matrix, order);
@@ -2707,9 +2872,14 @@
GpStatus WINGDIPAPI GdipGetClip(GpGraphics *graphics, GpRegion *region)
{
- FIXME("(%p, %p): stub\n", graphics, region);
+ if(!graphics || !region)
+ return InvalidParameter;
- return NotImplemented;
+ if(graphics->busy)
+ return ObjectBusy;
+
+ FIXME("(%p, %p): stub\n", graphics, region);
+ return NotImplemented;
}
GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space,