gdiplus: Allow more drawing operations to succeed without an HDC.

This should bring things to the mostly-regression-free-but-easier-to-debug
state I was expecting when I removed DIBs from many bitmaps.
This commit is contained in:
Vincent Povirk 2010-11-09 14:09:11 -06:00 committed by Alexandre Julliard
parent 6c1f2e4f3f
commit 8f1b722790
1 changed files with 85 additions and 6 deletions

View File

@ -98,11 +98,6 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
GpPointF pt[2]; GpPointF pt[2];
DWORD dash_array[MAX_DASHLEN]; DWORD dash_array[MAX_DASHLEN];
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
}
save_state = SaveDC(graphics->hdc); save_state = SaveDC(graphics->hdc);
EndPath(graphics->hdc); EndPath(graphics->hdc);
@ -1504,6 +1499,12 @@ GpStatus WINGDIPAPI GdipDrawArc(GpGraphics *graphics, GpPen *pen, REAL x,
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
num_pts = arc2polybezier(points, x, y, width, height, startAngle, sweepAngle); num_pts = arc2polybezier(points, x, y, width, height, startAngle, sweepAngle);
save_state = prepare_dc(graphics, pen); save_state = prepare_dc(graphics, pen);
@ -1540,6 +1541,12 @@ GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics *graphics, GpPen *pen, REAL x1,
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
pt[0].X = x1; pt[0].X = x1;
pt[0].Y = y1; pt[0].Y = y1;
pt[1].X = x2; pt[1].X = x2;
@ -1574,6 +1581,12 @@ GpStatus WINGDIPAPI GdipDrawBezierI(GpGraphics *graphics, GpPen *pen, INT x1,
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
pt[0].X = x1; pt[0].X = x1;
pt[0].Y = y1; pt[0].Y = y1;
pt[1].X = x2; pt[1].X = x2;
@ -1780,6 +1793,12 @@ GpStatus WINGDIPAPI GdipDrawCurve2(GpGraphics *graphics, GpPen *pen,
if(count < 2) if(count < 2)
return InvalidParameter; return InvalidParameter;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
pt = GdipAlloc(len_pt * sizeof(GpPointF)); pt = GdipAlloc(len_pt * sizeof(GpPointF));
if(!pt) if(!pt)
return OutOfMemory; return OutOfMemory;
@ -1895,6 +1914,12 @@ GpStatus WINGDIPAPI GdipDrawEllipse(GpGraphics *graphics, GpPen *pen, REAL x,
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
ptf[0].X = x; ptf[0].X = x;
ptf[0].Y = y; ptf[0].Y = y;
ptf[1].X = x + width; ptf[1].X = x + width;
@ -2447,6 +2472,12 @@ GpStatus WINGDIPAPI GdipDrawLine(GpGraphics *graphics, GpPen *pen, REAL x1,
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
pt[0].X = x1; pt[0].X = x1;
pt[0].Y = y1; pt[0].Y = y1;
pt[1].X = x2; pt[1].X = x2;
@ -2476,6 +2507,12 @@ GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1,
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
pt[0].X = (REAL)x1; pt[0].X = (REAL)x1;
pt[0].Y = (REAL)y1; pt[0].Y = (REAL)y1;
pt[1].X = (REAL)x2; pt[1].X = (REAL)x2;
@ -2504,6 +2541,12 @@ GpStatus WINGDIPAPI GdipDrawLines(GpGraphics *graphics, GpPen *pen, GDIPCONST
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
save_state = prepare_dc(graphics, pen); save_state = prepare_dc(graphics, pen);
retval = draw_polyline(graphics, pen, points, count, TRUE); retval = draw_polyline(graphics, pen, points, count, TRUE);
@ -2529,6 +2572,12 @@ GpStatus WINGDIPAPI GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
ptf = GdipAlloc(count * sizeof(GpPointF)); ptf = GdipAlloc(count * sizeof(GpPointF));
if(!ptf) return OutOfMemory; if(!ptf) return OutOfMemory;
@ -2560,6 +2609,12 @@ GpStatus WINGDIPAPI GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path)
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
save_state = prepare_dc(graphics, pen); save_state = prepare_dc(graphics, pen);
retval = draw_poly(graphics, pen, path->pathdata.Points, retval = draw_poly(graphics, pen, path->pathdata.Points,
@ -2584,6 +2639,12 @@ GpStatus WINGDIPAPI GdipDrawPie(GpGraphics *graphics, GpPen *pen, REAL x,
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
save_state = prepare_dc(graphics, pen); save_state = prepare_dc(graphics, pen);
SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH)); SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH));
@ -2618,6 +2679,12 @@ GpStatus WINGDIPAPI GdipDrawRectangle(GpGraphics *graphics, GpPen *pen, REAL x,
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
ptf[0].X = x; ptf[0].X = x;
ptf[0].Y = y; ptf[0].Y = y;
ptf[1].X = x + width; ptf[1].X = x + width;
@ -2661,6 +2728,12 @@ GpStatus WINGDIPAPI GdipDrawRectangles(GpGraphics *graphics, GpPen *pen,
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
ptf = GdipAlloc(4 * count * sizeof(GpPointF)); ptf = GdipAlloc(4 * count * sizeof(GpPointF));
pti = GdipAlloc(4 * count * sizeof(POINT)); pti = GdipAlloc(4 * count * sizeof(POINT));
@ -4015,7 +4088,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
if(!graphics->hdc) if(!graphics->hdc)
{ {
FIXME("graphics object has no HDC\n"); FIXME("graphics object has no HDC\n");
return NotImplemented; return Ok;
} }
if(format){ if(format){
@ -4581,6 +4654,12 @@ GpStatus WINGDIPAPI GdipDrawPolygon(GpGraphics *graphics,GpPen *pen,GDIPCONST Gp
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
return Ok;
}
pti = GdipAlloc(sizeof(POINT) * count); pti = GdipAlloc(sizeof(POINT) * count);
save_state = prepare_dc(graphics, pen); save_state = prepare_dc(graphics, pen);