Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
1486d205
E
engine
项目概览
qq_34031325
/
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,发现更多精彩内容 >>
提交
1486d205
编写于
1月 08, 2016
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2235 from abarth/compute_paint_bounds
Compute paint bounds from cull rects
上级
076d2643
f7d1856b
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
49 addition
and
39 deletion
+49
-39
sky/compositor/color_filter_layer.cc
sky/compositor/color_filter_layer.cc
+6
-1
sky/compositor/color_filter_layer.h
sky/compositor/color_filter_layer.h
+2
-0
sky/compositor/container_layer.cc
sky/compositor/container_layer.cc
+10
-6
sky/compositor/container_layer.h
sky/compositor/container_layer.h
+2
-3
sky/compositor/layer.cc
sky/compositor/layer.cc
+1
-1
sky/compositor/layer.h
sky/compositor/layer.h
+6
-2
sky/compositor/layer_tree.cc
sky/compositor/layer_tree.cc
+2
-1
sky/compositor/opacity_layer.cc
sky/compositor/opacity_layer.cc
+6
-1
sky/compositor/opacity_layer.h
sky/compositor/opacity_layer.h
+1
-0
sky/compositor/picture_layer.cc
sky/compositor/picture_layer.cc
+7
-7
sky/compositor/picture_layer.h
sky/compositor/picture_layer.h
+1
-2
sky/compositor/transform_layer.cc
sky/compositor/transform_layer.cc
+3
-3
sky/compositor/transform_layer.h
sky/compositor/transform_layer.h
+1
-2
sky/engine/core/compositing/SceneBuilder.cpp
sky/engine/core/compositing/SceneBuilder.cpp
+1
-9
sky/engine/core/compositing/SceneBuilder.h
sky/engine/core/compositing/SceneBuilder.h
+0
-1
未找到文件。
sky/compositor/color_filter_layer.cc
浏览文件 @
1486d205
...
...
@@ -13,13 +13,18 @@ ColorFilterLayer::ColorFilterLayer() {
ColorFilterLayer
::~
ColorFilterLayer
()
{
}
void
ColorFilterLayer
::
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
{
ContainerLayer
::
Preroll
(
context
,
matrix
);
set_paint_bounds
(
context
->
child_paint_bounds
);
}
void
ColorFilterLayer
::
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
{
RefPtr
<
SkColorFilter
>
color_filter
=
adoptRef
(
SkColorFilter
::
CreateModeFilter
(
color_
,
transfer_mode_
));
SkPaint
paint
;
paint
.
setColorFilter
(
color_filter
.
get
());
SkCanvas
&
canvas
=
frame
.
canvas
();
canvas
.
saveLayer
(
has_paint_bounds
()
?
&
paint_bounds
()
:
nullptr
,
&
paint
);
canvas
.
saveLayer
(
&
paint_bounds
()
,
&
paint
);
PaintChildren
(
frame
);
canvas
.
restore
();
}
...
...
sky/compositor/color_filter_layer.h
浏览文件 @
1486d205
...
...
@@ -21,6 +21,8 @@ class ColorFilterLayer : public ContainerLayer {
transfer_mode_
=
transfer_mode
;
}
protected:
void
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
override
;
void
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
override
;
private:
...
...
sky/compositor/container_layer.cc
浏览文件 @
1486d205
...
...
@@ -18,15 +18,19 @@ void ContainerLayer::Add(std::unique_ptr<Layer> layer) {
layers_
.
push_back
(
std
::
move
(
layer
));
}
void
ContainerLayer
::
Preroll
(
PaintContext
::
ScopedFrame
&
frame
,
const
SkMatrix
&
matrix
)
{
PrerollChildren
(
frame
,
matrix
);
void
ContainerLayer
::
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
{
PrerollChildren
(
context
,
matrix
);
}
void
ContainerLayer
::
PrerollChildren
(
P
aintContext
::
ScopedFrame
&
frame
,
void
ContainerLayer
::
PrerollChildren
(
P
rerollContext
*
context
,
const
SkMatrix
&
matrix
)
{
for
(
auto
&
layer
:
layers_
)
layer
->
Preroll
(
frame
,
matrix
);
SkRect
child_paint_bounds
;
for
(
auto
&
layer
:
layers_
)
{
PrerollContext
child_context
=
*
context
;
layer
->
Preroll
(
&
child_context
,
matrix
);
child_paint_bounds
.
join
(
child_context
.
child_paint_bounds
);
}
context
->
child_paint_bounds
=
child_paint_bounds
;
}
void
ContainerLayer
::
PaintChildren
(
PaintContext
::
ScopedFrame
&
frame
)
const
{
...
...
sky/compositor/container_layer.h
浏览文件 @
1486d205
...
...
@@ -18,10 +18,9 @@ class ContainerLayer : public Layer {
void
Add
(
std
::
unique_ptr
<
Layer
>
layer
);
void
Preroll
(
P
aintContext
::
ScopedFrame
&
frame
,
const
SkMatrix
&
matrix
)
override
;
void
Preroll
(
P
rerollContext
*
context
,
const
SkMatrix
&
matrix
)
override
;
void
PrerollChildren
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
;
void
PrerollChildren
(
PaintContext
::
ScopedFrame
&
frame
,
const
SkMatrix
&
matrix
);
void
PaintChildren
(
PaintContext
::
ScopedFrame
&
frame
)
const
;
const
std
::
vector
<
std
::
unique_ptr
<
Layer
>>&
layers
()
const
{
return
layers_
;
}
...
...
sky/compositor/layer.cc
浏览文件 @
1486d205
...
...
@@ -18,7 +18,7 @@ Layer::Layer()
Layer
::~
Layer
()
{
}
void
Layer
::
Preroll
(
P
aintContext
::
ScopedFrame
&
frame
,
const
SkMatrix
&
matrix
)
{
void
Layer
::
Preroll
(
P
rerollContext
*
context
,
const
SkMatrix
&
matrix
)
{
}
}
// namespace compositor
...
...
sky/compositor/layer.h
浏览文件 @
1486d205
...
...
@@ -31,8 +31,12 @@ class Layer {
Layer
();
virtual
~
Layer
();
virtual
void
Preroll
(
PaintContext
::
ScopedFrame
&
frame
,
const
SkMatrix
&
matrix
);
struct
PrerollContext
{
PaintContext
::
ScopedFrame
&
frame
;
SkRect
child_paint_bounds
;
};
virtual
void
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
);
virtual
void
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
=
0
;
ContainerLayer
*
parent
()
const
{
return
parent_
;
}
...
...
sky/compositor/layer_tree.cc
浏览文件 @
1486d205
...
...
@@ -16,7 +16,8 @@ LayerTree::~LayerTree() {
}
void
LayerTree
::
Raster
(
PaintContext
::
ScopedFrame
&
frame
)
{
root_layer_
->
Preroll
(
frame
,
SkMatrix
());
Layer
::
PrerollContext
context
=
{
frame
,
SkRect
::
MakeEmpty
()
};
root_layer_
->
Preroll
(
&
context
,
SkMatrix
());
root_layer_
->
Paint
(
frame
);
}
...
...
sky/compositor/opacity_layer.cc
浏览文件 @
1486d205
...
...
@@ -13,12 +13,17 @@ OpacityLayer::OpacityLayer() {
OpacityLayer
::~
OpacityLayer
()
{
}
void
OpacityLayer
::
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
{
ContainerLayer
::
Preroll
(
context
,
matrix
);
set_paint_bounds
(
context
->
child_paint_bounds
);
}
void
OpacityLayer
::
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
{
SkPaint
paint
;
paint
.
setColor
(
SkColorSetARGB
(
alpha_
,
0
,
0
,
0
));
paint
.
setXfermodeMode
(
SkXfermode
::
kSrcOver_Mode
);
SkCanvas
&
canvas
=
frame
.
canvas
();
canvas
.
saveLayer
(
has_paint_bounds
()
?
&
paint_bounds
()
:
nullptr
,
&
paint
);
canvas
.
saveLayer
(
&
paint_bounds
()
,
&
paint
);
PaintChildren
(
frame
);
canvas
.
restore
();
}
...
...
sky/compositor/opacity_layer.h
浏览文件 @
1486d205
...
...
@@ -18,6 +18,7 @@ class OpacityLayer : public ContainerLayer {
void
set_alpha
(
int
alpha
)
{
alpha_
=
alpha
;
}
protected:
void
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
override
;
void
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
override
;
private:
...
...
sky/compositor/picture_layer.cc
浏览文件 @
1486d205
...
...
@@ -20,10 +20,11 @@ PictureLayer::PictureLayer() {
PictureLayer
::~
PictureLayer
()
{
}
void
PictureLayer
::
Preroll
(
P
aintContext
::
ScopedFrame
&
frame
,
void
PictureLayer
::
Preroll
(
P
rerollContext
*
context
,
const
SkMatrix
&
matrix
)
{
image_
=
frame
.
context
().
raster_cache
().
GetPrerolledImage
(
frame
.
gr_context
(),
picture_
.
get
(),
matrix
);
image_
=
context
->
frame
.
context
().
raster_cache
().
GetPrerolledImage
(
context
->
frame
.
gr_context
(),
picture_
.
get
(),
matrix
);
context
->
child_paint_bounds
=
picture_
->
cullRect
();
}
void
PictureLayer
::
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
{
...
...
@@ -44,10 +45,9 @@ void PictureLayer::Paint(PaintContext::ScopedFrame& frame) {
canvas
.
drawImage
(
image_
.
get
(),
dx
,
dy
);
canvas
.
restore
();
if
(
kDebugCheckerboardRasterizedLayers
)
{
SkRect
rect
=
paint_bounds
().
makeOffset
(
offset_
.
x
(),
offset_
.
y
());
DrawCheckerboard
(
&
canvas
,
rect
);
}
if
(
kDebugCheckerboardRasterizedLayers
)
DrawCheckerboard
(
&
canvas
,
rect
.
makeOffset
(
offset_
.
x
(),
offset_
.
y
()));
}
else
{
canvas
.
save
();
canvas
.
translate
(
offset_
.
x
(),
offset_
.
y
());
...
...
sky/compositor/picture_layer.h
浏览文件 @
1486d205
...
...
@@ -21,8 +21,7 @@ class PictureLayer : public Layer {
SkPicture
*
picture
()
const
{
return
picture_
.
get
();
}
void
Preroll
(
PaintContext
::
ScopedFrame
&
frame
,
const
SkMatrix
&
matrix
)
override
;
void
Preroll
(
PrerollContext
*
frame
,
const
SkMatrix
&
matrix
)
override
;
void
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
override
;
private:
...
...
sky/compositor/transform_layer.cc
浏览文件 @
1486d205
...
...
@@ -13,11 +13,11 @@ TransformLayer::TransformLayer() {
TransformLayer
::~
TransformLayer
()
{
}
void
TransformLayer
::
Preroll
(
PaintContext
::
ScopedFrame
&
frame
,
const
SkMatrix
&
matrix
)
{
void
TransformLayer
::
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
{
SkMatrix
childMatrix
;
childMatrix
.
setConcat
(
matrix
,
transform_
);
PrerollChildren
(
frame
,
childMatrix
);
PrerollChildren
(
context
,
childMatrix
);
transform_
.
mapRect
(
&
context
->
child_paint_bounds
);
}
void
TransformLayer
::
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
{
...
...
sky/compositor/transform_layer.h
浏览文件 @
1486d205
...
...
@@ -17,8 +17,7 @@ class TransformLayer : public ContainerLayer {
void
set_transform
(
const
SkMatrix
&
transform
)
{
transform_
=
transform
;
}
void
Preroll
(
PaintContext
::
ScopedFrame
&
frame
,
const
SkMatrix
&
matrix
)
override
;
void
Preroll
(
PrerollContext
*
context
,
const
SkMatrix
&
matrix
)
override
;
void
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
override
;
private:
...
...
sky/engine/core/compositing/SceneBuilder.cpp
浏览文件 @
1486d205
...
...
@@ -62,8 +62,7 @@ FOR_EACH_BINDING(DART_REGISTER_NATIVE)
}
SceneBuilder
::
SceneBuilder
(
const
Rect
&
bounds
)
:
m_rootPaintBounds
(
bounds
.
sk_rect
)
,
m_currentLayer
(
nullptr
)
:
m_currentLayer
(
nullptr
)
,
m_currentRasterizerTracingThreshold
(
0
)
{
}
...
...
@@ -106,8 +105,6 @@ void SceneBuilder::pushClipPath(const CanvasPath* path, const Rect& bounds)
void
SceneBuilder
::
pushOpacity
(
int
alpha
,
const
Rect
&
bounds
)
{
std
::
unique_ptr
<
sky
::
compositor
::
OpacityLayer
>
layer
(
new
sky
::
compositor
::
OpacityLayer
());
if
(
!
bounds
.
is_null
)
layer
->
set_paint_bounds
(
bounds
.
sk_rect
);
layer
->
set_alpha
(
alpha
);
addLayer
(
std
::
move
(
layer
));
}
...
...
@@ -115,8 +112,6 @@ void SceneBuilder::pushOpacity(int alpha, const Rect& bounds)
void
SceneBuilder
::
pushColorFilter
(
CanvasColor
color
,
TransferMode
transferMode
,
const
Rect
&
bounds
)
{
std
::
unique_ptr
<
sky
::
compositor
::
ColorFilterLayer
>
layer
(
new
sky
::
compositor
::
ColorFilterLayer
());
if
(
!
bounds
.
is_null
)
layer
->
set_paint_bounds
(
bounds
.
sk_rect
);
layer
->
set_color
(
color
);
layer
->
set_transfer_mode
(
transferMode
);
addLayer
(
std
::
move
(
layer
));
...
...
@@ -128,7 +123,6 @@ void SceneBuilder::addLayer(std::unique_ptr<sky::compositor::ContainerLayer> lay
if
(
!
m_rootLayer
)
{
DCHECK
(
!
m_currentLayer
);
m_rootLayer
=
std
::
move
(
layer
);
m_rootLayer
->
set_paint_bounds
(
m_rootPaintBounds
);
m_currentLayer
=
m_rootLayer
.
get
();
return
;
}
...
...
@@ -153,8 +147,6 @@ void SceneBuilder::addPicture(const Offset& offset, Picture* picture, const Rect
std
::
unique_ptr
<
sky
::
compositor
::
PictureLayer
>
layer
(
new
sky
::
compositor
::
PictureLayer
());
layer
->
set_offset
(
SkPoint
::
Make
(
offset
.
sk_size
.
width
(),
offset
.
sk_size
.
height
()));
layer
->
set_picture
(
picture
->
toSkia
());
if
(
!
paintBounds
.
is_null
)
layer
->
set_paint_bounds
(
paintBounds
.
sk_rect
);
m_currentLayer
->
Add
(
std
::
move
(
layer
));
}
...
...
sky/engine/core/compositing/SceneBuilder.h
浏览文件 @
1486d205
...
...
@@ -57,7 +57,6 @@ private:
void
addLayer
(
std
::
unique_ptr
<
sky
::
compositor
::
ContainerLayer
>
layer
);
SkRect
m_rootPaintBounds
;
std
::
unique_ptr
<
sky
::
compositor
::
ContainerLayer
>
m_rootLayer
;
sky
::
compositor
::
ContainerLayer
*
m_currentLayer
;
int32_t
m_currentRasterizerTracingThreshold
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录