Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
dl_test_surface_provider_impeller.cc
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
6
7namespace flutter {
8namespace testing {
9
11
12std::unique_ptr<impeller::PlaygroundImpl>
18
20 size_t height,
21 PixelFormat format) {
22 if (format != kN32Premul) {
23 // The caller didn't check our supported formats.
24 return false;
25 }
27 return true;
28}
29
30std::shared_ptr<DlSurfaceInstance>
32 return primary_;
33}
34
35std::unique_ptr<DlSurfaceInstance>
37 size_t height,
38 PixelFormat format) const {
39 return MakeOffscreenSurface(GetPlayground()->GetContext(), width, height,
40 format);
41}
42
43std::unique_ptr<DlSurfaceInstanceImpeller>
45 std::shared_ptr<impeller::Context> context,
46 size_t width,
47 size_t height,
48 PixelFormat format) {
49 if (format != kN32Premul) {
50 // The caller didn't check our supported formats.
51 return nullptr;
52 }
54 int mip_count = 1;
55
56 impeller::RenderTargetAllocator render_target_allocator =
57 impeller::RenderTargetAllocator(context->GetResourceAllocator());
58 std::shared_ptr<impeller::RenderTarget> target;
59 if (context->GetCapabilities()->SupportsOffscreenMSAA()) {
60 target = std::make_shared<impeller::RenderTarget>(
61 render_target_allocator.CreateOffscreenMSAA(
62 *context, // context
63 size, // size
64 /*mip_count=*/mip_count,
65 "Picture Snapshot MSAA", // label
67 kDefaultColorAttachmentConfigMSAA // color_attachment_config
68 ));
69 } else {
70 target = std::make_shared<impeller::RenderTarget>(
71 render_target_allocator.CreateOffscreen(
72 *context, // context
73 size, // size
74 /*mip_count=*/mip_count,
75 "Picture Snapshot", // label
77 kDefaultColorAttachmentConfig // color_attachment_config
78 ));
79 }
80 if (!target->IsValid()) {
81 return nullptr;
82 }
83 return std::make_unique<DlSurfaceInstanceImpeller>(std::move(context),
84 target);
85}
86
90
92 return true;
93}
94
95} // namespace testing
96} // namespace flutter
bool InitializeSurface(size_t width, size_t height, PixelFormat format) override
static std::unique_ptr< impeller::PlaygroundImpl > MakePlayground(impeller::PlaygroundBackend backend, const impeller::PlaygroundSwitches &switches)
std::unique_ptr< DlSurfaceInstance > MakeOffscreenSurface(size_t width, size_t height, PixelFormat format) const override
virtual impeller::PlaygroundImpl * GetPlayground() const =0
bool SupportsPixelFormat(PixelFormat format) const override
std::shared_ptr< DlSurfaceInstance > GetPrimarySurface() const override
static std::unique_ptr< PlaygroundImpl > Create(PlaygroundBackend backend, PlaygroundSwitches switches)
a wrapper around the impeller [Allocator] instance that can be used to provide caching of allocated r...
virtual RenderTarget CreateOffscreenMSAA(const Context &context, ISize size, int mip_count, std::string_view label="Offscreen MSAA", RenderTarget::AttachmentConfigMSAA color_attachment_config=RenderTarget::kDefaultColorAttachmentConfigMSAA, std::optional< RenderTarget::AttachmentConfig > stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &existing_color_msaa_texture=nullptr, const std::shared_ptr< Texture > &existing_color_resolve_texture=nullptr, const std::shared_ptr< Texture > &existing_depth_stencil_texture=nullptr, std::optional< PixelFormat > target_pixel_format=std::nullopt)
virtual RenderTarget CreateOffscreen(const Context &context, ISize size, int mip_count, std::string_view label="Offscreen", RenderTarget::AttachmentConfig color_attachment_config=RenderTarget::kDefaultColorAttachmentConfig, std::optional< RenderTarget::AttachmentConfig > stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &existing_color_texture=nullptr, const std::shared_ptr< Texture > &existing_depth_stencil_texture=nullptr, std::optional< PixelFormat > target_pixel_format=std::nullopt)
uint32_t uint32_t * format
uint32_t * target
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
PlaygroundBackend
Definition playground.h:26
int32_t height
int32_t width