Revision: 14303
http://sourceforge.net/p/skim-app/code/14303
Author: hofman
Date: 2024-06-05 14:19:19 +0000 (Wed, 05 Jun 2024)
Log Message:
-----------
no need for intermediate variable, order bitmaps by size
Modified Paths:
--------------
trunk/PDFPage_SKExtensions.m
trunk/SKSnapshotWindowController.m
Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m 2024-06-05 14:15:40 UTC (rev 14302)
+++ trunk/PDFPage_SKExtensions.m 2024-06-05 14:19:19 UTC (rev 14303)
@@ -149,8 +149,7 @@
}
- (NSImage *)thumbnailWithSize:(CGFloat)aSize scale:(CGFloat)backingScale
forBox:(PDFDisplayBox)box hasShadow:(BOOL)hasShadow highlights:(NSArray
*)highlights {
- NSRect bounds = [self boundsForBox:box];
- NSSize pageSize = bounds.size;
+ NSSize pageSize = [self boundsForBox:box].size;
CGFloat scale = 1.0;
NSSize thumbnailSize;
CGFloat shadowBlurRadius = 0.0;
@@ -219,7 +218,7 @@
- (NSAttributedString *)thumbnailAttachmentWithSize:(CGFloat)aSize {
NSBitmapImageRep *imageRep1 = (NSBitmapImageRep *)[[[self
thumbnailWithSize:aSize scale:2.0 forBox:kPDFDisplayBoxCropBox hasShadow:YES
highlights:nil] representations] firstObject];
NSBitmapImageRep *imageRep2 = (NSBitmapImageRep *)[[[self
thumbnailWithSize:aSize scale:1.0 forBox:kPDFDisplayBoxCropBox hasShadow:YES
highlights:nil] representations] firstObject];
- NSData *data = [NSBitmapImageRep
TIFFRepresentationOfImageRepsInArray:@[imageRep2, imageRep1]];
+ NSData *data = [NSBitmapImageRep
TIFFRepresentationOfImageRepsInArray:@[imageRep1, imageRep2]];
NSFileWrapper *wrapper = [[NSFileWrapper alloc]
initRegularFileWithContents:data];
NSString *filename = [NSString stringWithFormat:@"page_%lu.tiff",
(unsigned long)([self pageIndex] + 1)];
[wrapper setFilename:filename];
@@ -284,7 +283,7 @@
}];
}
- return [NSBitmapImageRep TIFFRepresentationOfImageRepsInArray:@[imageRep2,
imageRep1]];
+ return [NSBitmapImageRep TIFFRepresentationOfImageRepsInArray:@[imageRep1,
imageRep2]];
}
- (NSData *)dataRepresentationForPageIndexes:(NSIndexSet *)pageIndexes {
Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m 2024-06-05 14:15:40 UTC (rev 14302)
+++ trunk/SKSnapshotWindowController.m 2024-06-05 14:19:19 UTC (rev 14303)
@@ -522,7 +522,7 @@
- (NSAttributedString *)thumbnailAttachmentWithSize:(CGFloat)size {
NSBitmapImageRep *imageRep1 = (NSBitmapImageRep *)[[[self
thumbnailWithSize:size scale:1.0] representations] firstObject];
NSBitmapImageRep *imageRep2 = (NSBitmapImageRep *)[[[self
thumbnailWithSize:size scale:2.0] representations] firstObject];
- NSData *data = [NSBitmapImageRep
TIFFRepresentationOfImageRepsInArray:@[imageRep2, imageRep1]];
+ NSData *data = [NSBitmapImageRep
TIFFRepresentationOfImageRepsInArray:@[imageRep1, imageRep2]];
NSFileWrapper *wrapper = [[NSFileWrapper alloc]
initRegularFileWithContents:data];
NSString *filename = [NSString
stringWithFormat:@"snapshot_page_%lu.tiff",(unsigned long)( [self pageIndex] +
1)];
@@ -723,7 +723,7 @@
- (void)filePromiseProvider:(NSFilePromiseProvider *)filePromiseProvider
writePromiseToURL:(NSURL *)fileURL completionHandler:(void (^)(NSError
*))completionHandler {
NSBitmapImageRep *imageRep1 = (NSBitmapImageRep *)[[[self
thumbnailWithSize:0.0 scale:1.0] representations] firstObject];
NSBitmapImageRep *imageRep2 = (NSBitmapImageRep *)[[[self
thumbnailWithSize:0.0 scale:2.0] representations] firstObject];
- NSData *data = [NSBitmapImageRep
TIFFRepresentationOfImageRepsInArray:@[imageRep2, imageRep1]];
+ NSData *data = [NSBitmapImageRep
TIFFRepresentationOfImageRepsInArray:@[imageRep1, imageRep2]];
NSError *error = nil;
[data writeToURL:fileURL options:NSDataWritingAtomic error:&error];
completionHandler(error);
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