Flutter Engine
surface.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "surface.h"
6 
7 #include <fcntl.h>
8 #include <lib/fdio/watcher.h>
9 #include <lib/zx/time.h>
10 #include <unistd.h>
11 
12 #include "flutter/fml/unique_fd.h"
13 
14 namespace flutter_runner {
15 
16 Surface::Surface(std::string debug_label,
17  std::shared_ptr<flutter::ExternalViewEmbedder> view_embedder,
18  GrDirectContext* gr_context)
19  : debug_label_(std::move(debug_label)),
20  view_embedder_(view_embedder),
21  gr_context_(gr_context) {}
22 
23 Surface::~Surface() = default;
24 
25 // |flutter::Surface|
26 bool Surface::IsValid() {
27  return true;
28 }
29 
30 // |flutter::Surface|
31 std::unique_ptr<flutter::SurfaceFrame> Surface::AcquireFrame(
32  const SkISize& size) {
33  return std::make_unique<flutter::SurfaceFrame>(
34  nullptr, true,
35  [](const flutter::SurfaceFrame& surface_frame, SkCanvas* canvas) {
36  return true;
37  });
38 }
39 
40 // |flutter::Surface|
41 GrDirectContext* Surface::GetContext() {
42  return gr_context_;
43 }
44 
45 // |flutter::Surface|
46 SkMatrix Surface::GetRootTransformation() const {
47  // This backend does not support delegating to the underlying platform to
48  // query for root surface transformations. Just return identity.
49  SkMatrix matrix;
50  matrix.reset();
51  return matrix;
52 }
53 
54 // |flutter::GetViewEmbedder|
55 flutter::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() {
56  return view_embedder_.get();
57 }
58 
59 } // namespace flutter_runner
Definition: ref_ptr.h:252
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13