Flutter Engine
flutter::testing::MockLayer Class Reference

#include <mock_layer.h>

Inheritance diagram for flutter::testing::MockLayer:
flutter::Layer

Public Member Functions

 MockLayer (SkPath path, SkPaint paint=SkPaint(), bool fake_has_platform_view=false, bool fake_needs_system_composite=false, bool fake_reads_surface=false)
 
void Preroll (PrerollContext *context, const SkMatrix &matrix) override
 
void Paint (PaintContext &context) const override
 
const MutatorsStackparent_mutators ()
 
const SkMatrix & parent_matrix ()
 
const SkRect & parent_cull_rect ()
 
bool parent_has_platform_view ()
 
- Public Member Functions inherited from flutter::Layer
 Layer ()
 
virtual ~Layer ()
 
bool needs_system_composite () const
 
void set_needs_system_composite (bool value)
 
const SkRect & paint_bounds () const
 
void set_paint_bounds (const SkRect &paint_bounds)
 
bool needs_painting () const
 
uint64_t unique_id () const
 

Detailed Description

Definition at line 17 of file mock_layer.h.

Constructor & Destructor Documentation

◆ MockLayer()

flutter::testing::MockLayer::MockLayer ( SkPath  path,
SkPaint  paint = SkPaint(),
bool  fake_has_platform_view = false,
bool  fake_needs_system_composite = false,
bool  fake_reads_surface = false 
)

Definition at line 10 of file mock_layer.cc.

15  : fake_paint_path_(path),
16  fake_paint_(paint),
17  fake_has_platform_view_(fake_has_platform_view),
18  fake_needs_system_composite_(fake_needs_system_composite),
19  fake_reads_surface_(fake_reads_surface) {}
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32

Member Function Documentation

◆ Paint()

void flutter::testing::MockLayer::Paint ( PaintContext context) const
overridevirtual

Implements flutter::Layer.

Definition at line 35 of file mock_layer.cc.

References FML_DCHECK, flutter::Layer::PaintContext::leaf_nodes_canvas, and flutter::Layer::needs_painting().

35  {
37 
38  context.leaf_nodes_canvas->drawPath(fake_paint_path_, fake_paint_);
39 }
#define FML_DCHECK(condition)
Definition: logging.h:86
bool needs_painting() const
Definition: layer.h:174

◆ parent_cull_rect()

const SkRect& flutter::testing::MockLayer::parent_cull_rect ( )
inline

Definition at line 30 of file mock_layer.h.

30 { return parent_cull_rect_; }

◆ parent_has_platform_view()

bool flutter::testing::MockLayer::parent_has_platform_view ( )
inline

Definition at line 31 of file mock_layer.h.

31 { return parent_has_platform_view_; }

◆ parent_matrix()

const SkMatrix& flutter::testing::MockLayer::parent_matrix ( )
inline

Definition at line 29 of file mock_layer.h.

29 { return parent_matrix_; }

◆ parent_mutators()

const MutatorsStack& flutter::testing::MockLayer::parent_mutators ( )
inline

Definition at line 28 of file mock_layer.h.

28 { return parent_mutators_; }

◆ Preroll()

void flutter::testing::MockLayer::Preroll ( PrerollContext context,
const SkMatrix &  matrix 
)
overridevirtual

Reimplemented from flutter::Layer.

Definition at line 21 of file mock_layer.cc.

References flutter::PrerollContext::cull_rect, flutter::PrerollContext::has_platform_view, flutter::PrerollContext::mutators_stack, flutter::Layer::set_needs_system_composite(), flutter::Layer::set_paint_bounds(), and flutter::PrerollContext::surface_needs_readback.

21  {
22  parent_mutators_ = context->mutators_stack;
23  parent_matrix_ = matrix;
24  parent_cull_rect_ = context->cull_rect;
25  parent_has_platform_view_ = context->has_platform_view;
26 
27  context->has_platform_view = fake_has_platform_view_;
28  set_paint_bounds(fake_paint_path_.getBounds());
29  set_needs_system_composite(fake_needs_system_composite_);
30  if (fake_reads_surface_) {
31  context->surface_needs_readback = true;
32  }
33 }
void set_paint_bounds(const SkRect &paint_bounds)
Definition: layer.h:170
void set_needs_system_composite(bool value)
Definition: layer.h:162

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