Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
14namespace flutter_runner {
15
16Surface::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
23Surface::~Surface() = default;
24
25// |flutter::Surface|
27 return true;
28}
29
30// |flutter::Surface|
31std::unique_ptr<flutter::SurfaceFrame> Surface::AcquireFrame(
32 const SkISize& size) {
34 framebuffer_info.supports_readback = true;
35 return std::make_unique<flutter::SurfaceFrame>(
36 nullptr, std::move(framebuffer_info),
37 [](const flutter::SurfaceFrame& surface_frame,
38 flutter::DlCanvas* canvas) { return true; },
39 size);
40}
41
42// |flutter::Surface|
44 return gr_context_;
45}
46
47// |flutter::Surface|
49 // This backend does not support delegating to the underlying platform to
50 // query for root surface transformations. Just return identity.
51 SkMatrix matrix;
52 matrix.reset();
53 return matrix;
54}
55
56} // namespace flutter_runner
Developer-facing API for rendering anything within the engine.
Definition dl_canvas.h:37
bool IsValid() override
Definition surface.cc:26
std::unique_ptr< flutter::SurfaceFrame > AcquireFrame(const SkISize &size) override
Definition surface.cc:31
SkMatrix GetRootTransformation() const override
Definition surface.cc:48
GrDirectContext * GetContext() override
Definition surface.cc:43
Definition ref_ptr.h:256