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