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_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 ()
 
void AssignOldLayer (Layer *old_layer)
 
bool subtree_has_platform_view () const
 
void set_subtree_has_platform_view (bool value)
 
const SkRect & paint_bounds () const
 
void set_paint_bounds (const SkRect &paint_bounds)
 
bool is_empty () const
 
bool needs_painting (PaintContext &context) const
 
uint64_t original_layer_id () 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_reads_surface = false 
)

Definition at line 10 of file mock_layer.cc.

14  : fake_paint_path_(path),
15  fake_paint_(paint),
16  fake_has_platform_view_(fake_has_platform_view),
17  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 51 of file mock_layer.cc.

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

51  {
52  FML_DCHECK(needs_painting(context));
53 
54  context.leaf_nodes_canvas->drawPath(fake_paint_path_, fake_paint_);
55 }
#define FML_DCHECK(condition)
Definition: logging.h:86
bool needs_painting(PaintContext &context) const
Definition: layer.h:249

◆ parent_cull_rect()

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

Definition at line 29 of file mock_layer.h.

29 { return parent_cull_rect_; }

◆ parent_has_platform_view()

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

Definition at line 30 of file mock_layer.h.

30 { return parent_has_platform_view_; }

◆ parent_matrix()

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

Definition at line 28 of file mock_layer.h.

28 { return parent_matrix_; }

◆ parent_mutators()

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

Definition at line 27 of file mock_layer.h.

27 { return parent_mutators_; }

◆ Preroll()

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

Reimplemented from flutter::Layer.

Definition at line 38 of file mock_layer.cc.

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

Referenced by flutter::testing::MockRasterCache::AddMockLayer().

38  {
39  parent_mutators_ = context->mutators_stack;
40  parent_matrix_ = matrix;
41  parent_cull_rect_ = context->cull_rect;
42  parent_has_platform_view_ = context->has_platform_view;
43 
44  context->has_platform_view = fake_has_platform_view_;
45  set_paint_bounds(fake_paint_path_.getBounds());
46  if (fake_reads_surface_) {
47  context->surface_needs_readback = true;
48  }
49 }
void set_paint_bounds(const SkRect &paint_bounds)
Definition: layer.h:240

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