Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
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 SkIRect &additional_damage=SkIRect::MakeEmpty(), int horizontal_clip_alignment=0, int vertical_alignment=0, bool use_raster_cache=true, bool impeller_enabled=false)
 
sk_sp< DisplayListCreateDisplayList (const SkRect &bounds, DlColor color=DlColor::kBlack())
 
std::shared_ptr< DisplayListLayerCreateDisplayListLayer (const sk_sp< DisplayList > &display_list, const SkPoint &offset=SkPoint::Make(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, SkAlpha alpha, const SkPoint &offset=SkPoint::Make(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. 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...
 
std::vector< RasterCacheItem * > & cacheable_items ()
 
std::shared_ptr< TextureRegistrytexture_registry ()
 
RasterCacheraster_cache ()
 
PrerollContextpreroll_context ()
 
PaintContextpaint_context ()
 
PaintContextdisplay_list_paint_context ()
 
LayerSnapshotStorelayer_snapshot_store ()
 
sk_sp< DisplayListdisplay_list ()
 
void reset_display_list ()
 
void enable_leaf_layer_tracing ()
 
void disable_leaf_layer_tracing ()
 
- Public Member Functions inherited from flutter::testing::CanvasTestBase< BaseT >
 CanvasTestBase ()=default
 
MockCanvasmock_canvas ()
 
sk_sp< SkColorSpacemock_color_space ()
 

Detailed Description

Definition at line 37 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 47 of file diff_context_test.cc.

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

◆ CreateContainerLayer() [2/2]

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

Definition at line 61 of file diff_context_test.h.

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

◆ CreateDisplayList()

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

Definition at line 34 of file diff_context_test.cc.

35 {
36 DisplayListBuilder builder;
37 builder.DrawRect(bounds, DlPaint().setColor(color));
38 return builder.Build();
39}
DlColor color
Optional< SkRect > bounds
Definition: SkRecords.h:189
flutter::DlPaint DlPaint

◆ CreateDisplayListLayer()

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

Definition at line 41 of file diff_context_test.cc.

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

◆ CreateOpacityLater()

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

Definition at line 56 of file diff_context_test.cc.

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

◆ DiffLayerTree()

Damage flutter::testing::DiffContextTest::DiffLayerTree ( MockLayerTree layer_tree,
const MockLayerTree old_layer_tree,
const SkIRect additional_damage = SkIRect::MakeEmpty(),
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(
28 SkRect::MakeIWH(layer_tree.size().width(), layer_tree.size().height()));
29 layer_tree.root()->Diff(&dc, old_layer_tree.root());
30 return dc.ComputeDamage(additional_damage, horizontal_clip_alignment,
31 vertical_clip_alignment);
32}
#define FML_CHECK(condition)
Definition: logging.h:85
static SkRect MakeIWH(int w, int h)
Definition: SkRect.h:623

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