Vincent Povirk : gdiplus: Allow more drawing operations to succeed without an HDC.
Alexandre Julliard
julliard at winehq.org
Wed Nov 10 11:09:43 CST 2010
Module: wine
Branch: master
Commit: 8f1b72279030d60e9c11362bf8a9de420851191c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8f1b72279030d60e9c11362bf8a9de420851191c
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Tue Nov 9 14:09:11 2010 -0600
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.
---
dlls/gdiplus/graphics.c | 91 +++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 85 insertions(+), 6 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 5ec54ad..e85a8ba 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -98,11 +98,6 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
GpPointF pt[2];
DWORD dash_array[MAX_DASHLEN];
- if (!graphics->hdc)
- {
- FIXME("graphics object has no HDC\n");
- }
-
save_state = SaveDC(graphics->hdc);
EndPath(graphics->hdc);
@@ -1504,6 +1499,12 @@ GpStatus WINGDIPAPI GdipDrawArc(GpGraphics *graphics, GpPen *pen, REAL x,
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
num_pts = arc2polybezier(points, x, y, width, height, startAngle, sweepAngle);
save_state = prepare_dc(graphics, pen);
@@ -1540,6 +1541,12 @@ GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics *graphics, GpPen *pen, REAL x1,
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
pt[0].X = x1;
pt[0].Y = y1;
pt[1].X = x2;
@@ -1574,6 +1581,12 @@ GpStatus WINGDIPAPI GdipDrawBezierI(GpGraphics *graphics, GpPen *pen, INT x1,
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
pt[0].X = x1;
pt[0].Y = y1;
pt[1].X = x2;
@@ -1780,6 +1793,12 @@ GpStatus WINGDIPAPI GdipDrawCurve2(GpGraphics *graphics, GpPen *pen,
if(count < 2)
return InvalidParameter;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
pt = GdipAlloc(len_pt * sizeof(GpPointF));
if(!pt)
return OutOfMemory;
@@ -1895,6 +1914,12 @@ GpStatus WINGDIPAPI GdipDrawEllipse(GpGraphics *graphics, GpPen *pen, REAL x,
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
ptf[0].X = x;
ptf[0].Y = y;
ptf[1].X = x + width;
@@ -2447,6 +2472,12 @@ GpStatus WINGDIPAPI GdipDrawLine(GpGraphics *graphics, GpPen *pen, REAL x1,
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
pt[0].X = x1;
pt[0].Y = y1;
pt[1].X = x2;
@@ -2476,6 +2507,12 @@ GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1,
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
pt[0].X = (REAL)x1;
pt[0].Y = (REAL)y1;
pt[1].X = (REAL)x2;
@@ -2504,6 +2541,12 @@ GpStatus WINGDIPAPI GdipDrawLines(GpGraphics *graphics, GpPen *pen, GDIPCONST
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
save_state = prepare_dc(graphics, pen);
retval = draw_polyline(graphics, pen, points, count, TRUE);
@@ -2529,6 +2572,12 @@ GpStatus WINGDIPAPI GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
ptf = GdipAlloc(count * sizeof(GpPointF));
if(!ptf) return OutOfMemory;
@@ -2560,6 +2609,12 @@ GpStatus WINGDIPAPI GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path)
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
save_state = prepare_dc(graphics, pen);
retval = draw_poly(graphics, pen, path->pathdata.Points,
@@ -2584,6 +2639,12 @@ GpStatus WINGDIPAPI GdipDrawPie(GpGraphics *graphics, GpPen *pen, REAL x,
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
save_state = prepare_dc(graphics, pen);
SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH));
@@ -2618,6 +2679,12 @@ GpStatus WINGDIPAPI GdipDrawRectangle(GpGraphics *graphics, GpPen *pen, REAL x,
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
ptf[0].X = x;
ptf[0].Y = y;
ptf[1].X = x + width;
@@ -2661,6 +2728,12 @@ GpStatus WINGDIPAPI GdipDrawRectangles(GpGraphics *graphics, GpPen *pen,
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
ptf = GdipAlloc(4 * count * sizeof(GpPointF));
pti = GdipAlloc(4 * count * sizeof(POINT));
@@ -4015,7 +4088,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
if(!graphics->hdc)
{
FIXME("graphics object has no HDC\n");
- return NotImplemented;
+ return Ok;
}
if(format){
@@ -4581,6 +4654,12 @@ GpStatus WINGDIPAPI GdipDrawPolygon(GpGraphics *graphics,GpPen *pen,GDIPCONST Gp
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
pti = GdipAlloc(sizeof(POINT) * count);
save_state = prepare_dc(graphics, pen);
More information about the wine-cvs
mailing list