Revision: 14220
http://sourceforge.net/p/skim-app/code/14220
Author: hofman
Date: 2024-04-18 17:04:48 +0000 (Thu, 18 Apr 2024)
Log Message:
-----------
calculate page rect in one line
Modified Paths:
--------------
trunk/SKMainWindowController_FullScreen.m
Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m 2024-04-18 16:22:43 UTC (rev
14219)
+++ trunk/SKMainWindowController_FullScreen.m 2024-04-18 17:04:48 UTC (rev
14220)
@@ -364,16 +364,10 @@
} else {
PDFPage *page = [pdfView currentPage];
NSRect pageRect = [page boundsForBox:kPDFDisplayBoxCropBox];
- CGFloat scale = 1.0;
if (([page rotation] % 180) != 0)
pageRect = NSMakeRect(0.0, 0.0, NSHeight(pageRect),
NSWidth(pageRect));
- if (NSHeight(pageRect) * NSWidth(rect) < NSWidth(pageRect) *
NSHeight(rect)) {
- scale = NSWidth(rect) / NSWidth(pageRect);
- pageRect = NSMakeRect(0.0, 0.5 * (NSHeight(rect) - scale *
NSHeight(pageRect)), NSWidth(rect), scale * NSHeight(pageRect));
- } else {
- scale = NSHeight(rect) / NSHeight(pageRect);
- pageRect = NSMakeRect(0.5 * (NSWidth(rect) - scale *
NSWidth(pageRect)), 0.0, scale * NSWidth(pageRect), NSHeight(rect));
- }
+ CGFloat scale = fmin(NSHeight(rect) / NSHeight(pageRect),
NSWidth(rect) / NSWidth(pageRect));
+ pageRect = NSInsetRect(rect, 0.5 * (NSWidth(rect) - scale *
NSWidth(pageRect)), 0.5 * (NSHeight(rect) - scale * NSHeight(pageRect)));
imageRep = [[window contentView]
bitmapImageRepForCachingDisplayInRect:rect];
CGContextRef context = [[NSGraphicsContext
graphicsContextWithBitmapImageRep:imageRep] CGContext];
CGContextSetFillColorWithColor(context,
CGColorGetConstantColor(kCGColorWhite));
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit