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:
@@ -3471,6 +3471,20 @@ void wxWindowGTK::DoGetTextExtent( const wxString& string,
|
||||
txm.GetTextExtent(string, x, y, descent, externalLeading);
|
||||
}
|
||||
|
||||
double wxWindowGTK::GetContentScaleFactor() const
|
||||
{
|
||||
double scaleFactor = 1;
|
||||
#if GTK_CHECK_VERSION(3,10,0)
|
||||
if (m_widget && gtk_check_version(3,10,0) == NULL)
|
||||
{
|
||||
GdkWindow* window = gtk_widget_get_window(m_widget);
|
||||
if (window)
|
||||
scaleFactor = gdk_window_get_scale_factor(window);
|
||||
}
|
||||
#endif
|
||||
return scaleFactor;
|
||||
}
|
||||
|
||||
void wxWindowGTK::GTKDisableFocusOutEvent()
|
||||
{
|
||||
g_signal_handlers_block_by_func( m_focusWidget,
|
||||
|
||||
Reference in New Issue
Block a user