Flutter Engine
flutter::testing::LayerTestBase< BaseT > Class Template Reference

#include <layer_test.h>

Inheritance diagram for flutter::testing::LayerTestBase< BaseT >:
flutter::testing::CanvasTestBase< BaseT >

Public Member Functions

 LayerTestBase ()
 
void use_null_raster_cache ()
 Use no raster cache in the preroll_context() and paint_context() structures. More...
 
void use_mock_raster_cache ()
 Use a mock raster cache in the preroll_context() and paint_context() structures. More...
 
void use_skia_raster_cache ()
 Use a normal raster cache in the preroll_context() and paint_context() structures. More...
 
TextureRegistrytexture_regitry ()
 
RasterCacheraster_cache ()
 
PrerollContextpreroll_context ()
 
Layer::PaintContextpaint_context ()
 
Layer::PaintContextcheck_board_context ()
 
- Public Member Functions inherited from flutter::testing::CanvasTestBase< BaseT >
 CanvasTestBase ()=default
 
MockCanvasmock_canvas ()
 

Detailed Description

template<typename BaseT>
class flutter::testing::LayerTestBase< BaseT >

Definition at line 37 of file layer_test.h.

Constructor & Destructor Documentation

◆ LayerTestBase()

template<typename BaseT>
flutter::testing::LayerTestBase< BaseT >::LayerTestBase ( )
inline

Definition at line 41 of file layer_test.h.

42  : preroll_context_({
43  nullptr, /* raster_cache */
44  nullptr, /* gr_context */
45  nullptr, /* external_view_embedder */
46  mutators_stack_, TestT::mock_canvas().imageInfo().colorSpace(),
47  kGiantRect, /* cull_rect */
48  false, /* layer reads from surface */
49  raster_time_, ui_time_, texture_registry_,
50  false, /* checkerboard_offscreen_layers */
51  1.0f, /* frame_device_pixel_ratio */
52  false, /* has_platform_view */
53  }),
54  paint_context_({
55  TestT::mock_canvas().internal_canvas(), /* internal_nodes_canvas */
56  &TestT::mock_canvas(), /* leaf_nodes_canvas */
57  nullptr, /* gr_context */
58  nullptr, /* external_view_embedder */
59  raster_time_, ui_time_, texture_registry_,
60  nullptr, /* raster_cache */
61  false, /* checkerboard_offscreen_layers */
62  1.0f, /* frame_device_pixel_ratio */
63  }),
64  check_board_context_({
65  TestT::mock_canvas().internal_canvas(), /* internal_nodes_canvas */
66  &TestT::mock_canvas(), /* leaf_nodes_canvas */
67  nullptr, /* gr_context */
68  nullptr, /* external_view_embedder */
69  raster_time_, ui_time_, texture_registry_,
70  nullptr, /* raster_cache */
71  true, /* checkerboard_offscreen_layers */
72  1.0f, /* frame_device_pixel_ratio */
73  }) {
75  }
void use_null_raster_cache()
Use no raster cache in the preroll_context() and paint_context() structures.
Definition: layer_test.h:88
static constexpr SkRect kGiantRect
Definition: layer.h:38
SkNWayCanvas * internal_canvas()
Definition: mock_canvas.h:142

Member Function Documentation

◆ check_board_context()

template<typename BaseT>
Layer::PaintContext& flutter::testing::LayerTestBase< BaseT >::check_board_context ( )
inline

Definition at line 130 of file layer_test.h.

130 { return check_board_context_; }

◆ paint_context()

template<typename BaseT>
Layer::PaintContext& flutter::testing::LayerTestBase< BaseT >::paint_context ( )
inline

Definition at line 129 of file layer_test.h.

129 { return paint_context_; }

◆ preroll_context()

template<typename BaseT>
PrerollContext* flutter::testing::LayerTestBase< BaseT >::preroll_context ( )
inline

Definition at line 128 of file layer_test.h.

128 { return &preroll_context_; }

◆ raster_cache()

template<typename BaseT>
RasterCache* flutter::testing::LayerTestBase< BaseT >::raster_cache ( )
inline

Definition at line 127 of file layer_test.h.

Referenced by flutter::testing::LayerTestBase< ThreadTest >::check_board_context().

127 { return raster_cache_.get(); }

◆ texture_regitry()

template<typename BaseT>
TextureRegistry& flutter::testing::LayerTestBase< BaseT >::texture_regitry ( )
inline

Definition at line 126 of file layer_test.h.

126 { return texture_registry_; }

◆ use_mock_raster_cache()

template<typename BaseT>
void flutter::testing::LayerTestBase< BaseT >::use_mock_raster_cache ( )
inline

Use a mock raster cache in the preroll_context() and paint_context() structures.

This method must be called before using the preroll_context() and paint_context() structures in calls to the Layer::Preroll() and Layer::Paint() methods. The mock raster cache behaves like a normal raster cache with respect to decisions about when layers and pictures should be cached, but it does not incur the overhead of rendering the layers or caching the resulting pixels.

See also
use_null_raster_cache()
use_skia_raster_cache()

Definition at line 104 of file layer_test.h.

104  {
105  set_raster_cache_(std::make_unique<MockRasterCache>());
106  }

◆ use_null_raster_cache()

template<typename BaseT>
void flutter::testing::LayerTestBase< BaseT >::use_null_raster_cache ( )
inline

Use no raster cache in the preroll_context() and paint_context() structures.

This method must be called before using the preroll_context() and paint_context() structures in calls to the Layer::Preroll() and Layer::Paint() methods. This is the default mode of operation.

See also
use_mock_raster_cache()
use_skia_raster_cache()

Definition at line 88 of file layer_test.h.

Referenced by flutter::testing::LayerTestBase< ThreadTest >::LayerTestBase().

88 { set_raster_cache_(nullptr); }

◆ use_skia_raster_cache()

template<typename BaseT>
void flutter::testing::LayerTestBase< BaseT >::use_skia_raster_cache ( )
inline

Use a normal raster cache in the preroll_context() and paint_context() structures.

This method must be called before using the preroll_context() and paint_context() structures in calls to the Layer::Preroll() and Layer::Paint() methods. The Skia raster cache will behave identically to the raster cache typically used when handling a frame on a device including rendering the contents of pictures and layers to an SkImage, but using a software rather than a hardware renderer.

See also
use_null_raster_cache()
use_mock_raster_cache()

Definition at line 122 of file layer_test.h.

122  {
123  set_raster_cache_(std::make_unique<RasterCache>());
124  }

The documentation for this class was generated from the following file: