Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
sksg::RenderNode::RenderContext Struct Reference

#include <SkSGRenderNode.h>

Public Member Functions

bool requiresIsolation () const
 
void modulatePaint (const SkMatrix &ctm, SkPaint *, bool is_layer_paint=false) const
 

Public Attributes

sk_sp< SkColorFilterfColorFilter
 
sk_sp< SkShaderfShader
 
sk_sp< SkShaderfMaskShader
 
sk_sp< SkBlenderfBlender
 
SkMatrix fShaderCTM = SkMatrix::I()
 
SkMatrix fMaskCTM = SkMatrix::I()
 
float fOpacity = 1
 

Detailed Description

Definition at line 60 of file SkSGRenderNode.h.

Member Function Documentation

◆ modulatePaint()

void sksg::RenderNode::RenderContext::modulatePaint ( const SkMatrix ctm,
SkPaint paint,
bool  is_layer_paint = false 
) const

Definition at line 102 of file SkSGRenderNode.cpp.

103 {
104 paint->setAlpha(ScaleAlpha(paint->getAlpha(), fOpacity));
105 paint->setColorFilter(SkColorFilters::Compose(fColorFilter, paint->refColorFilter()));
106 if (fShader) {
107 paint->setShader(LocalShader(fShader, fShaderCTM, ctm));
108 }
109 if (fBlender) {
110 paint->setBlender(fBlender);
111 }
112
113 // Only apply the shader mask for regular paints. Isolation layers require
114 // special handling on restore.
115 if (!is_layer_paint && fMaskShader) {
118 paint->refShader()));
119 }
120}
@ kSrcIn
r = s * da
static sk_sp< SkColorFilter > Compose(const sk_sp< SkColorFilter > &outer, sk_sp< SkColorFilter > inner)
Definition: SkColorFilter.h:92
const Paint & paint
Definition: color_source.cc:38
SK_API sk_sp< SkShader > Blend(SkBlendMode mode, sk_sp< SkShader > dst, sk_sp< SkShader > src)
static sk_sp< SkShader > LocalShader(const sk_sp< SkShader > &shader, const SkMatrix &base, const SkMatrix &ctm)
static SkAlpha ScaleAlpha(SkAlpha alpha, float opacity)
sk_sp< SkColorFilter > fColorFilter

◆ requiresIsolation()

bool sksg::RenderNode::RenderContext::requiresIsolation ( ) const

Definition at line 94 of file SkSGRenderNode.cpp.

94 {
95 // Note: fShader is never applied on isolation layers.
99 || fBlender;
100}
constexpr SkAlpha SK_AlphaOPAQUE
Definition: SkColor.h:94

Member Data Documentation

◆ fBlender

sk_sp<SkBlender> sksg::RenderNode::RenderContext::fBlender

Definition at line 64 of file SkSGRenderNode.h.

◆ fColorFilter

sk_sp<SkColorFilter> sksg::RenderNode::RenderContext::fColorFilter

Definition at line 61 of file SkSGRenderNode.h.

◆ fMaskCTM

SkMatrix sksg::RenderNode::RenderContext::fMaskCTM = SkMatrix::I()

Definition at line 66 of file SkSGRenderNode.h.

◆ fMaskShader

sk_sp<SkShader> sksg::RenderNode::RenderContext::fMaskShader

Definition at line 63 of file SkSGRenderNode.h.

◆ fOpacity

float sksg::RenderNode::RenderContext::fOpacity = 1

Definition at line 67 of file SkSGRenderNode.h.

◆ fShader

sk_sp<SkShader> sksg::RenderNode::RenderContext::fShader

Definition at line 62 of file SkSGRenderNode.h.

◆ fShaderCTM

SkMatrix sksg::RenderNode::RenderContext::fShaderCTM = SkMatrix::I()

Definition at line 65 of file SkSGRenderNode.h.


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