Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
f6aa6899
E
engine
项目概览
liujiuri
/
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,发现更多精彩内容 >>
提交
f6aa6899
编写于
9月 11, 2015
作者:
C
Chinmay Garde
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use the physical size to key the images cached in the rasterizer
上级
4f356fa5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
23 deletion
+23
-23
sky/compositor/picture_layer.cc
sky/compositor/picture_layer.cc
+7
-5
sky/compositor/picture_rasterizer.cc
sky/compositor/picture_rasterizer.cc
+13
-15
sky/compositor/picture_rasterizer.h
sky/compositor/picture_rasterizer.h
+3
-3
未找到文件。
sky/compositor/picture_layer.cc
浏览文件 @
f6aa6899
...
...
@@ -17,14 +17,16 @@ PictureLayer::~PictureLayer() {
void
PictureLayer
::
Paint
(
PaintContext
::
ScopedFrame
&
frame
)
{
DCHECK
(
picture_
);
const
SkRect
&
bounds
=
paint_bounds
();
const
SkISize
size
=
SkISize
::
Make
(
bounds
.
width
(),
bounds
.
height
());
SkCanvas
&
canvas
=
frame
.
canvas
();
PictureRasterzier
&
rasterizer
=
frame
.
paint_context
().
rasterizer
();
const
SkRect
&
bounds
=
paint_bounds
();
const
SkMatrix
&
ctm
=
canvas
.
getTotalMatrix
();
const
SkISize
physical_size
=
SkISize
::
Make
(
bounds
.
width
()
*
ctm
.
getScaleX
(),
bounds
.
height
()
*
ctm
.
getScaleY
());
PictureRasterzier
&
rasterizer
=
frame
.
paint_context
().
rasterizer
();
RefPtr
<
SkImage
>
image
=
rasterizer
.
GetCachedImageIfPresent
(
frame
.
paint_context
(),
frame
.
gr_context
(),
picture_
.
get
(),
size
,
c
anvas
.
getTotalMatrix
()
);
frame
.
paint_context
(),
frame
.
gr_context
(),
picture_
.
get
(),
physical_
size
,
c
tm
);
if
(
image
)
{
canvas
.
drawImage
(
image
.
get
(),
offset_
.
x
(),
offset_
.
y
());
...
...
sky/compositor/picture_rasterizer.cc
浏览文件 @
f6aa6899
...
...
@@ -42,13 +42,13 @@ RefPtr<SkImage> PictureRasterzier::ImageFromPicture(
PaintContext
&
context
,
GrContext
*
gr_context
,
SkPicture
*
picture
,
const
SkISize
&
size
,
const
SkMatrix
&
incoming
CTM
)
{
const
SkISize
&
physical_
size
,
const
SkMatrix
&
incoming
_ctm
)
{
// Step 1: Create a texture from the context's texture provider
GrSurfaceDesc
desc
;
desc
.
fWidth
=
size
.
width
()
*
incomingCTM
.
getScaleX
();
desc
.
fHeight
=
size
.
height
()
*
incomingCTM
.
getScaleY
();
desc
.
fWidth
=
physical_size
.
width
();
desc
.
fHeight
=
physical_size
.
height
();
desc
.
fFlags
=
kRenderTarget_GrSurfaceFlag
;
desc
.
fConfig
=
kRGBA_8888_GrPixelConfig
;
...
...
@@ -65,10 +65,8 @@ RefPtr<SkImage> PictureRasterzier::ImageFromPicture(
GrBackendTextureDesc
backendDesc
;
backendDesc
.
fConfig
=
desc
.
fConfig
;
// Note that here, we are not using GrSurfaceDesc's dimensions as those are
// not in point space.
backendDesc
.
fWidth
=
size
.
width
();
backendDesc
.
fHeight
=
size
.
height
();
backendDesc
.
fWidth
=
physical_size
.
width
()
/
incoming_ctm
.
getScaleX
();
backendDesc
.
fHeight
=
physical_size
.
height
()
/
incoming_ctm
.
getScaleY
();
backendDesc
.
fSampleCnt
=
desc
.
fSampleCnt
;
backendDesc
.
fFlags
=
kRenderTarget_GrBackendTextureFlag
;
backendDesc
.
fConfig
=
desc
.
fConfig
;
...
...
@@ -86,7 +84,7 @@ RefPtr<SkImage> PictureRasterzier::ImageFromPicture(
SkCanvas
*
canvas
=
surface
->
getCanvas
();
DCHECK
(
canvas
);
canvas
->
setMatrix
(
incoming
CTM
);
canvas
->
setMatrix
(
incoming
_ctm
);
canvas
->
drawPicture
(
picture
);
if
(
context
.
options
().
isEnabled
(
...
...
@@ -111,13 +109,13 @@ RefPtr<SkImage> PictureRasterzier::GetCachedImageIfPresent(
PaintContext
&
context
,
GrContext
*
gr_context
,
SkPicture
*
picture
,
const
SkISize
&
size
,
const
SkMatrix
&
incoming
CTM
)
{
if
(
size
.
isEmpty
()
||
picture
==
nullptr
||
gr_context
==
nullptr
)
{
const
SkISize
&
physical_
size
,
const
SkMatrix
&
incoming
_ctm
)
{
if
(
physical_
size
.
isEmpty
()
||
picture
==
nullptr
||
gr_context
==
nullptr
)
{
return
nullptr
;
}
const
Key
key
(
picture
->
uniqueID
(),
size
);
const
Key
key
(
picture
->
uniqueID
(),
physical_
size
);
Value
&
value
=
cache_
[
key
];
...
...
@@ -131,8 +129,8 @@ RefPtr<SkImage> PictureRasterzier::GetCachedImageIfPresent(
<<
"Did you forget to call PurgeCache between frames?"
;
if
(
!
value
.
image
)
{
value
.
image
=
ImageFromPicture
(
context
,
gr_context
,
picture
,
size
,
incomingCTM
);
value
.
image
=
ImageFromPicture
(
context
,
gr_context
,
picture
,
physical_size
,
incoming_ctm
);
}
if
(
value
.
image
)
{
...
...
sky/compositor/picture_rasterizer.h
浏览文件 @
f6aa6899
...
...
@@ -28,8 +28,8 @@ class PictureRasterzier {
RefPtr
<
SkImage
>
GetCachedImageIfPresent
(
PaintContext
&
context
,
GrContext
*
gr_context
,
SkPicture
*
picture
,
const
SkISize
&
size
,
const
SkMatrix
&
incoming
CTM
);
const
SkISize
&
physical_
size
,
const
SkMatrix
&
incoming
_ctm
);
void
PurgeCache
();
...
...
@@ -81,7 +81,7 @@ class PictureRasterzier {
RefPtr
<
SkImage
>
ImageFromPicture
(
PaintContext
&
context
,
GrContext
*
gr_context
,
SkPicture
*
picture
,
const
SkISize
&
size
,
const
SkISize
&
physical_
size
,
const
SkMatrix
&
incomingCTM
);
DISALLOW_COPY_AND_ASSIGN
(
PictureRasterzier
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录