Revision: 14795
http://sourceforge.net/p/skim-app/code/14795
Author: hofman
Date: 2024-12-08 23:17:57 +0000 (Sun, 08 Dec 2024)
Log Message:
-----------
No need to dirty full rect for annotation as we only redraw the selection
highlight, annotation itself should be updated from updateAnnotation:
Modified Paths:
--------------
trunk/PDFAnnotationInk_SKExtensions.m
trunk/PDFAnnotationLine_SKExtensions.m
trunk/PDFAnnotationMarkup_SKExtensions.m
trunk/PDFAnnotation_SKExtensions.h
trunk/PDFAnnotation_SKExtensions.m
trunk/PDFView_SKExtensions.m
trunk/SKMainWindowController.m
trunk/SKPDFView.m
Modified: trunk/PDFAnnotationInk_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationInk_SKExtensions.m 2024-12-08 22:27:33 UTC (rev
14794)
+++ trunk/PDFAnnotationInk_SKExtensions.m 2024-12-08 23:17:57 UTC (rev
14795)
@@ -166,16 +166,6 @@
return NO;
}
-- (NSRect)displayRectForBounds:(NSRect)bounds lineWidth:(CGFloat)lineWidth {
- NSRect rect = NSZeroRect;
- if (lineWidth < 1.0)
- lineWidth = 1.0;
- for (NSBezierPath *path in [self paths])
- rect = NSUnionRect(rect, NSInsetRect([path nonEmptyBounds], -0.5 *
lineWidth, -0.5 * lineWidth));
- rect.origin = SKAddPoints(rect.origin, bounds.origin);
- return NSUnionRect([super displayRectForBounds:bounds
lineWidth:lineWidth], NSIntegralRect(rect));
-}
-
- (void)drawShadowWithUnitWidth:(CGFloat)unitWidth
inContext:(CGContextRef)context {
NSRect bounds = [self bounds];
CGFloat r = fmin(2.0, 2.0 * unitWidth);
Modified: trunk/PDFAnnotationLine_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationLine_SKExtensions.m 2024-12-08 22:27:33 UTC (rev
14794)
+++ trunk/PDFAnnotationLine_SKExtensions.m 2024-12-08 23:17:57 UTC (rev
14795)
@@ -142,18 +142,6 @@
return fmin([page sortOrderForBounds:startBounds], [page
sortOrderForBounds:endBounds]);
}
-- (NSRect)displayRectForBounds:(NSRect)bounds lineWidth:(CGFloat)lineWidth {
- NSRect rect = [super displayRectForBounds:bounds lineWidth:lineWidth];
- // need a large padding amount for large line width and cap changes
- CGFloat delta = ceil(fmax(3.0 * lineWidth, 2.0));
- rect = NSInsetRect(rect, -delta, -delta);
- if (NSWidth(bounds) < 2.0 * delta)
- rect = NSInsetRect(rect, -delta, 0.0);
- if (NSHeight(bounds) < 2.0 * delta)
- rect = NSInsetRect(rect, 0.0, -delta);
- return rect;
-}
-
- (SKRectEdges)resizeHandleForPoint:(NSPoint)point
scaleFactor:(CGFloat)scaleFactor {
if ([self isResizable] == NO)
return 0;
Modified: trunk/PDFAnnotationMarkup_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationMarkup_SKExtensions.m 2024-12-08 22:27:33 UTC (rev
14794)
+++ trunk/PDFAnnotationMarkup_SKExtensions.m 2024-12-08 23:17:57 UTC (rev
14795)
@@ -221,15 +221,6 @@
return [[self page] sortOrderForBounds:bounds];
}
-- (NSRect)displayRectForBounds:(NSRect)bounds lineWidth:(CGFloat)lineWidth {
- bounds = [super displayRectForBounds:bounds lineWidth:lineWidth];
- if ([self markupType] == kPDFMarkupTypeHighlight) {
- CGFloat delta = -0.03 * NSHeight(bounds);
- bounds = ([[self page] lineDirectionAngle] % 180) != 0 ?
NSInsetRect(bounds, 0.0, delta) : NSInsetRect(bounds, delta, 0.0);
- }
- return bounds;
-}
-
- (void)drawSelectionHighlightWithUnitWidth:(CGFloat)unitWidth
active:(BOOL)active inContext:(CGContextRef)context {
if (NSIsEmptyRect([self bounds]))
return;
Modified: trunk/PDFAnnotation_SKExtensions.h
===================================================================
--- trunk/PDFAnnotation_SKExtensions.h 2024-12-08 22:27:33 UTC (rev 14794)
+++ trunk/PDFAnnotation_SKExtensions.h 2024-12-08 23:17:57 UTC (rev 14795)
@@ -121,9 +121,6 @@
@property (nonatomic, readonly) CGFloat boundsOrder;
-- (NSRect)displayRectForBounds:(NSRect)bounds lineWidth:(CGFloat)lineWidth;
-@property (nonatomic, readonly) NSRect displayRect;
-
- (SKRectEdges)resizeHandleForPoint:(NSPoint)point
scaleFactor:(CGFloat)scaleFactor;
- (void)drawSelectionHighlightWithUnitWidth:(CGFloat)unitWidth
active:(BOOL)active inContext:(CGContextRef)context;
Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m 2024-12-08 22:27:33 UTC (rev 14794)
+++ trunk/PDFAnnotation_SKExtensions.m 2024-12-08 23:17:57 UTC (rev 14795)
@@ -489,14 +489,6 @@
return [[self page] sortOrderForBounds:[self bounds]];
}
-- (NSRect)displayRectForBounds:(NSRect)bounds lineWidth:(CGFloat)lineWidth {
- return bounds;
-}
-
-- (NSRect)displayRect {
- return [self displayRectForBounds:[self bounds] lineWidth:[self
lineWidth]];
-}
-
- (SKRectEdges)resizeHandleForPoint:(NSPoint)point
scaleFactor:(CGFloat)scaleFactor {
return [self isResizable] ? SKResizeHandleForPointFromRect(point, [self
bounds], 4.0 / scaleFactor) : 0;
}
Modified: trunk/PDFView_SKExtensions.m
===================================================================
--- trunk/PDFView_SKExtensions.m 2024-12-08 22:27:33 UTC (rev 14794)
+++ trunk/PDFView_SKExtensions.m 2024-12-08 23:17:57 UTC (rev 14795)
@@ -118,8 +118,6 @@
NSView *pageView = [self safePageViewForPage:page];
if (pageView)
[pageView updateAnnotation:annotation];
- else
- [self setNeedsDisplayInRect:[annotation displayRect] ofPage:page];
[self annotationsChangedOnPage:page];
}
@@ -131,8 +129,6 @@
NSView *pageView = [self safePageViewForPage:page];
if (pageView)
[pageView addAnnotation:annotation];
- else
- [self setNeedsDisplayInRect:[annotation displayRect] ofPage:page];
[self annotationsChangedOnPage:page];
}
@@ -140,8 +136,6 @@
NSView *pageView = [self safePageViewForPage:page];
if (pageView)
[pageView removeAnnotation:annotation];
- else
- [self setNeedsDisplayInRect:[annotation displayRect] ofPage:page];
[self annotationsChangedOnPage:page];
}
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2024-12-08 22:27:33 UTC (rev 14794)
+++ trunk/SKMainWindowController.m 2024-12-08 23:17:57 UTC (rev 14795)
@@ -2687,15 +2687,8 @@
if ([keyPath isEqualToString:SKNPDFAnnotationModificationDateKey]
== NO && [keyPath isEqualToString:SKNPDFAnnotationUserNameKey] == NO &&
[keyPath isEqualToString:SKNPDFAnnotationTextKey] == NO) {
PDFPage *page = [note page];
NSRect oldRect = NSZeroRect;
- if ([keyPath isEqualToString:SKNPDFAnnotationBoundsKey] &&
[oldValue isEqual:[NSNull null]] == NO) {
- oldRect = [note displayRectForBounds:[oldValue rectValue]
lineWidth:[note lineWidth]];
- } else if ([keyPath isEqualToString:SKNPDFAnnotationBorderKey]
&& [oldValue isEqual:[NSNull null]] == NO) {
- if ([oldValue lineWidth] > [note lineWidth]) {
- oldRect = [note displayRectForBounds:[note bounds]
lineWidth:[oldValue lineWidth]];
- if (NSContainsRect([note bounds], oldRect))
- oldRect = NSZeroRect;
- }
- }
+ if ([keyPath isEqualToString:SKNPDFAnnotationBoundsKey] &&
[oldValue isEqual:[NSNull null]] == NO)
+ oldRect = [oldValue rectValue];
[self updateThumbnailAtPageIndex:[note pageIndex]];
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2024-12-08 22:27:33 UTC (rev 14794)
+++ trunk/SKPDFView.m 2024-12-08 23:17:57 UTC (rev 14795)
@@ -2838,7 +2838,7 @@
PDFPage *page = [annotation page];
[self annotationsChangedOnPage:page];
if (annotation == currentAnnotation && atomic_load(&highlightLayerState)
!= SKLayerUse && needsRedraw) {
- NSRect rect = NSUnionRect([annotation displayRect], oldRect);
+ NSRect rect = NSUnionRect([annotation bounds], oldRect);
CGFloat margin = (([annotation isResizable] || [annotation isNote]) ?
HANDLE_SIZE : 1.0) / [self scaleFactor];
rect = NSInsetRect(rect, -margin, -margin);
[self setNeedsDisplayInRect:rect ofPage:page];
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