Clean up ASDisplayNode internal flags.

* Reorganise and rename `_flags` for clarity and consistency.
* Remove ambiguity between `implementsDisplay` and `hasClassDisplay`.
* Delete useless `hasWillDisplayAsyncLayer` check -- make it a simple
  subclass override point, as with `didDisplayAsyncLayer:`.
* Minor comment cleanup.
This commit is contained in:
Nadine Salter
2014-12-02 16:53:02 -08:00
parent a53bc08eaf
commit a30c087616
5 changed files with 87 additions and 83 deletions

View File

@@ -72,7 +72,7 @@ static void __ASDisplayLayerDecrementConcurrentDisplayCount(BOOL displayIsAsync,
- (NSObject *)drawParameters
{
if (_flags.hasDrawParametersForAsyncLayer) {
if (_flags.implementsDrawParameters) {
return [self drawParametersForAsyncLayer:self.asyncLayer];
}
@@ -197,7 +197,7 @@ static void __ASDisplayLayerDecrementConcurrentDisplayCount(BOOL displayIsAsync,
return image;
};
} else if (_flags.hasClassDisplay) {
} else if (_flags.implementsImageDisplay) {
// Capture drawParameters from delegate on main thread
id drawParameters = [self drawParameters];
@@ -213,7 +213,7 @@ static void __ASDisplayLayerDecrementConcurrentDisplayCount(BOOL displayIsAsync,
return result;
};
} else if (_flags.implementsDisplay) {
} else if (_flags.implementsDrawRect) {
CGRect bounds = self.bounds;
if (CGRectIsEmpty(bounds)) {
@@ -317,9 +317,7 @@ static void __ASDisplayLayerDecrementConcurrentDisplayCount(BOOL displayIsAsync,
if (displayBlock != NULL) {
// Call willDisplay immediately in either case
if (_flags.hasWillDisplayAsyncLayer) {
[self willDisplayAsyncLayer:self.asyncLayer];
}
[self willDisplayAsyncLayer:self.asyncLayer];
if (asynchronously) {
[transaction addOperationWithBlock:displayBlock queue:[_ASDisplayLayer displayQueue] completion:completionBlock];