From 2efa1da0d2f5fb5f5d27e77fc88c1ac879a1ffac Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 20 Mar 2015 00:23:56 +0100 Subject: [PATCH] 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. --- docs/changes.txt | 1 + src/msw/dc.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 8885427009..062db24483 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -601,6 +601,7 @@ wxGTK: wxMSW: +- Fix regression in wxDC drawing with bottom-to-top y axis (Artur Wieczorek). - Fix compilation with C++Builder XE compiler (Nichka). - Fix best height of wxSlider with labels but without ticks (Artur Wieczorek). - Fix initial text value of wxSpinCtrlDouble (Laurent Poujoulat). diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index abd8956f34..d9168af520 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -2007,7 +2007,7 @@ void wxMSWDCImpl::RealizeScaleAndOrigin() // Becaue only devExtX/logExtX ratio and devExtY/logExtY ratio are counted // we can reduce the fractions to avoid large absolute numbers // and possible arithmetic overflows. - unsigned int gcd = CalcGCD(abs(devExtX), abs(logExtX)); + int gcd = CalcGCD(abs(devExtX), abs(logExtX)); devExtX /= gcd; logExtX /= gcd; gcd = CalcGCD(abs(devExtY), abs(logExtY));