Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
e09af86a
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,发现更多精彩内容 >>
未验证
提交
e09af86a
编写于
8月 21, 2020
作者:
J
Jason Simmons
提交者:
GitHub
8月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove image sizes from Picture::GetAllocationSize (#20673)
上级
fe8c1544
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
0 addition
and
31 deletion
+0
-31
lib/ui/painting/canvas.cc
lib/ui/painting/canvas.cc
+0
-3
testing/dart/canvas_test.dart
testing/dart/canvas_test.dart
+0
-28
未找到文件。
lib/ui/painting/canvas.cc
浏览文件 @
e09af86a
...
...
@@ -327,7 +327,6 @@ void Canvas::drawImage(const CanvasImage* image,
ToDart
(
"Canvas.drawImage called with non-genuine Image."
));
return
;
}
external_allocation_size_
+=
image
->
GetAllocationSize
();
canvas_
->
drawImage
(
image
->
image
(),
x
,
y
,
paint
.
paint
());
}
...
...
@@ -352,7 +351,6 @@ void Canvas::drawImageRect(const CanvasImage* image,
}
SkRect
src
=
SkRect
::
MakeLTRB
(
src_left
,
src_top
,
src_right
,
src_bottom
);
SkRect
dst
=
SkRect
::
MakeLTRB
(
dst_left
,
dst_top
,
dst_right
,
dst_bottom
);
external_allocation_size_
+=
image
->
GetAllocationSize
();
canvas_
->
drawImageRect
(
image
->
image
(),
src
,
dst
,
paint
.
paint
(),
SkCanvas
::
kFast_SrcRectConstraint
);
}
...
...
@@ -381,7 +379,6 @@ void Canvas::drawImageNine(const CanvasImage* image,
SkIRect
icenter
;
center
.
round
(
&
icenter
);
SkRect
dst
=
SkRect
::
MakeLTRB
(
dst_left
,
dst_top
,
dst_right
,
dst_bottom
);
external_allocation_size_
+=
image
->
GetAllocationSize
();
canvas_
->
drawImageNine
(
image
->
image
(),
icenter
,
dst
,
paint
.
paint
());
}
...
...
testing/dart/canvas_test.dart
浏览文件 @
e09af86a
...
...
@@ -297,34 +297,6 @@ void main() {
expectArgumentError
(()
=>
canvas
.
drawRawAtlas
(
image
,
Float32List
(
4
),
Float32List
(
4
),
Int32List
(
2
),
BlendMode
.
src
,
rect
,
paint
));
});
test
(
'Image size reflected in picture size for image*, drawAtlas, and drawPicture methods'
,
()
async
{
final
Image
image
=
await
createImage
(
100
,
100
);
final
PictureRecorder
recorder
=
PictureRecorder
();
final
Canvas
canvas
=
Canvas
(
recorder
);
const
Rect
rect
=
Rect
.
fromLTWH
(
0
,
0
,
100
,
100
);
canvas
.
drawImage
(
image
,
Offset
.
zero
,
Paint
());
canvas
.
drawImageRect
(
image
,
rect
,
rect
,
Paint
());
canvas
.
drawImageNine
(
image
,
rect
,
rect
,
Paint
());
canvas
.
drawAtlas
(
image
,
<
RSTransform
>[],
<
Rect
>[],
<
Color
>[],
BlendMode
.
src
,
rect
,
Paint
());
final
Picture
picture
=
recorder
.
endRecording
();
// Some of the numbers here appear to utilize sharing/reuse of common items,
// e.g. of the Paint() or same `Rect` usage, etc.
// The raw utilization of a 100x100 picture here should be 53333:
// 100 * 100 * 4 * (4/3) = 53333.333333....
// To avoid platform specific idiosyncrasies and brittleness against changes
// to Skia, we just assert this is _at least_ 4x the image size.
const
int
minimumExpected
=
53333
*
4
;
expect
(
picture
.
approximateBytesUsed
,
greaterThan
(
minimumExpected
));
final
PictureRecorder
recorder2
=
PictureRecorder
();
final
Canvas
canvas2
=
Canvas
(
recorder2
);
canvas2
.
drawPicture
(
picture
);
final
Picture
picture2
=
recorder2
.
endRecording
();
expect
(
picture2
.
approximateBytesUsed
,
greaterThan
(
minimumExpected
));
});
test
(
'Vertex buffer size reflected in picture size for drawVertices'
,
()
async
{
final
PictureRecorder
recorder
=
PictureRecorder
();
final
Canvas
canvas
=
Canvas
(
recorder
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录