• 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 #ifndef SHELL_GPU_GPU_SURFACE_VULKAN_H_
6 #define SHELL_GPU_GPU_SURFACE_VULKAN_H_
7 
8 #include <memory>
9 
10 #include "flutter/fml/macros.h"
11 #include "flutter/fml/memory/weak_ptr.h"
12 #include "flutter/shell/common/surface.h"
13 #include "flutter/vulkan/vulkan_native_surface.h"
14 #include "flutter/vulkan/vulkan_window.h"
15 
16 namespace flutter {
17 
18 class GPUSurfaceVulkan : public Surface {
19  public:
20   GPUSurfaceVulkan(fml::RefPtr<vulkan::VulkanProcTable> proc_table,
21                    std::unique_ptr<vulkan::VulkanNativeSurface> native_surface);
22 
23   ~GPUSurfaceVulkan() override;
24 
25   // |Surface|
26   bool IsValid() override;
27 
28   // |Surface|
29   std::unique_ptr<SurfaceFrame> AcquireFrame(const SkISize& size) override;
30 
31   // |Surface|
32   SkMatrix GetRootTransformation() const override;
33 
34   // |Surface|
35   GrContext* GetContext() override;
36 
37  private:
38   vulkan::VulkanWindow window_;
39   fml::WeakPtrFactory<GPUSurfaceVulkan> weak_factory_;
40 
41   FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceVulkan);
42 };
43 
44 }  // namespace flutter
45 
46 #endif  // SHELL_GPU_GPU_SURFACE_VULKAN_H_
47