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_PLATFORM_DARWIN_IOS_IOS_SURFACE_METAL_H_ 6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_METAL_H_ 7 8 #include "flutter/fml/macros.h" 9 #include "flutter/fml/platform/darwin/scoped_nsobject.h" 10 #include "flutter/shell/gpu/gpu_surface_metal.h" 11 #include "flutter/shell/platform/darwin/ios/ios_surface.h" 12 13 @class CAMetalLayer; 14 15 namespace flutter { 16 17 class IOSSurfaceMetal final : public IOSSurface { 18 public: 19 IOSSurfaceMetal(fml::scoped_nsobject<CAMetalLayer> layer, 20 FlutterPlatformViewsController* platform_views_controller); 21 22 ~IOSSurfaceMetal() override; 23 24 private: 25 fml::scoped_nsobject<CAMetalLayer> layer_; 26 27 // |IOSSurface| 28 bool IsValid() const override; 29 30 // |IOSSurface| 31 bool ResourceContextMakeCurrent() override; 32 33 // |IOSSurface| 34 void UpdateStorageSizeIfNecessary() override; 35 36 // |IOSSurface| 37 std::unique_ptr<Surface> CreateGPUSurface() override; 38 39 FML_DISALLOW_COPY_AND_ASSIGN(IOSSurfaceMetal); 40 }; 41 42 } // namespace flutter 43 44 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_METAL_H_ 45