26 {
28
30
34 image_info,
35 1,
37 nullptr,
38 false
39 );
40
42 FML_LOG(
ERROR) <<
"Could not update the off-screen composition.";
43 return false;
44 }
45
46 auto canvas =
surface->getCanvas();
47
48
49
51
52 for (size_t i = 0; i < layers_count; ++i) {
53 const auto* layer = layers[i];
54
56
59
60 switch (layer->type) {
62 layer_image =
63 reinterpret_cast<SkSurface*
>(layer->backing_store->user_data)
64 ->makeImageSnapshot();
65
66 break;
68 layer_image =
71 : nullptr;
73 break;
74 };
75
76
77
79 FML_LOG(
ERROR) <<
"Could not snapshot layer in test compositor: "
80 << *layer;
81 return false;
82 }
83
84
85
86 if (layer_image) {
87
88
89 canvas->drawImage(layer_image.
get(), canvas_offset.
x(),
91 }
92 }
93
95
97 FML_LOG(
ERROR) <<
"Could not update the contents of the sub-composition.";
98 return false;
99 }
100
106 callback(std::move(last_composition_snapshot));
107 }
108
109 return true;
110}
@ kTopLeft_GrSurfaceOrigin
constexpr SkColor SK_ColorTRANSPARENT
sk_sp< SkImage > makeRasterImage(GrDirectContext *, CachingHint cachingHint=kDisallow_CachingHint) const
NextSceneCallback next_scene_callback_
const SkISize surface_size_
sk_sp< GrDirectContext > context_
sk_sp< SkImage > last_composition_
PlatformViewRendererCallback platform_view_renderer_callback_
@ kFlutterLayerContentTypePlatformView
Indicates that the contents of this layer are determined by the embedder.
@ kFlutterLayerContentTypeBackingStore
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
#define FML_LOG(severity)
#define FML_CHECK(condition)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
constexpr int32_t y() const
static constexpr SkIPoint Make(int32_t x, int32_t y)
constexpr int32_t x() const
static SkImageInfo MakeN32Premul(int width, int height)