Flutter Engine
The Flutter Engine
embedder_test_backingstore_producer.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_TESTS_EMBEDDER_TEST_BACKINGSTORE_PRODUCER_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_BACKINGSTORE_PRODUCER_H_
7
8#include <memory>
9#include "flutter/fml/macros.h"
10#include "flutter/fml/memory/ref_ptr_internal.h"
11#include "flutter/shell/platform/embedder/embedder.h"
12
15
16#ifdef SHELL_ENABLE_METAL
17#include "flutter/testing/test_metal_context.h"
18#endif
19
20#ifdef SHELL_ENABLE_VULKAN
21#include "flutter/testing/test_vulkan_context.h" // nogncheck
22#endif
23
24namespace flutter {
25namespace testing {
26
28 public:
29 struct UserData {
32 };
33
34 enum class RenderTargetType {
35 kSoftwareBuffer,
36 kSoftwareBuffer2,
37 kOpenGLFramebuffer,
38 kOpenGLTexture,
39 kMetalTexture,
40 kVulkanImage,
41 };
42
45 FlutterSoftwarePixelFormat software_pixfmt =
48
49 bool Create(const FlutterBackingStoreConfig* config,
50 FlutterBackingStore* renderer_out);
51
52 private:
53 bool CreateFramebuffer(const FlutterBackingStoreConfig* config,
54 FlutterBackingStore* renderer_out);
55
56 bool CreateTexture(const FlutterBackingStoreConfig* config,
57 FlutterBackingStore* renderer_out);
58
59 bool CreateSoftware(const FlutterBackingStoreConfig* config,
60 FlutterBackingStore* backing_store_out);
61
62 bool CreateSoftware2(const FlutterBackingStoreConfig* config,
63 FlutterBackingStore* backing_store_out);
64
65 bool CreateMTLTexture(const FlutterBackingStoreConfig* config,
66 FlutterBackingStore* renderer_out);
67
68 bool CreateVulkanImage(const FlutterBackingStoreConfig* config,
69 FlutterBackingStore* renderer_out);
70
72 RenderTargetType type_;
73 FlutterSoftwarePixelFormat software_pixfmt_;
74
75#ifdef SHELL_ENABLE_METAL
76 std::unique_ptr<TestMetalContext> test_metal_context_;
77#endif
78
79#ifdef SHELL_ENABLE_VULKAN
80 fml::RefPtr<TestVulkanContext> test_vulkan_context_;
81#endif
82
83 FML_DISALLOW_COPY_AND_ASSIGN(EmbedderTestBackingStoreProducer);
84};
85
86} // namespace testing
87} // namespace flutter
88
89#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_BACKINGSTORE_PRODUCER_H_
GLenum type
EmbedderTestBackingStoreProducer(sk_sp< GrDirectContext > context, RenderTargetType type, FlutterSoftwarePixelFormat software_pixfmt=kFlutterSoftwarePixelFormatNative32)
bool Create(const FlutterBackingStoreConfig *config, FlutterBackingStore *renderer_out)
FlutterSoftwarePixelFormat
Definition: embedder.h:335
@ kFlutterSoftwarePixelFormatNative32
Definition: embedder.h:363