Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
8d102cbe
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
8d102cbe
编写于
9月 11, 2016
作者:
A
Adam Barth
提交者:
GitHub
9月 11, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add hello_flutter and make it work on Fuchsia (#3016)
上级
62053fc9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
69 addition
and
1 deletion
+69
-1
examples/BUILD.gn
examples/BUILD.gn
+2
-1
examples/hello_flutter/.packages
examples/hello_flutter/.packages
+1
-0
examples/hello_flutter/BUILD.gn
examples/hello_flutter/BUILD.gn
+9
-0
examples/hello_flutter/lib/main.dart
examples/hello_flutter/lib/main.dart
+50
-0
sky/engine/BUILD.gn
sky/engine/BUILD.gn
+7
-0
未找到文件。
examples/BUILD.gn
浏览文件 @
8d102cbe
...
...
@@ -4,6 +4,7 @@
group("examples") {
deps = [
"spinning_square"
"hello_flutter",
"spinning_square",
]
}
examples/hello_flutter/.packages
0 → 100644
浏览文件 @
8d102cbe
# hello_flutter doesn't depend on any packages.
examples/hello_flutter/BUILD.gn
0 → 100644
浏览文件 @
8d102cbe
# Copyright 2016 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.
import("//flutter/build/flutter_app.gni")
flutter_app("hello_flutter") {
main_dart = "lib/main.dart"
}
examples/hello_flutter/lib/main.dart
0 → 100644
浏览文件 @
8d102cbe
// Copyright 2016 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.
// This example shows how to show the text 'Hello, world.' using using the raw
// interface to the engine.
import
'dart:ui'
as
ui
;
void
beginFrame
(
Duration
timeStamp
)
{
final
double
devicePixelRatio
=
ui
.
window
.
devicePixelRatio
;
// TODO(abarth): ui.window.size should be in physical units.
final
ui
.
Size
logicalSize
=
ui
.
window
.
size
;
final
ui
.
ParagraphBuilder
paragraphBuilder
=
new
ui
.
ParagraphBuilder
()
..
addText
(
'Hello, world.'
);
final
ui
.
Paragraph
paragraph
=
paragraphBuilder
.
build
(
new
ui
.
ParagraphStyle
())
..
layout
(
new
ui
.
ParagraphConstraints
(
width:
logicalSize
.
width
));
final
ui
.
Rect
physicalBounds
=
ui
.
Point
.
origin
&
(
logicalSize
*
devicePixelRatio
);
final
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
final
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
physicalBounds
);
canvas
.
scale
(
devicePixelRatio
,
devicePixelRatio
);
canvas
.
drawRect
(
ui
.
Point
.
origin
&
logicalSize
,
new
ui
.
Paint
()..
color
=
const
ui
.
Color
(
0xFF0000FF
));
canvas
.
drawParagraph
(
paragraph
,
new
ui
.
Offset
(
(
logicalSize
.
width
-
paragraph
.
maxIntrinsicWidth
)
/
2.0
,
(
logicalSize
.
height
-
paragraph
.
height
)
/
2.0
));
final
ui
.
Picture
picture
=
recorder
.
endRecording
();
final
ui
.
SceneBuilder
sceneBuilder
=
new
ui
.
SceneBuilder
()
// TODO(abarth): We should be able to add a picture without pushing a
// container layer first.
..
pushClipRect
(
physicalBounds
)
..
addPicture
(
ui
.
Offset
.
zero
,
picture
)
..
pop
();
ui
.
window
.
render
(
sceneBuilder
.
build
());
}
// This function is the primary entry point to your application. The engine
// calls main() as soon as it has loaded your code.
void
main
(
)
{
// The engine calls onBeginFrame whenever it wants us to produce a frame.
ui
.
window
.
onBeginFrame
=
beginFrame
;
// Here we kick off the whole process by asking the engine to schedule a new
// frame. The engine will eventually call onBeginFrame when it is time for us
// to actually produce the frame.
ui
.
window
.
scheduleFrame
();
}
sky/engine/BUILD.gn
浏览文件 @
8d102cbe
...
...
@@ -22,6 +22,13 @@ config("config") {
cflags = [
"-Wno-inconsistent-missing-override",
]
if (is_fuchsia) {
# TODO(abarth): Remove once the kernel support unmapping memory properly.
defines = [
"MEMORY_TOOL_REPLACES_ALLOCATOR",
]
}
}
# The follow configs apply to all targets except for unit tests, which rely on
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录