Really fix setting wxBitmap scale factor
Optimization of 2ae80673ff (Avoid unnecessarily unsharing bitmaps in
wxMSW, 2022-02-02) broke setting the scale factor because we didn't
update the right bitmap data in case bitmap hadn't had exclusive
ownership of its data before. Fix this by not using a reference which
may refer to another object after AllocExclusive() call.
Also change the other ports to unshared the bitmap when modifying its
scale factor so that the new unit test passes for them too.
This commit is contained in:
@@ -1391,7 +1391,12 @@ void wxBitmap::SetScaleFactor(double scale)
|
||||
{
|
||||
wxCHECK_RET( IsOk(), wxT("invalid bitmap") );
|
||||
|
||||
return GetBitmapData()->SetScaleFactor(scale) ;
|
||||
if ( GetBitmapData()->GetScaleFactor() != scale )
|
||||
{
|
||||
AllocExclusive();
|
||||
|
||||
GetBitmapData()->SetScaleFactor(scale) ;
|
||||
}
|
||||
}
|
||||
|
||||
double wxBitmap::GetScaleFactor() const
|
||||
|
||||
Reference in New Issue
Block a user