From 2ea3ea94a117772532e6f04ae7284c5842392af4 Mon Sep 17 00:00:00 2001 From: Nulano Date: Thu, 26 Dec 2024 21:41:51 +0100 Subject: [PATCH] Skip failing WMF records on 32-bit Windows --- Tests/test_file_wmf.py | 2 -- src/display.c | 9 +-------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/Tests/test_file_wmf.py b/Tests/test_file_wmf.py index 9322bd0c53b..d3cad7ca481 100644 --- a/Tests/test_file_wmf.py +++ b/Tests/test_file_wmf.py @@ -1,6 +1,5 @@ from __future__ import annotations -import sys from io import BytesIO from pathlib import Path from typing import IO @@ -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() diff --git a/src/display.c b/src/display.c index fe5801fc0e6..b5e9c2a3db7 100644 --- a/src/display.c +++ b/src/display.c @@ -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 ) { @@ -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 */