From e8daaf659eb20d365a947b6a2f6168398731175c Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 7 Apr 2019 21:56:35 -0400 Subject: [PATCH] windows/direct2d: fix ID2D1RenderTarget::GetPixelFormat() and ID2D1RenderTarget::GetSize() typedefs in MinGW-w64 ABI workaround MinGW-w64 recently added manual workarounds directly into the class via overloads that make existing Direct2D code source-compatible. However, that exposed an error in my definition of the typedefs I was using in my own workaround: both of these methods are const, even in MSVC, but I neglected to include the const qualifier. I'm not sure how this code compiled in the past, but now the overload resolution engine finds no match. I want to remain compatible with versions of MinGW-w64 old enough to not have their fix, so our fix remains. Fixes #446. --- windows/colordialog.cpp | 2 +- windows/winutil.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/colordialog.cpp b/windows/colordialog.cpp index d7030a4ff..a04c44614 100644 --- a/windows/colordialog.cpp +++ b/windows/colordialog.cpp @@ -314,7 +314,7 @@ static void drawGrid(ID2D1RenderTarget *rt, D2D1_RECT_F *fillRect) pformat = rt->GetPixelFormat(); #else { - typedef D2D1_PIXEL_FORMAT *(__stdcall ID2D1RenderTarget::* GetPixelFormatF)(D2D1_PIXEL_FORMAT *); + typedef D2D1_PIXEL_FORMAT *(__stdcall ID2D1RenderTarget::* GetPixelFormatF)(D2D1_PIXEL_FORMAT *) const; GetPixelFormatF gpf; gpf = (GetPixelFormatF) (&(rt->GetPixelFormat)); diff --git a/windows/winutil.cpp b/windows/winutil.cpp index 507c5a3f7..67f060684 100644 --- a/windows/winutil.cpp +++ b/windows/winutil.cpp @@ -144,7 +144,7 @@ D2D1_SIZE_F realGetSize(ID2D1RenderTarget *rt) return rt->GetSize(); #else D2D1_SIZE_F size; - typedef D2D1_SIZE_F *(__stdcall ID2D1RenderTarget::* GetSizeF)(D2D1_SIZE_F *); + typedef D2D1_SIZE_F *(__stdcall ID2D1RenderTarget::* GetSizeF)(D2D1_SIZE_F *) const; GetSizeF gs; gs = (GetSizeF) (&(rt->GetSize));