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 ()
 
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
 

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.

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 24 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.

24  {
25  TRACE_EVENT0("flutter", "ShaderMaskLayer::Paint");
27 
28  Layer::AutoSaveLayer save =
29  Layer::AutoSaveLayer::Create(context, paint_bounds(), nullptr);
30  PaintChildren(context);
31 
32  SkPaint paint;
33  paint.setBlendMode(blend_mode_);
34  paint.setShader(shader_);
35  context.leaf_nodes_canvas->translate(mask_rect_.left(), mask_rect_.top());
36  context.leaf_nodes_canvas->drawRect(
37  SkRect::MakeWH(mask_rect_.width(), mask_rect_.height()), paint);
38 }
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:75
#define FML_DCHECK(condition)
Definition: logging.h:86
static AutoSaveLayer Create(const PaintContext &paint_context, const SkRect &bounds, const SkPaint *paint)
Definition: layer.cc:96
bool needs_painting() const
Definition: layer.h:174
const SkRect & paint_bounds() const
Definition: layer.h:166
void PaintChildren(PaintContext &context) const

◆ Preroll()

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

Reimplemented from flutter::ContainerLayer.

Definition at line 14 of file shader_mask_layer.cc.

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

14  {
15 #if defined(LEGACY_FUCHSIA_EMBEDDER)
16  CheckForChildLayerBelow(context);
17 #endif
18 
19  Layer::AutoPrerollSaveLayerState save =
21  ContainerLayer::Preroll(context, matrix);
22 }
static AutoPrerollSaveLayerState Create(PrerollContext *preroll_context, bool save_layer_is_active=true, bool layer_itself_performs_readback=false)
Definition: layer.cc:43
void Preroll(PrerollContext *context, const SkMatrix &matrix) override

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