diff --git a/include/wx/gtk/dc.h b/include/wx/gtk/dc.h index 6c8fb391e3..de09ee2494 100644 --- a/include/wx/gtk/dc.h +++ b/include/wx/gtk/dc.h @@ -32,9 +32,14 @@ public: virtual bool DoStretchBlit(int xdest, int ydest, int dstWidth, int dstHeight, wxDC* source, int xsrc, int ysrc, int srcWidth, int srcHeight, wxRasterOperationMode rop, bool useMask, int xsrcMask, int ysrcMask) wxOVERRIDE; virtual void* GetCairoContext() const wxOVERRIDE; + virtual wxSize GetPPI() const wxOVERRIDE; + protected: int m_width, m_height; +private: + bool TryGetWindowSize(wxSize& size, wxSize& sizeMM) const; + wxDECLARE_NO_COPY_CLASS(wxGTKCairoDCImpl); }; //----------------------------------------------------------------------------- diff --git a/src/gtk/dc.cpp b/src/gtk/dc.cpp index 711b96d517..ed846c0899 100644 --- a/src/gtk/dc.cpp +++ b/src/gtk/dc.cpp @@ -15,6 +15,7 @@ #include "wx/dcclient.h" #include "wx/dcmemory.h" #include "wx/dcscreen.h" +#include "wx/gdicmn.h" #include "wx/icon.h" #include "wx/gtk/dc.h" @@ -237,6 +238,18 @@ void* wxGTKCairoDCImpl::GetCairoContext() const return cr; } +wxSize wxGTKCairoDCImpl::GetPPI() const +{ + if ( m_window ) + { + return wxGetDisplayPPI(); + } + + // For a non-window-based DC the concept of PPI doesn't make much sense + // anyhow, so just return the hardcoded value used by the base class. + return wxGCDCImpl::GetPPI(); +} + //----------------------------------------------------------------------------- wxWindowDCImpl::wxWindowDCImpl(wxWindowDC* owner, wxWindow* window)