-
Notifications
You must be signed in to change notification settings - Fork 29.7k
painting layers - draft #134701
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
painting layers - draft #134701
Conversation
| void dispose() { | ||
| for (final OpacityLayer layer in _createdLayers) { | ||
| layer.dispose(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right. I believe, the caller of pushOpacity assumes ownership of the OpacityLayer and should be in charge of disposing it, not the PaintContext.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This thing is just for testing.
And, i think it is reasonable to ask test to dispose the instance of created TestRecordingPaintingContext, at the end of the test.
Otherwise, it should return the layer somehow, that means change of contract.
|
|
||
| TestClipPaintingContext._(this._layer) : super(_layer, Rect.zero); | ||
|
|
||
| ContainerLayer _layer = ContainerLayer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need this default value? Looks like in all code paths it's always overridden? Also, should this field be final?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, i need just one created in constructor. Thanks.
| final int disabledColorAlpha = disabledColor.alpha; | ||
| if (needsCompositing) { | ||
| context.pushLayer(OpacityLayer(alpha: disabledColorAlpha), paintWithOverlay, offset); | ||
| context.pushOpacity(offset, disabledColorAlpha, paintWithOverlay); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you need to hold on to the layer this method returns, see https://master-api.flutter.dev/flutter/rendering/LayerHandle-class.html (and probably other invocations of this method).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
The issue is fixed by other prs. Closing. |
_RenderChip should not create new layer to push opacity.
TestRecordingPaintingContext, TestClipPaintingContext should dispose created Layers.