mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
83 lines
2.5 KiB
Diff
83 lines
2.5 KiB
Diff
From ec412084355740035c309ab3ce82b6bcaf17a1f8 Mon Sep 17 00:00:00 2001
|
|
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
|
Date: Tue, 17 Dec 2019 17:12:55 +0800
|
|
Subject: [PATCH 2/3] gdiplus: Reimplement GdipCreateBitmapFromGdiDib by using
|
|
GdipCreateBitmapFromHBITMAP.
|
|
|
|
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
|
|
---
|
|
dlls/gdiplus/image.c | 47 ++++++++++++--------------------------------
|
|
1 file changed, 13 insertions(+), 34 deletions(-)
|
|
|
|
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
|
|
index aed931dd7df..76dc9a73f84 100644
|
|
--- a/dlls/gdiplus/image.c
|
|
+++ b/dlls/gdiplus/image.c
|
|
@@ -1386,50 +1386,29 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO* info,
|
|
VOID *bits, GpBitmap **bitmap)
|
|
{
|
|
DWORD height, stride;
|
|
- PixelFormat format;
|
|
+ HBITMAP hbm;
|
|
+ void *bmbits;
|
|
+ GpStatus status;
|
|
|
|
- FIXME("(%p, %p, %p) - partially implemented\n", info, bits, bitmap);
|
|
+ TRACE("(%p, %p, %p)\n", info, bits, bitmap);
|
|
|
|
if (!info || !bits || !bitmap)
|
|
return InvalidParameter;
|
|
|
|
+ hbm = CreateDIBSection(0, info, DIB_RGB_COLORS, &bmbits, NULL, 0);
|
|
+ if (!hbm)
|
|
+ return InvalidParameter;
|
|
+
|
|
height = abs(info->bmiHeader.biHeight);
|
|
stride = ((info->bmiHeader.biWidth * info->bmiHeader.biBitCount + 31) >> 3) & ~3;
|
|
+ TRACE("height %u, stride %u, image size %u\n", height, stride, height * stride);
|
|
|
|
- if(info->bmiHeader.biHeight > 0) /* bottom-up */
|
|
- {
|
|
- bits = (BYTE*)bits + (height - 1) * stride;
|
|
- stride = -stride;
|
|
- }
|
|
+ memcpy(bmbits, bits, height * stride);
|
|
|
|
- switch(info->bmiHeader.biBitCount) {
|
|
- case 1:
|
|
- format = PixelFormat1bppIndexed;
|
|
- break;
|
|
- case 4:
|
|
- format = PixelFormat4bppIndexed;
|
|
- break;
|
|
- case 8:
|
|
- format = PixelFormat8bppIndexed;
|
|
- break;
|
|
- case 16:
|
|
- format = PixelFormat16bppRGB555;
|
|
- break;
|
|
- case 24:
|
|
- format = PixelFormat24bppRGB;
|
|
- break;
|
|
- case 32:
|
|
- format = PixelFormat32bppRGB;
|
|
- break;
|
|
- default:
|
|
- FIXME("don't know how to handle %d bpp\n", info->bmiHeader.biBitCount);
|
|
- *bitmap = NULL;
|
|
- return InvalidParameter;
|
|
- }
|
|
-
|
|
- return GdipCreateBitmapFromScan0(info->bmiHeader.biWidth, height, stride, format,
|
|
- bits, bitmap);
|
|
+ status = GdipCreateBitmapFromHBITMAP(hbm, NULL, bitmap);
|
|
+ DeleteObject(hbm);
|
|
|
|
+ return status;
|
|
}
|
|
|
|
/* FIXME: no icm */
|
|
--
|
|
2.24.0
|
|
|