• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "compositor_context.h"
8 #include "flutter/fml/macros.h"
9 #include "flutter/fml/memory/weak_ptr.h"
10 #include "flutter/shell/common/surface.h"
11 
12 namespace flutter_runner {
13 
14 // The interface between the Flutter rasterizer and the underlying platform. May
15 // be constructed on any thread but will be used by the engine only on the GPU
16 // thread.
17 class Surface final : public flutter::Surface {
18  public:
19   Surface(std::string debug_label);
20 
21   ~Surface() override;
22 
23  private:
24   const bool valid_ = CanConnectToDisplay();
25   const std::string debug_label_;
26 
27   // |flutter::Surface|
28   bool IsValid() override;
29 
30   // |flutter::Surface|
31   std::unique_ptr<flutter::SurfaceFrame> AcquireFrame(
32       const SkISize& size) override;
33 
34   // |flutter::Surface|
35   GrContext* GetContext() override;
36 
37   // |flutter::Surface|
38   SkMatrix GetRootTransformation() const override;
39 
40   static bool CanConnectToDisplay();
41 
42   FML_DISALLOW_COPY_AND_ASSIGN(Surface);
43 };
44 
45 }  // namespace flutter_runner
46