Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
d36ecec5
Unverified
Commit
d36ecec5
authored
Jul 02, 2022
by
Jonah Williams
Committed by
GitHub
Jul 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[framework] partial removal of forced compositing from opacity (#106989)
parent
efd006e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
23 deletions
+32
-23
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+20
-21
proxy_box_test.dart
packages/flutter/test/rendering/proxy_box_test.dart
+11
-1
debug_test.dart
packages/flutter/test/widgets/debug_test.dart
+1
-1
No files found.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
d36ecec5
...
...
@@ -883,15 +883,7 @@ class RenderOpacity extends RenderProxyBox {
super
(
child
);
@override
bool
get
alwaysNeedsCompositing
=>
child
!=
null
&&
(
_alpha
>
0
);
@override
OffsetLayer
updateCompositedLayer
({
required
covariant
OpacityLayer
?
oldLayer
})
{
assert
(
_alpha
!=
255
);
final
OpacityLayer
updatedLayer
=
oldLayer
??
OpacityLayer
();
updatedLayer
.
alpha
=
_alpha
;
return
updatedLayer
;
}
bool
get
alwaysNeedsCompositing
=>
child
!=
null
&&
(
_alpha
>
0
&&
_alpha
<
255
);
int
_alpha
;
...
...
@@ -949,19 +941,26 @@ class RenderOpacity extends RenderProxyBox {
@override
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
{
if
(
_alpha
==
0
)
{
// No need to keep the layer. We'll create a new one if necessary.
layer
=
null
;
return
;
}
assert
(
needsCompositing
);
layer
=
context
.
pushOpacity
(
offset
,
_alpha
,
super
.
paint
,
oldLayer:
layer
as
OpacityLayer
?);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
if
(
child
==
null
)
{
return
;
}
if
(
_alpha
==
0
)
{
// No need to keep the layer. We'll create a new one if necessary.
layer
=
null
;
return
;
}
if
(
_alpha
==
255
)
{
// No need to keep the layer. We'll create a new one if necessary.
layer
=
null
;
return
super
.
paint
(
context
,
offset
);
}
assert
(
needsCompositing
);
layer
=
context
.
pushOpacity
(
offset
,
_alpha
,
super
.
paint
,
oldLayer:
layer
as
OpacityLayer
?);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
@override
...
...
packages/flutter/test/rendering/proxy_box_test.dart
View file @
d36ecec5
...
...
@@ -240,11 +240,21 @@ void main() {
expect
(
renderOpacity
.
needsCompositing
,
false
);
});
test
(
'RenderOpacity does composite if it is opaque'
,
()
{
test
(
'RenderOpacity does
not
composite if it is opaque'
,
()
{
final
RenderOpacity
renderOpacity
=
RenderOpacity
(
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
);
layout
(
renderOpacity
,
phase:
EnginePhase
.
composite
);
expect
(
renderOpacity
.
needsCompositing
,
false
);
});
test
(
'RenderOpacity does composite if it is partially opaque'
,
()
{
final
RenderOpacity
renderOpacity
=
RenderOpacity
(
opacity:
0.1
,
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
);
layout
(
renderOpacity
,
phase:
EnginePhase
.
composite
);
expect
(
renderOpacity
.
needsCompositing
,
true
);
});
...
...
packages/flutter/test/widgets/debug_test.dart
View file @
d36ecec5
...
...
@@ -285,7 +285,7 @@ void main() {
child:
Placeholder
(),
),
const
Opacity
(
opacity:
1.0
,
opacity:
0.9
,
child:
Placeholder
(),
),
ImageFiltered
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment