Skip to content

Commit

Permalink
Merge pull request #28 from nulano/emf_records
Browse files Browse the repository at this point in the history
Skip failing WMF records on 32-bit Windows
  • Loading branch information
radarhere authored Dec 27, 2024
2 parents 413cae5 + 2ea3ea9 commit e16e334
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
2 changes: 0 additions & 2 deletions Tests/test_file_wmf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import sys
from io import BytesIO
from pathlib import Path
from typing import IO
Expand Down Expand Up @@ -43,7 +42,6 @@ def test_load_zero_inch() -> None:
pass


@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: 1 addition & 8 deletions src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ PyImaging_EventLoopWin32(PyObject *self, PyObject *args) {

#define GET32(p, o) ((DWORD *)(p + o))[0]

int
static int CALLBACK
enhMetaFileProc(
HDC hdc, HANDLETABLE *lpht, const ENHMETARECORD *lpmr, int nHandles, LPARAM data
) {
Expand Down Expand Up @@ -804,14 +804,7 @@ 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 e16e334

Please sign in to comment.