16#include "include/core/SkColorSpace.h"
22 : root_layer_(root_layer), frame_size_(frame_size) {}
25 return canvas ? canvas->
GetImageInfo().colorSpace() :
nullptr;
29 bool ignore_raster_cache,
34 FML_LOG(ERROR) <<
"The scene did not specify any layers.";
43 raster_cache_items_.clear();
52 .state_stack = state_stack,
53 .dst_color_space = sk_ref_sp<SkColorSpace>(color_space),
54 .surface_needs_readback =
false,
58 .raster_cached_entries = &raster_cache_items_,
61 root_layer_->Preroll(&context);
68 const std::vector<RasterCacheItem*>& raster_cached_items,
70 bool ignore_raster_cache) {
72 const auto item_size = raster_cached_items.size();
73 while (
i < item_size) {
74 auto* item = raster_cached_items[
i];
75 if (item->need_caching()) {
79 if (item->TryToPrepareRasterCache(*paint_context,
false)) {
81 for (
unsigned j = 0; j < item->child_items(); j++) {
82 auto* child_item = raster_cached_items[
i + j + 1];
83 if (child_item->need_caching()) {
84 child_item->TryToPrepareRasterCache(*paint_context,
true);
87 i += item->child_items() + 1;
97 bool ignore_raster_cache)
const {
101 FML_LOG(ERROR) <<
"The scene did not specify any layers to paint.";
122 .dst_color_space = sk_ref_sp(color_space),
128 .raster_cache = cache,
142 if (root_layer_->needs_painting(context)) {
143 root_layer_->Paint(context);
149 const std::shared_ptr<TextureRegistry>& texture_registry,
150 GrDirectContext* gr_context) {
163 .raster_cache =
nullptr,
166 .view_embedder =
nullptr,
167 .state_stack = preroll_state_stack,
168 .dst_color_space =
nullptr,
169 .surface_needs_readback =
false,
170 .raster_time = unused_stopwatch,
171 .ui_time = unused_stopwatch,
172 .texture_registry = texture_registry,
182 .gr_context = gr_context,
183 .dst_color_space =
nullptr,
184 .view_embedder =
nullptr,
185 .raster_time = unused_stopwatch,
186 .ui_time = unused_stopwatch,
187 .texture_registry = texture_registry,
189 .raster_cache =
nullptr,
197 root_layer_->Preroll(&preroll_context);
200 if (root_layer_->needs_painting(paint_context)) {
201 root_layer_->Paint(paint_context);
205 return builder.
Build();
ExternalViewEmbedder * view_embedder()
GrDirectContext * gr_context() const
CompositorContext & context() const
impeller::AiksContext * aiks_context() const
const DlMatrix & root_surface_transformation() const
const Stopwatch & raster_time() const
std::shared_ptr< TextureRegistry > texture_registry()
RasterCache & raster_cache()
sk_sp< DisplayList > Build()
Developer-facing API for rendering anything within the engine.
virtual SkImageInfo GetImageInfo() const =0
Used for fixed refresh rate cases.
void set_delegate(DlCanvas *canvas)
void set_preroll_delegate(const DlRect &cull_rect, const DlMatrix &matrix)
sk_sp< DisplayList > Flatten(const DlRect &bounds, const std::shared_ptr< TextureRegistry > &texture_registry=nullptr, GrDirectContext *gr_context=nullptr)
void Paint(CompositorContext::ScopedFrame &frame, bool ignore_raster_cache=false) const
static void TryToRasterCache(const std::vector< RasterCacheItem * > &raster_cached_entries, const PaintContext *paint_context, bool ignore_raster_cache=false)
LayerTree(const std::shared_ptr< Layer > &root_layer, const DlISize &frame_size)
bool Preroll(CompositorContext::ScopedFrame &frame, bool ignore_raster_cache=false, DlRect cull_rect=kGiantRect)
void EvictUnusedCacheEntries()
#define FML_LOG(severity)
SkColorSpace * GetColorSpace(DlCanvas *canvas)
LayerStateStack & state_stack
GrDirectContext * gr_context
bool surface_needs_readback
#define TRACE_EVENT0(category_group, name)