9#include "third_party/skia/include/core/SkColorSpace.h"
10#include "third_party/skia/include/gpu/ganesh/GrBackendSurface.h"
11#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
23 sk_sp<GrDirectContext> context,
27 software_pixfmt_(software_pixfmt) {
30 FML_LOG(ERROR) <<
"Expected pixel format to be the default "
31 "(kFlutterSoftwarePixelFormatNative32) when"
32 "backing store producer should produce deprecated v1 "
47 return CreateSoftware(config, backing_store_out);
49 return CreateSoftware2(config, backing_store_out);
64 return user_data->surface->makeImageSnapshot();
67bool EmbedderTestBackingStoreProducerSoftware::CreateSoftware(
70 auto surface = SkSurfaces::Raster(
75 <<
"Could not create the render target for compositor layer.";
80 if (!
surface->peekPixels(&pixmap)) {
81 FML_LOG(ERROR) <<
"Could not peek pixels of pixmap.";
93 delete reinterpret_cast<UserData*
>(
user_data);
99bool EmbedderTestBackingStoreProducerSoftware::CreateSoftware2(
107 auto surface = SkSurfaces::Raster(SkImageInfo::Make(
111 <<
"Could not create the render target for compositor layer.";
116 if (!
surface->peekPixels(&pixmap)) {
117 FML_LOG(ERROR) <<
"Could not peek pixels of pixmap.";
131 delete reinterpret_cast<UserData*
>(
user_data);
virtual ~EmbedderTestBackingStoreProducerSoftware()
bool Create(const FlutterBackingStoreConfig *config, FlutterBackingStore *backing_store_out) override
EmbedderTestBackingStoreProducerSoftware(sk_sp< GrDirectContext > context, RenderTargetType type, FlutterSoftwarePixelFormat software_pixfmt=kFlutterSoftwarePixelFormatNative32)
sk_sp< SkSurface > GetSurface(const FlutterBackingStore *backing_store) const override
sk_sp< SkImage > MakeImageSnapshot(const FlutterBackingStore *backing_store) const override
FlutterSoftwarePixelFormat
@ kFlutterSoftwarePixelFormatNative32
@ kFlutterBackingStoreTypeSoftware2
@ kFlutterBackingStoreTypeSoftware
Specified an software allocation for Flutter to render into using the CPU.
#define FML_LOG(severity)
FlutterSize size
The size of the render target the engine expects to render into.
FlutterBackingStoreType type
Specifies the type of backing store.
FlutterSoftwareBackingStore software
The description of the software backing store.
FlutterSoftwareBackingStore2 software2
The description of the software backing store.
size_t struct_size
The size of this struct. Must be sizeof(FlutterSoftwareBackingStore2).
VoidCallback destruction_callback
size_t row_bytes
The number of bytes in a single row of the allocation.
size_t height
The number of rows in the allocation.
FlutterSoftwarePixelFormat pixel_format
VoidCallback destruction_callback
size_t row_bytes
The number of bytes in a single row of the allocation.
size_t height
The number of rows in the allocation.