11#include "third_party/skia/include/core/SkColorSpace.h"
12#include "third_party/skia/include/core/SkImageInfo.h"
13#include "third_party/skia/include/core/SkSurface.h"
14#include "third_party/skia/include/gpu/ganesh/GrDirectContext.h"
20 std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder)
21 : software_dispatch_table_(
std::move(software_dispatch_table)),
22 external_view_embedder_(
std::move(external_view_embedder)) {
32bool EmbedderSurfaceSoftware::IsValid()
const {
37std::unique_ptr<Surface> EmbedderSurfaceSoftware::CreateGPUSurface() {
41 const bool render_to_surface = !external_view_embedder_;
42 auto surface = std::make_unique<GPUSurfaceSoftware>(
this, render_to_surface);
52sk_sp<GrDirectContext> EmbedderSurfaceSoftware::CreateResourceContext()
const {
57sk_sp<SkSurface> EmbedderSurfaceSoftware::AcquireBackingStore(
59 TRACE_EVENT0(
"flutter",
"EmbedderSurfaceSoftware::AcquireBackingStore");
62 <<
"Could not acquire backing store for the software surface.";
66 if (sk_surface_ !=
nullptr &&
67 size.width == sk_surface_->width() &&
68 size.height == sk_surface_->height()) {
73 SkImageInfo info = SkImageInfo::MakeN32(
74 size.width,
size.height, kPremul_SkAlphaType, SkColorSpace::MakeSRGB());
75 sk_surface_ = SkSurfaces::Raster(info,
nullptr);
77 if (sk_surface_ ==
nullptr) {
78 FML_LOG(ERROR) <<
"Could not create backing store for software rendering.";
86bool EmbedderSurfaceSoftware::PresentBackingStore(
87 sk_sp<SkSurface> backing_store) {
89 FML_LOG(ERROR) <<
"Tried to present an invalid software surface.";
94 if (!backing_store->peekPixels(&pixmap)) {
95 FML_LOG(ERROR) <<
"Could not peek the pixels of the backing store.";
100 uint64_t expected_pixmap_data_size = pixmap.width() * pixmap.height() * 4;
102 const size_t pixmap_size = pixmap.computeByteSize();
104 if (expected_pixmap_data_size != pixmap_size) {
105 FML_LOG(ERROR) <<
"Software backing store had unexpected size.";
~EmbedderSurfaceSoftware() override
EmbedderSurfaceSoftware(SoftwareDispatchTable software_dispatch_table, std::shared_ptr< EmbedderExternalViewEmbedder > external_view_embedder)
#define FML_LOG(severity)
impeller::ISize32 DlISize
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
std::function< bool(const void *allocation, size_t row_bytes, size_t height)> software_present_backing_store
#define TRACE_EVENT0(category_group, name)