Skip to content

Commit

Permalink
windows/direct2d: fix ID2D1RenderTarget::GetPixelFormat() and ID2D1Re…
Browse files Browse the repository at this point in the history
…nderTarget::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.
  • Loading branch information
andlabs committed Apr 8, 2019
1 parent 9c164a2 commit e8daaf6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion windows/colordialog.cpp
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion windows/winutil.cpp
Expand Up @@ -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));
Expand Down

0 comments on commit e8daaf6

Please sign in to comment.