Flutter Engine
 
Loading...
Searching...
No Matches
embedder_surface_metal_skia.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_EMBEDDER_EMBEDDER_SURFACE_METAL_SKIA_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_METAL_SKIA_H_
7
8#if !SLIMPELLER
9
10#include "flutter/fml/macros.h"
15
16#include "third_party/skia/include/core/SkSurface.h"
17
18namespace flutter {
19
20// TODO(148235): This class is Skia specific and there is another on
21// specifically for Impeller called EmbedderSurfaceMetalImpeller. Rename this to
22// EmbedderSurfaceMetalSkia to avoid confusion.
25 public:
27 std::function<bool(GPUMTLTextureInfo texture)> present; // required
28 std::function<GPUMTLTextureInfo(const DlISize& frame_size)>
29 get_texture; // required
30 };
31
34 GPUMTLCommandQueueHandle command_queue,
35 MetalDispatchTable dispatch_table,
36 std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder);
37
39
40 private:
41 bool valid_ = false;
42 MetalDispatchTable metal_dispatch_table_;
43 std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder_;
44 sk_sp<SkSurface> surface_;
45 sk_sp<GrDirectContext> main_context_;
46 sk_sp<GrDirectContext> resource_context_;
47
48 // |EmbedderSurface|
49 bool IsValid() const override;
50
51 // |EmbedderSurface|
52 std::unique_ptr<Surface> CreateGPUSurface() override;
53
54 // |EmbedderSurface|
55 sk_sp<GrDirectContext> CreateResourceContext() const override;
56
57 // |GPUSurfaceMetalDelegate|
58 GPUCAMetalLayerHandle GetCAMetalLayer(
59 const DlISize& frame_size) const override;
60
61 // |GPUSurfaceMetalDelegate|
62 bool PresentDrawable(GrMTLHandle drawable) const override;
63
64 // |GPUSurfaceMetalDelegate|
65 GPUMTLTextureInfo GetMTLTexture(const DlISize& frame_size) const override;
66
67 // |GPUSurfaceMetalDelegate|
68 bool PresentTexture(GPUMTLTextureInfo texture) const override;
69
71};
72
73} // namespace flutter
74
75#endif // !SLIMPELLER
76
77#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_METAL_SKIA_H_
Interface implemented by all platform surfaces that can present a metal backing store to the "screen"...
VkDevice device
Definition main.cc:69
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
FlTexture * texture
std::function< bool(GPUMTLTextureInfo texture)> present
std::function< GPUMTLTextureInfo(const DlISize &frame_size)> get_texture