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