Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
82aac14c
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,发现更多精彩内容 >>
未验证
提交
82aac14c
编写于
1月 20, 2021
作者:
F
Ferhat
提交者:
GitHub
1月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[web] Fix drawPoints api crash when strokeWidth is not specified. (#23773)
上级
0979cdb8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
3 deletion
+29
-3
lib/web_ui/dev/goldens_lock.yaml
lib/web_ui/dev/goldens_lock.yaml
+1
-1
lib/web_ui/lib/src/engine/bitmap_canvas.dart
lib/web_ui/lib/src/engine/bitmap_canvas.dart
+7
-2
lib/web_ui/test/golden_tests/engine/canvas_draw_points_test.dart
..._ui/test/golden_tests/engine/canvas_draw_points_test.dart
+21
-0
未找到文件。
lib/web_ui/dev/goldens_lock.yaml
浏览文件 @
82aac14c
repository
:
https://github.com/flutter/goldens.git
revision
:
510c545ee4dd94f7d620cdc51a9027fdd8e521bc
revision
:
999507db8c924635a605325252702bad661e2ad2
lib/web_ui/lib/src/engine/bitmap_canvas.dart
浏览文件 @
82aac14c
...
...
@@ -951,11 +951,16 @@ class BitmapCanvas extends EngineCanvas {
_drawPointsPaint
.
style
=
ui
.
PaintingStyle
.
fill
;
}
_drawPointsPaint
.
color
=
paint
.
color
;
_drawPointsPaint
.
strokeWidth
=
paint
.
strokeWidth
;
_drawPointsPaint
.
maskFilter
=
paint
.
maskFilter
;
final
double
dpr
=
ui
.
window
.
devicePixelRatio
;
// Use hairline (device pixel when strokeWidth is not specified).
final
double
strokeWidth
=
paint
.
strokeWidth
==
null
?
1.0
/
dpr
:
paint
.
strokeWidth
!;
_drawPointsPaint
.
strokeWidth
=
strokeWidth
;
_setUpPaint
(
_drawPointsPaint
,
null
);
_canvasPool
.
drawPoints
(
pointMode
,
points
,
paint
.
strokeWidth
!
/
2.0
);
// Draw point using circle with half radius.
_canvasPool
.
drawPoints
(
pointMode
,
points
,
strokeWidth
/
2.0
);
_tearDownPaint
();
}
...
...
lib/web_ui/test/golden_tests/engine/canvas_draw_points_test.dart
浏览文件 @
82aac14c
...
...
@@ -59,4 +59,25 @@ void testMain() async {
html
.
document
.
body
.
append
(
canvas
.
rootElement
);
await
matchGoldenFile
(
'canvas_draw_points.png'
,
region:
region
);
});
test
(
'Should draw points with strokeWidth'
,
()
async
{
final
SurfacePaintData
nullStrokePaint
=
SurfacePaintData
()..
color
=
Color
(
0xffff0000
);
canvas
.
drawPoints
(
PointMode
.
lines
,
Float32List
.
fromList
([
30.0
,
20.0
,
200.0
,
20.0
]),
nullStrokePaint
);
final
SurfacePaintData
strokePaint1
=
SurfacePaintData
()
..
strokeWidth
=
1.0
..
color
=
Color
(
0xff0000ff
);
canvas
.
drawPoints
(
PointMode
.
lines
,
Float32List
.
fromList
([
30.0
,
30.0
,
200.0
,
30.0
]),
strokePaint1
);
final
SurfacePaintData
strokePaint3
=
SurfacePaintData
()
..
strokeWidth
=
3.0
..
color
=
Color
(
0xff00a000
);
canvas
.
drawPoints
(
PointMode
.
lines
,
Float32List
.
fromList
([
30.0
,
40.0
,
200.0
,
40.0
]),
strokePaint3
);
canvas
.
drawPoints
(
PointMode
.
points
,
Float32List
.
fromList
([
30.0
,
50.0
,
40.0
,
50.0
,
50.0
,
50.0
]),
strokePaint3
);
html
.
document
.
body
.
append
(
canvas
.
rootElement
);
await
matchGoldenFile
(
'canvas_draw_points_stroke.png'
,
region:
region
);
});
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录