Flutter Engine
The Flutter Engine
ios_surface.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_H_
6#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_H_
7
8#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h"
9
10#include <memory>
11
12#include "flutter/flow/embedded_views.h"
13#include "flutter/flow/surface.h"
14#include "flutter/fml/macros.h"
15#include "flutter/fml/platform/darwin/scoped_nsobject.h"
16
17@class CALayer;
18
19namespace flutter {
20
21// Returns true if the app explicitly specified to use the iOS view embedding
22// mechanism which is still in a release preview.
24
26 public:
27 static std::unique_ptr<IOSSurface> Create(std::shared_ptr<IOSContext> context,
29
30 std::shared_ptr<IOSContext> GetContext() const;
31
32 virtual ~IOSSurface();
33
34 virtual bool IsValid() const = 0;
35
36 virtual void UpdateStorageSizeIfNecessary() = 0;
37
38 // Creates a GPU surface. If no GrDirectContext is supplied and the rendering mode
39 // supports one, a new one will be created; otherwise, the software backend
40 // will be used.
41 //
42 // If a GrDirectContext is supplied, creates a secondary surface.
43 virtual std::unique_ptr<Surface> CreateGPUSurface(GrDirectContext* gr_context = nullptr) = 0;
44
45 protected:
46 explicit IOSSurface(std::shared_ptr<IOSContext> ios_context);
47
48 private:
49 std::shared_ptr<IOSContext> ios_context_;
50
51 FML_DISALLOW_COPY_AND_ASSIGN(IOSSurface);
52};
53
54} // namespace flutter
55
56#endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_H_
virtual bool IsValid() const =0
static std::unique_ptr< IOSSurface > Create(std::shared_ptr< IOSContext > context, const fml::scoped_nsobject< CALayer > &layer)
Definition: ios_surface.mm:16
IOSSurface(std::shared_ptr< IOSContext > ios_context)
Definition: ios_surface.mm:49
virtual void UpdateStorageSizeIfNecessary()=0
virtual std::unique_ptr< Surface > CreateGPUSurface(GrDirectContext *gr_context=nullptr)=0
std::shared_ptr< IOSContext > GetContext() const
Definition: ios_surface.mm:56
bool IsIosEmbeddedViewsPreviewEnabled()