Module: wine Branch: master Commit: c37fea89e6202e82e91d6af75f94441a76a9c130 URL: https://gitlab.winehq.org/wine/wine/-/commit/c37fea89e6202e82e91d6af75f94441...
Author: Esme Povirk esme@codeweavers.com Date: Fri Feb 23 20:19:14 2024 +0000
gdiplus: Restore hdc argument to gdip_format_string.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56345
---
dlls/gdiplus/gdiplus_private.h | 3 ++- dlls/gdiplus/graphics.c | 27 ++++++++++++++------------- dlls/gdiplus/graphicspath.c | 6 +++--- 3 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index c88b5407257..1ae03d7126e 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -621,6 +621,7 @@ struct gdip_font_link_info {
struct gdip_format_string_info { GpGraphics *graphics; + HDC hdc; GDIPCONST WCHAR *string; INT index; INT length; @@ -636,7 +637,7 @@ struct gdip_format_string_info {
typedef GpStatus (*gdip_format_string_callback)(struct gdip_format_string_info *info);
-GpStatus gdip_format_string(GpGraphics *graphics, +GpStatus gdip_format_string(GpGraphics *graphics, HDC hdc, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data); diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 74271a49418..85b25e1ac24 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5217,7 +5217,7 @@ static void generate_font_link_info(struct gdip_format_string_info *info, DWORD IUnknown_Release(unk);
get_font_hfont(info->graphics, base_font, NULL, &hfont, NULL, NULL); - IMLangFontLink_GetFontCodePages(iMLFL, info->graphics->hdc, hfont, &font_codepages); + IMLangFontLink_GetFontCodePages(iMLFL, info->hdc, hfont, &font_codepages);
while (progress < length) { @@ -5232,10 +5232,10 @@ static void generate_font_link_info(struct gdip_format_string_info *info, DWORD } else { - IMLangFontLink_MapFont(iMLFL, info->graphics->hdc, string_codepages, hfont, &map_hfont); - old_font = SelectObject(info->graphics->hdc, map_hfont); - GdipCreateFontFromDC(info->graphics->hdc, &gpfont); - SelectObject(info->graphics->hdc, old_font); + IMLangFontLink_MapFont(iMLFL, info->hdc, string_codepages, hfont, &map_hfont); + old_font = SelectObject(info->hdc, map_hfont); + GdipCreateFontFromDC(info->hdc, &gpfont); + SelectObject(info->hdc, old_font); IMLangFontLink_ReleaseFont(iMLFL, map_hfont); section->font = gpfont; } @@ -5271,9 +5271,9 @@ static void font_link_get_text_extent_point(struct gdip_format_string_info *info to_measure_length = min(length - (i - index), section->end - i);
get_font_hfont(info->graphics, section->font, NULL, &hfont, NULL, NULL); - oldhfont = SelectObject(info->graphics->hdc, hfont); - GetTextExtentExPointW(info->graphics->hdc, &info->string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux); - SelectObject(info->graphics->hdc, oldhfont); + oldhfont = SelectObject(info->hdc, hfont); + GetTextExtentExPointW(info->hdc, &info->string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux); + SelectObject(info->hdc, oldhfont); DeleteObject(hfont);
max_ext -= sizeaux.cx; @@ -5301,7 +5301,7 @@ static void release_font_link_info(struct gdip_font_link_info *font_link_info) } }
-GpStatus gdip_format_string(GpGraphics *graphics, +GpStatus gdip_format_string(GpGraphics *graphics, HDC hdc, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data) @@ -5321,6 +5321,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, struct gdip_format_string_info info;
info.graphics = graphics; + info.hdc = hdc; info.rect = rect; info.bounds = &bounds; info.user_data = user_data; @@ -5645,7 +5646,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
gdi_transform_acquire(graphics);
- stat = gdip_format_string(graphics, string, length, font, &scaled_rect, stringFormat, + stat = gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, stringFormat, (stringFormat->attr & StringFormatFlagsNoClip) != 0, measure_ranges_callback, &args);
gdi_transform_release(graphics); @@ -5755,7 +5756,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
gdi_transform_acquire(graphics);
- gdip_format_string(graphics, string, length, font, &scaled_rect, format, TRUE, + gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, format, TRUE, measure_string_callback, &args);
gdi_transform_release(graphics); @@ -5814,7 +5815,7 @@ static GpStatus draw_string_callback(struct gdip_format_string_info *info) REAL underline_y, underline_height; int i;
- GetOutlineTextMetricsW(info->graphics->hdc, sizeof(otm), &otm); + GetOutlineTextMetricsW(info->hdc, sizeof(otm), &otm);
underline_height = otm.otmsUnderscoreSize / args->rel_height; underline_y = position.Y - otm.otmsUnderscorePosition / args->rel_height - underline_height / 2; @@ -5942,7 +5943,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string GetTextMetricsW(hdc, &textmetric); args.ascent = textmetric.tmAscent / rel_height;
- gdip_format_string(graphics, string, length, font, &scaled_rect, format, TRUE, + gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, format, TRUE, draw_string_callback, &args);
gdi_transform_release(graphics); diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 6009f941b7d..54d9f252c2f 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -1019,7 +1019,7 @@ static GpStatus format_string_callback(struct gdip_format_string_info* info) TTPOLYGONHEADER *ph = NULL, *origph; char *start; DWORD len, ofs = 0; - len = GetGlyphOutlineW(info->graphics->hdc, info->string[i], GGO_BEZIER, &gm, 0, NULL, &identity); + len = GetGlyphOutlineW(info->hdc, info->string[i], GGO_BEZIER, &gm, 0, NULL, &identity); if (len == GDI_ERROR) { status = GenericError; @@ -1033,7 +1033,7 @@ static GpStatus format_string_callback(struct gdip_format_string_info* info) status = OutOfMemory; break; } - GetGlyphOutlineW(info->graphics->hdc, info->string[i], GGO_BEZIER, &gm, len, start, &identity); + GetGlyphOutlineW(info->hdc, info->string[i], GGO_BEZIER, &gm, len, start, &identity);
ofs = 0; while (ofs < len) @@ -1161,7 +1161,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT args.maxY = 0; args.scale = emSize / native_height; args.ascent = textmetric.tmAscent * args.scale; - status = gdip_format_string(graphics, string, length, NULL, &scaled_layout_rect, + status = gdip_format_string(graphics, dc, string, length, NULL, &scaled_layout_rect, format, TRUE, format_string_callback, &args);
DeleteDC(dc);