Flutter iOS Embedder
ios_surface_software.h
Go to the documentation of this file.
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_SOFTWARE_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_SOFTWARE_H_
7 
8 #include "flutter/flow/embedded_views.h"
9 #include "flutter/fml/macros.h"
10 #include "flutter/fml/platform/darwin/scoped_nsobject.h"
11 #include "flutter/shell/gpu/gpu_surface_software.h"
14 
15 #include "third_party/skia/include/core/SkSurface.h"
16 
17 @class CALayer;
18 
19 namespace flutter {
20 
21 class IOSSurfaceSoftware final : public IOSSurface, public GPUSurfaceSoftwareDelegate {
22  public:
23  IOSSurfaceSoftware(const fml::scoped_nsobject<CALayer>& layer,
24  std::shared_ptr<IOSContext> context);
25 
26  ~IOSSurfaceSoftware() override;
27 
28  // |IOSSurface|
29  bool IsValid() const override;
30 
31  // |IOSSurface|
32  void UpdateStorageSizeIfNecessary() override;
33 
34  // |IOSSurface|
35  std::unique_ptr<Surface> CreateGPUSurface(GrDirectContext* gr_context = nullptr) override;
36 
37  // |GPUSurfaceSoftwareDelegate|
38  sk_sp<SkSurface> AcquireBackingStore(const SkISize& size) override;
39 
40  // |GPUSurfaceSoftwareDelegate|
41  bool PresentBackingStore(sk_sp<SkSurface> backing_store) override;
42 
43  private:
44  fml::scoped_nsobject<CALayer> layer_;
45  sk_sp<SkSurface> sk_surface_;
46 
47  FML_DISALLOW_COPY_AND_ASSIGN(IOSSurfaceSoftware);
48 };
49 
50 } // namespace flutter
51 
52 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_SOFTWARE_H_
flutter::IOSSurfaceSoftware::IsValid
bool IsValid() const override
Definition: ios_surface_software.mm:26
flutter::IOSSurfaceSoftware::PresentBackingStore
bool PresentBackingStore(sk_sp< SkSurface > backing_store) override
Definition: ios_surface_software.mm:69
flutter::IOSSurfaceSoftware::IOSSurfaceSoftware
IOSSurfaceSoftware(const fml::scoped_nsobject< CALayer > &layer, std::shared_ptr< IOSContext > context)
Definition: ios_surface_software.mm:20
flutter::IOSSurface
Definition: ios_surface.h:25
flutter::IOSSurfaceSoftware::AcquireBackingStore
sk_sp< SkSurface > AcquireBackingStore(const SkISize &size) override
Definition: ios_surface_software.mm:51
flutter::IOSSurfaceSoftware
Definition: ios_surface_software.h:21
ios_surface.h
flutter
Definition: accessibility_bridge.h:28
flutter::IOSSurfaceSoftware::UpdateStorageSizeIfNecessary
void UpdateStorageSizeIfNecessary() override
Definition: ios_surface_software.mm:30
ios_context.h
flutter::IOSSurfaceSoftware::CreateGPUSurface
std::unique_ptr< Surface > CreateGPUSurface(GrDirectContext *gr_context=nullptr) override
Definition: ios_surface_software.mm:37
flutter::IOSSurfaceSoftware::~IOSSurfaceSoftware
~IOSSurfaceSoftware() override