Kaushik Iska 326b202cc7
Reland fuchsia external view embedder will be shared with platform view (#22008)
* Reland fuchsia external view embedder will be shared with platform view

This reverts commit 9b752790f4d25ab238576c719208d7a38c6293f3.

* wait for the external view embedder to be initialized before creating
shell
2020-10-22 13:48:36 -07:00

60 lines
1.5 KiB
C++

// Copyright 2013 The Flutter 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 "surface.h"
#include <fcntl.h>
#include <lib/fdio/watcher.h>
#include <lib/zx/time.h>
#include <unistd.h>
#include "flutter/fml/unique_fd.h"
namespace flutter_runner {
Surface::Surface(std::string debug_label,
std::shared_ptr<flutter::ExternalViewEmbedder> view_embedder,
GrDirectContext* gr_context)
: debug_label_(std::move(debug_label)),
view_embedder_(view_embedder),
gr_context_(gr_context) {}
Surface::~Surface() = default;
// |flutter::Surface|
bool Surface::IsValid() {
return true;
}
// |flutter::Surface|
std::unique_ptr<flutter::SurfaceFrame> Surface::AcquireFrame(
const SkISize& size) {
return std::make_unique<flutter::SurfaceFrame>(
nullptr, true,
[](const flutter::SurfaceFrame& surface_frame, SkCanvas* canvas) {
return true;
});
}
// |flutter::Surface|
GrDirectContext* Surface::GetContext() {
return gr_context_;
}
// |flutter::Surface|
SkMatrix Surface::GetRootTransformation() const {
// This backend does not support delegating to the underlying platform to
// query for root surface transformations. Just return identity.
SkMatrix matrix;
matrix.reset();
return matrix;
}
// |flutter::GetViewEmbedder|
flutter::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() {
return view_embedder_.get();
}
} // namespace flutter_runner