Use wxBitmap::Rescale() in wxGenericStaticBitmap code

No real changes, just reuse the existing function instead of redoing it
one more time.
This commit is contained in:
Vadim Zeitlin
2021-10-21 22:57:01 +01:00
parent 3abec9254f
commit 0a91a2f40b

View File

@@ -55,7 +55,7 @@ void wxGenericStaticBitmap::OnPaint(wxPaintEvent& WXUNUSED(event))
if ( !drawSize.x || !drawSize.y ) if ( !drawSize.x || !drawSize.y )
return; return;
const wxBitmap bitmap = GetBitmap(); wxBitmap bitmap = GetBitmap();
const wxSize bmpSize = bitmap.GetSize(); const wxSize bmpSize = bitmap.GetSize();
wxDouble w = 0; wxDouble w = 0;
wxDouble h = 0; wxDouble h = 0;
@@ -96,9 +96,8 @@ void wxGenericStaticBitmap::OnPaint(wxPaintEvent& WXUNUSED(event))
gc(wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc)); gc(wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc));
gc->DrawBitmap(bitmap, x, y, w, h); gc->DrawBitmap(bitmap, x, y, w, h);
#else #else
wxImage img = bitmap.ConvertToImage(); wxBitmap::Rescale(bitmap, wxSize(wxRound(w), wxRound(h)));
img.Rescale(wxRound(w), wxRound(h), wxIMAGE_QUALITY_HIGH); dc.DrawBitmap(bitmap, wxRound(x), wxRound(y), true);
dc.DrawBitmap(wxBitmap(img), wxRound(x), wxRound(y), true);
#endif #endif
} }