提交 18e43c93 编写于 作者: A Adam Barth 提交者: GitHub

Get //flutter/flow building on Fuchsia (#2899)

上级 4a972e2d
......@@ -2,11 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This target will be built if no target is specified when invoking ninja.
group("flutter") {
testonly = true
deps = [
"//flutter/flow",
"//flutter/glue",
]
......
......@@ -47,9 +47,17 @@ source_set("flow") {
deps = [
"//flutter/glue",
"//flutter/skia",
"//lib/ftl",
"//mojo/services/gfx/composition/interfaces",
"//mojo/skia",
"//flutter/skia",
]
if (is_fuchsia) {
# TODO(abarth): In principle, we should add "//mojo/public/c/gpu" as a
# dependency, but that doesn't work currently because GPU support on Fuchsia
# is still a work in progress.
include_dirs = [
"//mojo/public/c/gpu",
]
}
}
......@@ -4,13 +4,37 @@
#include "flutter/flow/layers/child_scene_layer.h"
#include "mojo/skia/type_converters.h"
namespace flow {
namespace {
mojo::TransformPtr GetTransformFromSkMatrix(const SkMatrix& input) {
// Expand 3x3 to 4x4.
auto output = mojo::Transform::New();
output->matrix.resize(16u);
output->matrix[0] = input[0];
output->matrix[1] = input[1];
output->matrix[2] = 0.f;
output->matrix[3] = input[2];
output->matrix[4] = input[3];
output->matrix[5] = input[4];
output->matrix[6] = 0.f;
output->matrix[7] = input[5];
output->matrix[8] = 0.f;
output->matrix[9] = 0.f;
output->matrix[10] = 1.f;
output->matrix[11] = 0.f;
output->matrix[12] = input[6];
output->matrix[13] = input[7];
output->matrix[14] = 0.f;
output->matrix[15] = input[8];
return output.Pass();
}
// TODO(abarth): We need to figure out how to allocate these ids sensibly.
static uint32_t next_id = 10;
} // namespace
ChildSceneLayer::ChildSceneLayer() : device_pixel_ratio_(1.0f) {}
ChildSceneLayer::~ChildSceneLayer() {}
......@@ -42,7 +66,7 @@ void ChildSceneLayer::UpdateScene(mojo::gfx::composition::SceneUpdate* update,
child_node->content_clip = mojo::RectF::New();
child_node->content_clip->width = physical_size_.width();
child_node->content_clip->height = physical_size_.height();
child_node->content_transform = mojo::Transform::From(transform_);
child_node->content_transform = GetTransformFromSkMatrix(transform_);
update->nodes.insert(id, child_node.Pass());
container->child_node_ids.push_back(id);
}
......
......@@ -7,19 +7,19 @@
#include "lib/ftl/build_config.h"
#if OS_IOS
#if defined(OS_IOS)
#include <OpenGLES/ES2/gl.h>
#elif OS_MACOSX
#elif defined(OS_MACOSX)
#include <OpenGL/gl.h>
#elif OS_ANDROID
#elif defined(OS_ANDROID) || defined(OS_FUCHSIA)
#include <GLES2/gl2.h>
#elif OS_LINUX
#elif defined(OS_LINUX)
#include <GL/gl.h>
......
......@@ -2,6 +2,16 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if (is_fuchsia) {
group("skia") {
# TODO(abarth): Switch the non-Fuchsia build over to using Skia's BUILD.gn
# files as well.
public_deps = [ "//third_party/skia" ]
}
} else {
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//testing/test.gni")
......@@ -553,3 +563,5 @@ source_set("skia_opts") {
visibility = [ ":skia" ]
}
} # if (is_fuchsia)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册