gdiplus: Only release device contexts created internally.
This commit is contained in:
parent
fea6d0a764
commit
8a3d9ff773
|
@ -91,6 +91,7 @@ struct GpPen{
|
||||||
struct GpGraphics{
|
struct GpGraphics{
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
BOOL owndc;
|
||||||
SmoothingMode smoothing;
|
SmoothingMode smoothing;
|
||||||
CompositingQuality compqual;
|
CompositingQuality compqual;
|
||||||
InterpolationMode interpolation;
|
InterpolationMode interpolation;
|
||||||
|
|
|
@ -924,6 +924,7 @@ GpStatus WINGDIPAPI GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **gra
|
||||||
|
|
||||||
(*graphics)->hdc = hdc;
|
(*graphics)->hdc = hdc;
|
||||||
(*graphics)->hwnd = WindowFromDC(hdc);
|
(*graphics)->hwnd = WindowFromDC(hdc);
|
||||||
|
(*graphics)->owndc = FALSE;
|
||||||
(*graphics)->smoothing = SmoothingModeDefault;
|
(*graphics)->smoothing = SmoothingModeDefault;
|
||||||
(*graphics)->compqual = CompositingQualityDefault;
|
(*graphics)->compqual = CompositingQualityDefault;
|
||||||
(*graphics)->interpolation = InterpolationModeDefault;
|
(*graphics)->interpolation = InterpolationModeDefault;
|
||||||
|
@ -947,6 +948,7 @@ GpStatus WINGDIPAPI GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
(*graphics)->hwnd = hwnd;
|
(*graphics)->hwnd = hwnd;
|
||||||
|
(*graphics)->owndc = TRUE;
|
||||||
|
|
||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
@ -1081,7 +1083,7 @@ GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
|
||||||
if(!graphics) return InvalidParameter;
|
if(!graphics) return InvalidParameter;
|
||||||
if(graphics->busy) return ObjectBusy;
|
if(graphics->busy) return ObjectBusy;
|
||||||
|
|
||||||
if(graphics->hwnd)
|
if(graphics->owndc)
|
||||||
ReleaseDC(graphics->hwnd, graphics->hdc);
|
ReleaseDC(graphics->hwnd, graphics->hdc);
|
||||||
|
|
||||||
GdipDeleteRegion(graphics->clip);
|
GdipDeleteRegion(graphics->clip);
|
||||||
|
|
Loading…
Reference in New Issue