Fix wrong uses of wxBitmap::CreateWithDIPSize()
In portable code CreateWithLogicalSize() must be used when its arguments are logical coordinates, e.g. window sizes, so using CreateWithDIPSize() was wrong and resulted in missized bitmaps in high DPI under MSW.
This commit is contained in:
parent
006a84db14
commit
6655f6e41c
6 changed files with 9 additions and 9 deletions
|
|
@ -173,7 +173,7 @@ void wxAnimationCtrlBase::UpdateStaticImage()
|
|||
m_bmpStaticReal.GetLogicalHeight() != sz.GetHeight())
|
||||
{
|
||||
// need to (re)create m_bmpStaticReal
|
||||
if (!m_bmpStaticReal.CreateWithDIPSize(sz,
|
||||
if (!m_bmpStaticReal.CreateWithLogicalSize(sz,
|
||||
bmpCurrent.GetScaleFactor(),
|
||||
bmpCurrent.GetDepth()))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ private:
|
|||
|
||||
// we must always return a valid bitmap but creating a bitmap of
|
||||
// size 0 would fail, so create a 1*1 bitmap in this case
|
||||
buffer->CreateWithDIPSize(wxMax(w, 1), wxMax(h, 1), scale);
|
||||
buffer->CreateWithLogicalSize(wxMax(w, 1), wxMax(h, 1), scale);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -999,7 +999,7 @@ bool wxWizard::ResizeBitmap(wxBitmap& bmp)
|
|||
if (!m_statbmp->GetBitmap().IsOk() || m_statbmp->GetBitmap().GetLogicalHeight() != bitmapHeight)
|
||||
{
|
||||
wxBitmap bitmap;
|
||||
bitmap.CreateWithDIPSize(bitmapWidth, bitmapHeight, bmp.GetScaleFactor(), bmp.GetDepth());
|
||||
bitmap.CreateWithLogicalSize(bitmapWidth, bitmapHeight, bmp.GetScaleFactor(), bmp.GetDepth());
|
||||
{
|
||||
wxMemoryDC dc;
|
||||
dc.SelectObject(bitmap);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ void wxOverlayImpl::Init(wxDC* dc, int , int , int , int )
|
|||
m_rect.SetSize(m_window->GetClientSize());
|
||||
m_rect.SetPosition(m_window->GetScreenPosition());
|
||||
|
||||
m_bitmap.CreateWithDIPSize(m_rect.GetSize(), m_window->GetDPIScaleFactor());
|
||||
m_bitmap.CreateWithLogicalSize(m_rect.GetSize(), m_window->GetDPIScaleFactor());
|
||||
|
||||
m_overlayWindow = wxCreateOverlayWindow(m_rect);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4607,10 +4607,10 @@ void wxPropertyGrid::OnResize( wxSizeEvent& event )
|
|||
if ( !m_doubleBuffer )
|
||||
{
|
||||
// Create double buffer bitmap to draw on, if none
|
||||
int w = wxMax(width, 250);
|
||||
int h = wxMax(height + dblh, 400);
|
||||
int w = wxMax(width, FromDIP(250));
|
||||
int h = wxMax(height + dblh, FromDIP(400));
|
||||
m_doubleBuffer = new wxBitmap;
|
||||
m_doubleBuffer->CreateWithDIPSize( w, h, scaleFactor );
|
||||
m_doubleBuffer->CreateWithLogicalSize( w, h, scaleFactor );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -4624,7 +4624,7 @@ void wxPropertyGrid::OnResize( wxSizeEvent& event )
|
|||
if ( h < (height+dblh) ) h = height + dblh;
|
||||
delete m_doubleBuffer;
|
||||
m_doubleBuffer = new wxBitmap;
|
||||
m_doubleBuffer->CreateWithDIPSize( w, h, scaleFactor );
|
||||
m_doubleBuffer->CreateWithLogicalSize( w, h, scaleFactor );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3029,7 +3029,7 @@ bool wxRichTextCtrl::RecreateBuffer(const wxSize& size)
|
|||
#if defined(__WXMSW__)
|
||||
depth = 24;
|
||||
#endif
|
||||
m_bufferBitmap.CreateWithDIPSize(sz, GetDPIScaleFactor(), depth);
|
||||
m_bufferBitmap.CreateWithLogicalSize(sz, GetDPIScaleFactor(), depth);
|
||||
}
|
||||
return m_bufferBitmap.IsOk();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue