5#ifndef FLUTTER_FLOW_TESTING_MOCK_RASTER_CACHE_H_
6#define FLUTTER_FLOW_TESTING_MOCK_RASTER_CACHE_H_
9#include "flutter/flow/layers/layer.h"
10#include "flutter/flow/raster_cache.h"
11#include "flutter/flow/raster_cache_item.h"
12#include "flutter/flow/testing/mock_layer.h"
13#include "flutter/testing/mock_canvas.h"
34 bool preserve_rtree =
false)
const override {};
61 size_t picture_and_display_list_cache_limit_per_frame =
64 picture_and_display_list_cache_limit_per_frame) {
80 std::shared_ptr<TextureRegistry> texture_registry_;
85 .view_embedder =
nullptr,
86 .state_stack = preroll_state_stack_,
88 .surface_needs_readback =
false,
89 .raster_time = raster_time_,
91 .texture_registry = texture_registry_,
92 .has_platform_view =
false,
93 .has_texture_layer =
false,
102 .gr_context =
nullptr,
104 .view_embedder =
nullptr,
105 .raster_time = raster_time_,
107 .texture_registry = texture_registry_,
108 .raster_cache =
nullptr,
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
SK_API int SkColorTypeBytesPerPixel(SkColorType ct)
static sk_sp< SkColorSpace > MakeSRGB()
static const SkMatrix & I()
Developer-facing API for rendering anything within the engine.
Used for fixed refresh rate cases.
void set_preroll_delegate(const SkRect &cull_rect, const SkMatrix &matrix)
void set_delegate(DlCanvas *canvas)
size_t access_threshold() const
Return the number of frames that a picture must be prepared before it will be cached....
A RasterCacheResult implementation that represents a cached Layer or DisplayList without the overhead...
MockRasterCacheResult(SkRect device_rect)
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
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)
unsigned useCenter Optional< SkMatrix > matrix
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 SkMatrix &matrix)
bool RasterCacheItemPrerollAndTryToRasterCache(DisplayListRasterCacheItem &display_list_item, PrerollContext &context, PaintContext &paint_context, const SkMatrix &matrix)
PaintContextHolder GetSamplePaintContextHolder(LayerStateStack &state_stack, RasterCache *raster_cache, FixedRefreshRateStopwatch *raster_time, FixedRefreshRateStopwatch *ui_time)
static std::vector< RasterCacheItem * > raster_cache_items_
constexpr int64_t area() const
constexpr float height() const
constexpr float width() const
static constexpr SkSize Make(SkScalar w, SkScalar h)
LayerStateStack & state_stack
GrDirectContext * gr_context
static constexpr int kDefaultPictureAndDisplayListCacheLimitPerFrame
sk_sp< SkColorSpace > srgb
PaintContext paint_context
PrerollContext preroll_context
sk_sp< SkColorSpace > srgb
sk_sp< SkColorSpace > color_space_