• 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 FLUTTER_VULKAN_VULKAN_SURFACE_H_
6 #define FLUTTER_VULKAN_VULKAN_SURFACE_H_
7 
8 #ifndef RS_ENABLE_VK
9 #include "flutter/fml/macros.h"
10 #endif
11 #include "flutter/vulkan/vulkan_handle.h"
12 #include "third_party/skia/include/core/SkSize.h"
13 
14 namespace vulkan {
15 
16 class VulkanProcTable;
17 class VulkanApplication;
18 class VulkanNativeSurface;
19 
20 class VulkanSurface {
21  public:
22   VulkanSurface(VulkanProcTable& vk,
23                 VulkanApplication& application,
24                 std::unique_ptr<VulkanNativeSurface> native_surface);
25 
26   ~VulkanSurface();
27 
28   bool IsValid() const;
29 
30   /// Returns the current size of the surface or (0, 0) if invalid.
31   SkISize GetSize() const;
32 
33   const VulkanHandle<VkSurfaceKHR>& Handle() const;
34 
35   const VulkanNativeSurface& GetNativeSurface() const;
36 
37  private:
38   VulkanProcTable& vk;
39   VulkanApplication& application_;
40   std::unique_ptr<VulkanNativeSurface> native_surface_;
41   VulkanHandle<VkSurfaceKHR> surface_;
42   bool valid_;
43 
44 #ifndef RS_ENABLE_VK
45   FML_DISALLOW_COPY_AND_ASSIGN(VulkanSurface);
46 #endif
47 };
48 
49 }  // namespace vulkan
50 
51 #endif  // FLUTTER_VULKAN_VULKAN_SURFACE_H_
52