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

Improve CAShapeLayer #2134

Merged
merged 3 commits into from
Mar 6, 2017
Merged

Conversation

DHowett-MSFT
Copy link

This pull request fixes CAShapeLayer the issues mentioned in #2039, plus adds support for EO fill and line caps.

CAShapeLayer originally used a nested layer that it manually poked an image into; doing this is incompatible with #1194 (and therefore #2119). It also had a secret dependency on CreateLayerContentsBitmapContext32, a private import from CALayer.

Testing was carried out manually in WOCCatalog on 1.0, 2.0, and 3.5-scale devices.

Fixes #2039.

@@ -34,8 +34,8 @@ CA_EXPORT_CLASS

@property CGPathRef path;
@property CGColorRef fillColor;
@property (copy) NSString* fillRule STUB_PROPERTY;
@property (copy) NSString* lineCap STUB_PROPERTY;
@property (copy) NSString* fillRule;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does woccatalog have tests for fillRule and lineCap?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does (copy) work w/ overriding default getter/setter?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't; however, there's no the object you pass in will be ignored completely, as objects go annotation; assign would be truer, but copy is what the reference platform specifies and it is expected for all strings.

Since we've implemented it in terms of an enumerated value, we hold true to one of the core tenets of copy: The string they pass into the setter and the string they get back from the getter may not be the same pointer ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify question above - lets add the variation to woccatalog test to demonstrate this works.

@implementation CAShapeLayer {
CGPathRef _path;
CGPathDrawingMode _fillMode;
CGLineCap _lineCap;
float _lineWidth;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: CGFloat

@@ -34,8 +34,8 @@ CA_EXPORT_CLASS

@property CGPathRef path;
@property CGColorRef fillColor;
@property (copy) NSString* fillRule STUB_PROPERTY;
@property (copy) NSString* lineCap STUB_PROPERTY;
@property (copy) NSString* fillRule;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does (copy) work w/ overriding default getter/setter?

@DHowett-MSFT
Copy link
Author

The new test images look like:

image


if (_path == nil) {
_shapeImage.contents = nil;
- (void)drawInContext:(CGContextRef)context {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: return if invalid context?

@DHowett-MSFT
Copy link
Author

@rajsesh-msft ping! 😄 I'd like to make sure I address your concerns

@DHowett-MSFT DHowett-MSFT merged commit a1e8de3 into microsoft:develop Mar 6, 2017
@DHowett-MSFT DHowett-MSFT deleted the 201703-cashape branch March 6, 2017 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CAShapeLayer does an end run around CALayer rendering
6 participants