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 e4087f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Tests/test_file_wmf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import sys
from io import BytesIO
from pathlib import Path
from typing import IO
Expand Down Expand Up @@ -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()
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 e4087f9

Please sign in to comment.