Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
5607ac31
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,发现更多精彩内容 >>
提交
5607ac31
编写于
9月 09, 2015
作者:
C
Chinmay Garde
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow images rasterized by the picture rasterizer to be highlighted for debugging purposes
上级
f9eadec6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
86 addition
and
0 deletion
+86
-0
sky/compositor/BUILD.gn
sky/compositor/BUILD.gn
+3
-0
sky/compositor/compositor_config.h
sky/compositor/compositor_config.h
+13
-0
sky/compositor/compositor_tools.cc
sky/compositor/compositor_tools.cc
+46
-0
sky/compositor/compositor_tools.h
sky/compositor/compositor_tools.h
+18
-0
sky/compositor/picture_rasterizer.cc
sky/compositor/picture_rasterizer.cc
+6
-0
未找到文件。
sky/compositor/BUILD.gn
浏览文件 @
5607ac31
...
...
@@ -12,6 +12,9 @@ source_set("compositor") {
"clip_rrect_layer.h",
"color_filter_layer.cc",
"color_filter_layer.h",
"compositor_config.h",
"compositor_tools.cc",
"compositor_tools.h",
"container_layer.cc",
"container_layer.h",
"layer.cc",
...
...
sky/compositor/compositor_config.h
0 → 100644
浏览文件 @
5607ac31
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_COMPOSITOR_COMPOSITOR_CONFIG_H_
#define SKY_COMPOSITOR_COMPOSITOR_CONFIG_H_
// SkPictures that dont mutate from frame to frame are rasterized by the picture
// rasterizer. This guard enables highlighting the rasterized images. Useful
// when debugging caching
#define COMPOSITOR_HIGHLIGHT_RASTERIZED_PICTURES 0
#endif // SKY_COMPOSITOR_COMPOSITOR_CONFIG_H_
sky/compositor/compositor_tools.cc
0 → 100644
浏览文件 @
5607ac31
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/compositor/compositor_tools.h"
#include "third_party/skia/include/core/SkShader.h"
namespace
sky
{
namespace
compositor
{
static
SkShader
*
CreateCheckerboardShader
(
SkColor
c1
,
SkColor
c2
,
int
size
)
{
SkBitmap
bm
;
bm
.
allocN32Pixels
(
2
*
size
,
2
*
size
);
bm
.
eraseColor
(
c1
);
bm
.
eraseArea
(
SkIRect
::
MakeLTRB
(
0
,
0
,
size
,
size
),
c2
);
bm
.
eraseArea
(
SkIRect
::
MakeLTRB
(
size
,
size
,
2
*
size
,
2
*
size
),
c2
);
return
SkShader
::
CreateBitmapShader
(
bm
,
SkShader
::
kRepeat_TileMode
,
SkShader
::
kRepeat_TileMode
);
}
static
void
DrawCheckerboard
(
SkCanvas
*
canvas
,
SkColor
c1
,
SkColor
c2
,
int
size
)
{
SkPaint
paint
;
paint
.
setShader
(
CreateCheckerboardShader
(
c1
,
c2
,
size
))
->
unref
();
canvas
->
drawPaint
(
paint
);
}
void
DrawCheckerboard
(
SkCanvas
*
canvas
,
int
width
,
int
height
)
{
SkRect
rect
=
SkRect
::
MakeIWH
(
width
,
height
);
// Draw a checkerboard
canvas
->
clipRect
(
rect
);
DrawCheckerboard
(
canvas
,
0x9900FF00
,
0x00000000
,
12
);
// Stroke the drawn area
SkPaint
debugPaint
;
debugPaint
.
setStrokeWidth
(
3
);
debugPaint
.
setColor
(
SK_ColorRED
);
debugPaint
.
setStyle
(
SkPaint
::
kStroke_Style
);
canvas
->
drawRect
(
rect
,
debugPaint
);
}
}
// namespace compositor
}
// namespace sky
sky/compositor/compositor_tools.h
0 → 100644
浏览文件 @
5607ac31
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_COMPOSITOR_COMPOSITOR_TOOLS_H_
#define SKY_COMPOSITOR_COMPOSITOR_TOOLS_H_
#include "third_party/skia/include/core/SkCanvas.h"
namespace
sky
{
namespace
compositor
{
void
DrawCheckerboard
(
SkCanvas
*
canvas
,
int
width
,
int
height
);
}
// namespace compositor
}
// namespace sky
#endif // SKY_COMPOSITOR_COMPOSITOR_TOOLS_H_
sky/compositor/picture_rasterizer.cc
浏览文件 @
5607ac31
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/compositor/compositor_config.h"
#include "sky/compositor/compositor_tools.h"
#include "sky/compositor/picture_rasterizer.h"
#include "base/logging.h"
#include "third_party/skia/include/core/SkPicture.h"
...
...
@@ -80,6 +82,10 @@ static RefPtr<SkImage> ImageFromPicture(GrContext* context,
canvas
->
drawPicture
(
picture
);
#if COMPOSITOR_HIGHLIGHT_RASTERIZED_PICTURES
DrawCheckerboard
(
canvas
,
desc
.
fWidth
,
desc
.
fHeight
);
#endif
// Step 4: Create an image representation from the texture
RefPtr
<
SkImage
>
image
=
adoptRef
(
SkImage
::
NewFromTexture
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录