Revision: 5709
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5709&view=rev
Author:   hofman
Date:     2009-09-08 09:46:01 +0000 (Tue, 08 Sep 2009)

Log Message:
-----------
quad points may be in a different order, so get the rects from the enclosure of 
all four points

Modified Paths:
--------------
    trunk/PDFAnnotationMarkup_SKExtensions.m

Modified: trunk/PDFAnnotationMarkup_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationMarkup_SKExtensions.m    2009-09-08 09:25:08 UTC (rev 
5708)
+++ trunk/PDFAnnotationMarkup_SKExtensions.m    2009-09-08 09:46:01 UTC (rev 
5709)
@@ -259,6 +259,7 @@
 
     NSUInteger j, jMax = [quadPoints count] / 4;
     CFMutableArrayRef lines = [self lineRects];
+    NSPoint origin = [self bounds].origin;
     
     CFArrayRemoveAllValues(lines);
     
@@ -269,15 +270,18 @@
         NSValue *values[4];
         [quadPoints getObjects:values range:range];
         
-        NSPoint points[4];
-        NSUInteger i = 0;
-        for (i = 0; i < 4; i++)
-            points[i] = [values[i] pointValue];
+        NSPoint point;
+        NSUInteger i;
+        CGFloat minX = CGFLOAT_MAX, maxX = CGFLOAT_MIN, minY = CGFLOAT_MAX, 
maxY = CGFLOAT_MIN;
+        for (i = 0; i < 4; i++) {
+            point = [values[i] pointValue];
+            minX = SKMin(minX, point.x);
+            maxX = SKMax(maxX, point.x);
+            minY = SKMin(minY, point.y);
+            maxY = SKMax(maxY, point.y);
+        }
         
-        NSRect lineRect;
-        lineRect.size.height = points[1].y - points[2].y;
-        lineRect.size.width = points[1].x - points[2].x;
-        lineRect.origin = SKAddPoints(points[2], [self bounds].origin);
+        NSRect lineRect = NSMakeRect(origin.x + minX, origin.y + minY, maxX - 
minX, maxY - minY);
         CFArrayAppendValue(lines, &lineRect);
     }
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to