Revision: 12970 http://sourceforge.net/p/skim-app/code/12970 Author: hofman Date: 2022-06-28 16:11:41 +0000 (Tue, 28 Jun 2022) Log Message: ----------- No need to change graphics state when not drawing a reading bar
Modified Paths: -------------- trunk/SKReadingBar.m Modified: trunk/SKReadingBar.m =================================================================== --- trunk/SKReadingBar.m 2022-06-28 16:06:31 UTC (rev 12969) +++ trunk/SKReadingBar.m 2022-06-28 16:11:41 UTC (rev 12970) @@ -362,11 +362,12 @@ - (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box inContext:(CGContextRef)context { BOOL invert = [[NSUserDefaults standardUserDefaults] boolForKey:SKReadingBarInvertKey]; - CGContextSaveGState(context); - - CGContextSetFillColorWithColor(context, [[[NSUserDefaults standardUserDefaults] colorForKey:SKReadingBarColorKey] CGColor]); - if ([[self page] isEqual:pdfPage]) { + + CGContextSaveGState(context); + + CGContextSetFillColorWithColor(context, [[[NSUserDefaults standardUserDefaults] colorForKey:SKReadingBarColorKey] CGColor]); + NSRect rect = [self currentBounds]; if (invert) { NSRect bounds = [pdfPage boundsForBox:box]; @@ -383,12 +384,20 @@ CGContextSetBlendMode(context, kCGBlendModeMultiply); CGContextFillRect(context, NSRectToCGRect(rect)); } + + CGContextRestoreGState(context); + } else if (invert) { + + CGContextSaveGState(context); + + CGContextSetFillColorWithColor(context, [[[NSUserDefaults standardUserDefaults] colorForKey:SKReadingBarColorKey] CGColor]); + CGContextFillRect(context, NSRectToCGRect([pdfPage boundsForBox:box])); + + CGContextRestoreGState(context); + } - - - CGContextRestoreGState(context); } - (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box active:(BOOL)active { 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