13#include "third_party/skia/include/core/SkSurface.h"
14#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
20 std::shared_ptr<TestEGLContext> egl_context,
22 sk_sp<GrDirectContext> context)
24 egl_context_(
std::move(egl_context)) {}
36 std::make_unique<EmbedderTestBackingStoreProducerGL>(
context_,
type,
43 std::make_unique<EmbedderTestBackingStoreProducerSoftware>(
48 FML_LOG(FATAL) <<
"Unsupported render target type: "
49 <<
static_cast<int>(
type);
54bool EmbedderTestCompositorGL::UpdateOffscrenComposition(
62 SkSurfaces::RenderTarget(
context_.get(),
66 kTopLeft_GrSurfaceOrigin,
72 FML_LOG(ERROR) <<
"Could not update the off-screen composition.";
76 auto canvas =
surface->getCanvas();
80 canvas->clear(SK_ColorTRANSPARENT);
85 sk_sp<SkImage> platform_rendered_contents;
87 sk_sp<SkImage> layer_image;
88 SkIPoint canvas_offset = SkIPoint::Make(0, 0);
90 switch (layer->type) {
103 canvas_offset = SkIPoint::Make(layer->offset.x, layer->offset.y);
110 FML_LOG(ERROR) <<
"Could not snapshot layer in test compositor: "
120 canvas->drawImage(layer_image.get(), canvas_offset.x(),
128 FML_LOG(ERROR) <<
"Could not update the contents of the sub-composition.";
133 auto last_composition_snapshot =
138 callback(std::move(last_composition_snapshot));
void SetRenderTargetType(EmbedderTestBackingStoreProducer::RenderTargetType type, FlutterSoftwarePixelFormat software_pixfmt) override
EmbedderTestCompositorGL(std::shared_ptr< TestEGLContext > egl_context, DlISize surface_size, sk_sp< GrDirectContext > context)
~EmbedderTestCompositorGL() override
const DlISize surface_size_
NextSceneCallback next_scene_callback_
sk_sp< GrDirectContext > context_
sk_sp< SkImage > last_composition_
std::unique_ptr< EmbedderTestBackingStoreProducer > backingstore_producer_
PlatformViewRendererCallback platform_view_renderer_callback_
@ kFlutterLayerContentTypePlatformView
Indicates that the contents of this layer are determined by the embedder.
@ kFlutterLayerContentTypeBackingStore
FlutterSoftwarePixelFormat
const FlutterLayer size_t layers_count
const FlutterLayer ** layers
FlutterDesktopBinaryReply callback
#define FML_LOG(severity)
#define FML_CHECK(condition)
const SkISize & ToSkISize(const DlISize &size)