5#ifndef FLUTTER_FLOW_TESTING_LAYER_TEST_H_
6#define FLUTTER_FLOW_TESTING_LAYER_TEST_H_
9#include "flutter/flow/layer_snapshot_store.h"
10#include "flutter/flow/layers/layer.h"
16#include "flutter/flow/testing/mock_raster_cache.h"
17#include "flutter/fml/macros.h"
18#include "flutter/testing/assertions_skia.h"
19#include "flutter/testing/canvas_test.h"
20#include "flutter/testing/display_list_testing.h"
21#include "flutter/testing/mock_canvas.h"
41template <
typename BaseT>
53 .gr_context = nullptr,
54 .view_embedder = nullptr,
55 .state_stack = preroll_state_stack_,
57 .surface_needs_readback =
false,
58 .raster_time = raster_time_,
61 .has_platform_view =
false,
62 .raster_cached_entries = &cacheable_items_,
67 .state_stack = paint_state_stack_,
69 .gr_context = nullptr,
70 .view_embedder = nullptr,
71 .raster_time = raster_time_,
77 display_list_builder_(k_dl_bounds_),
78 display_list_paint_context_{
80 .state_stack = display_list_state_stack_,
81 .canvas = &display_list_builder_,
82 .gr_context = nullptr,
83 .view_embedder = nullptr,
84 .raster_time = raster_time_,
93 display_list_state_stack_.
set_delegate(&display_list_builder_);
124 set_raster_cache_(std::make_unique<MockRasterCache>());
142 set_raster_cache_(std::make_unique<RasterCache>());
148 return texture_registry_;
154 return display_list_paint_context_;
159 if (display_list_ ==
nullptr) {
160 display_list_ = display_list_builder_.
Build();
162 return display_list_;
166 display_list_ =
nullptr;
168 display_list_builder_.
Build();
184 void set_raster_cache_(std::unique_ptr<RasterCache>
raster_cache) {
186 preroll_context_.raster_cache = raster_cache_.get();
187 paint_context_.raster_cache = raster_cache_.get();
188 display_list_paint_context_.raster_cache = raster_cache_.get();
195 std::shared_ptr<TextureRegistry> texture_registry_;
197 std::unique_ptr<RasterCache> raster_cache_;
206 std::vector<RasterCacheItem*> cacheable_items_;
static const SkMatrix & I()
sk_sp< DisplayList > Build()
Used for fixed refresh rate cases.
Collects snapshots of layers during frame rasterization.
void set_preroll_delegate(const SkRect &cull_rect, const SkMatrix &matrix)
void set_delegate(DlCanvas *canvas)
MockCanvas & mock_canvas()
sk_sp< SkColorSpace > mock_color_space()
std::vector< RasterCacheItem * > & cacheable_items()
PrerollContext * preroll_context()
void use_skia_raster_cache()
Use a normal raster cache in the preroll_context() and paint_context() structures.
void enable_leaf_layer_tracing()
void reset_display_list()
LayerSnapshotStore & layer_snapshot_store()
sk_sp< DisplayList > display_list()
RasterCache * raster_cache()
void disable_leaf_layer_tracing()
PaintContext & paint_context()
void use_mock_raster_cache()
Use a mock raster cache in the preroll_context() and paint_context() structures.
std::shared_ptr< TextureRegistry > texture_registry()
void use_null_raster_cache()
Use no raster cache in the preroll_context() and paint_context() structures.
PaintContext & display_list_paint_context()
#define FML_DCHECK(condition)
static constexpr SkRect kGiantRect
static constexpr SkRect MakeWH(float w, float h)
bool enable_leaf_layer_tracing
LayerSnapshotStore * layer_snapshot_store