[giv] Temporary fix for a clipping refresh error.



commit e8d9258ec239cf961bd45236b558171a4d968f9c
Author: Dov Grobgeld <dov grobgeld gmail com>
Date:   Sun Sep 25 23:30:53 2011 +0300

    Temporary fix for a clipping refresh error.
    
    * GivRenderer.gob : Temporary fix for clipping error.

 ChangeLog          |    2 ++
 src/GivRenderer.cc |   24 ++++++++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6226037..403e96c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2011-09-25  Dov Grobgeld  <dov grobgeld gmail com>
 
+        * GivRenderer.gob : Temporary fix for clipping error. 
+
         * giv-win.gob, giv-parser.gob : Added tool for counting marks in rectangle.
 
         * giv-win.gob : Fixed bug that he -join flag wasn't functioning.
diff --git a/src/GivRenderer.cc b/src/GivRenderer.cc
index 31058b4..2775989 100644
--- a/src/GivRenderer.cc
+++ b/src/GivRenderer.cc
@@ -367,10 +367,26 @@ clip_line_to_rectangle(double x0, double y0, double x1, double y1,
         return TRUE;
     }
     else {
-        *cx0 = cross_x[0];
-        *cy0 = cross_y[0];
-        *cx1 = cross_x[1];
-        *cy1 = cross_y[1];
+        // This is wrong. The right thing is to choose which of the points [0] or [1]
+        // sit on the rectangle, and use that point.
+        if (z0_inside) {
+            *cx1 = cross_x[0];
+            *cy1 = cross_y[0];
+            *cx0 = x0;
+            *cy0 = y0;
+        }
+        else if (z1_inside) {
+            *cx0 = cross_x[0];
+            *cy0 = cross_y[0];
+            *cx1 = x1;
+            *cy1 = y1;
+        }
+        else {
+            *cx0 = cross_x[0];
+            *cy0 = cross_y[0];
+            *cx1 = cross_x[1];
+            *cy1 = cross_y[1];
+        }
         return TRUE;
     }
 }



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