Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CAEdgeAntialiasingMask instead of unsigned int #1667

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/ASDisplayNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ AS_EXTERN NSInteger const ASDefaultDrawingPriority;

@property BOOL allowsGroupOpacity;
@property BOOL allowsEdgeAntialiasing;
@property unsigned int edgeAntialiasingMask; // default==all values from CAEdgeAntialiasingMask
@property CAEdgeAntialiasingMask edgeAntialiasingMask; // default==all values from CAEdgeAntialiasingMask

@property BOOL needsDisplayOnBoundsChange; // default==NO
@property BOOL autoresizesSubviews; // default==YES (undefined for layer-backed nodes)
Expand Down
2 changes: 1 addition & 1 deletion Source/Details/UIView+ASConvenience.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) UIColor *backgroundColor;
@property (nonatomic) BOOL allowsGroupOpacity;
@property (nonatomic) BOOL allowsEdgeAntialiasing;
@property (nonatomic) unsigned int edgeAntialiasingMask;
@property (nonatomic) CAEdgeAntialiasingMask edgeAntialiasingMask;
@property (nonatomic, nullable, copy) NSDictionary<NSString *, id<CAAction>> *actions;

- (void)setNeedsDisplay;
Expand Down
4 changes: 2 additions & 2 deletions Source/Private/ASDisplayNode+UIViewBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -929,13 +929,13 @@ - (void)setAllowsEdgeAntialiasing:(BOOL)allowsEdgeAntialiasing
_setToLayer(allowsEdgeAntialiasing, allowsEdgeAntialiasing);
}

- (unsigned int)edgeAntialiasingMask
- (CAEdgeAntialiasingMask)edgeAntialiasingMask
{
_bridge_prologue_read;
return _getFromLayer(edgeAntialiasingMask);
}

- (void)setEdgeAntialiasingMask:(unsigned int)edgeAntialiasingMask
- (void)setEdgeAntialiasingMask:(CAEdgeAntialiasingMask)edgeAntialiasingMask
{
_bridge_prologue_write;
_setToLayer(edgeAntialiasingMask, edgeAntialiasingMask);
Expand Down
2 changes: 1 addition & 1 deletion Source/Private/_ASPendingState.mm
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ - (BOOL)allowsEdgeAntialiasing
return _flags.allowsEdgeAntialiasing;
}

- (void)setEdgeAntialiasingMask:(unsigned int)mask
- (void)setEdgeAntialiasingMask:(CAEdgeAntialiasingMask)mask
{
edgeAntialiasingMask = mask;
_stateToApplyFlags.setEdgeAntialiasingMask = YES;
Expand Down
4 changes: 2 additions & 2 deletions Tests/ASDisplayNodeTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ - (void)checkValuesMatchDefaults:(ASDisplayNode *)node isLayerBacked:(BOOL)isLay
XCTAssertEqual(NO, node.needsDisplayOnBoundsChange, @"default needsDisplayOnBoundsChange broken %@", hasLoadedView);
XCTAssertEqual(YES, node.allowsGroupOpacity, @"default allowsGroupOpacity broken %@", hasLoadedView);
XCTAssertEqual(NO, node.allowsEdgeAntialiasing, @"default allowsEdgeAntialiasing broken %@", hasLoadedView);
XCTAssertEqual((unsigned int)(kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge), node.edgeAntialiasingMask, @"default edgeAntialisingMask broken %@", hasLoadedView);
XCTAssertEqual((kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge), node.edgeAntialiasingMask, @"default edgeAntialisingMask broken %@", hasLoadedView);
XCTAssertEqual(NO, node.hidden, @"default hidden broken %@", hasLoadedView);
XCTAssertEqual(1.0f, node.alpha, @"default alpha broken %@", hasLoadedView);
XCTAssertTrue(CGRectEqualToRect(CGRectZero, node.bounds), @"default bounds broken %@", hasLoadedView);
Expand Down Expand Up @@ -579,7 +579,7 @@ - (void)checkValuesMatchSetValues:(ASDisplayNode *)node isLayerBacked:(BOOL)isLa
XCTAssertEqual(YES, node.needsDisplayOnBoundsChange, @"needsDisplayOnBoundsChange broken %@", hasLoadedView);
XCTAssertEqual(NO, node.allowsGroupOpacity, @"allowsGroupOpacity broken %@", hasLoadedView);
XCTAssertEqual(YES, node.allowsEdgeAntialiasing, @"allowsEdgeAntialiasing broken %@", hasLoadedView);
XCTAssertTrue((unsigned int)(kCALayerLeftEdge | kCALayerTopEdge) == node.edgeAntialiasingMask, @"edgeAntialiasingMask broken: %@", hasLoadedView);
XCTAssertTrue((kCALayerLeftEdge | kCALayerTopEdge) == node.edgeAntialiasingMask, @"edgeAntialiasingMask broken: %@", hasLoadedView);
XCTAssertEqual(YES, node.hidden, @"hidden broken %@", hasLoadedView);
XCTAssertEqual(.5f, node.alpha, @"alpha broken %@", hasLoadedView);
XCTAssertTrue(CGRectEqualToRect(CGRectMake(10, 15, 42, 115.2), node.bounds), @"bounds broken %@", hasLoadedView);
Expand Down