Flutter Engine
The Flutter Engine
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"
11#include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
12#include "flutter/shell/gpu/gpu_surface_metal_skia.h"
13#include "flutter/shell/platform/embedder/embedder_external_view_embedder.h"
14#include "flutter/shell/platform/embedder/embedder_surface.h"
15
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:
28 std::function<GPUMTLTextureInfo(const SkISize& 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 SkISize& frame_size) const override;
60
61 // |GPUSurfaceMetalDelegate|
62 bool PresentDrawable(GrMTLHandle drawable) const override;
63
64 // |GPUSurfaceMetalDelegate|
65 GPUMTLTextureInfo GetMTLTexture(const SkISize& frame_size) const override;
66
67 // |GPUSurfaceMetalDelegate|
68 bool PresentTexture(GPUMTLTextureInfo texture) const override;
69
70 FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSurfaceMetalSkia);
71};
72
73} // namespace flutter
74
75#endif // !SLIMPELLER
76
77#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_METAL_SKIA_H_
const void * GrMTLHandle
Definition: GrMtlTypes.h:20
EmbedderSurfaceMetalSkia(GPUMTLDeviceHandle device, GPUMTLCommandQueueHandle command_queue, MetalDispatchTable dispatch_table, std::shared_ptr< EmbedderExternalViewEmbedder > external_view_embedder)
Interface implemented by all platform surfaces that can present a metal backing store to the "screen"...
VkDevice device
Definition: main.cc:53
Dart_NativeFunction function
Definition: fuchsia.cc:51
FlTexture * texture
void * GPUMTLCommandQueueHandle
Definition: SkSize.h:16
std::function< GPUMTLTextureInfo(const SkISize &frame_size)> get_texture
std::function< bool(GPUMTLTextureInfo texture)> present