Flutter Engine
surface.h
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 #pragma once
6 
7 #include "flutter/flow/surface.h"
8 #include "flutter/fml/macros.h"
9 #include "flutter/fml/memory/weak_ptr.h"
10 
11 namespace flutter_runner {
12 
13 // The interface between the Flutter rasterizer and the underlying platform. May
14 // be constructed on any thread but will be used by the engine only on the
15 // raster thread.
16 class Surface final : public flutter::Surface {
17  public:
18  Surface(std::string debug_label,
19  std::shared_ptr<flutter::ExternalViewEmbedder> view_embedder,
20  GrDirectContext* gr_context);
21 
22  ~Surface() override;
23 
24  private:
25  const std::string debug_label_;
26  std::shared_ptr<flutter::ExternalViewEmbedder> view_embedder_;
27  GrDirectContext* gr_context_;
28 
29  // |flutter::Surface|
30  bool IsValid() override;
31 
32  // |flutter::Surface|
33  std::unique_ptr<flutter::SurfaceFrame> AcquireFrame(
34  const SkISize& size) override;
35 
36  // |flutter::Surface|
37  GrDirectContext* GetContext() override;
38 
39  // |flutter::Surface|
40  SkMatrix GetRootTransformation() const override;
41 
42  // |flutter::Surface|
43  flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override;
44 
45  FML_DISALLOW_COPY_AND_ASSIGN(Surface);
46 };
47 
48 } // namespace flutter_runner
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13
Abstract Base Class that represents where we will be rendering content.
Definition: surface.h:18