[PATCH 0/1] MR3546: gdiplus: move pointer calculation outside inner loop for alpha_blend_bmp_pixels
From: Bartosz Kosiorek <gang65(a)poczta.onet.pl> --- dlls/gdiplus/graphics.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index e3b5661fd67..3bbb4b14e8a 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -422,29 +422,29 @@ static GpStatus alpha_blend_bmp_pixels(GpGraphics *graphics, INT dst_x, INT dst_ for (y=0; y<src_height; y++) { + ARGB *src_color = ((ARGB*)(src + src_stride * y)); for (x=0; x<src_width; x++) { - ARGB dst_color, src_color; - src_color = ((ARGB*)(src + src_stride * y))[x]; - if (comp_mode == CompositingModeSourceCopy) { - if (!(src_color & 0xff000000)) + if (!(*src_color & 0xff000000)) GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, 0); else - GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, src_color); + GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, *src_color); } else { - if (!(src_color & 0xff000000)) + ARGB dst_color; + if (!(*src_color & 0xff000000)) continue; GdipBitmapGetPixel(dst_bitmap, x+dst_x, y+dst_y, &dst_color); if (fmt & PixelFormatPAlpha) - GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, color_over_fgpremult(dst_color, src_color)); + GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, color_over_fgpremult(dst_color, *src_color)); else - GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, color_over(dst_color, src_color)); + GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, color_over(dst_color, *src_color)); } + src_color++; } } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3546
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details: The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=135892 Your paranoid android. === debian11 (32 bit report) === gdiplus: graphics.c:6931: Test failed: Expected -16776961, got 0 graphics.c:6935: Test failed: Expected -16776961, got 0 image.c:4812: Test failed: 2: data should match image.c:4812: Test failed: 9: data should match image.c:3529: Test failed: Expected ffffffff, got 00000000 metafile.c:699: Test failed: Expected -16776961, got 00000000 metafile.c:708: Test failed: Expected -16776961, got 00000000 metafile.c:727: Test failed: Expected -16776961, got 00000000 metafile.c:907: Test failed: Expected -16776961, got 00000000 metafile.c:922: Test failed: Expected -16776961, got 00000000 metafile.c:942: Test failed: Expected -16776961, got 00000000 metafile.c:2994: Test failed: Expected -16776961, got 00000000 metafile.c:3002: Test failed: Expected -16776961, got 00000000 === debian11b (64 bit WoW report) === gdiplus: graphics.c:6931: Test failed: Expected -16776961, got 0 graphics.c:6935: Test failed: Expected -16776961, got 0 image.c:4812: Test failed: 2: data should match image.c:4812: Test failed: 9: data should match image.c:3529: Test failed: Expected ffffffff, got 00000000 metafile.c:699: Test failed: Expected -16776961, got 00000000 metafile.c:708: Test failed: Expected -16776961, got 00000000 metafile.c:727: Test failed: Expected -16776961, got 00000000 metafile.c:907: Test failed: Expected -16776961, got 00000000 metafile.c:922: Test failed: Expected -16776961, got 00000000 metafile.c:942: Test failed: Expected -16776961, got 00000000 metafile.c:2994: Test failed: Expected -16776961, got 00000000 metafile.c:3002: Test failed: Expected -16776961, got 00000000
What difference does this make? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3546#note_41982
On Thu Aug 10 22:58:33 2023 +0000, Nikolay Sivov wrote:
What difference does this make? In previous implementation we calculated `src_color` position every time:
for (x=0; x<src_width; x++)
{
ARGB dst_color, src_color;
src_color = ((ARGB*)(src + src_stride * y))[x];
With new implementation we are calculating `src_color` position only once (before `x` loop), and we just iterating the `src_color++`: ``` ARGB *src_color = ((ARGB*)(src + src_stride * y)); for (x=0; x<src_width; x++) { ... src_color++; } ``` It is much faster (avoiding not needed multiplications), especially for wide images. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3546#note_41984
This merge request was closed by Bartosz Kosiorek. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3546
participants (4)
-
Bartosz Kosiorek -
Bartosz Kosiorek (@gang65) -
Marvin -
Nikolay Sivov (@nsivov)