Revision: 13122
          http://sourceforge.net/p/skim-app/code/13122
Author:   hofman
Date:     2022-10-23 21:56:24 +0000 (Sun, 23 Oct 2022)
Log Message:
-----------
calculate magnified rect first rather than transform every corner point

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2022-10-23 14:57:20 UTC (rev 13121)
+++ trunk/SKPDFView.m   2022-10-23 21:56:24 UTC (rev 13122)
@@ -4868,17 +4868,13 @@
         }
         
         NSImage *image;
-        NSRange pageRange;
         NSAffineTransform *transform = [NSAffineTransform transform];
         NSImageInterpolation interpolation = [[NSUserDefaults 
standardUserDefaults] integerForKey:SKInterpolationQualityKey] + 1;
+        NSRect scaledRect = SKRectFromCenterAndSize(mouseLoc, 
NSMakeSize(NSWidth(magRect) / magnification, NSHeight(magRect) / 
magnification));
+        NSRange pageRange;
+        pageRange.location = MIN([[self 
pageForPoint:SKTopLeftPoint(scaledRect) nearest:YES] pageIndex], [[self 
pageForPoint:SKTopRightPoint(scaledRect) nearest:YES] pageIndex]);
+        pageRange.length = MAX([[self 
pageForPoint:SKBottomLeftPoint(scaledRect) nearest:YES] pageIndex], [[self 
pageForPoint:SKBottomRightPoint(scaledRect) nearest:YES] pageIndex]) + 1 - 
pageRange.location;
         
-        [transform translateXBy:mouseLoc.x yBy:mouseLoc.y];
-        [transform scaleBy:1.0 / magnification];
-        [transform translateXBy:-mouseLoc.x yBy:-mouseLoc.y];
-        pageRange.location = MIN([[self pageForPoint:[transform 
transformPoint:SKTopLeftPoint(magRect)] nearest:YES] pageIndex], [[self 
pageForPoint:[transform transformPoint:SKTopRightPoint(magRect)] nearest:YES] 
pageIndex]);
-        pageRange.length = MAX([[self pageForPoint:[transform 
transformPoint:SKBottomLeftPoint(magRect)] nearest:YES] pageIndex], [[self 
pageForPoint:[transform transformPoint:SKBottomRightPoint(magRect)] 
nearest:YES] pageIndex]) + 1 - pageRange.location;
-        
-        transform = [NSAffineTransform transform];
         [transform translateXBy:mouseLoc.x - NSMinX(magRect) yBy:mouseLoc.y - 
NSMinY(magRect)];
         [transform scaleBy:magnification];
         [transform translateXBy:-mouseLoc.x yBy:-mouseLoc.y];

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



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to