gdiplus: Use SaveDC, RestoreDC in GdipDrawLineI.

This commit is contained in:
Evan Stade 2007-07-02 15:13:05 -07:00 committed by Alexandre Julliard
parent 8fae363595
commit d9ef172e04

View File

@ -247,15 +247,18 @@ GpStatus WINGDIPAPI GdipDrawCurve2(GpGraphics *graphics, GpPen *pen,
GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1, GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1,
INT y1, INT x2, INT y2) INT y1, INT x2, INT y2)
{ {
HGDIOBJ old_obj; INT save_state;
if(!pen || !graphics) if(!pen || !graphics)
return InvalidParameter; return InvalidParameter;
old_obj = SelectObject(graphics->hdc, pen->gdipen); save_state = SaveDC(graphics->hdc);
SelectObject(graphics->hdc, pen->gdipen);
MoveToEx(graphics->hdc, x1, y1, NULL); MoveToEx(graphics->hdc, x1, y1, NULL);
LineTo(graphics->hdc, x2, y2); LineTo(graphics->hdc, x2, y2);
SelectObject(graphics->hdc, old_obj);
RestoreDC(graphics->hdc, save_state);
return Ok; return Ok;
} }