Handle wxDC scale factor in wxBitmap ctor taking wxDC in wxMSW
When using wxBitmap ctor taking wxDC, the bitmap should inherit the scale factor of the DC, both because it's already the case in the other ports and because it makes sense to do it. Add a unit test checking that this is the case in all ports now.
This commit is contained in:
@@ -755,7 +755,14 @@ bool wxBitmap::Create(int width, int height, const wxDC& dc)
|
||||
{
|
||||
wxCHECK_MSG( dc.IsOk(), false, wxT("invalid HDC in wxBitmap::Create()") );
|
||||
|
||||
return DoCreate(width, height, -1, dc.GetHDC());
|
||||
const double scale = dc.GetContentScaleFactor();
|
||||
|
||||
if ( !DoCreate(wxRound(width*scale), wxRound(height*scale), -1, dc.GetHDC()) )
|
||||
return false;
|
||||
|
||||
GetBitmapData()->m_scaleFactor = scale;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxBitmap::CreateWithDIPSize(const wxSize& size, double scale, int depth)
|
||||
|
||||
Reference in New Issue
Block a user