Flutter Engine
flutter::ShaderMaskLayer Class Reference

#include <shader_mask_layer.h>

Inheritance diagram for flutter::ShaderMaskLayer:
flutter::ContainerLayer flutter::Layer

Public Member Functions

 ShaderMaskLayer (sk_sp< SkShader > shader, const SkRect &mask_rect, SkBlendMode blend_mode)
 
void Preroll (PrerollContext *context, const SkMatrix &matrix) override
 
void Paint (PaintContext &context) const override
 
- Public Member Functions inherited from flutter::ContainerLayer
 ContainerLayer ()
 
virtual void Add (std::shared_ptr< Layer > layer)
 
const std::vector< std::shared_ptr< Layer > > & layers () const
 
- 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
 

Additional Inherited Members

- Protected Member Functions inherited from flutter::ContainerLayer
void PrerollChildren (PrerollContext *context, const SkMatrix &child_matrix, SkRect *child_paint_bounds)
 
void PaintChildren (PaintContext &context) const
 
- Static Protected Member Functions inherited from flutter::ContainerLayer
static void TryToPrepareRasterCache (PrerollContext *context, Layer *layer, const SkMatrix &matrix)
 

Detailed Description

Definition at line 13 of file shader_mask_layer.h.

Constructor & Destructor Documentation

◆ ShaderMaskLayer()

flutter::ShaderMaskLayer::ShaderMaskLayer ( sk_sp< SkShader >  shader,
const SkRect &  mask_rect,
SkBlendMode  blend_mode 
)

Definition at line 9 of file shader_mask_layer.cc.

References FML_DCHECK.

12  : shader_(shader), mask_rect_(mask_rect), blend_mode_(blend_mode) {}

Member Function Documentation

◆ Paint()

void flutter::ShaderMaskLayer::Paint ( PaintContext context) const
overridevirtual

Reimplemented from flutter::ContainerLayer.

Definition at line 40 of file shader_mask_layer.cc.

References flutter::Layer::AutoSaveLayer::Create(), FML_DCHECK, flutter::Layer::PaintContext::leaf_nodes_canvas, flutter::Layer::needs_painting(), flutter::Layer::paint_bounds(), flutter::ContainerLayer::PaintChildren(), and TRACE_EVENT0.

40  {
41  TRACE_EVENT0("flutter", "ShaderMaskLayer::Paint");
42  FML_DCHECK(needs_painting(context));
43 
44  Layer::AutoSaveLayer save =
45  Layer::AutoSaveLayer::Create(context, paint_bounds(), nullptr);
46  PaintChildren(context);
47 
48  SkPaint paint;
49  paint.setBlendMode(blend_mode_);
50  paint.setShader(shader_);
51  context.leaf_nodes_canvas->translate(mask_rect_.left(), mask_rect_.top());
52  context.leaf_nodes_canvas->drawRect(
53  SkRect::MakeWH(mask_rect_.width(), mask_rect_.height()), paint);
54 }
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:90
#define FML_DCHECK(condition)
Definition: logging.h:86
bool needs_painting(PaintContext &context) const
Definition: layer.h:249
const SkRect & paint_bounds() const
Definition: layer.h:227
void PaintChildren(PaintContext &context) const
static AutoSaveLayer Create(const PaintContext &paint_context, const SkRect &bounds, const SkPaint *paint, SaveMode save_mode=SaveMode::kInternalNodesCanvas)
Definition: layer.cc:82

◆ Preroll()

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

Reimplemented from flutter::ContainerLayer.

Definition at line 34 of file shader_mask_layer.cc.

References flutter::Layer::AutoPrerollSaveLayerState::Create(), and flutter::ContainerLayer::Preroll().

34  {
35  Layer::AutoPrerollSaveLayerState save =
37  ContainerLayer::Preroll(context, matrix);
38 }
static AutoPrerollSaveLayerState Create(PrerollContext *preroll_context, bool save_layer_is_active=true, bool layer_itself_performs_readback=false)
Definition: layer.cc:44
void Preroll(PrerollContext *context, const SkMatrix &matrix) override

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