Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
1f183bab
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
1f183bab
编写于
10月 01, 2020
作者:
D
David Worsham
提交者:
GitHub
10月 01, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fuchsia: Remove Opacity hole-punch (#21527)
上级
af5717eb
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
5 addition
and
26 deletion
+5
-26
flow/layers/child_scene_layer.cc
flow/layers/child_scene_layer.cc
+1
-17
flow/layers/layer.h
flow/layers/layer.h
+0
-1
flow/layers/opacity_layer.cc
flow/layers/opacity_layer.cc
+1
-6
flow/layers/opacity_layer_unittests.cc
flow/layers/opacity_layer_unittests.cc
+3
-2
未找到文件。
flow/layers/child_scene_layer.cc
浏览文件 @
1f183bab
...
...
@@ -20,26 +20,10 @@ void ChildSceneLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
context
->
child_scene_layer_exists_below
=
true
;
CheckForChildLayerBelow
(
context
);
// An alpha "hole punch" is required if the frame behind us is not opaque.
if
(
!
context
->
is_opaque
)
{
set_paint_bounds
(
SkRect
::
MakeXYWH
(
offset_
.
fX
,
offset_
.
fY
,
size_
.
fWidth
,
size_
.
fHeight
));
}
}
void
ChildSceneLayer
::
Paint
(
PaintContext
&
context
)
const
{
TRACE_EVENT0
(
"flutter"
,
"ChildSceneLayer::Paint"
);
FML_DCHECK
(
needs_painting
());
FML_DCHECK
(
needs_system_composite
());
// If we are being rendered into our own frame using the system compositor,
// then it is neccesary to "punch a hole" in the canvas/frame behind us so
// that group opacity looks correct.
SkPaint
paint
;
paint
.
setColor
(
SK_ColorTRANSPARENT
);
paint
.
setBlendMode
(
SkBlendMode
::
kSrc
);
context
.
leaf_nodes_canvas
->
drawRect
(
paint_bounds
(),
paint
);
FML_NOTREACHED
();
}
void
ChildSceneLayer
::
UpdateScene
(
SceneUpdateContext
&
context
)
{
...
...
flow/layers/layer.h
浏览文件 @
1f183bab
...
...
@@ -59,7 +59,6 @@ struct PrerollContext {
// These allow us to track properties like elevation, opacity, and the
// prescence of a platform view during Preroll.
bool
has_platform_view
=
false
;
bool
is_opaque
=
true
;
#if defined(LEGACY_FUCHSIA_EMBEDDER)
// True if, during the traversal so far, we have seen a child_scene_layer.
// Informs whether a layer needs to be system composited.
...
...
flow/layers/opacity_layer.cc
浏览文件 @
1f183bab
...
...
@@ -14,11 +14,8 @@ OpacityLayer::OpacityLayer(SkAlpha alpha, const SkPoint& offset)
void
OpacityLayer
::
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
{
TRACE_EVENT0
(
"flutter"
,
"OpacityLayer::Preroll"
);
FML_DCHECK
(
!
GetChildContainer
()
->
layers
().
empty
());
// We can't be a leaf.
ContainerLayer
*
container
=
GetChildContainer
();
FML_DCHECK
(
!
container
->
layers
().
empty
());
// OpacityLayer can't be a leaf.
const
bool
parent_is_opaque
=
context
->
is_opaque
;
SkMatrix
child_matrix
=
matrix
;
child_matrix
.
postTranslate
(
offset_
.
fX
,
offset_
.
fY
);
...
...
@@ -26,7 +23,6 @@ void OpacityLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
// reverse transformation to the cull rect to properly cull child layers.
context
->
cull_rect
=
context
->
cull_rect
.
makeOffset
(
-
offset_
.
fX
,
-
offset_
.
fY
);
context
->
is_opaque
=
parent_is_opaque
&&
(
alpha_
==
SK_AlphaOPAQUE
);
context
->
mutators_stack
.
PushTransform
(
SkMatrix
::
Translate
(
offset_
.
fX
,
offset_
.
fY
));
context
->
mutators_stack
.
PushOpacity
(
alpha_
);
...
...
@@ -35,7 +31,6 @@ void OpacityLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
ContainerLayer
::
Preroll
(
context
,
child_matrix
);
context
->
mutators_stack
.
Pop
();
context
->
mutators_stack
.
Pop
();
context
->
is_opaque
=
parent_is_opaque
;
{
set_paint_bounds
(
paint_bounds
().
makeOffset
(
offset_
.
fX
,
offset_
.
fY
));
...
...
flow/layers/opacity_layer_unittests.cc
浏览文件 @
1f183bab
...
...
@@ -20,8 +20,9 @@ TEST_F(OpacityLayerTest, LeafLayer) {
auto
layer
=
std
::
make_shared
<
OpacityLayer
>
(
SK_AlphaOPAQUE
,
SkPoint
::
Make
(
0.0
f
,
0.0
f
));
EXPECT_DEATH_IF_SUPPORTED
(
layer
->
Preroll
(
preroll_context
(),
SkMatrix
()),
"
\\
!container->layers
\\
(
\\
)
\\
.empty
\\
(
\\
)"
);
EXPECT_DEATH_IF_SUPPORTED
(
layer
->
Preroll
(
preroll_context
(),
SkMatrix
()),
"
\\
!GetChildContainer
\\
(
\\
)->layers
\\
(
\\
)
\\
.empty
\\
(
\\
)"
);
}
TEST_F
(
OpacityLayerTest
,
PaintingEmptyLayerDies
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录