diff --git a/.travis.yml b/.travis.yml index f3ffc1cad3..8380d561c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ matrix: env: wxGTK_VERSION=3 wxCONFIGURE_FLAGS="--enable-cxx11 --enable-stl" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" - dist: trusty compiler: clang - env: wxCONFIGURE_FLAGS="--disable-shared --disable-sys-libs" + env: wxCONFIGURE_FLAGS="--disable-shared --disable-sys-libs --disable-webview" - dist: trusty compiler: gcc env: wxTOOLSET=cmake wxCMAKE_GENERATOR="Unix Makefiles" diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake index bdb7ea8e04..04db51a020 100644 --- a/build/cmake/config.cmake +++ b/build/cmake/config.cmake @@ -65,6 +65,7 @@ function(wx_write_config) set(CXX ${CMAKE_CXX_COMPILER}) set(DMALLOC_LIBS) find_program(EGREP egrep) + mark_as_advanced(EGREP) set(EXTRALIBS_GUI) set(EXTRALIBS_HTML) set(EXTRALIBS_SDL) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index fac5a2be3d..292440380f 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -142,10 +142,6 @@ if(DEFINED wxUSE_OLE AND wxUSE_OLE) set(wxUSE_OLE_AUTOMATION ON) endif() -if(DEFINED wxUSE_GRAPHICS_DIRECT2D AND NOT wxUSE_GRAPHICS_CONTEXT) - set(wxUSE_GRAPHICS_DIRECT2D OFF) -endif() - if(wxUSE_OPENGL) set(wxUSE_GLCANVAS ON) endif() @@ -154,12 +150,41 @@ if(wxUSE_THREADS) find_package(Threads REQUIRED) endif() +if(wxUSE_LIBLZMA) + find_package(LibLZMA REQUIRED) +endif() + +if(UNIX AND wxUSE_SECRETSTORE) + # The required APIs are always available under MSW and OS X but we must + # have GNOME libsecret under Unix to be able to compile this class. + find_package(Libsecret REQUIRED) + if(NOT LIBSECRET_FOUND) + message(WARNING "libsecret not found, wxSecretStore won't be available") + wx_option_force_value(wxUSE_SECRETSTORE OFF) + endif() +endif() + if(wxUSE_GUI) if(WXMSW AND wxUSE_METAFILE) # this one should probably be made separately configurable set(wxUSE_ENH_METAFILE ON) endif() + # Direct2D check + if(WIN32 AND wxUSE_GRAPHICS_DIRECT2D) + check_include_file(d2d1.h HAVE_D2D1_H) + if (NOT HAVE_D2D1_H) + wx_option_force_value(wxUSE_GRAPHICS_DIRECT2D OFF) + endif() + endif() + if(MSVC) # match setup.h + if(MSVC_VERSION LESS 1600) + wx_option_force_value(wxUSE_GRAPHICS_DIRECT2D OFF) + else() + wx_option_force_value(wxUSE_GRAPHICS_DIRECT2D ${wxUSE_GRAPHICS_CONTEXT}) + endif() + endif() + # WXQT checks if(WXQT) wx_option_force_value(wxUSE_WEBVIEW OFF) @@ -216,7 +241,17 @@ if(wxUSE_GUI) endif() if(wxUSE_MEDIACTRL AND UNIX AND NOT APPLE AND NOT WIN32) - find_package(GStreamer) + find_package(GStreamer 1.0 COMPONENTS video) + if(NOT GSTREAMER_FOUND) + find_package(GStreamer 0.10 COMPONENTS interfaces) + endif() + + set(wxUSE_GSTREAMER ${GSTREAMER_FOUND}) + set(wxUSE_GSTREAMER_PLAYER OFF) + if(GSTREAMER_PLAYER_INCLUDE_DIRS) + set(wxUSE_GSTREAMER_PLAYER ON) + endif() + if(NOT GSTREAMER_FOUND) message(WARNING "GStreamer not found, wxMediaCtrl won't be available") wx_option_force_value(wxUSE_MEDIACTRL OFF) diff --git a/build/cmake/lib/base/CMakeLists.txt b/build/cmake/lib/base/CMakeLists.txt index 28377c4772..ec38b8947a 100644 --- a/build/cmake/lib/base/CMakeLists.txt +++ b/build/cmake/lib/base/CMakeLists.txt @@ -24,15 +24,6 @@ elseif(APPLE) endif() elseif(UNIX) wx_append_sources(BASE_FILES BASE_UNIX) - if(wxUSE_SECRETSTORE) - # The required APIs are always available under MSW and OS X but we must - # have GNOME libsecret under Unix to be able to compile this class. - find_package(Libsecret REQUIRED) - if(NOT LIBSECRET_FOUND) - message(WARNING "libsecret not found, wxSecretStore won't be available") - wx_option_force_value(wxUSE_SECRETSTORE OFF) - endif() - endif() endif() wx_add_library(base IS_BASE ${BASE_FILES}) diff --git a/build/cmake/lib/media/CMakeLists.txt b/build/cmake/lib/media/CMakeLists.txt index 7452774956..81028fabbe 100644 --- a/build/cmake/lib/media/CMakeLists.txt +++ b/build/cmake/lib/media/CMakeLists.txt @@ -32,7 +32,26 @@ if(WXOSX_COCOA) ) elseif(UNIX) wx_lib_include_directories(media PUBLIC ${GSTREAMER_INCLUDE_DIRS}) + if(GSTREAMER_INTERFACES_INCLUDE_DIRS) + wx_lib_include_directories(media PUBLIC ${GSTREAMER_INTERFACES_INCLUDE_DIRS}) + endif() + if(GSTREAMER_VIDEO_INCLUDE_DIRS) + wx_lib_include_directories(media PUBLIC ${GSTREAMER_VIDEO_INCLUDE_DIRS}) + endif() + if(GSTREAMER_PLAYER_INCLUDE_DIRS) + wx_lib_include_directories(media PUBLIC ${GSTREAMER_PLAYER_INCLUDE_DIRS}) + endif() + wx_lib_link_libraries(media PUBLIC ${GSTREAMER_LIBRARIES}) + if(GSTREAMER_INTERFACES_LIBRARIES) + wx_lib_link_libraries(media PUBLIC ${GSTREAMER_INTERFACES_LIBRARIES}) + endif() + if(GSTREAMER_VIDEO_LIBRARIES) + wx_lib_link_libraries(media PUBLIC ${GSTREAMER_VIDEO_LIBRARIES}) + endif() + if(GSTREAMER_PLAYER_LIBRARIES) + wx_lib_link_libraries(media PUBLIC ${GSTREAMER_PLAYER_LIBRARIES}) + endif() endif() wx_finalize_lib(media) diff --git a/build/cmake/modules/FindFontconfig.cmake b/build/cmake/modules/FindFontconfig.cmake index e6fa81d8ef..c7796b1643 100644 --- a/build/cmake/modules/FindFontconfig.cmake +++ b/build/cmake/modules/FindFontconfig.cmake @@ -43,7 +43,7 @@ else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_FONTCONFIG fontconfig) + pkg_check_modules(PC_FONTCONFIG QUIET fontconfig) set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER}) endif (NOT WIN32) diff --git a/build/cmake/modules/FindGStreamer.cmake b/build/cmake/modules/FindGStreamer.cmake index 99fb58faae..8baf9cde7b 100644 --- a/build/cmake/modules/FindGStreamer.cmake +++ b/build/cmake/modules/FindGStreamer.cmake @@ -22,6 +22,7 @@ # gstreamer-interfaces: GSTREAMER_INTERFACES_INCLUDE_DIRS and GSTREAMER_INTERFACES_LIBRARIES # gstreamer-pbutils: GSTREAMER_PBUTILS_INCLUDE_DIRS and GSTREAMER_PBUTILS_LIBRARIES # gstreamer-video: GSTREAMER_VIDEO_INCLUDE_DIRS and GSTREAMER_VIDEO_LIBRARIES +# gstreamer-player: GSTREAMER_PLAYER_INCLUDE_DIRS and GSTREAMER_PLAYER_LIBRARIES # # Copyright (C) 2012 Raphael Kubo da Costa # @@ -48,28 +49,32 @@ find_package(PkgConfig) -# The minimum GStreamer version we support. -set(GSTREAMER_MINIMUM_VERSION 0.10.30) +# Determine the version in the library name, default is 1.0 +set(GST_LIB_VERSION 1.0) +if(DEFINED GStreamer_FIND_VERSION AND GStreamer_FIND_VERSION VERSION_LESS 1.0) + set(GST_LIB_VERSION 0.10) +endif() # Helper macro to find a GStreamer plugin (or GStreamer itself) # _component_prefix is prepended to the _INCLUDE_DIRS and _LIBRARIES variables (eg. "GSTREAMER_AUDIO") -# _pkgconfig_name is the component's pkg-config name (eg. "gstreamer-0.10", or "gstreamer-video-0.10"). -# _header is the component's header, relative to the gstreamer-0.10 directory (eg. "gst/gst.h"). -# _library is the component's library name (eg. "gstreamer-0.10" or "gstvideo-0.10") +# _pkgconfig_name is the component's pkg-config name (eg. "gstreamer", or "gstreamer-video"). +# _header is the component's header, relative to the gstreamer-${GST_LIB_VERSION} directory (eg. "gst/gst.h"). +# _library is the component's library name (eg. "gstreamer" or "gstvideo") macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library) - # FIXME: The QUIET keyword can be used once we require CMake 2.8.2. - pkg_check_modules(PC_${_component_prefix} ${_pkgconfig_name}) + pkg_check_modules(PC_${_component_prefix} QUIET ${_pkgconfig_name}-${GST_LIB_VERSION}) find_path(${_component_prefix}_INCLUDE_DIRS NAMES ${_header} HINTS ${PC_${_component_prefix}_INCLUDE_DIRS} ${PC_${_component_prefix}_INCLUDEDIR} - PATH_SUFFIXES gstreamer-0.10 + PATH_SUFFIXES gstreamer-${GST_LIB_VERSION} ) find_library(${_component_prefix}_LIBRARIES - NAMES ${_library} + NAMES ${_library}-${GST_LIB_VERSION} HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR} ) + + mark_as_advanced(${_component_prefix}_INCLUDE_DIRS ${_component_prefix}_LIBRARIES) endmacro() # ------------------------ @@ -77,8 +82,8 @@ endmacro() # ------------------------ # 1.1. Find headers and libraries -FIND_GSTREAMER_COMPONENT(GSTREAMER gstreamer-0.10 gst/gst.h gstreamer-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_BASE gstreamer-base-0.10 gst/gst.h gstbase-0.10) +FIND_GSTREAMER_COMPONENT(GSTREAMER gstreamer gst/gst.h gstreamer) +FIND_GSTREAMER_COMPONENT(GSTREAMER_BASE gstreamer-base gst/gst.h gstbase) # 1.2. Check GStreamer version if (GSTREAMER_INCLUDE_DIRS) @@ -98,28 +103,22 @@ if (GSTREAMER_INCLUDE_DIRS) endif () endif () -# FIXME: With CMake 2.8.3 we can just pass GSTREAMER_VERSION to FIND_PACKAGE_HANDLE_STARNDARD_ARGS as VERSION_VAR -# and remove the version check here (GSTREAMER_MINIMUM_VERSION would be passed to FIND_PACKAGE). -set(VERSION_OK TRUE) -if ("${GSTREAMER_VERSION}" VERSION_LESS "${GSTREAMER_MINIMUM_VERSION}") - set(VERSION_OK FALSE) -endif () - # ------------------------- # 2. Find GStreamer plugins # ------------------------- -FIND_GSTREAMER_COMPONENT(GSTREAMER_APP gstreamer-app-0.10 gst/app/gstappsink.h gstapp-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_AUDIO gstreamer-audio-0.10 gst/audio/audio.h gstaudio-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_FFT gstreamer-fft-0.10 gst/fft/gstfft.h gstfft-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_INTERFACES gstreamer-interfaces-0.10 gst/interfaces/mixer.h gstinterfaces-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_PBUTILS gstreamer-pbutils-0.10 gst/pbutils/pbutils.h gstpbutils-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_VIDEO gstreamer-video-0.10 gst/video/video.h gstvideo-0.10) +FIND_GSTREAMER_COMPONENT(GSTREAMER_APP gstreamer-app gst/app/gstappsink.h gstapp) +FIND_GSTREAMER_COMPONENT(GSTREAMER_AUDIO gstreamer-audio gst/audio/audio.h gstaudio) +FIND_GSTREAMER_COMPONENT(GSTREAMER_FFT gstreamer-fft gst/fft/gstfft.h gstfft) +FIND_GSTREAMER_COMPONENT(GSTREAMER_INTERFACES gstreamer-interfaces gst/interfaces/mixer.h gstinterfaces) +FIND_GSTREAMER_COMPONENT(GSTREAMER_PBUTILS gstreamer-pbutils gst/pbutils/pbutils.h gstpbutils) +FIND_GSTREAMER_COMPONENT(GSTREAMER_VIDEO gstreamer-video gst/video/video.h gstvideo) +FIND_GSTREAMER_COMPONENT(GSTREAMER_PLAYER gstreamer-player gst/player/player.h gstplayer) # ------------------------------------------------ # 3. Process the COMPONENTS passed to FIND_PACKAGE # ------------------------------------------------ -set(_GSTREAMER_REQUIRED_VARS GSTREAMER_INCLUDE_DIRS GSTREAMER_LIBRARIES VERSION_OK GSTREAMER_BASE_INCLUDE_DIRS GSTREAMER_BASE_LIBRARIES) +set(_GSTREAMER_REQUIRED_VARS GSTREAMER_VERSION GSTREAMER_INCLUDE_DIRS GSTREAMER_LIBRARIES GSTREAMER_BASE_INCLUDE_DIRS GSTREAMER_BASE_LIBRARIES) foreach (_component ${GStreamer_FIND_COMPONENTS}) set(_gst_component "GSTREAMER_${_component}") @@ -129,4 +128,4 @@ foreach (_component ${GStreamer_FIND_COMPONENTS}) endforeach () include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer DEFAULT_MSG ${_GSTREAMER_REQUIRED_VARS}) \ No newline at end of file +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer DEFAULT_MSG ${_GSTREAMER_REQUIRED_VARS}) diff --git a/build/cmake/modules/FindGTK3.cmake b/build/cmake/modules/FindGTK3.cmake index 2b510aee5f..9f62658d0f 100644 --- a/build/cmake/modules/FindGTK3.cmake +++ b/build/cmake/modules/FindGTK3.cmake @@ -29,7 +29,7 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. find_package(PkgConfig) -pkg_check_modules(GTK3 gtk+-3.0) +pkg_check_modules(GTK3 QUIET gtk+-3.0) set(VERSION_OK TRUE) if (GTK3_VERSION) if (GTK3_FIND_VERSION_EXACT) diff --git a/build/cmake/modules/FindLibSoup.cmake b/build/cmake/modules/FindLibSoup.cmake index c7448921a9..8ce25561d8 100644 --- a/build/cmake/modules/FindLibSoup.cmake +++ b/build/cmake/modules/FindLibSoup.cmake @@ -52,3 +52,5 @@ endif() INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibSoup REQUIRED_VARS LIBSOUP_INCLUDE_DIRS LIBSOUP_LIBRARIES VERSION_VAR PC_LIBSOUP_VERSION) + +mark_as_advanced(LIBSOUP_LIBRARIES LIBSOUP_INCLUDE_DIRS) diff --git a/build/cmake/modules/FindLibsecret.cmake b/build/cmake/modules/FindLibsecret.cmake index d33228a77a..af1e059fcb 100644 --- a/build/cmake/modules/FindLibsecret.cmake +++ b/build/cmake/modules/FindLibsecret.cmake @@ -30,7 +30,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. find_package(PkgConfig) -pkg_check_modules(LIBSECRET libsecret-1) +pkg_check_modules(LIBSECRET QUIET libsecret-1) set(VERSION_OK TRUE) if (LIBSECRET_VERSION) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 19c7344b80..6b03f2b068 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -71,9 +71,6 @@ wx_add_thirdparty_library(wxUSE_LIBPNG PNG "use libpng (PNG image format)") wx_add_thirdparty_library(wxUSE_LIBTIFF TIFF "use libtiff (TIFF file format)") wx_option(wxUSE_LIBLZMA "use LZMA compression" OFF) -if(wxUSE_LIBLZMA) - find_package(LibLZMA REQUIRED) -endif() set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_LIBLZMA "use liblzma for LZMA compression") wx_option(wxUSE_OPENGL "use OpenGL (or Mesa)") @@ -211,8 +208,8 @@ if(APPLE) set(wxUSE_GRAPHICS_CONTEXT ON) else() wx_option(wxUSE_GRAPHICS_CONTEXT "use graphics context 2D drawing API") - if (WIN32 AND (NOT MSVC OR MSVC_VERSION LESS 1600)) - wx_option(wxUSE_GRAPHICS_DIRECT2D "enable Direct2D graphics context" OFF) + if(WIN32) + wx_option(wxUSE_GRAPHICS_DIRECT2D "enable Direct2D graphics context") endif() endif() diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index acd36027dc..40b72ee7d7 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -21,7 +21,18 @@ case $(uname -s) in *--with-qt*) libtoolkit_dev='qtdeclarative5-dev' ;; esac - $SUDO apt-get install -y $libgtk_dev $libtoolkit_dev libnotify-dev + pgk_check="libgstreamermm-1.0-dev libgstreamermm-0.10-dev \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ + libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev \ + libwebkitgtk-dev libglu1-mesa-dev libsecret-1-dev libnotify-dev" + + for pkg in $pgk_check; do + if $(apt-cache pkgnames | grep -q $pkg) ; then + pkg_install="$pkg_install $pkg" + fi + done + + $SUDO apt-get install -y $libgtk_dev $libtoolkit_dev $pkg_install fi ;; diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index 00eb65dde3..983372502c 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -23,6 +23,9 @@ #define D2D1MakeSkewMatrix wxD2D1MakeSkewMatrix #define D2D1IsMatrixInvertible wxD2D1IsMatrixInvertible #define D2D1InvertMatrix wxD2D1InvertMatrix +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +#define D3D11CreateDevice wxD3D11CreateDevice +#endif // There are clashes between the names of the member fields and parameters // in the standard d2d1helper.h header resulting in C4458 with VC14, @@ -42,9 +45,9 @@ #endif #if wxD2D_DEVICE_CONTEXT_SUPPORTED -#include -#include -#include +#include +#include +#include #endif #ifdef __VISUALC__ @@ -155,6 +158,11 @@ private: if ( !m_dllDirectWrite.Load(wxT("dwrite.dll"), wxDL_VERBATIM | wxDL_QUIET) ) return false; +#if wxD2D_DEVICE_CONTEXT_SUPPORTED + if (!m_dllDirect3d.Load(wxT("d3d11.dll"), wxDL_VERBATIM | wxDL_QUIET)) + return false; +#endif + #define wxLOAD_FUNC(dll, name) \ name = (name##_t)dll.RawGetSymbol(#name); \ if ( !name ) \ @@ -167,6 +175,10 @@ private: wxLOAD_FUNC(m_dllDirect2d, D2D1InvertMatrix); wxLOAD_FUNC(m_dllDirectWrite, DWriteCreateFactory); +#if wxD2D_DEVICE_CONTEXT_SUPPORTED + wxLOAD_FUNC(m_dllDirect3d, D3D11CreateDevice); +#endif + m_D2DRuntimeVersion = wxD2D_VERSION_1_0; return true; @@ -191,6 +203,11 @@ public: typedef HRESULT (WINAPI *DWriteCreateFactory_t)(DWRITE_FACTORY_TYPE, REFIID, IUnknown**); static DWriteCreateFactory_t DWriteCreateFactory; +#if wxD2D_DEVICE_CONTEXT_SUPPORTED + typedef HRESULT (WINAPI *D3D11CreateDevice_t)(IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, UINT, CONST D3D_FEATURE_LEVEL*, UINT, UINT, ID3D11Device**, D3D_FEATURE_LEVEL*, ID3D11DeviceContext**); + static D3D11CreateDevice_t D3D11CreateDevice; +#endif + private: static bool m_initialized; static bool m_hasDirect2DSupport; @@ -198,6 +215,9 @@ private: static wxDynamicLibrary m_dllDirect2d; static wxDynamicLibrary m_dllDirectWrite; +#if wxD2D_DEVICE_CONTEXT_SUPPORTED + static wxDynamicLibrary m_dllDirect3d; +#endif }; // define the members @@ -207,6 +227,9 @@ wxDirect2D::wxD2DVersion wxDirect2D::m_D2DRuntimeVersion = wxD2D_VERSION_NONE; wxDynamicLibrary wxDirect2D::m_dllDirect2d; wxDynamicLibrary wxDirect2D::m_dllDirectWrite; +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +wxDynamicLibrary wxDirect2D::m_dllDirect3d; +#endif // define the (not yet imported) functions wxDirect2D::D2D1CreateFactory_t wxDirect2D::D2D1CreateFactory = NULL; @@ -216,6 +239,10 @@ wxDirect2D::D2D1IsMatrixInvertible_t wxDirect2D::D2D1IsMatrixInvertible = NULL; wxDirect2D::D2D1InvertMatrix_t wxDirect2D::D2D1InvertMatrix = NULL; wxDirect2D::DWriteCreateFactory_t wxDirect2D::DWriteCreateFactory = NULL; +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +wxDirect2D::D3D11CreateDevice_t wxDirect2D::D3D11CreateDevice = NULL; +#endif + // define the interface GUIDs DEFINE_GUID(wxIID_IWICImagingFactory, 0xec5ec8a9, 0xc395, 0x4314, 0x9c, 0x77, 0x54, 0xd7, 0xa9, 0x35, 0xff, 0x70); @@ -235,6 +262,11 @@ DEFINE_GUID(GUID_WICPixelFormat32bppPBGRA, DEFINE_GUID(GUID_WICPixelFormat32bppBGR, 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0e); +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +DEFINE_GUID(IID_IDXGIDevice, + 0x54ec77fa, 0x1377, 0x44e6, 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c); +#endif + #ifndef CLSID_WICImagingFactory DEFINE_GUID(CLSID_WICImagingFactory, 0xcacaf262, 0x9370, 0x4615, 0xa1, 0x3b, 0x9f, 0x55, 0x39, 0xda, 0x4c, 0xa); @@ -298,6 +330,36 @@ BOOL WINAPI wxD2D1InvertMatrix( return wxDirect2D::D2D1InvertMatrix(matrix); } +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +HRESULT WINAPI wxD3D11CreateDevice( + IDXGIAdapter* pAdapter, + D3D_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + CONST D3D_FEATURE_LEVEL* pFeatureLevels, + UINT FeatureLevels, + UINT SDKVersion, + ID3D11Device** ppDevice, + D3D_FEATURE_LEVEL* pFeatureLevel, + ID3D11DeviceContext** ppImmediateContext) +{ + if (!wxDirect2D::Initialize()) + return S_FALSE; + + return wxDirect2D::D3D11CreateDevice( + pAdapter, + DriverType, + Software, + Flags, + pFeatureLevels, + FeatureLevels, + SDKVersion, + ppDevice, + pFeatureLevel, + ppImmediateContext); +} +#endif + static IWICImagingFactory* gs_WICImagingFactory = NULL; IWICImagingFactory* wxWICImagingFactory() @@ -401,7 +463,7 @@ public: // was not previously acquired virtual void* GetResource() = 0; - virtual ~wxResourceHolder(){}; + virtual ~wxResourceHolder() {} }; class wxD2DResourceManager; @@ -414,13 +476,13 @@ public: virtual bool IsBound() = 0; virtual wxD2DResourceManager* GetManager() = 0; - virtual ~wxD2DManagedObject() {}; + virtual ~wxD2DManagedObject() {} }; class wxManagedResourceHolder : public wxResourceHolder, public wxD2DManagedObject { public: - virtual ~wxManagedResourceHolder() {}; + virtual ~wxManagedResourceHolder() {} }; // A Direct2D resource manager handles the device-dependent @@ -594,7 +656,7 @@ public: virtual wxD2DManagedObject* GetManagedObject() = 0; - ~wxD2DManagedGraphicsData() {}; + ~wxD2DManagedGraphicsData() {} }; D2D1_CAP_STYLE wxD2DConvertPenCap(wxPenCap cap) @@ -1115,7 +1177,7 @@ public : void* GetNativePath() const wxOVERRIDE; // give the native path returned by GetNativePath() back (there might be some deallocations necessary) - void UnGetNativePath(void* WXUNUSED(p)) const wxOVERRIDE {}; + void UnGetNativePath(void* WXUNUSED(p)) const wxOVERRIDE {} // transforms each point of this path by the matrix void Transform(const wxGraphicsMatrixData* matrix) wxOVERRIDE; @@ -2199,7 +2261,7 @@ public: wxGraphicsBitmapData(renderer), m_bitmapHolder(bitmap) {} wxD2DBitmapData(wxGraphicsRenderer* renderer, const void* pseudoNativeBitmap) : - wxGraphicsBitmapData(renderer), m_bitmapHolder(*static_cast(pseudoNativeBitmap)) {}; + wxGraphicsBitmapData(renderer), m_bitmapHolder(*static_cast(pseudoNativeBitmap)) {} // returns the native representation void* GetNativeBitmap() const wxOVERRIDE; @@ -2268,8 +2330,8 @@ template class wxD2DBrushResourceHolder : public wxD2DResourceHolder { public: - wxD2DBrushResourceHolder(const wxBrush& brush) : m_sourceBrush(brush) {}; - virtual ~wxD2DBrushResourceHolder() {}; + wxD2DBrushResourceHolder(const wxBrush& brush) : m_sourceBrush(brush) {} + virtual ~wxD2DBrushResourceHolder() {} protected: const wxBrush m_sourceBrush; }; @@ -2645,7 +2707,7 @@ public: wxCOMPtr GetTextFormat() const { return m_textFormat; } - wxCOMPtr GetFont() { return m_font; }; + wxCOMPtr GetFont() { return m_font; } private: // The native, device-independent font object