From 827e3d455a8be8f7b46b2c92da418b898a39f948 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 29 Sep 2015 00:42:26 +0200 Subject: [PATCH 1/5] Build fixes for PCH-less build for D2D graphics context Include the required headers in all cases currently, ideal would be to include them only inside "#ifndef WX_PRECOMP" but it's probably not a big problem to just do it always. See #16625. --- src/msw/graphicsd2d.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index 98c3700166..844b385f5f 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -46,6 +46,8 @@ #include "wx/graphics.h" #include "wx/dc.h" +#include "wx/dcclient.h" +#include "wx/dcmemory.h" #include "wx/dynlib.h" #include "wx/image.h" #include "wx/module.h" @@ -53,6 +55,7 @@ #include "wx/private/graphics.h" #include "wx/stack.h" #include "wx/sharedptr.h" +#include "wx/window.h" // This must be the last header included to only affect the DEFINE_GUID() // occurrences below but not any GUIDs declared in the standard files included From db415ad04de40c56c244451e5275b20d32f9769d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 29 Sep 2015 00:44:08 +0200 Subject: [PATCH 2/5] Compilation fixes for C++98 compilers in D2D graphics code Don't use ">>" token in nested templates, this is not allowed in C++98 but only C++11. Also don't use "= NULL" on pure virtual functions. See #16625. --- src/msw/graphicsd2d.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index 844b385f5f..da189458a8 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -314,10 +314,10 @@ class wxD2DResourceManager; class wxD2DManagedObject { public: - virtual void Bind(wxD2DResourceManager* manager) = NULL; - virtual void UnBind() = NULL; - virtual bool IsBound() = NULL; - virtual wxD2DResourceManager* GetManager() = NULL; + virtual void Bind(wxD2DResourceManager* manager) = 0; + virtual void UnBind() = 0; + virtual bool IsBound() = 0; + virtual wxD2DResourceManager* GetManager() = 0; virtual ~wxD2DManagedObject() {}; }; @@ -2797,7 +2797,7 @@ private: // A ID2D1DrawingStateBlock represents the drawing state of a render target: // the anti aliasing mode, transform, tags, and text-rendering options. // The context owns these pointers and is responsible for releasing them. - wxStack> m_stateStack; + wxStack > m_stateStack; ClipMode m_clipMode; @@ -2806,7 +2806,7 @@ private: // A direct2d layer is a device-dependent resource. wxCOMPtr m_clipLayer; - wxStack> m_layers; + wxStack > m_layers; ID2D1RenderTarget* m_cachedRenderTarget; From 576b0033c06148ae1428a484a4db5d3616615459 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 29 Sep 2015 00:44:08 +0200 Subject: [PATCH 3/5] Fix wrong use of wxCHECK2_MSG in D2D graphics code This was supposed to be wxCHECK_MSG(). See #16625. --- src/msw/graphicsd2d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index da189458a8..f0b3e9debe 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -1452,7 +1452,7 @@ public: ULONG STDMETHODCALLTYPE Release(void) wxOVERRIDE { - wxCHECK2_MSG(m_refCount > 0, 0, "Unbalanced number of calls to Release"); + wxCHECK_MSG(m_refCount > 0, 0, "Unbalanced number of calls to Release"); ULONG refCount = InterlockedDecrement(&m_refCount); if (m_refCount == 0) From 2a9a42fd23bfdb13512e58f8854fcbb1cdb5aaf2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 29 Sep 2015 00:44:08 +0200 Subject: [PATCH 4/5] Don't pretend that we implement IWICBitmapSource::CopyPalette() We don't and it's unclear how to do it, so just return WINCODEC_ERR_PALETTEUNAVAILABLE instead of pretending that we copied the palette when we didn't. See #16625. --- src/msw/graphicsd2d.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index f0b3e9debe..061582fe93 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -1375,10 +1375,9 @@ public: return S_OK; } - HRESULT STDMETHODCALLTYPE CopyPalette(__RPC__in_opt IWICPalette *palette) wxOVERRIDE + HRESULT STDMETHODCALLTYPE CopyPalette(__RPC__in_opt IWICPalette* WXUNUSED(palette)) wxOVERRIDE { - palette = NULL; - return S_OK; + return WINCODEC_ERR_PALETTEUNAVAILABLE; } HRESULT STDMETHODCALLTYPE CopyPixels( From d1dfcd1497495185c90a61c803fb9be8132b06d3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 29 Sep 2015 00:44:08 +0200 Subject: [PATCH 5/5] Fix some g++ warnings in D2D graphics code Avoid warnings about a class with virtual methods having non-virtual dtor and not handling an enum value in a switch. See #16625. --- src/msw/graphicsd2d.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index 061582fe93..13534bc9a5 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -1355,6 +1355,8 @@ public: { } + virtual ~wxHatchBitmapSource() {} + HRESULT STDMETHODCALLTYPE GetSize(__RPC__out UINT *width, __RPC__out UINT *height) wxOVERRIDE { if (width != NULL) *width = 8; @@ -3700,6 +3702,12 @@ void wxD2DRenderer::GetVersion(int* major, int* minor, int* micro) const case wxDirect2D::wxD2D_VERSION_1_1: *minor = 1; break; + case wxDirect2D::wxD2D_VERSION_NONE: + // This is not supposed to happen, but we handle this value in + // the switch to ensure that we'll get warnings if any new + // values, not handled here, are added to the enum later. + *minor = -1; + break; } }