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. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit