[dasher: 15/27] Fix ClipLineToVisible & change contract; rm unimp DasherViewSq::DasherSpaceLine



commit 0eb0bb3a258e962438c4d833dbedd43fbe0aabf3
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Sat Aug 14 15:24:04 2010 +0100

    Fix ClipLineToVisible & change contract; rm unimp DasherViewSq::DasherSpaceLine
    
    (ClipLineToVisible leaves args undefined if returns false)

 Src/DasherCore/DasherView.cpp     |    4 ++--
 Src/DasherCore/DasherView.h       |    2 +-
 Src/DasherCore/DasherViewSquare.h |    2 --
 3 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/Src/DasherCore/DasherView.cpp b/Src/DasherCore/DasherView.cpp
index 08b9f6a..fdde335 100644
--- a/Src/DasherCore/DasherView.cpp
+++ b/Src/DasherCore/DasherView.cpp
@@ -131,8 +131,6 @@ bool CDasherView::ClipLineToVisible(myint &x1, myint &y1, myint &x2, myint &y2)
     DASHER_ASSERT(x1<iDasherMinX);
     return false;
   }
-  if (y1 < iDasherMinY && y2 < iDasherMinY) return false;
-  if (y1 > iDasherMaxY && y2 > iDasherMaxY) return false;
   if (x1 < iDasherMinX) {
     y1 = y2+((y1-y2)*(iDasherMinX-x2)/(x1 - x2));
     x1 = iDasherMinX;
@@ -141,6 +139,8 @@ bool CDasherView::ClipLineToVisible(myint &x1, myint &y1, myint &x2, myint &y2)
     y2 = y1 + (y2-y1)*(iDasherMaxX-x1)/(x2-x1);
     x2 = iDasherMaxX;
   }
+  if (y1 < iDasherMinY && y2 < iDasherMinY) return false;
+  if (y1 > iDasherMaxY && y2 > iDasherMaxY) return false;
   for (int i=0; i<2; i++) {
     myint &y(i ? y2 : y1), &oy(i ? y1 : y2);
     myint &x(i ? x2 : x1), &ox(i ? x1 : x2);
diff --git a/Src/DasherCore/DasherView.h b/Src/DasherCore/DasherView.h
index 9ef110a..ba7a276 100644
--- a/Src/DasherCore/DasherView.h
+++ b/Src/DasherCore/DasherView.h
@@ -174,7 +174,7 @@ protected:
   /// Clips a line (specified in Dasher co-ordinates) to the visible region
   /// by intersecting with all boundaries.
   /// \return true if any part of the line was within the visible region; in this case, (x1,y1)-(x2,y2) delineate exactly that part
-  /// false if the line would be entirely outside the visible region; x1, y1, x2, y2 unaffected.
+  /// false if the line would be entirely outside the visible region; x1, y1, x2, y2 undefined.
   bool ClipLineToVisible(myint &x1, myint &y1, myint &x2, myint &y2); 
   
   ///Convert a straight line in Dasher-space, to coordinates for a corresponding polyline on the screen
diff --git a/Src/DasherCore/DasherViewSquare.h b/Src/DasherCore/DasherViewSquare.h
index 433c477..963d0a9 100644
--- a/Src/DasherCore/DasherViewSquare.h
+++ b/Src/DasherCore/DasherViewSquare.h
@@ -99,8 +99,6 @@ public:
 
   /// @}
 
-  void DasherSpaceLine(myint x1, myint x2, myint y1, myint y2, int iColor, int iWidth);
-
 private:
   ///
   /// Draw text specified in Dasher co-ordinates



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