5#ifndef FLUTTER_FLOW_TESTING_MOCK_RASTER_CACHE_H_
6#define FLUTTER_FLOW_TESTING_MOCK_RASTER_CACHE_H_
13#include "third_party/skia/include/core/SkColorSpace.h"
14#include "third_party/skia/include/core/SkSize.h"
32 bool preserve_rtree =
false)
const override {};
35 return SkSize::Make(device_rect_.width(), device_rect_.height()).toCeil();
40 SkColorTypeBytesPerPixel(kBGRA_8888_SkColorType);
59 size_t picture_and_display_list_cache_limit_per_frame =
62 picture_and_display_list_cache_limit_per_frame) {
74 sk_sp<SkColorSpace> color_space_ = SkColorSpace::MakeSRGB();
78 std::shared_ptr<TextureRegistry> texture_registry_;
83 .view_embedder =
nullptr,
84 .state_stack = preroll_state_stack_,
86 .surface_needs_readback =
false,
87 .raster_time = raster_time_,
89 .texture_registry = texture_registry_,
90 .has_platform_view =
false,
91 .has_texture_layer =
false,
100 .gr_context =
nullptr,
102 .view_embedder =
nullptr,
103 .raster_time = raster_time_,
105 .texture_registry = texture_registry_,
106 .raster_cache =
nullptr,
Developer-facing API for rendering anything within the engine.
Used for fixed refresh rate cases.
void set_delegate(DlCanvas *canvas)
void set_preroll_delegate(const DlRect &cull_rect, const DlMatrix &matrix)
size_t access_threshold() const
Return the number of frames that a picture must be prepared before it will be cached....
A RasterCache implementation that simulates the act of rendering a Layer or DisplayList without the o...
void AddMockLayer(int width, int height)
MockRasterCache(size_t access_threshold=3, size_t picture_and_display_list_cache_limit_per_frame=RasterCacheUtil::kDefaultPictureAndDisplayListCacheLimitPerFrame)
void AddMockPicture(int width, int height)
A RasterCacheResult implementation that represents a cached Layer or DisplayList without the overhead...
SkISize image_dimensions() const override
void draw(DlCanvas &canvas, const DlPaint *paint=nullptr, bool preserve_rtree=false) const override
int64_t image_bytes() const override
bool RasterCacheItemTryToRasterCache(DisplayListRasterCacheItem &display_list_item, PaintContext &paint_context)
PrerollContextHolder GetSamplePrerollContextHolder(LayerStateStack &state_stack, RasterCache *raster_cache, FixedRefreshRateStopwatch *raster_time, FixedRefreshRateStopwatch *ui_time)
void RasterCacheItemPreroll(DisplayListRasterCacheItem &display_list_item, PrerollContext &context, const DlMatrix &matrix)
PaintContextHolder GetSamplePaintContextHolder(LayerStateStack &state_stack, RasterCache *raster_cache, FixedRefreshRateStopwatch *raster_time, FixedRefreshRateStopwatch *ui_time)
bool RasterCacheItemPrerollAndTryToRasterCache(DisplayListRasterCacheItem &display_list_item, PrerollContext &context, PaintContext &paint_context, const DlMatrix &matrix)
static std::vector< RasterCacheItem * > raster_cache_items_
impeller::Matrix DlMatrix
LayerStateStack & state_stack
GrDirectContext * gr_context
static constexpr int kDefaultPictureAndDisplayListCacheLimitPerFrame
sk_sp< SkColorSpace > srgb
PaintContext paint_context
PrerollContext preroll_context
sk_sp< SkColorSpace > srgb
A 4x4 matrix using column-major storage.
sk_sp< SkColorSpace > color_space_