[PATCH v2 0/1] MR2847: gdiplus: Improve performance of gdip_transform_points.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53947 -- v2: gdiplus: Improve performance of gdip_transform_points. https://gitlab.winehq.org/wine/wine/-/merge_requests/2847
From: Bartosz Kosiorek <gang65(a)poczta.onet.pl> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53947 --- dlls/gdiplus/graphics.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index fca66c8654b..6831cfcb247 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -6887,13 +6887,15 @@ GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_spac if (dst_space != src_space) { - scale_x = units_to_pixels(1.0, graphics->unit, graphics->xres, graphics->printer_display); - scale_y = units_to_pixels(1.0, graphics->unit, graphics->yres, graphics->printer_display); - if(graphics->unit != UnitDisplay) { - scale_x *= graphics->scale; - scale_y *= graphics->scale; + scale_x = units_to_pixels(graphics->scale, graphics->unit, graphics->xres, graphics->printer_display); + scale_y = units_to_pixels(graphics->scale, graphics->unit, graphics->yres, graphics->printer_display); + } + else + { + scale_x = units_to_pixels(1.0, graphics->unit, graphics->xres, graphics->printer_display); + scale_y = units_to_pixels(1.0, graphics->unit, graphics->yres, graphics->printer_display); } if (dst_space < src_space) @@ -6903,12 +6905,11 @@ GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_spac { case WineCoordinateSpaceGdiDevice: { - GpMatrix gdixform; - gdixform = graphics->gdi_transform; + GpMatrix gdixform = graphics->gdi_transform; stat = GdipInvertMatrix(&gdixform); if (stat != Ok) break; - GdipMultiplyMatrix(matrix, &gdixform, MatrixOrderAppend); + memcpy(matrix->matrix, gdixform.matrix, sizeof(matrix->matrix)); if (dst_space == CoordinateSpaceDevice) break; /* else fall-through */ @@ -6934,7 +6935,7 @@ GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_spac switch ((int)src_space) { case CoordinateSpaceWorld: - GdipMultiplyMatrix(matrix, &graphics->worldtrans, MatrixOrderAppend); + memcpy(matrix->matrix, &graphics->worldtrans, sizeof(matrix->matrix)); if (dst_space == CoordinateSpacePage) break; /* else fall-through */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2847
On Wed May 17 20:12:41 2023 +0000, Bartosz Kosiorek wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/2847/diffs?diff_id=47433&start_sha=bc552d6c21ad2199621aadf692e098ce918d543c#aaf93e29527c1cbc47ec54679da5828ebd679128_6958_6958) I have removed inline
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/2847#note_33050
This merge request was approved by Torge Matthies. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2847
This gets my approval but ultimately Esme's approval (or lack thereof) is what counts (see MAINTAINERS file) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2847#note_33066
This merge request was approved by Esme Povirk. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2847
If this function is called often enough that the performance matters so much, maybe it'd be worth caching some of these transform matrices (perhaps world<->device and world<->gdidevice). Most of the calls probably have the exact same inputs and result, and we know exactly when those inputs change. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2847#note_33102
participants (4)
-
Bartosz Kosiorek -
Bartosz Kosiorek (@gang65) -
Esme Povirk (@madewokherd) -
Torge Matthies (@tmatthies)