[PATCH 0/5] MR5688: gdiplus: Removing gdi32 objects from gdiplus objects. (part 5)
From: Esme Povirk <esme(a)codeweavers.com> --- dlls/gdiplus/graphics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 4c12cc18f11..87971180d2d 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -4907,7 +4907,7 @@ GpStatus WINGDIPAPI GdipFlush(GpGraphics *graphics, GpFlushIntention intention) /* We have no internal operation queue, so there's no need to clear it. */ - if (graphics->hdc) + if (has_gdi_dc(graphics)) GdiFlush(); return Ok; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5688
From: Esme Povirk <esme(a)codeweavers.com> --- dlls/gdiplus/graphics.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 87971180d2d..a16932a31ab 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5734,13 +5734,17 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics, if (regionCount < stringFormat->range_count) return InvalidParameter; - if(!graphics->hdc) + if(!has_gdi_dc(graphics)) { hdc = temp_hdc = CreateCompatibleDC(0); if (!temp_hdc) return OutOfMemory; } else - hdc = graphics->hdc; + { + stat = gdi_dc_acquire(graphics, &hdc); + if (stat != Ok) + return stat; + } if (stringFormat->attr) TRACE("may be ignoring some format flags: attr %x\n", stringFormat->attr); @@ -5787,6 +5791,8 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics, if (temp_hdc) DeleteDC(temp_hdc); + else + gdi_dc_release(graphics, hdc); return stat; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5688
From: Esme Povirk <esme(a)codeweavers.com> --- dlls/gdiplus/graphics.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index a16932a31ab..b93b3f0c277 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5836,6 +5836,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, RectF *bounds, INT *codepointsfitted, INT *linesfilled) { + GpStatus status; HFONT oldfont, gdifont; struct measure_string_args args; HDC temp_hdc=NULL, hdc; @@ -5850,13 +5851,17 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, if(!graphics || !string || !font || !rect || !bounds) return InvalidParameter; - if(!graphics->hdc) + if(!has_gdi_dc(graphics)) { hdc = temp_hdc = CreateCompatibleDC(0); if (!temp_hdc) return OutOfMemory; } else - hdc = graphics->hdc; + { + status = gdi_dc_acquire(graphics, &hdc); + if (status != Ok) + return status; + } if(linesfilled) *linesfilled = 0; if(codepointsfitted) *codepointsfitted = 0; @@ -5909,6 +5914,8 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, if (temp_hdc) DeleteDC(temp_hdc); + else + gdi_dc_release(graphics, hdc); return Ok; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5688
From: Esme Povirk <esme(a)codeweavers.com> --- dlls/gdiplus/graphics.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index b93b3f0c277..c089a984db7 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5987,6 +5987,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush) { + GpStatus status; HRGN rgn = NULL; HFONT gdifont; GpPointF rectcpy[4]; @@ -6005,9 +6006,11 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string if(!graphics || !string || !font || !brush || !rect) return InvalidParameter; - if(graphics->hdc) + if(has_gdi_dc(graphics)) { - hdc = graphics->hdc; + status = gdi_dc_acquire(graphics, &hdc); + if (status != Ok) + return status; } else { @@ -6097,7 +6100,10 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string RestoreDC(hdc, save_state); - DeleteDC(temp_hdc); + if (temp_hdc) + DeleteDC(temp_hdc); + else + gdi_dc_release(graphics, hdc); return Ok; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5688
From: Esme Povirk <esme(a)codeweavers.com> --- dlls/gdiplus/graphics.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index c089a984db7..83fca7a9bfa 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -7492,6 +7492,7 @@ static GpStatus GDI32_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UINT1 LOGFONTW lfw; UINT eto_flags=0; GpStatus status; + HDC hdc; HRGN hrgn; if (!(flags & DriverStringOptionsCmapLookup)) @@ -7509,15 +7510,23 @@ static GpStatus GDI32_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UINT1 } } - save_state = SaveDC(graphics->hdc); - SetBkMode(graphics->hdc, TRANSPARENT); - SetTextColor(graphics->hdc, get_gdi_brush_color(brush)); + status = gdi_dc_acquire(graphics, &hdc); + if (status != Ok) + { + free(real_positions); + free(eto_positions); + return status; + } + + save_state = SaveDC(hdc); + SetBkMode(hdc, TRANSPARENT); + SetTextColor(hdc, get_gdi_brush_color(brush)); status = get_clip_hrgn(graphics, &hrgn); if (status == Ok) { - ExtSelectClipRgn(graphics->hdc, hrgn, RGN_COPY); + ExtSelectClipRgn(hdc, hrgn, RGN_COPY); DeleteObject(hrgn); } @@ -7548,23 +7557,25 @@ static GpStatus GDI32_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UINT1 } } - SelectObject(graphics->hdc, hfont); + SelectObject(hdc, hfont); - SetTextAlign(graphics->hdc, TA_BASELINE|TA_LEFT); + SetTextAlign(hdc, TA_BASELINE|TA_LEFT); gdi_transform_acquire(graphics); - ExtTextOutW(graphics->hdc, gdip_round(pt.X), gdip_round(pt.Y), eto_flags, NULL, text, length, eto_positions); + ExtTextOutW(hdc, gdip_round(pt.X), gdip_round(pt.Y), eto_flags, NULL, text, length, eto_positions); gdi_transform_release(graphics); - RestoreDC(graphics->hdc, save_state); + RestoreDC(hdc, save_state); DeleteObject(hfont); free(real_positions); free(eto_positions); + gdi_dc_release(graphics, hdc); + return Ok; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5688
I can't find the CI failure in the log, my usual search for `done ([^0]` is failing me. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5688#note_70959
participants (2)
-
Esme Povirk -
Esme Povirk (@madewokherd)