Allow drawing HiDPI bitmaps with GTK3

1. Override wxWindow::GetContentScaleFactor() to use gdk_window_get_scale_factor()
   when available, and to use correct scale (1.0) otherwise, as wxDC::GetPPI()
   (used by overridden method) is not properly implemented for wxGTK
2. Record scale in wxBitmap(wxImage&) ctor and wxBitmap::CreateScaled()
3. Adjust cairo scale for drawing bitmap, and (inversely) for drawing on bitmap
This commit is contained in:
Paul Cornett
2016-02-14 13:12:52 -08:00
parent ed09b7b6c0
commit f95fd11e08
5 changed files with 49 additions and 4 deletions

View File

@@ -343,8 +343,8 @@ void wxMemoryDCImpl::Setup()
m_ok = m_bitmap.IsOk();
if (m_ok)
{
m_width = m_bitmap.GetWidth();
m_height = m_bitmap.GetHeight();
m_width = int(m_bitmap.GetScaledWidth());
m_height = int(m_bitmap.GetScaledHeight());
cairo_t* cr = m_bitmap.CairoCreate();
gc = wxGraphicsContext::CreateFromNative(cr);
gc->EnableOffset(true);