Revision: 15170
http://sourceforge.net/p/skim-app/code/15170
Author: hofman
Date: 2025-05-08 22:54:29 +0000 (Thu, 08 May 2025)
Log Message:
-----------
Avoid redrawing presentation view. Don't call setNeedsDisplay: on pageView when
view needs display, only update when changing an annotation. Don't redraw on
resize, only at endof live resize.
Modified Paths:
--------------
trunk/SKMainWindowController.m
trunk/SKPresentationView.h
trunk/SKPresentationView.m
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2025-05-08 16:14:28 UTC (rev 15169)
+++ trunk/SKMainWindowController.m 2025-05-08 22:54:29 UTC (rev 15170)
@@ -2193,7 +2193,7 @@
if (page) {
[self updateThumbnailAtPageIndex:[page pageIndex]];
if ([presentationView page] == page)
- [presentationView setNeedsDisplay:YES];
+ [presentationView updatedAnnotation];
}
} else {
[[undoManager prepareWithInvocationTarget:[notification object]]
removeAnnotation:annotation];
@@ -2217,7 +2217,7 @@
}
[secondaryPdfView addedAnnotation:annotation onPage:page];
if ([self interactionMode] == SKPresentationMode &&
[presentationView page] == page)
- [presentationView setNeedsDisplay:YES];
+ [presentationView updatedAnnotation];
}
}
}
@@ -2235,7 +2235,7 @@
if (page) {
[self updateThumbnailAtPageIndex:[page pageIndex]];
if ([presentationView page] == page)
- [presentationView setNeedsDisplay:YES];
+ [presentationView updatedAnnotation];
}
} else {
[[undoManager prepareWithInvocationTarget:[notification object]]
addAnnotation:annotation toPage:page];
@@ -2262,7 +2262,7 @@
}
[secondaryPdfView removedAnnotation:annotation onPage:page];
if ([self interactionMode] == SKPresentationMode &&
[presentationView page] == page)
- [presentationView setNeedsDisplay:YES];
+ [presentationView updatedAnnotation];
}
}
}
@@ -2287,7 +2287,7 @@
[secondaryPdfView removedAnnotation:annotation onPage:oldPage];
[secondaryPdfView addedAnnotation:annotation onPage:newPage];
if ([self interactionMode] == SKPresentationMode && ([presentationView
page] == oldPage || [presentationView page] == newPage))
- [presentationView setNeedsDisplay:YES];
+ [presentationView updatedAnnotation];
}
[rightSideController.noteArrayController rearrangeObjects];
@@ -2729,8 +2729,8 @@
[secondaryPdfView updatedAnnotation:note];
if ([self interactionMode] == SKPresentationMode &&
[presentationView page] == page)
- [presentationView setNeedsDisplay:YES];
-
+ [presentationView updatedAnnotation];
+
if ([keyPath isEqualToString:SKNPDFAnnotationBoundsKey] &&
note == [pdfView currentAnnotation] && [[NSUserDefaults standardUserDefaults]
boolForKey:SKDisplayNoteBoundsKey])
[self updateRightStatus];
}
Modified: trunk/SKPresentationView.h
===================================================================
--- trunk/SKPresentationView.h 2025-05-08 16:14:28 UTC (rev 15169)
+++ trunk/SKPresentationView.h 2025-05-08 22:54:29 UTC (rev 15170)
@@ -112,6 +112,8 @@
- (void)didOpen;
- (void)willClose;
+- (void)updatedAnnotation;
+
@end
NS_ASSUME_NONNULL_END
Modified: trunk/SKPresentationView.m
===================================================================
--- trunk/SKPresentationView.m 2025-05-08 16:14:28 UTC (rev 15169)
+++ trunk/SKPresentationView.m 2025-05-08 22:54:29 UTC (rev 15170)
@@ -143,16 +143,6 @@
#pragma mark Accessors
-- (void)setNeedsDisplay:(BOOL)needsDisplay {
- [super setNeedsDisplay:needsDisplay];
- [pageView setNeedsDisplay:needsDisplay];
-}
-
-- (void)setNeedsDisplayInRect:(NSRect)invalidRect {
- [super setNeedsDisplayInRect:invalidRect];
- [pageView setNeedsDisplay:YES];
-}
-
- (void)setPage:(PDFPage *)newPage {
if (newPage != page) {
page = newPage;
@@ -269,11 +259,23 @@
pvFlags.removeLaserPointerShadow = [[NSUserDefaults
standardUserDefaults] boolForKey:SKRemoveLaserPointerShadowKey];
pvFlags.enableDrawing = NO == [[NSUserDefaults standardUserDefaults]
boolForKey:SKDisableDrawingInPresentationKey];
+ [pageView
setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawOnSetNeedsDisplay];
+ [pageView
setLayerContentsPlacement:NSViewLayerContentsPlacementScaleProportionallyToFit];
+
[self addTrackingArea:[[NSTrackingArea alloc] initWithRect:NSZeroRect
options:NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited |
NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect owner:self userInfo:nil]];
}
return self;
}
+- (void)viewDidEndLiveResize {
+ [super viewDidEndLiveResize];
+ [pageView setNeedsDisplay:YES];
+}
+
+- (void)updatedAnnotation; {
+ [pageView setNeedsDisplay:YES];
+}
+
#pragma mark Accessors
- (BOOL)canBecomeKeyView {
@@ -287,6 +289,7 @@
- (void)setAutoScales:(BOOL)flag {
if (flag != pvFlags.autoScales) {
pvFlags.autoScales = flag;
+ [pageView setLayerContentsPlacement:flag ?
NSViewLayerContentsPlacementScaleProportionallyToFit :
NSViewLayerContentsPlacementCenter];
[pageView setNeedsDisplay:YES];
[[NSNotificationCenter defaultCenter]
postNotificationName:SKPresentationViewAutoScalesChangedNotification
object:self];
}
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