[dasher] Fix screen geometry in vertical orientations & clarify meaning iScaleFactorX/Y



commit b9f69835f877013656935decd2449f75bc923e35
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Tue Dec 21 18:42:18 2010 +0000

    Fix screen geometry in vertical orientations & clarify meaning iScaleFactorX/Y

 Src/DasherCore/DasherViewSquare.cpp |   16 ++++++++--------
 Src/DasherCore/DasherViewSquare.h   |    2 ++
 2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/Src/DasherCore/DasherViewSquare.cpp b/Src/DasherCore/DasherViewSquare.cpp
index 2a3b6cd..42ca120 100644
--- a/Src/DasherCore/DasherViewSquare.cpp
+++ b/Src/DasherCore/DasherViewSquare.cpp
@@ -831,12 +831,12 @@ void CDasherViewSquare::Screen2Dasher(screenint iInputX, screenint iInputY, myin
     iDasherY = myint(iDasherHeight / 2 + ( iInputY - iScreenHeight / 2 ) * m_iScalingFactor/ iScaleFactorY);
     break;
   case Dasher::Opts::TopToBottom:
-    iDasherX = myint( ( iScreenHeight - iInputY ) * m_iScalingFactor/ iScaleFactorY);
-    iDasherY = myint(iDasherHeight / 2 + ( iInputX - iScreenWidth / 2 ) * m_iScalingFactor/ iScaleFactorX);
+    iDasherX = myint( ( iScreenHeight - iInputY ) * m_iScalingFactor/ iScaleFactorX);
+    iDasherY = myint(iDasherHeight / 2 + ( iInputX - iScreenWidth / 2 ) * m_iScalingFactor/ iScaleFactorY);
     break;
   case Dasher::Opts::BottomToTop:
-    iDasherX = myint( ( iInputY  ) * m_iScalingFactor/ iScaleFactorY);
-    iDasherY = myint(iDasherHeight / 2 + ( iInputX - iScreenWidth / 2 ) * m_iScalingFactor/ iScaleFactorX);
+    iDasherX = myint( ( iInputY  ) * m_iScalingFactor/ iScaleFactorX);
+    iDasherY = myint(iDasherHeight / 2 + ( iInputX - iScreenWidth / 2 ) * m_iScalingFactor/ iScaleFactorY);
     break;
   }
 
@@ -1006,15 +1006,15 @@ void CDasherViewSquare::Dasher2Screen(myint iDasherX, myint iDasherY, screenint
     break;
   case Dasher::Opts::TopToBottom:
     iScreenX = screenint(iScreenWidth / 2 + 
-			 CustomIDiv(( iDasherY - iDasherHeight / 2 ) * iScaleFactorX, m_iScalingFactor));
+			 CustomIDiv(( iDasherY - iDasherHeight / 2 ) * iScaleFactorY, m_iScalingFactor));
     iScreenY = screenint(iScreenHeight - 
-			 CustomIDiv(( iDasherX ) * iScaleFactorY, m_iScalingFactor));
+			 CustomIDiv(( iDasherX ) * iScaleFactorX, m_iScalingFactor));
     break;
   case Dasher::Opts::BottomToTop:
     iScreenX = screenint(iScreenWidth / 2 + 
-			 CustomIDiv(( iDasherY - iDasherHeight / 2 ) * iScaleFactorX, m_iScalingFactor));
+			 CustomIDiv(( iDasherY - iDasherHeight / 2 ) * iScaleFactorY, m_iScalingFactor));
     iScreenY = screenint(
-			 CustomIDiv(( iDasherX ) * iScaleFactorY, m_iScalingFactor));
+			 CustomIDiv(( iDasherX ) * iScaleFactorX, m_iScalingFactor));
     break;
   }
 }
diff --git a/Src/DasherCore/DasherViewSquare.h b/Src/DasherCore/DasherViewSquare.h
index 1c669c5..bb25700 100644
--- a/Src/DasherCore/DasherViewSquare.h
+++ b/Src/DasherCore/DasherViewSquare.h
@@ -204,6 +204,8 @@ private:
   myint iMarginWidth;
 
   /// There is a ratio of iScaleFactor{X,Y} abstract screen coords to m_iScalingFactor real pixels
+  /// (Note the naming convention: iScaleFactorX/Y refers to X/Y in Dasher-space, which will be
+  /// the other way around to real screen coordinates if using a vertical (T-B/B-T) orientation)
   myint iScaleFactorX, iScaleFactorY;
   myint m_iScalingFactor;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]