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:
Vadim Zeitlin
2015-03-20 00:23:56 +01:00
parent f05b626b3b
commit 2efa1da0d2
2 changed files with 2 additions and 1 deletions

View File

@@ -601,6 +601,7 @@ wxGTK:
wxMSW: wxMSW:
- Fix regression in wxDC drawing with bottom-to-top y axis (Artur Wieczorek).
- Fix compilation with C++Builder XE compiler (Nichka). - Fix compilation with C++Builder XE compiler (Nichka).
- Fix best height of wxSlider with labels but without ticks (Artur Wieczorek). - Fix best height of wxSlider with labels but without ticks (Artur Wieczorek).
- Fix initial text value of wxSpinCtrlDouble (Laurent Poujoulat). - Fix initial text value of wxSpinCtrlDouble (Laurent Poujoulat).

View File

@@ -2007,7 +2007,7 @@ void wxMSWDCImpl::RealizeScaleAndOrigin()
// Becaue only devExtX/logExtX ratio and devExtY/logExtY ratio are counted // Becaue only devExtX/logExtX ratio and devExtY/logExtY ratio are counted
// we can reduce the fractions to avoid large absolute numbers // we can reduce the fractions to avoid large absolute numbers
// and possible arithmetic overflows. // and possible arithmetic overflows.
unsigned int gcd = CalcGCD(abs(devExtX), abs(logExtX)); int gcd = CalcGCD(abs(devExtX), abs(logExtX));
devExtX /= gcd; devExtX /= gcd;
logExtX /= gcd; logExtX /= gcd;
gcd = CalcGCD(abs(devExtY), abs(logExtY)); gcd = CalcGCD(abs(devExtY), abs(logExtY));