Revision: 14130
          http://sourceforge.net/p/skim-app/code/14130
Author:   hofman
Date:     2024-03-23 22:10:21 +0000 (Sat, 23 Mar 2024)
Log Message:
-----------
draw partial window image directly in thumbnail method

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

Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m  2024-03-23 18:50:42 UTC (rev 14129)
+++ trunk/SKSnapshotWindowController.m  2024-03-23 22:10:21 UTC (rev 14130)
@@ -470,9 +470,8 @@
     CGFloat shadowOffset = 0.0;
     NSImage *image;
     
-    bounds.origin = NSZeroPoint;
-    
     if (size > 0.0) {
+        bounds.origin = NSZeroPoint;
         shadowBlurRadius = round(size / 32.0);
         shadowOffset = -ceil(shadowBlurRadius * 0.75);
         if (NSHeight(bounds) > NSWidth(bounds))
@@ -481,12 +480,13 @@
             thumbnailSize = NSMakeSize(size, round((size - 2.0 * 
shadowBlurRadius) * NSHeight(bounds) / NSWidth(bounds) + 2.0 * 
shadowBlurRadius));
         [transform translateXBy:shadowBlurRadius yBy:shadowBlurRadius - 
shadowOffset];
         [transform scaleXBy:(thumbnailSize.width - 2.0 * shadowBlurRadius) / 
NSWidth(bounds) yBy:(thumbnailSize.height - 2.0 * shadowBlurRadius) / 
NSHeight(bounds)];
+    } else if (size < 0.0) {
+        thumbnailSize = [[self window] frame].size;
+    } else {
+        bounds.origin = NSZeroPoint;
     }
     
     
-    if (NSEqualPoints(bounds.origin, NSZeroPoint) == NO)
-        [transform translateXBy:-NSMinX(bounds) yBy:-NSMinY(bounds)];
-    
     image = [[NSImage alloc] initWithSize:thumbnailSize];
     
     [image lockFocus];
@@ -549,14 +549,6 @@
     return [self thumbnailAttachmentWithSize:32.0];
 }
 
-- (NSImage *)windowContentImage {
-    NSImage *image = [[NSImage alloc] initWithSize:[[self window] frame].size];
-    [image lockFocus];
-    [[self thumbnailWithSize:0.0] drawInRect:[pdfView visibleContentRect]];
-    [image unlockFocus];
-    return image;
-}
-
 #pragma mark Miniaturize / Deminiaturize
 
 - (NSRect)miniaturizedRectForDockingRect:(NSRect)dockRect {
@@ -590,7 +582,7 @@
         if ([self hasWindow])
             windowImage = [(SKSnapshotWindow *)[self window] windowImage];
         else
-            windowImage = [self windowContentImage];
+            windowImage = [self thumbnailWithSize:-1.0];
     }
     
     SKAnimatedBorderlessWindow *miniaturizeWindow = 
[[SKAnimatedBorderlessWindow alloc] initWithContentRect:startRect];

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

Reply via email to