From 6753f25f5870744d1eaa4c80d648452db2a12e98 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Tue, 11 Jun 2024 16:21:36 +0000 Subject: [PATCH] gdiplus: Fix DIB stride calculation in GdipDrawImagePointsRect. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56800 --- dlls/gdiplus/graphics.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 14e09e7cc47..265b3363ca9 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -3427,6 +3427,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image BITMAPINFOHEADER bih; BYTE *temp_bits; PixelFormat dst_format; + INT dib_stride; src_hdc = CreateCompatibleDC(0); @@ -3453,8 +3454,10 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image hbitmap = CreateDIBSection(src_hdc, (BITMAPINFO*)&bih, DIB_RGB_COLORS, (void**)&temp_bits, NULL, 0); + dib_stride = ((bitmap->width * PIXELFORMATBPP(dst_format) + 31) / 8) & ~3; + convert_pixels(bitmap->width, bitmap->height, - bitmap->width*PIXELFORMATBPP(dst_format)/8, temp_bits, dst_format, bitmap->image.palette, + dib_stride, temp_bits, dst_format, bitmap->image.palette, bitmap->stride, bitmap->bits, bitmap->format, bitmap->image.palette);