Skip to content

Commit

Permalink
Do not skip failing records on 32-bit
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Oct 26, 2024
1 parent 8c1dc0d commit 34a6c50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Tests/test_file_wmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,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()
Expand Down
9 changes: 8 additions & 1 deletion src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ PyImaging_EventLoopWin32(PyObject *self, PyObject *args) {

BOOL
enhMetaFileProc(
HDC hdc, HANDLETABLE FAR *lpht, CONST ENHMETARECORD *lpmr, int nHandles, LPARAM data
HDC hdc, HANDLETABLE FAR *lpht, const ENHMETARECORD *lpmr, int nHandles, LPARAM data
) {
PlayEnhMetaFileRecord(hdc, lpht, lpmr, nHandles);
return TRUE;
Expand Down Expand Up @@ -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 */

Expand Down

0 comments on commit 34a6c50

Please sign in to comment.