Flutter Engine
 
Loading...
Searching...
No Matches
flutter::testing::DiffContextTest Class Reference

#include <diff_context_test.h>

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

Public Member Functions

 DiffContextTest ()
 
Damage DiffLayerTree (MockLayerTree &layer_tree, const MockLayerTree &old_layer_tree, const DlIRect &additional_damage=DlIRect(), int horizontal_clip_alignment=0, int vertical_alignment=0, bool use_raster_cache=true, bool impeller_enabled=false)
 
sk_sp< DisplayListCreateDisplayList (const DlRect &bounds, DlColor color=DlColor::kBlack())
 
std::shared_ptr< DisplayListLayerCreateDisplayListLayer (const sk_sp< DisplayList > &display_list, const DlPoint &offset=DlPoint(0, 0))
 
std::shared_ptr< ContainerLayerCreateContainerLayer (std::initializer_list< std::shared_ptr< Layer > > layers)
 
std::shared_ptr< ContainerLayerCreateContainerLayer (std::shared_ptr< Layer > l)
 
std::shared_ptr< OpacityLayerCreateOpacityLater (std::initializer_list< std::shared_ptr< Layer > > layers, uint8_t alpha, const DlPoint &offset=DlPoint(0, 0))
 
- Public Member Functions inherited from flutter::testing::LayerTestBase< BaseT >
 LayerTestBase ()
 
void use_null_raster_cache ()
 Use no raster cache in the preroll_context() and paint_context() structures.
 
void use_mock_raster_cache ()
 Use a mock raster cache in the preroll_context() and paint_context() structures.
 
void use_skia_raster_cache ()
 Use a normal raster cache in the preroll_context() and paint_context() structures.
 
std::vector< RasterCacheItem * > & cacheable_items ()
 
std::shared_ptr< TextureRegistrytexture_registry ()
 
RasterCacheraster_cache ()
 
PrerollContextpreroll_context ()
 
PaintContextpaint_context ()
 
PaintContextdisplay_list_paint_context ()
 
sk_sp< DisplayListdisplay_list ()
 
void reset_display_list ()
 
- Public Member Functions inherited from flutter::testing::CanvasTestBase< BaseT >
 CanvasTestBase ()=default
 
sk_sp< SkColorSpace > mock_color_space ()
 

Detailed Description

Definition at line 38 of file diff_context_test.h.

Constructor & Destructor Documentation

◆ DiffContextTest()

flutter::testing::DiffContextTest::DiffContextTest ( )

Definition at line 13 of file diff_context_test.cc.

13{}

Member Function Documentation

◆ CreateContainerLayer() [1/2]

std::shared_ptr< ContainerLayer > flutter::testing::DiffContextTest::CreateContainerLayer ( std::initializer_list< std::shared_ptr< Layer > >  layers)

Definition at line 46 of file diff_context_test.cc.

47 {
48 auto res = std::make_shared<ContainerLayer>();
49 for (const auto& l : layers) {
50 res->Add(l);
51 }
52 return res;
53}
const FlutterLayer ** layers

References layers.

Referenced by CreateContainerLayer().

◆ CreateContainerLayer() [2/2]

std::shared_ptr< ContainerLayer > flutter::testing::DiffContextTest::CreateContainerLayer ( std::shared_ptr< Layer l)
inline

Definition at line 62 of file diff_context_test.h.

63 {
64 return CreateContainerLayer({std::move(l)});
65 }
std::shared_ptr< ContainerLayer > CreateContainerLayer(std::initializer_list< std::shared_ptr< Layer > > layers)

References CreateContainerLayer().

◆ CreateDisplayList()

sk_sp< DisplayList > flutter::testing::DiffContextTest::CreateDisplayList ( const DlRect bounds,
DlColor  color = DlColor::kBlack() 
)

Definition at line 33 of file diff_context_test.cc.

34 {
35 DisplayListBuilder builder;
36 builder.DrawRect(bounds, DlPaint().setColor(color));
37 return builder.Build();
38}
flutter::DlPaint DlPaint

References flutter::DisplayListBuilder::Build(), and flutter::DisplayListBuilder::DrawRect().

◆ CreateDisplayListLayer()

std::shared_ptr< DisplayListLayer > flutter::testing::DiffContextTest::CreateDisplayListLayer ( const sk_sp< DisplayList > &  display_list,
const DlPoint offset = DlPoint(0, 0) 
)

Definition at line 40 of file diff_context_test.cc.

42 {
43 return std::make_shared<DisplayListLayer>(offset, display_list, false, false);
44}
sk_sp< DisplayList > display_list()
Definition layer_test.h:139

References flutter::testing::LayerTestBase< BaseT >::display_list().

◆ CreateOpacityLater()

std::shared_ptr< OpacityLayer > flutter::testing::DiffContextTest::CreateOpacityLater ( std::initializer_list< std::shared_ptr< Layer > >  layers,
uint8_t  alpha,
const DlPoint offset = DlPoint(0, 0) 
)

Definition at line 55 of file diff_context_test.cc.

58 {
59 auto res = std::make_shared<OpacityLayer>(alpha, offset);
60 for (const auto& l : layers) {
61 res->Add(l);
62 }
63 return res;
64}

References layers.

◆ DiffLayerTree()

Damage flutter::testing::DiffContextTest::DiffLayerTree ( MockLayerTree layer_tree,
const MockLayerTree old_layer_tree,
const DlIRect additional_damage = DlIRect(),
int  horizontal_clip_alignment = 0,
int  vertical_alignment = 0,
bool  use_raster_cache = true,
bool  impeller_enabled = false 
)

Definition at line 15 of file diff_context_test.cc.

21 {
22 FML_CHECK(layer_tree.size() == old_layer_tree.size());
23
24 DiffContext dc(layer_tree.size(), layer_tree.paint_region_map(),
25 old_layer_tree.paint_region_map(), use_raster_cache,
26 impeller_enabled);
27 dc.PushCullRect(DlRect::MakeSize(layer_tree.size()));
28 layer_tree.root()->Diff(&dc, old_layer_tree.root());
29 return dc.ComputeDamage(additional_damage, horizontal_clip_alignment,
30 vertical_clip_alignment);
31}
#define FML_CHECK(condition)
Definition logging.h:104
static constexpr TRect MakeSize(const TSize< U > &size)
Definition rect.h:150

References flutter::DiffContext::ComputeDamage(), flutter::ContainerLayer::Diff(), FML_CHECK, impeller::TRect< Scalar >::MakeSize(), flutter::testing::MockLayerTree::paint_region_map(), flutter::DiffContext::PushCullRect(), flutter::testing::MockLayerTree::root(), and flutter::testing::MockLayerTree::size().


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