winemac: Directly use win32u for GDI functions in image.c.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b34018db20
commit
d71abff141
|
@ -69,7 +69,7 @@ CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP hbmCol
|
||||||
|
|
||||||
/* draw the cursor frame to a temporary buffer then create a CGImage from that */
|
/* draw the cursor frame to a temporary buffer then create a CGImage from that */
|
||||||
memset(color_bits, 0x00, color_size);
|
memset(color_bits, 0x00, color_size);
|
||||||
SelectObject(hdc, hbmColor);
|
NtGdiSelectBitmap(hdc, hbmColor);
|
||||||
if (!DrawIconEx(hdc, 0, 0, icon, width, height, istep, NULL, DI_NORMAL))
|
if (!DrawIconEx(hdc, 0, 0, icon, width, height, istep, NULL, DI_NORMAL))
|
||||||
{
|
{
|
||||||
WARN("Could not draw frame %d (walk past end of frames).\n", istep);
|
WARN("Could not draw frame %d (walk past end of frames).\n", istep);
|
||||||
|
@ -128,7 +128,7 @@ CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP hbmCol
|
||||||
|
|
||||||
/* draw the cursor mask to a temporary buffer */
|
/* draw the cursor mask to a temporary buffer */
|
||||||
memset(mask_bits, 0xFF, mask_size);
|
memset(mask_bits, 0xFF, mask_size);
|
||||||
SelectObject(hdc, hbmMask);
|
NtGdiSelectBitmap(hdc, hbmMask);
|
||||||
if (!DrawIconEx(hdc, 0, 0, icon, width, height, istep, NULL, DI_MASK))
|
if (!DrawIconEx(hdc, 0, 0, icon, width, height, istep, NULL, DI_MASK))
|
||||||
{
|
{
|
||||||
WARN("Failed to draw frame mask %d.\n", istep);
|
WARN("Failed to draw frame mask %d.\n", istep);
|
||||||
|
@ -202,17 +202,17 @@ CGImageRef create_cgimage_from_icon(HANDLE icon, int width, int height)
|
||||||
if (!GetIconInfo(icon, &info))
|
if (!GetIconInfo(icon, &info))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
GetObjectW(info.hbmMask, sizeof(bm), &bm);
|
NtGdiExtGetObjectW(info.hbmMask, sizeof(bm), &bm);
|
||||||
if (!info.hbmColor) bm.bmHeight = max(1, bm.bmHeight / 2);
|
if (!info.hbmColor) bm.bmHeight = max(1, bm.bmHeight / 2);
|
||||||
width = bm.bmWidth;
|
width = bm.bmWidth;
|
||||||
height = bm.bmHeight;
|
height = bm.bmHeight;
|
||||||
TRACE("new width %d height %d\n", width, height);
|
TRACE("new width %d height %d\n", width, height);
|
||||||
|
|
||||||
DeleteObject(info.hbmColor);
|
NtGdiDeleteObjectApp(info.hbmColor);
|
||||||
DeleteObject(info.hbmMask);
|
NtGdiDeleteObjectApp(info.hbmMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
hdc = CreateCompatibleDC(0);
|
hdc = NtGdiCreateCompatibleDC(0);
|
||||||
|
|
||||||
bitmapinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
bitmapinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||||
bitmapinfo->bmiHeader.biWidth = width;
|
bitmapinfo->bmiHeader.biWidth = width;
|
||||||
|
@ -226,7 +226,8 @@ CGImageRef create_cgimage_from_icon(HANDLE icon, int width, int height)
|
||||||
bitmapinfo->bmiHeader.biBitCount = 32;
|
bitmapinfo->bmiHeader.biBitCount = 32;
|
||||||
color_size = width * height * 4;
|
color_size = width * height * 4;
|
||||||
bitmapinfo->bmiHeader.biSizeImage = color_size;
|
bitmapinfo->bmiHeader.biSizeImage = color_size;
|
||||||
hbmColor = CreateDIBSection(hdc, bitmapinfo, DIB_RGB_COLORS, (VOID **) &color_bits, NULL, 0);
|
hbmColor = NtGdiCreateDIBSection(hdc, NULL, 0, bitmapinfo, DIB_RGB_COLORS,
|
||||||
|
0, 0, 0, (void **)&color_bits);
|
||||||
if (!hbmColor)
|
if (!hbmColor)
|
||||||
{
|
{
|
||||||
WARN("failed to create DIB section for cursor color data\n");
|
WARN("failed to create DIB section for cursor color data\n");
|
||||||
|
@ -244,7 +245,8 @@ CGImageRef create_cgimage_from_icon(HANDLE icon, int width, int height)
|
||||||
bitmapinfo->bmiColors[1].rgbReserved = 0;
|
bitmapinfo->bmiColors[1].rgbReserved = 0;
|
||||||
mask_size = ((width + 31) / 32 * 4) * height;
|
mask_size = ((width + 31) / 32 * 4) * height;
|
||||||
bitmapinfo->bmiHeader.biSizeImage = mask_size;
|
bitmapinfo->bmiHeader.biSizeImage = mask_size;
|
||||||
hbmMask = CreateDIBSection(hdc, bitmapinfo, DIB_RGB_COLORS, (VOID **) &mask_bits, NULL, 0);
|
hbmMask = NtGdiCreateDIBSection(hdc, NULL, 0, bitmapinfo, DIB_RGB_COLORS,
|
||||||
|
0, 0, 0, (void **)&mask_bits);
|
||||||
if (!hbmMask)
|
if (!hbmMask)
|
||||||
{
|
{
|
||||||
WARN("failed to create DIB section for cursor mask data\n");
|
WARN("failed to create DIB section for cursor mask data\n");
|
||||||
|
@ -255,9 +257,9 @@ CGImageRef create_cgimage_from_icon(HANDLE icon, int width, int height)
|
||||||
mask_bits, mask_size, width, height, 0);
|
mask_bits, mask_size, width, height, 0);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (hbmColor) DeleteObject(hbmColor);
|
if (hbmColor) NtGdiDeleteObjectApp(hbmColor);
|
||||||
if (hbmMask) DeleteObject(hbmMask);
|
if (hbmMask) NtGdiDeleteObjectApp(hbmMask);
|
||||||
DeleteDC(hdc);
|
NtGdiDeleteObjectApp(hdc);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "macdrv_cocoa.h"
|
#include "macdrv_cocoa.h"
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "wingdi.h"
|
#include "ntgdi.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/gdi_driver.h"
|
#include "wine/gdi_driver.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue