7#include "flutter/flow/layers/display_list_raster_cache_item.h"
12#include "flutter/display_list/benchmarking/dl_complexity.h"
13#include "flutter/display_list/display_list.h"
14#include "flutter/flow/layers/layer.h"
15#include "flutter/flow/raster_cache.h"
16#include "flutter/flow/raster_cache_item.h"
17#include "flutter/flow/raster_cache_key.h"
18#include "flutter/flow/raster_cache_util.h"
34 if (display_list ==
nullptr ||
47 unsigned int complexity_score = complexity_calculator->
Compute(display_list);
59 display_list_(display_list),
61 is_complex_(is_complex),
62 will_change_(will_change) {}
70 is_complex, will_change);
82 complexity_calculator)) {
87 transformation_matrix_ =
matrix;
90 if (!transformation_matrix_.
invert(
nullptr)) {
108 auto* raster_cache = context->raster_cache;
109 SkRect bounds = display_list_->bounds().makeOffset(offset_.
x(), offset_.
y());
134 if (!context.raster_cache || !canvas) {
138 return context.raster_cache->Draw(
key_id_, *canvas,
paint,
144static const auto*
flow_type =
"RasterCacheFlow::DisplayList";
148 bool parent_cached)
const {
158 !context.raster_cache->GenerateNewCacheInThisFrame() || !
id.has_value()) {
161 SkRect bounds = display_list_->bounds().makeOffset(offset_.
x(), offset_.
y());
166 .matrix = transformation_matrix_,
171 return context.raster_cache->UpdateCacheEntry(
172 id.
value(), r_context,
176 display_list_->rtree());
SK_API GrBackendApi backend() const
bool invert(SkMatrix *inverse) const
SkMatrix & preTranslate(SkScalar dx, SkScalar dy)
static DisplayListComplexityCalculator * GetForBackend(GrBackendApi backend)
static DisplayListComplexityCalculator * GetForSoftware()
virtual bool ShouldBeCached(unsigned int complexity_score)=0
virtual unsigned int Compute(const DisplayList *display_list)=0
bool TryToPrepareRasterCache(const PaintContext &context, bool parent_cached=false) const override
static std::unique_ptr< DisplayListRasterCacheItem > Make(const sk_sp< DisplayList > &, const SkPoint &offset, bool is_complex, bool will_change)
void PrerollSetup(PrerollContext *context, const SkMatrix &matrix) override
DisplayListRasterCacheItem(const sk_sp< DisplayList > &display_list, const SkPoint &offset, bool is_complex=true, bool will_change=false)
const DisplayList * display_list() const
void PrerollFinalize(PrerollContext *context, const SkMatrix &matrix) override
bool Draw(const PaintContext &context, const DlPaint *paint) const override
const SkRect & bounds() const
Developer-facing API for rendering anything within the engine.
virtual void DrawDisplayList(const sk_sp< DisplayList > display_list, SkScalar opacity=SK_Scalar1)=0
bool content_culled(const SkRect &content_bounds) const
static constexpr int kCallerCanApplyOpacity
virtual std::optional< RasterCacheKeyID > GetId() const
#define FML_DCHECK(condition)
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
static bool IsDisplayListWorthRasterizing(const DisplayList *display_list, bool will_change, bool is_complex, DisplayListComplexityCalculator *complexity_calculator)
static const auto * flow_type
constexpr float y() const
constexpr float x() const
bool rendering_above_platform_view
sk_sp< SkColorSpace > dst_color_space
GrDirectContext * gr_context
GrDirectContext * gr_context
std::vector< RasterCacheItem * > * raster_cached_entries
LayerStateStack & state_stack
int renderable_state_flags
static bool CanRasterizeRect(const SkRect &cull_rect)
const size_t accesses_since_visible
GrDirectContext * gr_context