You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
(23) |
Apr
(254) |
May
(252) |
Jun
(209) |
Jul
(198) |
Aug
(192) |
Sep
(207) |
Oct
(120) |
Nov
(179) |
Dec
(52) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(48) |
Feb
(69) |
Mar
(129) |
Apr
(250) |
May
(113) |
Jun
(177) |
Jul
(228) |
Aug
(155) |
Sep
(218) |
Oct
(185) |
Nov
(109) |
Dec
(88) |
2009 |
Jan
(83) |
Feb
(39) |
Mar
(70) |
Apr
(47) |
May
(48) |
Jun
(67) |
Jul
(61) |
Aug
(97) |
Sep
(221) |
Oct
(141) |
Nov
(70) |
Dec
(61) |
2010 |
Jan
(45) |
Feb
(76) |
Mar
(178) |
Apr
(106) |
May
(57) |
Jun
(32) |
Jul
(64) |
Aug
(98) |
Sep
(96) |
Oct
(19) |
Nov
(34) |
Dec
(117) |
2011 |
Jan
(55) |
Feb
(48) |
Mar
(64) |
Apr
(21) |
May
(39) |
Jun
(53) |
Jul
(99) |
Aug
(56) |
Sep
(39) |
Oct
(26) |
Nov
(19) |
Dec
(69) |
2012 |
Jan
(17) |
Feb
(40) |
Mar
(17) |
Apr
|
May
(2) |
Jun
(8) |
Jul
(2) |
Aug
(10) |
Sep
(10) |
Oct
(38) |
Nov
(48) |
Dec
(70) |
2013 |
Jan
(43) |
Feb
(47) |
Mar
(39) |
Apr
(37) |
May
(25) |
Jun
(6) |
Jul
(20) |
Aug
(49) |
Sep
(33) |
Oct
(34) |
Nov
(75) |
Dec
(6) |
2014 |
Jan
(32) |
Feb
(10) |
Mar
(17) |
Apr
|
May
|
Jun
(26) |
Jul
(5) |
Aug
|
Sep
(4) |
Oct
(23) |
Nov
(80) |
Dec
(48) |
2015 |
Jan
(80) |
Feb
(50) |
Mar
(58) |
Apr
(20) |
May
(11) |
Jun
(16) |
Jul
(24) |
Aug
(27) |
Sep
(56) |
Oct
(30) |
Nov
(16) |
Dec
(6) |
2016 |
Jan
(31) |
Feb
(14) |
Mar
(23) |
Apr
(17) |
May
(40) |
Jun
(12) |
Jul
(17) |
Aug
(9) |
Sep
(32) |
Oct
(36) |
Nov
(23) |
Dec
(9) |
2017 |
Jan
(37) |
Feb
(23) |
Mar
(65) |
Apr
(22) |
May
(6) |
Jun
(3) |
Jul
|
Aug
|
Sep
(3) |
Oct
(22) |
Nov
(63) |
Dec
(71) |
2018 |
Jan
(83) |
Feb
(21) |
Mar
(35) |
Apr
(44) |
May
(14) |
Jun
(12) |
Jul
(8) |
Aug
(18) |
Sep
(10) |
Oct
(145) |
Nov
(144) |
Dec
(76) |
2019 |
Jan
(18) |
Feb
(28) |
Mar
(5) |
Apr
(208) |
May
(291) |
Jun
(158) |
Jul
(27) |
Aug
(8) |
Sep
(10) |
Oct
(83) |
Nov
(41) |
Dec
(31) |
2020 |
Jan
(16) |
Feb
(46) |
Mar
(100) |
Apr
(78) |
May
(69) |
Jun
(71) |
Jul
(28) |
Aug
(131) |
Sep
(176) |
Oct
(89) |
Nov
(147) |
Dec
(19) |
2021 |
Jan
(19) |
Feb
(25) |
Mar
(91) |
Apr
(98) |
May
(14) |
Jun
(44) |
Jul
(8) |
Aug
(3) |
Sep
(38) |
Oct
(57) |
Nov
(97) |
Dec
(74) |
2022 |
Jan
(89) |
Feb
(47) |
Mar
(15) |
Apr
(50) |
May
(54) |
Jun
(56) |
Jul
(80) |
Aug
(12) |
Sep
(11) |
Oct
(60) |
Nov
(48) |
Dec
(4) |
2023 |
Jan
(75) |
Feb
(49) |
Mar
(84) |
Apr
(24) |
May
(13) |
Jun
(74) |
Jul
(32) |
Aug
(66) |
Sep
(50) |
Oct
(38) |
Nov
(105) |
Dec
(181) |
2024 |
Jan
(21) |
Feb
(49) |
Mar
(77) |
Apr
(84) |
May
(20) |
Jun
(71) |
Jul
(53) |
Aug
(33) |
Sep
(54) |
Oct
(124) |
Nov
(151) |
Dec
(73) |
2025 |
Jan
(61) |
Feb
(17) |
Mar
(136) |
Apr
(72) |
May
(200) |
Jun
(238) |
Jul
(91) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ho...@us...> - 2025-05-16 21:31:31
|
Revision: 15223 http://sourceforge.net/p/skim-app/code/15223 Author: hofman Date: 2025-05-16 21:31:28 +0000 (Fri, 16 May 2025) Log Message: ----------- revert last 2 commits Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-16 21:29:21 UTC (rev 15222) +++ trunk/SKPresentationView.m 2025-05-16 21:31:28 UTC (rev 15223) @@ -436,8 +436,6 @@ - (void)viewWillStartLiveResize { [super viewWillStartLiveResize]; [self removePredrawnImageAtIndex:NSNotFound]; - if (pvFlags.autoScales == NO) - [pageLayer setContentsGravity:kCAGravityCenter]; } - (void)viewDidEndLiveResize { @@ -444,8 +442,6 @@ [super viewDidEndLiveResize]; [self removePredrawnImageAtIndex:NSNotFound]; [self displayCurrentPage:nil]; - if (pvFlags.autoScales == NO) - [pageLayer setContentsGravity:kCAGravityResizeAspectFill]; } - (void)updatedAnnotationOnPage:(PDFPage *)aPage { @@ -543,6 +539,7 @@ - (void)setAutoScales:(BOOL)flag { if (flag != pvFlags.autoScales) { pvFlags.autoScales = flag; + [pageLayer setContentsGravity:flag ? kCAGravityResizeAspectFill : kCAGravityCenter]; [self removePredrawnImageAtIndex:NSNotFound]; [self displayCurrentPage:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:SKPresentationViewAutoScalesChangedNotification object:self]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-16 21:29:22
|
Revision: 15222 http://sourceforge.net/p/skim-app/code/15222 Author: hofman Date: 2025-05-16 21:29:21 +0000 (Fri, 16 May 2025) Log Message: ----------- Only set content gravity to center without auto scale during live resize Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-16 21:26:35 UTC (rev 15221) +++ trunk/SKPresentationView.m 2025-05-16 21:29:21 UTC (rev 15222) @@ -436,7 +436,7 @@ - (void)viewWillStartLiveResize { [super viewWillStartLiveResize]; [self removePredrawnImageAtIndex:NSNotFound]; - if (pvFlags.autoScales) + if (pvFlags.autoScales == NO) [pageLayer setContentsGravity:kCAGravityCenter]; } @@ -444,7 +444,7 @@ [super viewDidEndLiveResize]; [self removePredrawnImageAtIndex:NSNotFound]; [self displayCurrentPage:nil]; - if (pvFlags.autoScales) + if (pvFlags.autoScales == NO) [pageLayer setContentsGravity:kCAGravityResizeAspectFill]; } @@ -543,7 +543,6 @@ - (void)setAutoScales:(BOOL)flag { if (flag != pvFlags.autoScales) { pvFlags.autoScales = flag; - [pageLayer setContentsGravity:flag ? kCAGravityResizeAspectFill : kCAGravityCenter]; [self removePredrawnImageAtIndex:NSNotFound]; [self displayCurrentPage:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:SKPresentationViewAutoScalesChangedNotification object:self]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-16 21:26:38
|
Revision: 15221 http://sourceforge.net/p/skim-app/code/15221 Author: hofman Date: 2025-05-16 21:26:35 +0000 (Fri, 16 May 2025) Log Message: ----------- Only set content gravity to center on auto scale during live resize Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-16 21:20:33 UTC (rev 15220) +++ trunk/SKPresentationView.m 2025-05-16 21:26:35 UTC (rev 15221) @@ -436,6 +436,8 @@ - (void)viewWillStartLiveResize { [super viewWillStartLiveResize]; [self removePredrawnImageAtIndex:NSNotFound]; + if (pvFlags.autoScales) + [pageLayer setContentsGravity:kCAGravityCenter]; } - (void)viewDidEndLiveResize { @@ -442,6 +444,8 @@ [super viewDidEndLiveResize]; [self removePredrawnImageAtIndex:NSNotFound]; [self displayCurrentPage:nil]; + if (pvFlags.autoScales) + [pageLayer setContentsGravity:kCAGravityResizeAspectFill]; } - (void)updatedAnnotationOnPage:(PDFPage *)aPage { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-16 21:20:35
|
Revision: 15220 http://sourceforge.net/p/skim-app/code/15220 Author: hofman Date: 2025-05-16 21:20:33 +0000 (Fri, 16 May 2025) Log Message: ----------- remove NSNull from predrawn images after generation Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-16 21:17:27 UTC (rev 15219) +++ trunk/SKPresentationView.m 2025-05-16 21:20:33 UTC (rev 15220) @@ -511,10 +511,13 @@ if (image && predrawnImages && (__bridge id)NSMapGet(predrawnImages, (void *)pageIndex) == [NSNull null]) { NSUInteger currentIndex = [page pageIndex]; - if (pageIndex == currentIndex) - [pageLayer setContents:image]; - else if (pageIndex > currentIndex) + if (pageIndex > currentIndex) { NSMapInsert(predrawnImages, (void *)pageIndex, (__bridge void *)image); + } else { + if (pageIndex == currentIndex) + [pageLayer setContents:image]; + [self removePredrawnImageAtIndex:pageIndex]; + } } }); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-16 21:17:28
|
Revision: 15219 http://sourceforge.net/p/skim-app/code/15219 Author: hofman Date: 2025-05-16 21:17:27 +0000 (Fri, 16 May 2025) Log Message: ----------- ignore predrawn image when the user has moved past it Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-16 16:34:35 UTC (rev 15218) +++ trunk/SKPresentationView.m 2025-05-16 21:17:27 UTC (rev 15219) @@ -295,10 +295,10 @@ - (void)removePredrawnImageAtIndex:(NSUInteger)pageIndex {} -- (NSImage *)imageWithImageRep:(NSBitmapImageRep *)imageRep page:(PDFPage *)aPage autoScales:(BOOL)autoScales { +static NSImage *imageByDrawingPageToBitmapImageRep(NSBitmapImageRep *imageRep, PDFPage *aPage, BOOL autoScales) { NSSize size = [imageRep size]; NSRect pageRect = [aPage boundsForBox:kPDFDisplayBoxCropBox]; - if (([page rotation] % 180) != 0) + if (([aPage rotation] % 180) != 0) pageRect = NSMakeRect(0.0, 0.0, NSHeight(pageRect), NSWidth(pageRect)); CGFloat scale = 1.0; if (autoScales) { @@ -365,7 +365,7 @@ dispatch_async(drawingQueue, ^{ - NSImage *image = [self imageWithImageRep:imageRep page:thePage autoScales:autoScales]; + NSImage *image = imageByDrawingPageToBitmapImageRep(imageRep, thePage, autoScales); dispatch_async(dispatch_get_main_queue(), ^{ @@ -505,14 +505,15 @@ dispatch_async(predrawingQueue, ^{ - NSImage *image = [self imageWithImageRep:imageRep page:thePage autoScales:autoScales]; + NSImage *image = imageByDrawingPageToBitmapImageRep(imageRep, thePage, autoScales); dispatch_async(dispatch_get_main_queue(), ^{ if (image && predrawnImages && (__bridge id)NSMapGet(predrawnImages, (void *)pageIndex) == [NSNull null]) { - if (page == thePage) + NSUInteger currentIndex = [page pageIndex]; + if (pageIndex == currentIndex) [pageLayer setContents:image]; - else + else if (pageIndex > currentIndex) NSMapInsert(predrawnImages, (void *)pageIndex, (__bridge void *)image); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-16 16:34:38
|
Revision: 15218 http://sourceforge.net/p/skim-app/code/15218 Author: hofman Date: 2025-05-16 16:34:35 +0000 (Fri, 16 May 2025) Log Message: ----------- Handle nil page separately in setter. Rename a method to avoid confusion. Modify layout calculation of drawn page. Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-16 14:40:23 UTC (rev 15217) +++ trunk/SKPresentationView.m 2025-05-16 16:34:35 UTC (rev 15218) @@ -80,7 +80,7 @@ static NSInteger navigationMode = SKNavigationBottom; @interface SKPDFPageView () -- (void)displayPage:(void (^)(void))completionHandler; +- (void)displayCurrentPage:(void (^)(void))completionHandler; @end @implementation SKPDFPageView @@ -147,7 +147,7 @@ if (fabs([pageLayer contentsScale] - scale) > 0.0) { [pageLayer setContentsScale:scale]; [self removePredrawnImageAtIndex:NSNotFound]; - [self displayPage:nil]; + [self displayCurrentPage:nil]; } } @@ -172,14 +172,7 @@ - (void)displayPage:(PDFPage *)newPage completionHandler:(void (^)(void))completionHandler { page = newPage; - if (page) { - [self displayPage:completionHandler]; - } else { - [self removePredrawnImageAtIndex:NSNotFound]; - [pageLayer setContents:nil]; - if (completionHandler) - completionHandler(); - } + [self displayCurrentPage:completionHandler]; [[NSNotificationCenter defaultCenter] postNotificationName:SKPresentationViewPageChangedNotification object:self]; } @@ -230,8 +223,16 @@ #pragma mark Accessors - (void)setPage:(PDFPage *)newPage { - if (newPage != page) - [self displayPage:newPage completionHandler:nil]; + if (newPage != page) { + if (newPage) { + [self displayPage:newPage completionHandler:nil]; + } else { + page = nil; + [self removePredrawnImageAtIndex:NSNotFound]; + [pageLayer setContents:nil]; + // nothing needs the notification when set to nil + } + } } - (BOOL)autoScales { return YES; } @@ -295,12 +296,19 @@ - (void)removePredrawnImageAtIndex:(NSUInteger)pageIndex {} - (NSImage *)imageWithImageRep:(NSBitmapImageRep *)imageRep page:(PDFPage *)aPage autoScales:(BOOL)autoScales { - NSRect bounds = {NSZeroPoint, [imageRep size]}; + NSSize size = [imageRep size]; NSRect pageRect = [aPage boundsForBox:kPDFDisplayBoxCropBox]; if (([page rotation] % 180) != 0) pageRect = NSMakeRect(0.0, 0.0, NSHeight(pageRect), NSWidth(pageRect)); - CGFloat scale = autoScales ? fmin(NSHeight(bounds) / NSHeight(pageRect), NSWidth(bounds) / NSWidth(pageRect)) : 1.0; - pageRect = NSInsetRect(bounds, 0.5 * (NSWidth(bounds) - scale * NSWidth(pageRect)), 0.5 * (NSHeight(bounds) - scale * NSHeight(pageRect))); + CGFloat scale = 1.0; + if (autoScales) { + scale = fmin(size.height / NSHeight(pageRect), size.width / NSWidth(pageRect)); + pageRect.size.width *= scale; + pageRect.size.height *= scale; + } + pageRect.origin.x = 0.5 * (size.width - NSWidth(pageRect)); + pageRect.origin.y = 0.5 * (size.height - NSHeight(pageRect)); + CGContextRef context = [[NSGraphicsContext graphicsContextWithBitmapImageRep:imageRep] CGContext]; CGContextSaveGState(context); @@ -314,15 +322,18 @@ [aPage drawWithBox:kPDFDisplayBoxCropBox toContext:context]; CGContextRestoreGState(context); - NSImage *image = [[NSImage alloc] initWithSize:bounds.size]; + NSImage *image = [[NSImage alloc] initWithSize:size]; [image addRepresentation:imageRep]; return image; } -- (void)displayPage:(void (^)(void))completionHandler { - if (page == nil) +- (void)displayCurrentPage:(void (^)(void))completionHandler { + if (page == nil) { + if (completionHandler) + completionHandler(); return; + } NSUInteger pageIndex = [page pageIndex]; NSImage *predrawnImage = [self predrawnImageAtIndex:pageIndex]; @@ -430,14 +441,14 @@ - (void)viewDidEndLiveResize { [super viewDidEndLiveResize]; [self removePredrawnImageAtIndex:NSNotFound]; - [self displayPage:nil]; + [self displayCurrentPage:nil]; } - (void)updatedAnnotationOnPage:(PDFPage *)aPage { if (page == aPage) { [self removePredrawnImageAtIndex:[aPage pageIndex]]; - [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(displayPage:) object:nil]; - [self performSelector:@selector(displayPage:) withObject:nil afterDelay:0.0]; + [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(displayCurrentPage:) object:nil]; + [self performSelector:@selector(displayCurrentPage:) withObject:nil afterDelay:0.0]; } } @@ -457,12 +468,12 @@ NSMapRemove(predrawnImages, (void *)pageIndex); } -- (void)displayPage:(void (^)(void))completionHandler { +- (void)displayCurrentPage:(void (^)(void))completionHandler { + [super displayCurrentPage:completionHandler]; + if (page == nil) return; - [super displayPage:completionHandler]; - // generate an image for the next page in the background, which is usually needed next for a presentation NSUInteger pageIndex = [page pageIndex] + 1; @@ -526,7 +537,7 @@ pvFlags.autoScales = flag; [pageLayer setContentsGravity:flag ? kCAGravityResizeAspectFill : kCAGravityCenter]; [self removePredrawnImageAtIndex:NSNotFound]; - [self displayPage:nil]; + [self displayCurrentPage:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:SKPresentationViewAutoScalesChangedNotification object:self]; } } @@ -933,8 +944,8 @@ [annotation setColor:tmpColor]; [[page document] addAnnotation:annotation toPage:page]; - [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(displayPage:) object:nil]; - [self displayPage:^{ + [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(displayCurrentPage:) object:nil]; + [self displayCurrentPage:^{ [layer removeFromSuperlayer]; }]; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-16 14:40:26
|
Revision: 15217 http://sourceforge.net/p/skim-app/code/15217 Author: hofman Date: 2025-05-16 14:40:23 +0000 (Fri, 16 May 2025) Log Message: ----------- Draw image for next page in presentation view on a background queue, so it will be available immediately on goToNextPage: Modified Paths: -------------- trunk/SKPresentationView.h trunk/SKPresentationView.m Modified: trunk/SKPresentationView.h =================================================================== --- trunk/SKPresentationView.h 2025-05-15 21:22:20 UTC (rev 15216) +++ trunk/SKPresentationView.h 2025-05-16 14:40:23 UTC (rev 15217) @@ -73,6 +73,7 @@ #pragma mark - @interface SKPresentationView : SKPDFPageView { + NSMapTable *predrawnImages; SKNavigationWindow *navWindow; SKCursorStyleWindow *cursorWindow; NSInteger laserPointerColor; Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-15 21:22:20 UTC (rev 15216) +++ trunk/SKPresentationView.m 2025-05-16 14:40:23 UTC (rev 15217) @@ -146,8 +146,8 @@ CGFloat scale = [[self window] backingScaleFactor]; if (fabs([pageLayer contentsScale] - scale) > 0.0) { [pageLayer setContentsScale:scale]; - if (page) - [self displayPage:nil]; + [self removePredrawnImageAtIndex:NSNotFound]; + [self displayPage:nil]; } } @@ -172,7 +172,14 @@ - (void)displayPage:(PDFPage *)newPage completionHandler:(void (^)(void))completionHandler { page = newPage; - [self displayPage:completionHandler]; + if (page) { + [self displayPage:completionHandler]; + } else { + [self removePredrawnImageAtIndex:NSNotFound]; + [pageLayer setContents:nil]; + if (completionHandler) + completionHandler(); + } [[NSNotificationCenter defaultCenter] postNotificationName:SKPresentationViewPageChangedNotification object:self]; } @@ -283,23 +290,53 @@ #pragma mark Drawing +- (NSImage *)predrawnImageAtIndex:(NSUInteger)pageIndex { return nil; } + +- (void)removePredrawnImageAtIndex:(NSUInteger)pageIndex {} + +- (NSImage *)imageWithImageRep:(NSBitmapImageRep *)imageRep page:(PDFPage *)aPage autoScales:(BOOL)autoScales { + NSRect bounds = {NSZeroPoint, [imageRep size]}; + NSRect pageRect = [aPage boundsForBox:kPDFDisplayBoxCropBox]; + if (([page rotation] % 180) != 0) + pageRect = NSMakeRect(0.0, 0.0, NSHeight(pageRect), NSWidth(pageRect)); + CGFloat scale = autoScales ? fmin(NSHeight(bounds) / NSHeight(pageRect), NSWidth(bounds) / NSWidth(pageRect)) : 1.0; + pageRect = NSInsetRect(bounds, 0.5 * (NSWidth(bounds) - scale * NSWidth(pageRect)), 0.5 * (NSHeight(bounds) - scale * NSHeight(pageRect))); + CGContextRef context = [[NSGraphicsContext graphicsContextWithBitmapImageRep:imageRep] CGContext]; + + CGContextSaveGState(context); + CGContextSetFillColorWithColor(context, CGColorGetConstantColor(kCGColorWhite)); + CGContextFillRect(context, SKPixelAlignedRect(NSRectToCGRect(pageRect), context)); + CGContextRestoreGState(context); + CGContextSaveGState(context); + CGContextSetInterpolationQuality(context, [[NSUserDefaults standardUserDefaults] integerForKey:SKInterpolationQualityKey] + 1); + CGContextTranslateCTM(context, NSMinX(pageRect), NSMinY(pageRect)); + CGContextScaleCTM(context, scale, scale); + [aPage drawWithBox:kPDFDisplayBoxCropBox toContext:context]; + CGContextRestoreGState(context); + + NSImage *image = [[NSImage alloc] initWithSize:bounds.size]; + [image addRepresentation:imageRep]; + + return image; +} + - (void)displayPage:(void (^)(void))completionHandler { - if (page == nil) { - [pageLayer setContents:nil]; + if (page == nil) + return; + + NSUInteger pageIndex = [page pageIndex]; + NSImage *predrawnImage = [self predrawnImageAtIndex:pageIndex]; + + if (predrawnImage) { + [pageLayer setContents:predrawnImage]; + [self removePredrawnImageAtIndex:pageIndex]; if (completionHandler) completionHandler(); return; } - static dispatch_queue_t drawingQueue = nil; - if (drawingQueue == nil) { - dispatch_queue_attr_t queuePriority = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_CONCURRENT, QOS_CLASS_UTILITY, 0); - drawingQueue = dispatch_queue_create("net.sourceforge.skim-app.skim.pageView", queuePriority); - } + NSBitmapImageRep *imageRep = [self bitmapImageRepForCachingDisplayInRect:[self bounds]]; - NSRect bounds = [self bounds]; - NSBitmapImageRep *imageRep = [self bitmapImageRepForCachingDisplayInRect:bounds]; - if (imageRep == nil) { if (completionHandler) completionHandler(); @@ -306,31 +343,19 @@ return; } + static dispatch_queue_t drawingQueue = nil; + if (drawingQueue == nil) { + dispatch_queue_attr_t queuePriority = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_CONCURRENT, QOS_CLASS_UTILITY, 0); + drawingQueue = dispatch_queue_create("net.sourceforge.skim-app.skim.pageview.drawing", queuePriority); + } + PDFPage *thePage = page; - NSRect pageRect = [page boundsForBox:kPDFDisplayBoxCropBox]; - if (([page rotation] % 180) != 0) - pageRect = NSMakeRect(0.0, 0.0, NSHeight(pageRect), NSWidth(pageRect)); - CGFloat scale = [self autoScales] ? fmin(NSHeight(bounds) / NSHeight(pageRect), NSWidth(bounds) / NSWidth(pageRect)) : 1.0; - pageRect = NSInsetRect(bounds, 0.5 * (NSWidth(bounds) - scale * NSWidth(pageRect)), 0.5 * (NSHeight(bounds) - scale * NSHeight(pageRect))); - + BOOL autoScales = [self autoScales]; + dispatch_async(drawingQueue, ^{ - CGContextRef context = [[NSGraphicsContext graphicsContextWithBitmapImageRep:imageRep] CGContext]; + NSImage *image = [self imageWithImageRep:imageRep page:thePage autoScales:autoScales]; - CGContextSaveGState(context); - CGContextSetFillColorWithColor(context, CGColorGetConstantColor(kCGColorWhite)); - CGContextFillRect(context, SKPixelAlignedRect(NSRectToCGRect(pageRect), context)); - CGContextRestoreGState(context); - CGContextSaveGState(context); - CGContextSetInterpolationQuality(context, [[NSUserDefaults standardUserDefaults] integerForKey:SKInterpolationQualityKey] + 1); - CGContextTranslateCTM(context, NSMinX(pageRect), NSMinY(pageRect)); - CGContextScaleCTM(context, scale, scale); - [thePage drawWithBox:kPDFDisplayBoxCropBox toContext:context]; - CGContextRestoreGState(context); - - NSImage *image = [[NSImage alloc] initWithSize:bounds.size]; - [image addRepresentation:imageRep]; - dispatch_async(dispatch_get_main_queue(), ^{ if (thePage == page) @@ -341,6 +366,7 @@ }); }); + } - (NSBitmapImageRep *)bitmapImageRepCachingDisplay { @@ -396,18 +422,95 @@ return self; } +- (void)viewWillStartLiveResize { + [super viewWillStartLiveResize]; + [self removePredrawnImageAtIndex:NSNotFound]; +} + - (void)viewDidEndLiveResize { [super viewDidEndLiveResize]; + [self removePredrawnImageAtIndex:NSNotFound]; [self displayPage:nil]; } - (void)updatedAnnotationOnPage:(PDFPage *)aPage { if (page == aPage) { + [self removePredrawnImageAtIndex:[aPage pageIndex]]; [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(displayPage:) object:nil]; [self performSelector:@selector(displayPage:) withObject:nil afterDelay:0.0]; } } +- (NSImage *)predrawnImageAtIndex:(NSUInteger)pageIndex { + if (predrawnImages == nil) + return nil; + NSImage *image = (__bridge id)NSMapGet(predrawnImages, (void *)pageIndex); + if ([image isKindOfClass:[NSImage class]]) + return image; + return nil; +} + +- (void)removePredrawnImageAtIndex:(NSUInteger)pageIndex { + if (pageIndex == NSNotFound) + predrawnImages = nil; + else if (predrawnImages) + NSMapRemove(predrawnImages, (void *)pageIndex); +} + +- (void)displayPage:(void (^)(void))completionHandler { + if (page == nil) + return; + + [super displayPage:completionHandler]; + + // generate an image for the next page in the background, which is usually needed next for a presentation + + NSUInteger pageIndex = [page pageIndex] + 1; + + if (pageIndex >= [[page document] pageCount]) + return; + + if (predrawnImages == nil) + predrawnImages = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsOpaqueMemory | NSPointerFunctionsIntegerPersonality valueOptions:NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPersonality capacity:2]; + else if (NSMapGet(predrawnImages, (void *)pageIndex)) + return; + + // set NSNull so we can invalidate this image + NSMapInsert(predrawnImages, (void *)pageIndex, (__bridge void *)[NSNull null]); + + static dispatch_queue_t predrawingQueue = nil; + if (predrawingQueue == nil) { + dispatch_queue_attr_t queuePriority = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_BACKGROUND, 0); + predrawingQueue = dispatch_queue_create("net.sourceforge.skim-app.skim.pageview.predrawing", queuePriority); + } + + NSBitmapImageRep *imageRep = [self bitmapImageRepForCachingDisplayInRect:[self bounds]]; + + if (imageRep == nil) + return; + + PDFPage *thePage = [[page document] pageAtIndex:pageIndex]; + BOOL autoScales = [self autoScales]; + + dispatch_async(predrawingQueue, ^{ + + NSImage *image = [self imageWithImageRep:imageRep page:thePage autoScales:autoScales]; + + dispatch_async(dispatch_get_main_queue(), ^{ + + if (image && predrawnImages && (__bridge id)NSMapGet(predrawnImages, (void *)pageIndex) == [NSNull null]) { + if (page == thePage) + [pageLayer setContents:image]; + else + NSMapInsert(predrawnImages, (void *)pageIndex, (__bridge void *)image); + } + + }); + + }); + +} + #pragma mark Accessors - (BOOL)canBecomeKeyView { @@ -422,6 +525,7 @@ if (flag != pvFlags.autoScales) { pvFlags.autoScales = flag; [pageLayer setContentsGravity:flag ? kCAGravityResizeAspectFill : kCAGravityCenter]; + [self removePredrawnImageAtIndex:NSNotFound]; [self displayPage:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:SKPresentationViewAutoScalesChangedNotification object:self]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-15 21:22:23
|
Revision: 15216 http://sourceforge.net/p/skim-app/code/15216 Author: hofman Date: 2025-05-15 21:22:20 +0000 (Thu, 15 May 2025) Log Message: ----------- rename method Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-15 21:21:56 UTC (rev 15215) +++ trunk/SKPresentationView.m 2025-05-15 21:22:20 UTC (rev 15216) @@ -142,7 +142,7 @@ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } -- (void)handleWindoDidChangeBackingProperties:(NSNotification *)notifcation { +- (void)handleWindowDidChangeBackingProperties:(NSNotification *)notifcation { CGFloat scale = [[self window] backingScaleFactor]; if (fabs([pageLayer contentsScale] - scale) > 0.0) { [pageLayer setContentsScale:scale]; @@ -163,8 +163,8 @@ [super viewDidMoveToWindow]; NSWindow *window = [self window]; if (window) { - [self handleWindoDidChangeBackingProperties:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleWindoDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; + [self handleWindowDidChangeBackingProperties:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleWindowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-15 21:21:58
|
Revision: 15215 http://sourceforge.net/p/skim-app/code/15215 Author: hofman Date: 2025-05-15 21:21:56 +0000 (Thu, 15 May 2025) Log Message: ----------- rename method Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-15 21:20:00 UTC (rev 15214) +++ trunk/SKPresentationView.m 2025-05-15 21:21:56 UTC (rev 15215) @@ -142,7 +142,7 @@ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } -- (void)handleWindoWillChangeBackingProperties:(NSNotification *)notifcation { +- (void)handleWindoDidChangeBackingProperties:(NSNotification *)notifcation { CGFloat scale = [[self window] backingScaleFactor]; if (fabs([pageLayer contentsScale] - scale) > 0.0) { [pageLayer setContentsScale:scale]; @@ -163,8 +163,8 @@ [super viewDidMoveToWindow]; NSWindow *window = [self window]; if (window) { - [self handleWindoWillChangeBackingProperties:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleWindowWillChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; + [self handleWindoDidChangeBackingProperties:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleWindoDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-15 21:20:02
|
Revision: 15214 http://sourceforge.net/p/skim-app/code/15214 Author: hofman Date: 2025-05-15 21:20:00 +0000 (Thu, 15 May 2025) Log Message: ----------- Set contentsScale of page layer ourselves, update if needed when moving to a window or the windoww changes screen. Also redisplay when contentsScale changes. Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-15 09:29:50 UTC (rev 15213) +++ trunk/SKPresentationView.m 2025-05-15 21:20:00 UTC (rev 15214) @@ -79,7 +79,7 @@ static NSInteger navigationMode = SKNavigationBottom; -@interface SKPDFPageView () <CALayerDelegate> +@interface SKPDFPageView () - (void)displayPage:(void (^)(void))completionHandler; @end @@ -108,7 +108,7 @@ [pageLayer setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable]; [pageLayer setActions:@{@"contents": [NSNull null]}]; [pageLayer setFilters:SKColorEffectFilters()]; - [pageLayer setDelegate:self]; + [pageLayer setContentsScale:[[self layer] contentsScale]]; [[self layer] addSublayer:pageLayer]; [self setTranslatesAutoresizingMaskIntoConstraints:NO]; @@ -142,6 +142,32 @@ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } +- (void)handleWindoWillChangeBackingProperties:(NSNotification *)notifcation { + CGFloat scale = [[self window] backingScaleFactor]; + if (fabs([pageLayer contentsScale] - scale) > 0.0) { + [pageLayer setContentsScale:scale]; + if (page) + [self displayPage:nil]; + } +} + +- (void)viewWillMoveToWindow:(NSWindow *)newWindow { + [super viewWillMoveToWindow:newWindow]; + NSWindow *window = [self window]; + if (window) { + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window]; + } +} + +- (void)viewDidMoveToWindow { + [super viewDidMoveToWindow]; + NSWindow *window = [self window]; + if (window) { + [self handleWindoWillChangeBackingProperties:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleWindowWillChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; + } +} + #pragma mark Transitions - (void)displayPage:(PDFPage *)newPage completionHandler:(void (^)(void))completionHandler { @@ -327,10 +353,6 @@ return [super bitmapImageRepCachingDisplay]; } -- (BOOL)layer:(CALayer *)layer shouldInheritContentsScale:(CGFloat)newScale fromWindow:(NSWindow *)window { - return YES; -} - @end #pragma mark - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-15 09:29:56
|
Revision: 15213 http://sourceforge.net/p/skim-app/code/15213 Author: hofman Date: 2025-05-15 09:29:50 +0000 (Thu, 15 May 2025) Log Message: ----------- don't bother registering anmything except thumbnail update when removing temporary notes when closing presentation Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2025-05-15 09:22:28 UTC (rev 15212) +++ trunk/SKMainWindowController.m 2025-05-15 09:29:50 UTC (rev 15213) @@ -2228,13 +2228,16 @@ NSUndoManager *undoManager = [[self document] undoManager]; if ([self interactionMode] == SKPresentationMode && [undoManager isUndoing] == NO && [undoManager isRedoing] == NO) { - [[[self presentationUndoManager] prepareWithInvocationTarget:[notification object]] addAnnotation:annotation toPage:page]; - - [presentationNotes removeObject:annotation]; - if (page) { + if (mwcFlags.isSwitchingFullScreen == 0) { + [[[self presentationUndoManager] prepareWithInvocationTarget:[notification object]] addAnnotation:annotation toPage:page]; + + [presentationNotes removeObject:annotation]; + if (page) { + [self updateThumbnailAtPageIndex:[page pageIndex]]; + [presentationView updatedAnnotationOnPage:page]; + } + } else if (page) { [self updateThumbnailAtPageIndex:[page pageIndex]]; - if (mwcFlags.isSwitchingFullScreen == 0) - [presentationView updatedAnnotationOnPage:page]; } } else { [[undoManager prepareWithInvocationTarget:[notification object]] addAnnotation:annotation toPage:page]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-15 09:22:31
|
Revision: 15212 http://sourceforge.net/p/skim-app/code/15212 Author: hofman Date: 2025-05-15 09:22:28 +0000 (Thu, 15 May 2025) Log Message: ----------- do not update presentation view when removing temporary notes when closing Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2025-05-14 16:48:13 UTC (rev 15211) +++ trunk/SKMainWindowController.m 2025-05-15 09:22:28 UTC (rev 15212) @@ -2233,7 +2233,8 @@ [presentationNotes removeObject:annotation]; if (page) { [self updateThumbnailAtPageIndex:[page pageIndex]]; - [presentationView updatedAnnotationOnPage:page]; + if (mwcFlags.isSwitchingFullScreen == 0) + [presentationView updatedAnnotationOnPage:page]; } } else { [[undoManager prepareWithInvocationTarget:[notification object]] addAnnotation:annotation toPage:page]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-14 16:48:15
|
Revision: 15211 http://sourceforge.net/p/skim-app/code/15211 Author: hofman Date: 2025-05-14 16:48:13 +0000 (Wed, 14 May 2025) Log Message: ----------- getters are dynamic Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-14 16:30:26 UTC (rev 15210) +++ trunk/SKPresentationView.m 2025-05-14 16:48:13 UTC (rev 15211) @@ -85,7 +85,8 @@ @implementation SKPDFPageView -@synthesize page, transitionController, canGoToNextPage, canGoToPreviousPage, canGoToFirstPage, canGoToLastPage; +@synthesize page, transitionController; +@dynamic canGoToNextPage, canGoToPreviousPage, canGoToFirstPage, canGoToLastPage; static inline NSArray *defaultKeysToObserve() { if (@available(macOS 10.14, *)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-14 16:30:31
|
Revision: 15210 http://sourceforge.net/p/skim-app/code/15210 Author: hofman Date: 2025-05-14 16:30:26 +0000 (Wed, 14 May 2025) Log Message: ----------- Draw placeholder thumbnail for snapshot from configuration, generate placeholder whenever tthumbnail of snapshot is nil when updating. Modified Paths: -------------- trunk/SKMainWindowController.m trunk/SKSnapshotConfiguration.h trunk/SKSnapshotConfiguration.m trunk/SKSnapshotWindowController.h trunk/SKSnapshotWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2025-05-14 15:58:06 UTC (rev 15209) +++ trunk/SKMainWindowController.m 2025-05-14 16:30:26 UTC (rev 15210) @@ -2361,8 +2361,6 @@ if (openType == SKSnapshotOpenPreview) return; - NSImage *image = [controller placeholderThumbnailWithSize:snapshotCacheSize scale:[[self window] backingScaleFactor]]; - [controller setThumbnail:image]; [self snapshotNeedsUpdate:controller lowPriority:openType == SKSnapshotOpenFromSetup]; if (openType == SKSnapshotOpenFromSetup) { @@ -3073,6 +3071,9 @@ NSDate *date = [NSDate date]; dispatch_queue_t queue; + if ([controller thumbnail] == nil) + [controller setThumbnail:[configuration placeholderThumbnailWithSize:snapshotCacheSize scale:backingScale]]; + if ([rightSideController.snapshotTableView window] == nil || [self leftSidePaneIsOpen] == NO) queue = [[self class] backgroundThumbnailQueue]; else if (lowPriority) Modified: trunk/SKSnapshotConfiguration.h =================================================================== --- trunk/SKSnapshotConfiguration.h 2025-05-14 15:58:06 UTC (rev 15209) +++ trunk/SKSnapshotConfiguration.h 2025-05-14 16:30:26 UTC (rev 15210) @@ -52,6 +52,7 @@ - (instancetype)initWithPDFView:(PDFView *)pdfView; - (NSImage *)thumbnailWithSize:(CGFloat)aSize scale:(CGFloat)scale; +- (NSImage *)placeholderThumbnailWithSize:(CGFloat)aSize scale:(CGFloat)scale; - (NSBitmapImageRep *)bitmapImageRepWithSize:(CGFloat)aSize scale:(CGFloat)scale; @end Modified: trunk/SKSnapshotConfiguration.m =================================================================== --- trunk/SKSnapshotConfiguration.m 2025-05-14 15:58:06 UTC (rev 15209) +++ trunk/SKSnapshotConfiguration.m 2025-05-14 16:30:26 UTC (rev 15210) @@ -65,7 +65,7 @@ return self; } -- (NSBitmapImageRep *)bitmapImageRepWithSize:(CGFloat)aSize scale:(CGFloat)scale { +- (NSBitmapImageRep *)bitmapImageRepWithSize:(CGFloat)aSize scale:(CGFloat)scale placeholder:(BOOL)placeholder { NSAffineTransform *transform = [NSAffineTransform transform]; NSSize thumbnailSize = size; CGFloat shadowBlurRadius = 0.0; @@ -94,19 +94,22 @@ if (shadowBlurRadius > 0.0) [NSShadow setShadowWithWhite:0.0 alpha:0.3 blurRadius:shadowBlurRadius yOffset:shadowOffset]; NSRectFill((NSRect){NSZeroPoint, size}); - [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationDefault]; - [NSGraphicsContext restoreGraphicsState]; - [[NSBezierPath bezierPathWithRect:(NSRect){NSZeroPoint, size}] addClip]; - CGContextRef context = [[NSGraphicsContext currentContext] CGContext]; - CGContextSetInterpolationQuality(context, interpolationQuality + 1); - for (PDFDestination *dest in pages) { - NSPoint point = [dest point]; - CGContextSaveGState(context); - CGContextTranslateCTM(context, point.x, point.y); - CGContextScaleCTM(context, scaleFactor, scaleFactor); - [[dest page] drawWithBox:displayBox toContext:context]; - CGContextRestoreGState(context); + if (placeholder == NO) { + [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationDefault]; + [NSGraphicsContext restoreGraphicsState]; + [[NSBezierPath bezierPathWithRect:(NSRect){NSZeroPoint, size}] addClip]; + + CGContextRef context = [[NSGraphicsContext currentContext] CGContext]; + CGContextSetInterpolationQuality(context, interpolationQuality + 1); + for (PDFDestination *dest in pages) { + NSPoint point = [dest point]; + CGContextSaveGState(context); + CGContextTranslateCTM(context, point.x, point.y); + CGContextScaleCTM(context, scaleFactor, scaleFactor); + [[dest page] drawWithBox:displayBox toContext:context]; + CGContextRestoreGState(context); + } } }]; @@ -114,6 +117,10 @@ return imageRep; } +- (NSBitmapImageRep *)bitmapImageRepWithSize:(CGFloat)aSize scale:(CGFloat)scale { + return [self bitmapImageRepWithSize:aSize scale:scale placeholder:NO]; +} + - (NSImage *)thumbnailWithSize:(CGFloat)aSize scale:(CGFloat)scale { NSBitmapImageRep *imageRep = [self bitmapImageRepWithSize:aSize scale:scale]; NSImage *image = [[NSImage alloc] initWithSize:[imageRep size]]; @@ -121,4 +128,11 @@ return image; } +- (NSImage *)placeholderThumbnailWithSize:(CGFloat)aSize scale:(CGFloat)scale { + NSBitmapImageRep *imageRep = [self bitmapImageRepWithSize:aSize scale:scale placeholder:YES]; + NSImage *image = [[NSImage alloc] initWithSize:[imageRep size]]; + [image addRepresentation:imageRep]; + return image; +} + @end Modified: trunk/SKSnapshotWindowController.h =================================================================== --- trunk/SKSnapshotWindowController.h 2025-05-14 15:58:06 UTC (rev 15209) +++ trunk/SKSnapshotWindowController.h 2025-05-14 16:30:26 UTC (rev 15210) @@ -87,8 +87,6 @@ - (void)updatePageLabel; -- (NSImage *)placeholderThumbnailWithSize:(CGFloat)size scale:(CGFloat)scale; - - (NSAttributedString *)thumbnailAttachmentWithSize:(CGFloat)size; - (void)miniaturize; Modified: trunk/SKSnapshotWindowController.m =================================================================== --- trunk/SKSnapshotWindowController.m 2025-05-14 15:58:06 UTC (rev 15209) +++ trunk/SKSnapshotWindowController.m 2025-05-14 16:30:26 UTC (rev 15210) @@ -484,14 +484,6 @@ #pragma mark Thumbnails -- (NSImage *)placeholderThumbnailWithSize:(CGFloat)size scale:(CGFloat)scale { - PDFPage *page = [[PDFPage alloc] init]; - NSRect bounds = [pdfView visibleContentRect]; - bounds.origin = NSZeroPoint; - [page setBounds:bounds forBox:kPDFDisplayBoxMediaBox]; - return [page thumbnailWithSize:size scale:scale forBox:kPDFDisplayBoxMediaBox hasShadow:YES highlights:nil]; -} - - (NSAttributedString *)thumbnailAttachmentWithSize:(CGFloat)size { SKSnapshotConfiguration *configuration = [self currentConfiguration]; NSBitmapImageRep *imageRep1 = [configuration bitmapImageRepWithSize:size scale:1.0]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-14 15:58:11
|
Revision: 15209 http://sourceforge.net/p/skim-app/code/15209 Author: hofman Date: 2025-05-14 15:58:06 +0000 (Wed, 14 May 2025) Log Message: ----------- simplify draw method for thumbnail highlights, will not be a PDFSelection anymore Modified Paths: -------------- trunk/PDFPage_SKExtensions.h trunk/PDFPage_SKExtensions.m trunk/SKReadingBar.h trunk/SKReadingBar.m trunk/SKThumbnailStamp.h trunk/SKThumbnailStamp.m Modified: trunk/PDFPage_SKExtensions.h =================================================================== --- trunk/PDFPage_SKExtensions.h 2025-05-14 15:30:52 UTC (rev 15208) +++ trunk/PDFPage_SKExtensions.h 2025-05-14 15:58:06 UTC (rev 15209) @@ -115,4 +115,8 @@ @end +@interface NSObject (SKThumbnailHighlight) +- (void)drawForPage:(PDFPage *)page withBox:(PDFDisplayBox)box; +@end + NS_ASSUME_NONNULL_END Modified: trunk/PDFPage_SKExtensions.m =================================================================== --- trunk/PDFPage_SKExtensions.m 2025-05-14 15:30:52 UTC (rev 15208) +++ trunk/PDFPage_SKExtensions.m 2025-05-14 15:58:06 UTC (rev 15209) @@ -204,9 +204,9 @@ [self drawWithBox:box toContext:[[NSGraphicsContext currentContext] CGContext]]; for (id highlight in highlights) { - // highlight should be a PDFSelection or SKReadingBar - if ([highlight respondsToSelector:@selector(drawForPage:withBox:active:)]) - [highlight drawForPage:self withBox:box active:YES]; + // highlight should be a SKReadingBar or SKThumbnailStamp + if ([highlight respondsToSelector:@selector(drawForPage:withBox:)]) + [highlight drawForPage:self withBox:box]; } [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationDefault]; Modified: trunk/SKReadingBar.h =================================================================== --- trunk/SKReadingBar.h 2025-05-14 15:30:52 UTC (rev 15208) +++ trunk/SKReadingBar.h 2025-05-14 15:58:06 UTC (rev 15209) @@ -80,7 +80,7 @@ + (NSRect)bounds:(NSRect)rect forBox:(PDFDisplayBox)box onPage:(PDFPage *)aPage; - (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box inContext:(CGContextRef)context; -- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box active:(BOOL)active; +- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box; @end Modified: trunk/SKReadingBar.m =================================================================== --- trunk/SKReadingBar.m 2025-05-14 15:30:52 UTC (rev 15208) +++ trunk/SKReadingBar.m 2025-05-14 15:58:06 UTC (rev 15209) @@ -394,10 +394,12 @@ } } -- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box active:(BOOL)active { +- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box { CGContextRef context = [[NSGraphicsContext currentContext] CGContext]; - [page transformContext:context forBox:box]; + CGContextSaveGState(context); + [pdfPage transformContext:context forBox:box]; [self drawForPage:pdfPage withBox:box inContext:context]; + CGContextRestoreGState(context); } @end Modified: trunk/SKThumbnailStamp.h =================================================================== --- trunk/SKThumbnailStamp.h 2025-05-14 15:30:52 UTC (rev 15208) +++ trunk/SKThumbnailStamp.h 2025-05-14 15:58:06 UTC (rev 15209) @@ -49,7 +49,7 @@ - (instancetype)initWithImage:(NSImage *)anImage rect:(NSRect)aRect fraction:(CGFloat)aFraction; -- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box active:(BOOL)active; +- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box; @end Modified: trunk/SKThumbnailStamp.m =================================================================== --- trunk/SKThumbnailStamp.m 2025-05-14 15:30:52 UTC (rev 15208) +++ trunk/SKThumbnailStamp.m 2025-05-14 15:58:06 UTC (rev 15209) @@ -50,7 +50,7 @@ return self; } -- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box active:(BOOL)active { +- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box { // ignore transformContext:forBox:, as we only use it when this does nothing [image drawInRect:rect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:fraction]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-14 15:30:57
|
Revision: 15208 http://sourceforge.net/p/skim-app/code/15208 Author: hofman Date: 2025-05-14 15:30:52 +0000 (Wed, 14 May 2025) Log Message: ----------- draw page for tooltip image directly in image bbitmap instead of first drawing a full thumbnail, avoids drawing parts of the image that won't be visible, and potentially can be expensive. Modified Paths: -------------- trunk/SKImageToolTipContext.m Modified: trunk/SKImageToolTipContext.m =================================================================== --- trunk/SKImageToolTipContext.m 2025-05-13 21:44:48 UTC (rev 15207) +++ trunk/SKImageToolTipContext.m 2025-05-14 15:30:52 UTC (rev 15208) @@ -48,6 +48,8 @@ #import "NSColor_SKExtensions.h" #import "NSAttributedString_SKExtensions.h" #import "PDFDestination_SKExtensions.h" +#import "NSBitmapImageRep_SKExtensions.h" +#import "SKStringConstants.h" #define TEXT_MARGIN_X 2.0 #define TEXT_MARGIN_Y 2.0 @@ -112,31 +114,21 @@ if (labelColor == nil) labelColor = [NSColor colorWithGenericGamma22White:0.55 alpha:0.8]; - if (selections) { - selections = [[NSArray alloc] initWithArray:selections copyItems:YES]; - [selections setValue:[NSColor findHighlightColor] forKey:@"color"]; - } + PDFPage *page = [self page]; - BOOL isScaled = fabs(scale - 1.0) > 0.01; - PDFPage *page = [self page]; + if (page == nil) + return nil; + + NSRect sourceRect = NSZeroRect; NSPoint point = [[self effectiveDestinationForView:nil] point]; NSRect bounds = [page boundsForBox:kPDFDisplayBoxCropBox]; - CGFloat size = isScaled ? ceil(scale * fmax(NSWidth(bounds), NSHeight(bounds))) : 0.0; - NSImage *pageImage = [page thumbnailWithSize:size scale:backingScale forBox:kPDFDisplayBoxCropBox hasShadow:NO highlights:selections]; - NSRect pageImageRect = {NSZeroPoint, [pageImage size]}; - NSRect sourceRect = NSZeroRect; - PDFSelection *pageSelection = [page selectionForRect:bounds]; - NSRect selBounds; NSAffineTransform *transform = [page affineTransformForBox:kPDFDisplayBoxCropBox]; - if (isScaled) { + if (fabs(scale - 1.0) > 0.0) { NSAffineTransform *scaleTransform = [NSAffineTransform transform]; - [scaleTransform scaleBy:size / fmax(NSWidth(bounds), NSHeight(bounds))]; + [scaleTransform scaleBy:scale]; [transform appendTransform:scaleTransform]; } - if (page == nil) - return nil; - sourceRect.size.width = [[NSUserDefaults standardUserDefaults] doubleForKey:SKToolTipWidthKey]; sourceRect.size.height = [[NSUserDefaults standardUserDefaults] doubleForKey:SKToolTipHeightKey]; sourceRect.origin = [transform transformPoint:point]; @@ -143,7 +135,9 @@ sourceRect.origin.x -= OFFSET_X; sourceRect.origin.y -= NSHeight(sourceRect) - OFFSET_Y; - if ([pageSelection hasCharacters]) + NSRect selBounds; + PDFSelection *pageSelection = [page selectionForRect:bounds]; + if ([pageSelection hasCharacters]) selBounds = NSIntersectionRect(NSInsetRect([pageSelection boundsForPage:page], -2.0, -2.0), bounds); else selBounds = [page boundingBox]; @@ -151,13 +145,25 @@ sourceRect.origin.x = fmax(floor(NSMinX(selBounds)), fmin(floor(NSMaxX(selBounds) - NSWidth(sourceRect)), NSMinX(sourceRect))); sourceRect.origin.y = fmin(ceil(NSMaxY(selBounds)), fmax(ceil(NSMinY(selBounds) + NSHeight(sourceRect)), NSMaxY(sourceRect))) - NSHeight(sourceRect); - sourceRect = SKConstrainRect(sourceRect, pageImageRect); + NSRect pageRect = NSZeroRect; + if (([page rotation] % 180)) { + pageRect.size.width = round(scale * NSHeight(bounds)); + pageRect.size.height = round(scale * NSWidth(bounds)); + } else { + pageRect.size.width = round(scale * NSWidth(bounds)); + pageRect.size.height = round(scale * NSHeight(bounds)); + } + sourceRect = SKConstrainRect(sourceRect, pageRect); + if (selections) { + selections = [[NSArray alloc] initWithArray:selections copyItems:YES]; + [selections setValue:[NSColor findHighlightColor] forKey:@"color"]; + } + if (label == nil) label = [NSString stringWithFormat:NSLocalizedString(@"Page %@", @"Tool tip label format"), [page displayLabel]]; NSAttributedString *labelString = [[NSAttributedString alloc] initWithString:label attributes:labelAttributes]; NSRect labelRect = [labelString boundingRectWithSize:NSZeroSize options:NSStringDrawingUsesLineFragmentOrigin]; - labelRect.size.width = floor(NSWidth(labelRect)); labelRect.size.height = 2.0 * floor(0.5 * NSHeight(labelRect)); // make sure the cap radius is integral labelRect.origin.x = NSWidth(sourceRect) - NSWidth(labelRect) - 0.5 * NSHeight(labelRect) - TEXT_MARGIN_X; @@ -164,28 +170,44 @@ labelRect.origin.y = TEXT_MARGIN_Y; labelRect = NSIntegralRect(labelRect); - NSImage *image = [NSImage imageWithSize:sourceRect.size flipped:NO drawingHandler:^(NSRect dstRect){ + CGFloat radius = 0.5 * NSHeight(labelRect); + NSBezierPath *path = [NSBezierPath bezierPath]; + [path moveToPoint:SKTopLeftPoint(labelRect)]; + [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(labelRect), NSMidY(labelRect)) radius:radius startAngle:90.0 endAngle:270.0]; + [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(labelRect), NSMidY(labelRect)) radius:radius startAngle:-90.0 endAngle:90.0]; + [path closePath]; + + transform = [NSAffineTransform transform]; + [transform translateXBy:-NSMinX(sourceRect) yBy:-NSMinY(sourceRect)]; + [transform scaleBy:scale]; + + NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithSize:sourceRect.size scale:backingScale drawingHandler:^(NSRect dstRect){ - [pageImage drawInRect:dstRect fromRect:sourceRect operation:NSCompositingOperationCopy fraction:1.0]; + [NSGraphicsContext saveGraphicsState]; + [[NSColor whiteColor] setFill]; + NSRectFill(dstRect); + [NSGraphicsContext restoreGraphicsState]; - CGFloat radius = 0.5 * NSHeight(labelRect); - NSBezierPath *path = [NSBezierPath bezierPath]; + [NSGraphicsContext saveGraphicsState]; + [[NSGraphicsContext currentContext] setImageInterpolation:[[NSUserDefaults standardUserDefaults] integerForKey:SKInterpolationQualityKey] + 1]; + [transform concat]; + [page drawWithBox:kPDFDisplayBoxCropBox toContext:[[NSGraphicsContext currentContext] CGContext]]; + for (PDFSelection *selection in selections) + [selection drawForPage:page withBox:kPDFDisplayBoxCropBox active:YES]; + [NSGraphicsContext restoreGraphicsState]; - [path moveToPoint:SKTopLeftPoint(labelRect)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(labelRect), NSMidY(labelRect)) radius:radius startAngle:90.0 endAngle:270.0]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(labelRect), NSMidY(labelRect)) radius:radius startAngle:-90.0 endAngle:90.0]; - [path closePath]; - + [NSGraphicsContext saveGraphicsState]; [labelColor setFill]; [path fill]; - [labelString drawWithRect:labelRect options:NSStringDrawingUsesLineFragmentOrigin]; - - return YES; + [NSGraphicsContext restoreGraphicsState]; }]; - [[[image representations] firstObject] setOpaque:YES]; + [imageRep setOpaque:YES]; + NSImage *image = [[NSImage alloc] initWithSize:sourceRect.size]; + [image addRepresentation:imageRep]; + return image; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-13 21:44:51
|
Revision: 15207 http://sourceforge.net/p/skim-app/code/15207 Author: hofman Date: 2025-05-13 21:44:48 +0000 (Tue, 13 May 2025) Log Message: ----------- calculate parameters outside block so we can use properties of self Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-13 16:31:24 UTC (rev 15206) +++ trunk/SKPresentationView.m 2025-05-13 21:44:48 UTC (rev 15207) @@ -280,15 +280,14 @@ } PDFPage *thePage = page; - BOOL autoScales = [self autoScales]; - + NSRect pageRect = [page boundsForBox:kPDFDisplayBoxCropBox]; + if (([page rotation] % 180) != 0) + pageRect = NSMakeRect(0.0, 0.0, NSHeight(pageRect), NSWidth(pageRect)); + CGFloat scale = [self autoScales] ? fmin(NSHeight(bounds) / NSHeight(pageRect), NSWidth(bounds) / NSWidth(pageRect)) : 1.0; + pageRect = NSInsetRect(bounds, 0.5 * (NSWidth(bounds) - scale * NSWidth(pageRect)), 0.5 * (NSHeight(bounds) - scale * NSHeight(pageRect))); + dispatch_async(drawingQueue, ^{ - NSRect pageRect = [thePage boundsForBox:kPDFDisplayBoxCropBox]; - if (([thePage rotation] % 180) != 0) - pageRect = NSMakeRect(0.0, 0.0, NSHeight(pageRect), NSWidth(pageRect)); - CGFloat scale = autoScales ? fmin(NSHeight(bounds) / NSHeight(pageRect), NSWidth(bounds) / NSWidth(pageRect)) : 1.0; - pageRect = NSInsetRect(bounds, 0.5 * (NSWidth(bounds) - scale * NSWidth(pageRect)), 0.5 * (NSHeight(bounds) - scale * NSHeight(pageRect))); CGContextRef context = [[NSGraphicsContext graphicsContextWithBitmapImageRep:imageRep] CGContext]; CGContextSaveGState(context); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-13 16:31:26
|
Revision: 15206 http://sourceforge.net/p/skim-app/code/15206 Author: hofman Date: 2025-05-13 16:31:24 +0000 (Tue, 13 May 2025) Log Message: ----------- make sure contents scale of layer is set Modified Paths: -------------- trunk/SKPresentationOptionsSheetController.m Modified: trunk/SKPresentationOptionsSheetController.m =================================================================== --- trunk/SKPresentationOptionsSheetController.m 2025-05-13 16:15:19 UTC (rev 15205) +++ trunk/SKPresentationOptionsSheetController.m 2025-05-13 16:31:24 UTC (rev 15206) @@ -347,6 +347,7 @@ CALayer *layer = [CALayer layer]; [layer setBackgroundColor:CGColorGetConstantColor(kCGColorBlack)]; [layer setCornerRadius:PREVIEW_CORNER_RADIUS]; + [layer setContentsScale:[[self window] backingScaleFactor]]; [bgView setLayer:layer]; [bgView setWantsLayer:YES]; [bgView setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawDuringViewResize]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-13 16:15:21
|
Revision: 15205 http://sourceforge.net/p/skim-app/code/15205 Author: hofman Date: 2025-05-13 16:15:19 +0000 (Tue, 13 May 2025) Log Message: ----------- Set correct property and change some code without real effect Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-13 15:47:09 UTC (rev 15204) +++ trunk/SKPresentationView.m 2025-05-13 16:15:19 UTC (rev 15205) @@ -99,6 +99,8 @@ if (self) { page = nil; + [self setWantsLayer:YES]; + pageLayer = [CALayer layer]; [pageLayer setMasksToBounds:YES]; [pageLayer setFrame:NSRectToCGRect([self bounds])]; @@ -106,7 +108,6 @@ [pageLayer setActions:@{@"contents": [NSNull null]}]; [pageLayer setFilters:SKColorEffectFilters()]; [pageLayer setDelegate:self]; - [self setWantsLayer:YES]; [[self layer] addSublayer:pageLayer]; [self setTranslatesAutoresizingMaskIntoConstraints:NO]; @@ -366,7 +367,7 @@ pvFlags.removeLaserPointerShadow = [[NSUserDefaults standardUserDefaults] boolForKey:SKRemoveLaserPointerShadowKey]; pvFlags.enableDrawing = NO == [[NSUserDefaults standardUserDefaults] boolForKey:SKDisableDrawingInPresentationKey]; - [pageLayer setContents:kCAGravityResizeAspectFill]; + [pageLayer setContentsGravity:kCAGravityResizeAspectFill]; [self addTrackingArea:[[NSTrackingArea alloc] initWithRect:NSZeroRect options:NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect owner:self userInfo:nil]]; } @@ -553,7 +554,7 @@ - (void)mouseDown:(NSEvent *)theEvent { BOOL didHideMouse = pvFlags.cursorHidden; if ([pageLayer opacity] <= 0.0) { - [self toggleBlackout:nil]; + [pageLayer setOpacity:1.0]; } else if ([NSApp willDragMouse] == NO) { [self goToNextPage:self]; } else if (IS_TABLET_EVENT(theEvent, NSPointingDeviceTypePen) == NO && ([[self window] styleMask] & NSWindowStyleMaskResizable) != 0 && NSEqualRects([[self window] frame], [[[self window] screen] frame]) == NO && (pvFlags.enableDrawing == NO || ([theEvent modifierFlags] & NSEventModifierFlagShift) == 0)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-13 15:47:11
|
Revision: 15204 http://sourceforge.net/p/skim-app/code/15204 Author: hofman Date: 2025-05-13 15:47:09 +0000 (Tue, 13 May 2025) Log Message: ----------- Don't use pageView subview and add page layer directly assublayer of the view layer. Add layer for drawing freehand note to pageLayer, so it inherits content filters. Modified Paths: -------------- trunk/SKPresentationView.h trunk/SKPresentationView.m Modified: trunk/SKPresentationView.h =================================================================== --- trunk/SKPresentationView.h 2025-05-13 15:30:36 UTC (rev 15203) +++ trunk/SKPresentationView.h 2025-05-13 15:47:09 UTC (rev 15204) @@ -46,7 +46,7 @@ @class PDFPage, SKTransitionController, SKNavigationWindow, SKCursorStyleWindow; @interface SKPDFPageView : NSView { - NSView *pageView; + CALayer *pageLayer; PDFPage *page; SKTransitionController *transitionController; } Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-13 15:30:36 UTC (rev 15203) +++ trunk/SKPresentationView.m 2025-05-13 15:47:09 UTC (rev 15204) @@ -99,17 +99,15 @@ if (self) { page = nil; - CALayer *layer = [CALayer layer]; - [layer setMasksToBounds:YES]; - [layer setFrame:NSRectToCGRect([self bounds])]; - [layer setActions:@{@"contents": [NSNull null]}]; - [layer setDelegate:self]; - pageView = [[NSView alloc] initWithFrame:[self bounds]]; - [pageView setLayer:layer]; - [pageView setWantsLayer:YES]; - [pageView setContentFilters:SKColorEffectFilters()]; - [pageView setTranslatesAutoresizingMaskIntoConstraints:NO]; - [self addSubviewWithConstraints:pageView]; + pageLayer = [CALayer layer]; + [pageLayer setMasksToBounds:YES]; + [pageLayer setFrame:NSRectToCGRect([self bounds])]; + [pageLayer setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable]; + [pageLayer setActions:@{@"contents": [NSNull null]}]; + [pageLayer setFilters:SKColorEffectFilters()]; + [pageLayer setDelegate:self]; + [self setWantsLayer:YES]; + [[self layer] addSublayer:pageLayer]; [self setTranslatesAutoresizingMaskIntoConstraints:NO]; @@ -132,12 +130,12 @@ if (@available(macOS 10.14, *)) [super viewDidChangeEffectiveAppearance]; if ([[NSUserDefaults standardUserDefaults] boolForKey:SKInvertColorsInDarkModeKey]) - [pageView setContentFilters:SKColorEffectFilters()]; + [pageLayer setFilters:SKColorEffectFilters()]; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (context == &SKPresentationViewDefaultsObservationContext) - [pageView setContentFilters:SKColorEffectFilters()]; + [pageLayer setFilters:SKColorEffectFilters()]; else [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } @@ -259,7 +257,7 @@ - (void)displayPage:(void (^)(void))completionHandler { if (page == nil) { - [[pageView layer] setContents:nil]; + [pageLayer setContents:nil]; if (completionHandler) completionHandler(); return; @@ -309,7 +307,7 @@ dispatch_async(dispatch_get_main_queue(), ^{ if (thePage == page) - [[pageView layer] setContents:image]; + [pageLayer setContents:image]; if (completionHandler) completionHandler(); @@ -319,7 +317,7 @@ } - (NSBitmapImageRep *)bitmapImageRepCachingDisplay { - NSImage *image = [[pageView layer] contents]; + NSImage *image = [pageLayer contents]; if ([image isKindOfClass:[NSImage class]]) { NSImageRep *imageRep = [[image representations] firstObject]; if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) @@ -368,7 +366,7 @@ pvFlags.removeLaserPointerShadow = [[NSUserDefaults standardUserDefaults] boolForKey:SKRemoveLaserPointerShadowKey]; pvFlags.enableDrawing = NO == [[NSUserDefaults standardUserDefaults] boolForKey:SKDisableDrawingInPresentationKey]; - [pageView setLayerContentsPlacement:NSViewLayerContentsPlacementScaleProportionallyToFill]; + [pageLayer setContents:kCAGravityResizeAspectFill]; [self addTrackingArea:[[NSTrackingArea alloc] initWithRect:NSZeroRect options:NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect owner:self userInfo:nil]]; } @@ -400,7 +398,7 @@ - (void)setAutoScales:(BOOL)flag { if (flag != pvFlags.autoScales) { pvFlags.autoScales = flag; - [pageView setLayerContentsPlacement:flag ? NSViewLayerContentsPlacementScaleProportionallyToFill : NSViewLayerContentsPlacementCenter]; + [pageLayer setContentsGravity:flag ? kCAGravityResizeAspectFill : kCAGravityCenter]; [self displayPage:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:SKPresentationViewAutoScalesChangedNotification object:self]; } @@ -407,7 +405,7 @@ } - (BOOL)hasBlackout { - return [pageView alphaValue] <= 0.0; + return [pageLayer opacity] <= 0.0; } - (NSInteger)cursorStyle { @@ -429,7 +427,7 @@ } - (void)toggleBlackout:(id)sender { - [[pageView animator] setAlphaValue:1.0 - [pageView alphaValue]]; + [pageLayer setOpacity:1.0 - [pageLayer opacity]]; } - (void)exitPresentation:(id)sender { @@ -554,7 +552,7 @@ - (void)mouseDown:(NSEvent *)theEvent { BOOL didHideMouse = pvFlags.cursorHidden; - if ([pageView alphaValue] <= 0.0) { + if ([pageLayer opacity] <= 0.0) { [self toggleBlackout:nil]; } else if ([NSApp willDragMouse] == NO) { [self goToNextPage:self]; @@ -741,8 +739,7 @@ } [layer setContentsScale:[[self layer] contentsScale]]; - [[self layer] addSublayer:layer]; - [layer setFilters:SKColorEffectFilters()]; + [pageLayer addSublayer:layer]; t = CGAffineTransformMakeScale(scale, scale); @@ -855,7 +852,12 @@ - (void)didOpen { [self setAutoScales:YES]; - [pageView setAlphaValue:1.0]; + if ([pageLayer opacity] < 1.0) { + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + [pageLayer setOpacity:1.0]; + [CATransaction commit]; + } [self performSelectorOnce:@selector(setCursorForMouse:) afterDelay:0.0]; [self performSelectorOnce:@selector(doAutoHide) afterDelay:AUTO_HIDE_DELAY]; @@ -958,7 +960,12 @@ [nc addObserver:self selector:@selector(handleWindowDidBecomeKeyNotification:) name:NSWindowDidBecomeKeyNotification object:newWindow]; [nc addObserver:self selector:@selector(handleWindowDidResignKeyNotification:) name:NSWindowDidResignKeyNotification object:newWindow]; } else { - [pageView setAlphaValue:1.0]; + if ([pageLayer opacity] < 1.0) { + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + [pageLayer setOpacity:1.0]; + [CATransaction commit]; + } pvFlags.cursorHidden = NO; [NSCursor setHiddenUntilMouseMoves:NO]; [[NSCursor arrowCursor] set]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-13 15:30:38
|
Revision: 15203 http://sourceforge.net/p/skim-app/code/15203 Author: hofman Date: 2025-05-13 15:30:36 +0000 (Tue, 13 May 2025) Log Message: ----------- Make sure page layer inherits contents scale from window Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-12 21:22:51 UTC (rev 15202) +++ trunk/SKPresentationView.m 2025-05-13 15:30:36 UTC (rev 15203) @@ -103,6 +103,7 @@ [layer setMasksToBounds:YES]; [layer setFrame:NSRectToCGRect([self bounds])]; [layer setActions:@{@"contents": [NSNull null]}]; + [layer setDelegate:self]; pageView = [[NSView alloc] initWithFrame:[self bounds]]; [pageView setLayer:layer]; [pageView setWantsLayer:YES]; @@ -327,6 +328,10 @@ return [super bitmapImageRepCachingDisplay]; } +- (BOOL)layer:(CALayer *)layer shouldInheritContentsScale:(CGFloat)newScale fromWindow:(NSWindow *)window { + return YES; +} + @end #pragma mark - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-12 21:22:53
|
Revision: 15202 http://sourceforge.net/p/skim-app/code/15202 Author: hofman Date: 2025-05-12 21:22:51 +0000 (Mon, 12 May 2025) Log Message: ----------- Combine redraw for note changes in the same run. Remove layer for drawing freehand note wwhen displaying the page with the note. Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-12 16:16:57 UTC (rev 15201) +++ trunk/SKPresentationView.m 2025-05-12 21:22:51 UTC (rev 15202) @@ -376,8 +376,10 @@ } - (void)updatedAnnotationOnPage:(PDFPage *)aPage { - if (page == aPage) - [self displayPage:nil]; + if (page == aPage) { + [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(displayPage:) object:nil]; + [self performSelector:@selector(displayPage:) withObject:nil afterDelay:0.0]; + } } #pragma mark Accessors @@ -791,8 +793,6 @@ } } - [layer removeFromSuperlayer]; - [NSEvent setMouseCoalescingEnabled:wasMouseCoalescingEnabled]; if (bezierPath) { @@ -803,6 +803,13 @@ if (tmpColor) [annotation setColor:tmpColor]; [[page document] addAnnotation:annotation toPage:page]; + + [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(displayPage:) object:nil]; + [self displayPage:^{ + [layer removeFromSuperlayer]; + }]; + } else { + [layer removeFromSuperlayer]; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-12 16:17:00
|
Revision: 15201 http://sourceforge.net/p/skim-app/code/15201 Author: hofman Date: 2025-05-12 16:16:57 +0000 (Mon, 12 May 2025) Log Message: ----------- Set flag onm transition view instead of controller, so we have no need to reference self from block Modified Paths: -------------- trunk/SKTransitionController.h trunk/SKTransitionController.m Modified: trunk/SKTransitionController.h =================================================================== --- trunk/SKTransitionController.h 2025-05-12 16:10:40 UTC (rev 15200) +++ trunk/SKTransitionController.h 2025-05-12 16:16:57 UTC (rev 15201) @@ -46,7 +46,6 @@ @interface SKTransitionController : NSObject { SKTransitionView *transitionView; - BOOL animating; BOOL shouldScale; SKTransitionInfo *transition; Modified: trunk/SKTransitionController.m =================================================================== --- trunk/SKTransitionController.m 2025-05-12 16:10:40 UTC (rev 15200) +++ trunk/SKTransitionController.m 2025-05-12 16:16:57 UTC (rev 15201) @@ -60,21 +60,19 @@ CIFilter *filter; id<MTLCommandQueue> commandQueue; CIContext *context; + BOOL inUse; } @property (nonatomic) CGRect extent; @property (nonatomic, strong) CIFilter *filter; @property (nonatomic) CGFloat progress; +@property (nonatomic, getter=isInUse) BOOL inUse; @end #pragma mark - -@interface SKTransitionController () -@property (nonatomic, getter=isAnimating) BOOL animating; -@end - @implementation SKTransitionController -@synthesize transition, pageTransitions, shouldScale, animating; +@synthesize transition, pageTransitions, shouldScale; static inline CGRect scaleRect(NSRect rect, CGFloat scale) { return CGRectMake(scale * NSMinX(rect), scale * NSMinY(rect), scale * NSWidth(rect), scale * NSHeight(rect)); @@ -172,7 +170,7 @@ } - (SKTransitionAnimation)animationAtIndex:(NSUInteger)idx forView:(NSView *)view { - if ([self isAnimating]) + if ([transitionView isInUse]) return nil; SKTransitionInfo *currentTransition = transition; @@ -182,8 +180,6 @@ if ([currentTransition style] == SKNoTransition) return nil; - [self setAnimating:YES]; - CIImage *initialImage = currentImageForView(view); NSRect bounds = [view bounds]; @@ -194,10 +190,10 @@ transitionView = [[SKTransitionView alloc] initWithFrame:bounds]; else [transitionView setFrame:bounds]; + [transitionView setInUse:YES]; + SKTransitionView *transView = transitionView; - __weak SKTransitionController *weakSelf = self; - return ^(NSRect rect, BOOL forward, void (^completionHandler)(void)){ CIImage *finalImage = currentImageForView(view); @@ -217,7 +213,7 @@ } completionHandler:^{ [transView removeFromSuperview]; [transView setFilter:nil]; - [weakSelf setAnimating:NO]; + [transView setInUse:NO]; if (completionHandler) completionHandler(); }]; @@ -231,7 +227,7 @@ @implementation SKTransitionView -@synthesize extent, filter; +@synthesize extent, filter, inUse; @dynamic progress; - (instancetype)initWithFrame:(NSRect)frameRect { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-12 16:10:42
|
Revision: 15200 http://sourceforge.net/p/skim-app/code/15200 Author: hofman Date: 2025-05-12 16:10:40 +0000 (Mon, 12 May 2025) Log Message: ----------- use accessors Modified Paths: -------------- trunk/SKTransitionController.m Modified: trunk/SKTransitionController.m =================================================================== --- trunk/SKTransitionController.m 2025-05-12 16:03:26 UTC (rev 15199) +++ trunk/SKTransitionController.m 2025-05-12 16:10:40 UTC (rev 15200) @@ -172,7 +172,7 @@ } - (SKTransitionAnimation)animationAtIndex:(NSUInteger)idx forView:(NSView *)view { - if (animating) + if ([self isAnimating]) return nil; SKTransitionInfo *currentTransition = transition; @@ -182,7 +182,7 @@ if ([currentTransition style] == SKNoTransition) return nil; - animating = YES; + [self setAnimating:YES]; CIImage *initialImage = currentImageForView(view); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-05-12 16:03:30
|
Revision: 15199 http://sourceforge.net/p/skim-app/code/15199 Author: hofman Date: 2025-05-12 16:03:26 +0000 (Mon, 12 May 2025) Log Message: ----------- use proper getterr name Modified Paths: -------------- trunk/SKTransitionController.m Modified: trunk/SKTransitionController.m =================================================================== --- trunk/SKTransitionController.m 2025-05-12 15:52:49 UTC (rev 15198) +++ trunk/SKTransitionController.m 2025-05-12 16:03:26 UTC (rev 15199) @@ -69,7 +69,7 @@ #pragma mark - @interface SKTransitionController () -@property (nonatomic) BOOL animating; +@property (nonatomic, getter=isAnimating) BOOL animating; @end @implementation SKTransitionController This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |