Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
4192794b
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
4192794b
编写于
2月 03, 2016
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2347 from abarth/composite_child_scenes
Include child scenes when uploading to Mozart
上级
cd2dbd5e
e3bf0fa3
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
69 addition
and
4 deletion
+69
-4
flow/BUILD.gn
flow/BUILD.gn
+2
-1
flow/layers/child_scene_layer.cc
flow/layers/child_scene_layer.cc
+27
-0
flow/layers/child_scene_layer.h
flow/layers/child_scene_layer.h
+4
-0
flow/layers/container_layer.cc
flow/layers/container_layer.cc
+6
-0
flow/layers/container_layer.h
flow/layers/container_layer.h
+3
-0
flow/layers/layer.cc
flow/layers/layer.cc
+4
-0
flow/layers/layer.h
flow/layers/layer.h
+5
-1
flow/layers/layer_tree.cc
flow/layers/layer_tree.cc
+8
-2
flow/layers/layer_tree.h
flow/layers/layer_tree.h
+6
-0
sky/shell/gpu/mojo/rasterizer_mojo.cc
sky/shell/gpu/mojo/rasterizer_mojo.cc
+4
-0
未找到文件。
flow/BUILD.gn
浏览文件 @
4192794b
...
...
@@ -42,7 +42,8 @@ source_set("flow") {
deps = [
"//base",
"//skia",
"//mojo/services/gfx/composition/interfaces",
"//mojo/skia",
"//skia",
]
}
flow/layers/child_scene_layer.cc
浏览文件 @
4192794b
...
...
@@ -4,15 +4,42 @@
#include "flow/layers/child_scene_layer.h"
#include "mojo/skia/type_converters.h"
namespace
flow
{
// TODO(abarth): We need to figure out how to allocate these ids sensibly.
static
uint32_t
next_id
=
10
;
ChildSceneLayer
::
ChildSceneLayer
()
{
}
ChildSceneLayer
::~
ChildSceneLayer
()
{
}
void
ChildSceneLayer
::
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
{
transform_
=
matrix
;
}
void
ChildSceneLayer
::
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
{
}
void
ChildSceneLayer
::
UpdateScene
(
mojo
::
gfx
::
composition
::
SceneUpdate
*
update
,
mojo
::
gfx
::
composition
::
Node
*
container
)
{
uint32_t
id
=
next_id
++
;
auto
child_resource
=
mojo
::
gfx
::
composition
::
Resource
::
New
();
child_resource
->
set_scene
(
mojo
::
gfx
::
composition
::
SceneResource
::
New
());
child_resource
->
get_scene
()
->
scene_token
=
scene_token_
.
Clone
();
update
->
resources
.
insert
(
id
,
child_resource
.
Pass
());
auto
child_node
=
mojo
::
gfx
::
composition
::
Node
::
New
();
child_node
->
op
=
mojo
::
gfx
::
composition
::
NodeOp
::
New
();
child_node
->
op
->
set_scene
(
mojo
::
gfx
::
composition
::
SceneNodeOp
::
New
());
child_node
->
op
->
get_scene
()
->
scene_resource_id
=
id
;
child_node
->
content_transform
=
mojo
::
Transform
::
From
(
transform_
);
update
->
nodes
.
insert
(
id
,
child_node
.
Pass
());
container
->
child_node_ids
.
push_back
(
id
);
}
}
// namespace flow
flow/layers/child_scene_layer.h
浏览文件 @
4192794b
...
...
@@ -25,12 +25,16 @@ class ChildSceneLayer : public Layer {
scene_token_
=
scene_token
.
Pass
();
}
void
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
override
;
void
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
override
;
void
UpdateScene
(
mojo
::
gfx
::
composition
::
SceneUpdate
*
update
,
mojo
::
gfx
::
composition
::
Node
*
container
)
override
;
private:
SkPoint
offset_
;
SkISize
physical_size_
;
mojo
::
gfx
::
composition
::
SceneTokenPtr
scene_token_
;
SkMatrix
transform_
;
DISALLOW_COPY_AND_ASSIGN
(
ChildSceneLayer
);
};
...
...
flow/layers/container_layer.cc
浏览文件 @
4192794b
...
...
@@ -37,4 +37,10 @@ void ContainerLayer::PaintChildren(PaintContext::ScopedFrame& frame) const {
layer
->
Paint
(
frame
);
}
void
ContainerLayer
::
UpdateScene
(
mojo
::
gfx
::
composition
::
SceneUpdate
*
update
,
mojo
::
gfx
::
composition
::
Node
*
container
)
{
for
(
auto
&
layer
:
layers_
)
layer
->
UpdateScene
(
update
,
container
);
}
}
// namespace flow
flow/layers/container_layer.h
浏览文件 @
4192794b
...
...
@@ -22,6 +22,9 @@ class ContainerLayer : public Layer {
void
PaintChildren
(
PaintContext
::
ScopedFrame
&
frame
)
const
;
void
UpdateScene
(
mojo
::
gfx
::
composition
::
SceneUpdate
*
update
,
mojo
::
gfx
::
composition
::
Node
*
container
)
override
;
const
std
::
vector
<
std
::
unique_ptr
<
Layer
>>&
layers
()
const
{
return
layers_
;
}
private:
...
...
flow/layers/layer.cc
浏览文件 @
4192794b
...
...
@@ -20,4 +20,8 @@ Layer::~Layer() {
void
Layer
::
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
{
}
void
Layer
::
UpdateScene
(
mojo
::
gfx
::
composition
::
SceneUpdate
*
update
,
mojo
::
gfx
::
composition
::
Node
*
container
)
{
}
}
// namespace flow
flow/layers/layer.h
浏览文件 @
4192794b
...
...
@@ -10,8 +10,9 @@
#include "base/logging.h"
#include "base/macros.h"
#include "skia/ext/refptr.h"
#include "flow/paint_context.h"
#include "mojo/services/gfx/composition/interfaces/scenes.mojom.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkColorFilter.h"
...
...
@@ -38,6 +39,9 @@ class Layer {
virtual
void
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
);
virtual
void
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
=
0
;
virtual
void
UpdateScene
(
mojo
::
gfx
::
composition
::
SceneUpdate
*
update
,
mojo
::
gfx
::
composition
::
Node
*
container
);
ContainerLayer
*
parent
()
const
{
return
parent_
;
}
void
set_parent
(
ContainerLayer
*
parent
)
{
parent_
=
parent
;
}
...
...
flow/layers/layer_tree.cc
浏览文件 @
4192794b
...
...
@@ -17,15 +17,21 @@ LayerTree::~LayerTree() {
void
LayerTree
::
Raster
(
PaintContext
::
ScopedFrame
&
frame
)
{
{
TRACE_EVENT0
(
"flutter"
,
"LayerTree::Preroll"
)
TRACE_EVENT0
(
"flutter"
,
"LayerTree::Preroll"
)
;
Layer
::
PrerollContext
context
=
{
frame
,
SkRect
::
MakeEmpty
()
};
root_layer_
->
Preroll
(
&
context
,
SkMatrix
());
}
{
TRACE_EVENT0
(
"flutter"
,
"LayerTree::Paint"
)
TRACE_EVENT0
(
"flutter"
,
"LayerTree::Paint"
)
;
root_layer_
->
Paint
(
frame
);
}
}
void
LayerTree
::
UpdateScene
(
mojo
::
gfx
::
composition
::
SceneUpdate
*
update
,
mojo
::
gfx
::
composition
::
Node
*
container
)
{
TRACE_EVENT0
(
"flutter"
,
"LayerTree::UpdateScene"
);
root_layer_
->
UpdateScene
(
update
,
container
);
}
}
// namespace flow
flow/layers/layer_tree.h
浏览文件 @
4192794b
...
...
@@ -22,6 +22,12 @@ class LayerTree {
void
Raster
(
PaintContext
::
ScopedFrame
&
frame
);
// TODO(abarth): Integrate scene updates with the rasterization pass so that
// we can draw on top of child scenes (and so that we can apply clips and
// blending operations to child scene).
void
UpdateScene
(
mojo
::
gfx
::
composition
::
SceneUpdate
*
update
,
mojo
::
gfx
::
composition
::
Node
*
container
);
Layer
*
root_layer
()
const
{
return
root_layer_
.
get
();
}
void
set_root_layer
(
std
::
unique_ptr
<
Layer
>
root_layer
)
{
...
...
sky/shell/gpu/mojo/rasterizer_mojo.cc
浏览文件 @
4192794b
...
...
@@ -84,6 +84,8 @@ void RasterizerMojo::Draw(uint64_t layer_tree_ptr,
DCHECK
(
resource
);
auto
update
=
mojo
::
gfx
::
composition
::
SceneUpdate
::
New
();
update
->
clear_resources
=
true
;
update
->
clear_nodes
=
true
;
update
->
resources
.
insert
(
kContentImageResourceId
,
resource
.
Pass
());
auto
root_node
=
mojo
::
gfx
::
composition
::
Node
::
New
();
root_node
->
op
=
mojo
::
gfx
::
composition
::
NodeOp
::
New
();
...
...
@@ -94,6 +96,8 @@ void RasterizerMojo::Draw(uint64_t layer_tree_ptr,
root_node
->
op
->
get_image
()
->
image_resource_id
=
kContentImageResourceId
;
update
->
nodes
.
insert
(
kRootNodeId
,
root_node
.
Pass
());
layer_tree
->
UpdateScene
(
update
.
get
(),
root_node
.
get
());
scene_
->
Update
(
update
.
Pass
());
scene_
->
Publish
(
nullptr
);
callback
.
Run
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录