Do not skip failing records on 32-bit

This commit is contained in:
Andrew Murray 2024-10-27 07:03:35 +11:00
parent 8c1dc0de3c
commit b4ba466541
2 changed files with 12 additions and 3 deletions

View File

@ -1,5 +1,6 @@
from __future__ import annotations
import sys
from io import BytesIO
from pathlib import Path
from typing import IO
@ -35,6 +36,7 @@ def test_load() -> None:
assert im.load()[0, 0] == (255, 255, 255)
@pytest.mark.skipif(sys.maxsize <= 2**32, reason="Requires 64-bit system")
def test_render() -> None:
with open("Tests/images/drawing.emf", "rb") as fp:
data = fp.read()

View File

@ -716,12 +716,12 @@ PyImaging_EventLoopWin32(PyObject *self, PyObject *args) {
#define GET32(p, o) ((DWORD *)(p + o))[0]
BOOL
int
enhMetaFileProc(
HDC hdc, HANDLETABLE FAR *lpht, CONST ENHMETARECORD *lpmr, int nHandles, LPARAM data
HDC hdc, HANDLETABLE *lpht, const ENHMETARECORD *lpmr, int nHandles, LPARAM data
) {
PlayEnhMetaFileRecord(hdc, lpht, lpmr, nHandles);
return TRUE;
return 1;
}
PyObject *
@ -804,7 +804,14 @@ PyImaging_DrawWmf(PyObject *self, PyObject *args) {
/* FIXME: make background transparent? configurable? */
FillRect(dc, &rect, GetStockObject(WHITE_BRUSH));
#ifdef _WIN64
EnumEnhMetaFile(dc, meta, enhMetaFileProc, NULL, &rect);
#else
if (!PlayEnhMetaFile(dc, meta, &rect)) {
PyErr_SetString(PyExc_OSError, "cannot render metafile");
goto error;
}
#endif
/* step 4: extract bits from bitmap */