Revision: 5705
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5705&view=rev
Author:   hofman
Date:     2009-09-07 22:20:51 +0000 (Mon, 07 Sep 2009)

Log Message:
-----------
use convenience method to rotate the context for a page

Modified Paths:
--------------
    trunk/PDFPage_SKExtensions.m
    trunk/SKPDFView.m

Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m        2009-09-07 21:55:10 UTC (rev 5704)
+++ trunk/PDFPage_SKExtensions.m        2009-09-07 22:20:51 UTC (rev 5705)
@@ -160,25 +160,7 @@
     }
     
     if (NSIsEmptyRect(readingBarRect) == NO) {
-        NSAffineTransform *transform = [NSAffineTransform transform];
-        switch ([self rotation]) {
-            case 0:
-                [transform translateXBy:-NSMinX(bounds) yBy:-NSMinY(bounds)];
-                break;
-            case 90:
-                [transform rotateByDegrees:-90.0];
-                [transform translateXBy:-NSMaxX(bounds) yBy:-NSMinY(bounds)];
-                break;
-            case 180:
-                [transform rotateByDegrees:180.0];
-                [transform translateXBy:-NSMaxX(bounds) yBy:-NSMaxY(bounds)];
-                break;
-            case 270:
-                [transform rotateByDegrees:90.0];
-                [transform translateXBy:-NSMinX(bounds) yBy:-NSMaxY(bounds)];
-                break;
-        }
-        [transform concat];
+        [self transformContextForBox:box];
         [[[NSUserDefaults standardUserDefaults] 
colorForKey:SKReadingBarColorKey] setFill];
         if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKReadingBarInvertKey]) {
             NSRect outRect, ignored;

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2009-09-07 21:55:10 UTC (rev 5704)
+++ trunk/SKPDFView.m   2009-09-07 22:20:51 UTC (rev 5705)
@@ -140,8 +140,6 @@
 - (void)addAnnotationWithType:(SKNoteType)annotationType 
defaultPoint:(NSPoint)point;
 - (void)addAnnotationWithType:(SKNoteType)annotationType contents:(NSString 
*)text page:(PDFPage *)page bounds:(NSRect)bounds;
 
-- (void)transformCGContext:(CGContextRef)context forPage:(PDFPage *)page;
-
 - (NSRange)visiblePageIndexRange;
 - (NSRect)visibleContentRect;
 
@@ -328,7 +326,7 @@
     // Let PDFView do most of the hard work.
     [super drawPage: pdfPage];
        
-    [self transformCGContext:context forPage:pdfPage];
+    [pdfPage transformContextForBox:[self displayBox]];
     SKCGContextSetDefaultRGBColorSpace(context);
     
     if (bezierPaths && pathPageIndex == [pdfPage pageIndex]) {
@@ -2470,28 +2468,6 @@
     }
 }
 
-- (void)transformCGContext:(CGContextRef)context forPage:(PDFPage *)page {
-    NSRect boxRect = [page boundsForBox:[self displayBox]];
-    
-    switch ([page rotation]) {
-        case 0:
-            CGContextTranslateCTM(context, -NSMinX(boxRect), -NSMinY(boxRect));
-            break;
-        case 90:
-            CGContextRotateCTM(context, - M_PI / 2);
-            CGContextTranslateCTM(context, -NSMaxX(boxRect), -NSMinY(boxRect));
-            break;
-        case 180:
-            CGContextRotateCTM(context, M_PI);
-            CGContextTranslateCTM(context, -NSMaxX(boxRect), -NSMaxY(boxRect));
-            break;
-        case 270:
-            CGContextRotateCTM(context, M_PI / 2);
-            CGContextTranslateCTM(context, -NSMinX(boxRect), -NSMaxY(boxRect));
-            break;
-    }
-}
-
 - (NSRect)visibleContentRect {
     NSView *clipView = [[[self documentView] enclosingScrollView] contentView];
     return [clipView convertRect:[clipView visibleRect] toView:self];


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