Revision: 14013
http://sourceforge.net/p/skim-app/code/14013
Author: hofman
Date: 2024-01-14 23:06:16 +0000 (Sun, 14 Jan 2024)
Log Message:
-----------
avoid CFAutorelease
Modified Paths:
--------------
trunk/NSBezierPath_SKExtensions.h
trunk/NSBezierPath_SKExtensions.m
trunk/PDFAnnotationInk_SKExtensions.m
trunk/SKPDFView.m
trunk/SKTransitionController.m
Modified: trunk/NSBezierPath_SKExtensions.h
===================================================================
--- trunk/NSBezierPath_SKExtensions.h 2024-01-10 14:48:26 UTC (rev 14012)
+++ trunk/NSBezierPath_SKExtensions.h 2024-01-14 23:06:16 UTC (rev 14013)
@@ -47,7 +47,7 @@
- (NSPoint)associatedPointForElementAtIndex:(NSUInteger)anIndex;
-@property (nonatomic, readonly) CGPathRef CGPath;
+@property (nonatomic, readonly) CGPathRef copyCGPath;
- (void)halfEllipseFromPoint:(NSPoint)halfwayPoint toPoint:(NSPoint)endPoint;
Modified: trunk/NSBezierPath_SKExtensions.m
===================================================================
--- trunk/NSBezierPath_SKExtensions.m 2024-01-10 14:48:26 UTC (rev 14012)
+++ trunk/NSBezierPath_SKExtensions.m 2024-01-14 23:06:16 UTC (rev 14013)
@@ -92,7 +92,7 @@
return bounds;
}
-- (CGPathRef)CGPath {
+- (CGPathRef)copyCGPath {
CGMutablePathRef mutablePath = CGPathCreateMutable();
NSInteger numElements = [self elementCount];
NSPoint points[3];
@@ -118,7 +118,7 @@
CGPathRef path = CGPathCreateCopy(mutablePath);
CGPathRelease(mutablePath);
- return (CGPathRef)CFAutorelease(path);
+ return path;
}
// distance ratio for control points to approximate a quarter ellipse by a
cubic bezier curve
Modified: trunk/PDFAnnotationInk_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationInk_SKExtensions.m 2024-01-10 14:48:26 UTC (rev
14012)
+++ trunk/PDFAnnotationInk_SKExtensions.m 2024-01-14 23:06:16 UTC (rev
14013)
@@ -184,8 +184,11 @@
r = fabs(CGSizeApplyAffineTransform(CGSizeMake(r, r), t).height);
t = CGAffineTransformMakeTranslation(NSMinX(bounds), NSMinY(bounds));
CGMutablePathRef path = CGPathCreateMutable();
- for (NSBezierPath *aPath in [self paths])
- CGPathAddPath(path, &t, [aPath CGPath]);
+ for (NSBezierPath *aPath in [self paths]) {
+ CGPathRef cgPath = [aPath copyCGPath];
+ CGPathAddPath(path, &t, cgPath);
+ CGPathRelease(cgPath);
+ }
CGContextSaveGState(context);
CGContextSetAlpha(context, [[self color] alphaComponent]);
CGContextBeginTransparencyLayerWithRect(context, rect, NULL);
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2024-01-10 14:48:26 UTC (rev 14012)
+++ trunk/SKPDFView.m 2024-01-14 23:06:16 UTC (rev 14013)
@@ -4387,6 +4387,7 @@
BOOL wasOption = NO;
BOOL wantsBreak = isOption;
NSBezierPath *bezierPath = nil;
+ CGPathRef cgPath = NULL;
CAShapeLayer *layer = nil;
NSRect boxBounds = NSIntersectionRect([page boundsForBox:[self
displayBox]], [self convertRect:[self visibleContentRect] toPage:page]);
CGAffineTransform t =
CGAffineTransformRotate(CGAffineTransformMakeScale([self scaleFactor], [self
scaleFactor]), -M_PI_2 * [page rotation] / 90.0);
@@ -4467,7 +4468,9 @@
wasOption = isOption;
wantsBreak = NO;
- [layer setPath:[bezierPath CGPath]];
+ cgPath = [bezierPath copyCGPath];
+ [layer setPath:cgPath];
+ CGPathRelease(cgPath);
} else if ((([theEvent modifierFlags] & NSEventModifierFlagOption) !=
0) != isOption) {
Modified: trunk/SKTransitionController.m
===================================================================
--- trunk/SKTransitionController.m 2024-01-10 14:48:26 UTC (rev 14012)
+++ trunk/SKTransitionController.m 2024-01-14 23:06:16 UTC (rev 14013)
@@ -632,7 +632,7 @@
CGRect bounds = {CGPointZero, [view drawableSize]};
CIImage *img = image;
- CGColorSpaceRef cs = [image colorSpace] ?: [(CIImage *)[filter
valueForKey:kCIInputImageKey] colorSpace] ?:
(CGColorSpaceRef)CFAutorelease(CGColorSpaceCreateDeviceRGB());
+ CGColorSpaceRef cs = CGColorSpaceRetain([image colorSpace]) ?:
CGColorSpaceRetain([(CIImage *)[filter valueForKey:kCIInputImageKey]
colorSpace]) ?: CGColorSpaceCreateDeviceRGB();
if (CGRectEqualToRect(extent, bounds) == NO) {
CGAffineTransform t =
CGAffineTransformMakeScale(CGRectGetWidth(bounds) / CGRectGetWidth(extent),
CGRectGetHeight(bounds) / CGRectGetHeight(extent));
@@ -642,6 +642,8 @@
[context render:img toMTLTexture:[drawable texture]
commandBuffer:commandBuffer bounds:bounds colorSpace:cs];
+ CGColorSpaceRelease(cs);
+
[commandBuffer presentDrawable:drawable];
[commandBuffer commit];
}
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