Revision: 5802
http://skim-app.svn.sourceforge.net/skim-app/?rev=5802&view=rev
Author: hofman
Date: 2009-09-23 17:14:34 +0000 (Wed, 23 Sep 2009)
Log Message:
-----------
use pointer array for line rects on pdfpage
Modified Paths:
--------------
trunk/PDFPage_SKExtensions.h
trunk/PDFPage_SKExtensions.m
trunk/SKPDFView.m
trunk/SKReadingBar.h
trunk/SKReadingBar.m
Modified: trunk/PDFPage_SKExtensions.h
===================================================================
--- trunk/PDFPage_SKExtensions.h 2009-09-23 17:03:35 UTC (rev 5801)
+++ trunk/PDFPage_SKExtensions.h 2009-09-23 17:14:34 UTC (rev 5802)
@@ -72,7 +72,7 @@
- (NSData *)PDFDataForRect:(NSRect)rect;
- (NSData *)TIFFDataForRect:(NSRect)rect;
-- (NSArray *)lineRects;
+- (NSPointerArray *)lineRects;
- (NSUInteger)pageIndex;
- (NSString *)sequentialLabel;
Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m 2009-09-23 17:03:35 UTC (rev 5801)
+++ trunk/PDFPage_SKExtensions.m 2009-09-23 17:14:34 UTC (rev 5802)
@@ -54,6 +54,7 @@
#import "PDFAnnotation_SKExtensions.h"
#import "PDFAnnotationMarkup_SKExtensions.h"
#import "PDFAnnotationInk_SKExtensions.h"
+#import "NSPointerFunctions_SKExtensions.h"
NSString *SKPDFPageBoundsDidChangeNotification =
@"SKPDFPageBoundsDidChangeNotification";
@@ -276,7 +277,7 @@
return data;
}
-- (NSArray *)lineRects {
+- (NSPointerArray *)lineRects {
NSMutableArray *lines = [NSMutableArray array];
PDFSelection *sel = [self selectionForRect:[self
boundsForBox:kPDFDisplayBoxCropBox]];
@@ -289,7 +290,7 @@
[lines sortUsingSelector:@selector(boundsCompare:)];
NSUInteger i, iMax = [lines count];
- NSMutableArray *fullLines = [NSMutableArray array];
+ NSPointerArray *fullLines = [[[NSPointerArray alloc]
initWithPointerFunctions:[NSPointerFunctions rectPointerFunctions]]
autorelease];
NSRect r1 = NSZeroRect;
for (i = 0; i < iMax; i++) {
@@ -299,12 +300,12 @@
} else if ((NSMinY(r1) < NSMidY(r2) && NSMidY(r1) > NSMinY(r2)) ||
(NSMidY(r1) < NSMaxY(r2) && NSMaxY(r1) > NSMidY(r2))) {
r1 = NSUnionRect(r1, r2);
} else if (NSEqualRects(r1, NSZeroRect) == NO) {
- [fullLines addObject:[NSValue valueWithRect:r1]];
+ [fullLines addPointer:&r1];
r1 = r2;
}
}
if (NSEqualRects(r1, NSZeroRect) == NO)
- [fullLines addObject:[NSValue valueWithRect:r1]];
+ [fullLines addPointer:&r1];
return fullLines;
}
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2009-09-23 17:03:35 UTC (rev 5801)
+++ trunk/SKPDFView.m 2009-09-23 17:14:34 UTC (rev 5802)
@@ -112,7 +112,7 @@
static NSUInteger moveReadingBarModifiers = NSAlternateKeyMask;
static NSUInteger resizeReadingBarModifiers = NSAlternateKeyMask |
NSShiftKeyMask;
-static inline NSInteger SKIndexOfRectAtYInOrderedRects(CGFloat y, NSArray
*rectValues, BOOL lower);
+static inline NSInteger SKIndexOfRectAtYInOrderedRects(CGFloat y,
NSPointerArray *rectArray, BOOL lower);
static CGMutablePathRef SKCGCreatePathWithRoundRectInRect(CGRect rect, CGFloat
radius);
static void SKCGContextDrawGrabHandle(CGContextRef context, CGPoint point,
CGFloat radius, bool active);
@@ -3747,7 +3747,7 @@
- (void)doDragReadingBarWithEvent:(NSEvent *)theEvent {
PDFPage *page = [readingBar page];
- NSArray *lineRects = [page lineRects];
+ NSPointerArray *lineRects = [page lineRects];
NSMutableDictionary *userInfo = [NSMutableDictionary
dictionaryWithObjectsAndKeys:page, SKPDFViewOldPageKey, nil];
NSEvent *lastMouseEvent = theEvent;
@@ -3833,7 +3833,7 @@
- (void)doResizeReadingBarWithEvent:(NSEvent *)theEvent {
PDFPage *page = [readingBar page];
NSInteger firstLine = [readingBar currentLine];
- NSArray *lineRects = [page lineRects];
+ NSPointerArray *lineRects = [page lineRects];
NSDictionary *userInfo = [NSDictionary
dictionaryWithObjectsAndKeys:page, SKPDFViewOldPageKey, page,
SKPDFViewNewPageKey, nil];
[[NSCursor resizeUpDownCursor] push];
@@ -4298,12 +4298,12 @@
@end
-static inline NSInteger SKIndexOfRectAtYInOrderedRects(CGFloat y, NSArray
*rectValues, BOOL lower)
+static inline NSInteger SKIndexOfRectAtYInOrderedRects(CGFloat y,
NSPointerArray *rectArray, BOOL lower)
{
- NSInteger i = 0, iMax = [rectValues count];
+ NSInteger i = 0, iMax = [rectArray count];
for (i = 0; i < iMax; i++) {
- NSRect rect = [[rectValues objectAtIndex:i] rectValue];
+ NSRect rect = *(NSRectPointer)[rectArray pointerAtIndex:i];
if (NSMaxY(rect) > y) {
if (NSMinY(rect) <= y)
break;
Modified: trunk/SKReadingBar.h
===================================================================
--- trunk/SKReadingBar.h 2009-09-23 17:03:35 UTC (rev 5801)
+++ trunk/SKReadingBar.h 2009-09-23 17:14:34 UTC (rev 5802)
@@ -42,7 +42,7 @@
@interface SKReadingBar : NSObject {
PDFPage *page;
- NSArray *lineRects;
+ NSPointerArray *lineRects;
NSInteger currentLine;
NSUInteger numberOfLines;
}
Modified: trunk/SKReadingBar.m
===================================================================
--- trunk/SKReadingBar.m 2009-09-23 17:03:35 UTC (rev 5801)
+++ trunk/SKReadingBar.m 2009-09-23 17:14:34 UTC (rev 5802)
@@ -102,7 +102,7 @@
NSRect rect = NSZeroRect;
NSInteger i, lastLine = [self currentLastLine];
for (i = currentLine; i <= lastLine; i++)
- rect = NSUnionRect(rect, [[lineRects objectAtIndex:i] rectValue]);
+ rect = NSUnionRect(rect, *(NSRectPointer)[lineRects pointerAtIndex:i]);
return rect;
}
@@ -148,7 +148,7 @@
while (++i < iMax) {
PDFPage *nextPage = [doc pageAtIndex:i];
- NSArray *lines = [nextPage lineRects];
+ NSPointerArray *lines = [nextPage lineRects];
if ([lines count]) {
[page release];
page = [nextPage retain];
@@ -169,7 +169,7 @@
while (i-- > 0) {
PDFPage *prevPage = [doc pageAtIndex:i];
- NSArray *lines = [prevPage lineRects];
+ NSPointerArray *lines = [prevPage lineRects];
if ([lines count]) {
[page release];
page = [prevPage retain];
@@ -188,7 +188,7 @@
return NO;
NSInteger i = [lineRects count] - numberOfLines;
while (--i >= 0)
- if (NSMaxY([[lineRects objectAtIndex:i] rectValue]) >= point.y) break;
+ if (NSMaxY(*(NSRectPointer)[lineRects pointerAtIndex:i]) >= point.y)
break;
currentLine = MAX(0, i);
return YES;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit