Skip to content

Commit

Permalink
Use CAEdgeAntialiasingMask instead of unsigned int (#1667)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanton authored and Greg Bolsinga committed Sep 11, 2019
1 parent 5e7fbf2 commit c99bcb0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
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

0 comments on commit c99bcb0

Please sign in to comment.