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#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_
6#define FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_
7
8#include "flutter/flow/surface.h"
9#include "flutter/fml/macros.h"
10#include "flutter/fml/memory/weak_ptr.h"
11#include "flutter/shell/gpu/gpu_surface_software_delegate.h"
12
13namespace flutter {
14
15class GPUSurfaceSoftware : public Surface {
16 public:
17 GPUSurfaceSoftware(GPUSurfaceSoftwareDelegate* delegate,
18 bool render_to_surface);
19
20 ~GPUSurfaceSoftware() override;
21
22 // |Surface|
23 bool IsValid() override;
24
25 // |Surface|
26 std::unique_ptr<SurfaceFrame> AcquireFrame(const SkISize& size) override;
27
28 // |Surface|
29 SkMatrix GetRootTransformation() const override;
30
31 // |Surface|
32 GrDirectContext* GetContext() override;
33
34 private:
35 GPUSurfaceSoftwareDelegate* delegate_;
36 // TODO(38466): Refactor GPU surface APIs take into account the fact that an
37 // external view embedder may want to render to the root surface. This is a
38 // hack to make avoid allocating resources for the root surface when an
39 // external view embedder is present.
40 const bool render_to_surface_;
41 fml::TaskRunnerAffineWeakPtrFactory<GPUSurfaceSoftware> weak_factory_;
42 FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceSoftware);
43};
44
45} // namespace flutter
46
47#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_
48

source code of flutter_engine/flutter/shell/gpu/gpu_surface_software.h

Morty Proxy This is a proxified and sanitized view of the page, visit original site.