Fix regression in wxMSW wxDC::SetAxisOrientation().
Don't mix signed/unsigned integers in arithmetic operations when normalizing wxDC scale factors: variable holding GCD value should be of the same type as variables holding devExt and logExt to avoid wrong results of /= operation when dividend is a negative value. Closes #16908.
This commit is contained in:
committed by
Vadim Zeitlin
parent
d2ddb2c7c0
commit
7a0123ea8e
@@ -2012,7 +2012,7 @@ void wxMSWDCImpl::RealizeScaleAndOrigin()
|
|||||||
// In GDI anisotropic mode only devExt/logExt ratio is important
|
// In GDI anisotropic mode only devExt/logExt ratio is important
|
||||||
// so we can reduce the fractions to avoid large numbers
|
// so we can reduce the fractions to avoid large numbers
|
||||||
// which could cause arithmetic overflows inside Win API.
|
// which could cause arithmetic overflows inside Win API.
|
||||||
unsigned int gcd = wxGCD(abs(devExtX), abs(logExtX));
|
int gcd = wxGCD(abs(devExtX), abs(logExtX));
|
||||||
devExtX /= gcd;
|
devExtX /= gcd;
|
||||||
logExtX /= gcd;
|
logExtX /= gcd;
|
||||||
gcd = wxGCD(abs(devExtY), abs(logExtY));
|
gcd = wxGCD(abs(devExtY), abs(logExtY));
|
||||||
|
Reference in New Issue
Block a user