28 kInvisible_Flag = 1 << 0,
36 return !(fNodeFlags & kInvisible_Flag);
45 fNodeFlags = v ? (fNodeFlags & ~kInvisible_Flag)
46 : (fNodeFlags | kInvisible_Flag);
103 bool is_layer_paint)
const {
110 paint->setBlender(fBlender);
115 if (!is_layer_paint && fMaskShader) {
118 paint->refShader()));
125 , fRestoreCount(canvas->getSaveCount()) {}
128 if (fRestoreCount >= 0) {
132 mask_paint.
setShader(std::move(fMaskShader));
133 fCanvas->drawPaint(mask_paint);
135 fCanvas->restoreToCount(fRestoreCount);
141 SkASSERT(opacity >= 0 && opacity <= 1);
142 fCtx.fOpacity *= opacity;
143 return std::move(*
this);
149 return std::move(*
this);
156 fCtx.fShader = std::move(
sh);
157 fCtx.fShaderCTM = shader_ctm;
160 return std::move(*
this);
165 if (fCtx.fMaskShader) {
173 if (ms && fCtx.fMaskCTM.invert(&invMaskCTM)) {
176 std::move(fCtx.fMaskShader),
180 fCtx.fMaskShader = std::move(ms);
184 return std::move(*
this);
189 fCtx.fBlender = std::move(blender);
190 return std::move(*
this);
196 if (isolation && fCtx.requiresIsolation()) {
198 fCtx.modulatePaint(ctm, &layer_paint,
true);
199 fCanvas->saveLayer(
bounds, &layer_paint);
202 if (fCtx.fMaskShader) {
203 fMaskShader =
LocalShader(fCtx.fMaskShader, fCtx.fMaskCTM, ctm);
207 fCtx.fColorFilter =
nullptr;
208 fCtx.fMaskShader =
nullptr;
209 fCtx.fBlender =
nullptr;
213 return std::move(*
this);
221 fCtx.modulatePaint(ctm, &layer_paint);
230 fCanvas->saveLayer(
bounds, &layer_paint);
234 return std::move(*
this);
239 , fChildren(
std::move(children)) {
240 for (
const auto& child : fChildren) {
246 for (
const auto& child : fChildren) {
252 for (
const auto& child : fChildren) {
constexpr SkAlpha SK_AlphaOPAQUE
#define sk_float_round2int(x)
constexpr uint8_t SkToU8(S x)
static sk_sp< SkColorFilter > Compose(const sk_sp< SkColorFilter > &outer, sk_sp< SkColorFilter > inner)
static sk_sp< SkImageFilter > Blend(SkBlendMode mode, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground=nullptr, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Shader(sk_sp< SkShader > shader, const CropRect &cropRect={})
static SkMatrix Concat(const SkMatrix &a, const SkMatrix &b)
bool invert(SkMatrix *inverse) const
static const SkMatrix & I()
SkMatrix & preConcat(const SkMatrix &other)
sk_sp< SkShader > refShader() const
void setImageFilter(sk_sp< SkImageFilter > imageFilter)
void setShader(sk_sp< SkShader > shader)
void setBlendMode(SkBlendMode mode)
SkImageFilter * getImageFilter() const
SkShader * getShader() const
sk_sp< SkShader > makeWithLocalMatrix(const SkMatrix &) const
~CustomRenderNode() override
bool hasChildrenInval() const
CustomRenderNode(std::vector< sk_sp< RenderNode > > &&children)
static bool HasInval(const sk_sp< Node > &node)
void observeInval(const sk_sp< Node > &)
void unobserveInval(const sk_sp< Node > &)
const SkRect & bounds() const
void invalidate(bool damage=true)
ScopedRenderContext && setFilterIsolation(const SkRect &bounds, const SkMatrix &ctm, sk_sp< SkImageFilter >)
ScopedRenderContext && modulateOpacity(float opacity)
ScopedRenderContext && modulateMaskShader(sk_sp< SkShader >, const SkMatrix &ms_ctm)
ScopedRenderContext && setIsolation(const SkRect &bounds, const SkMatrix &ctm, bool do_isolate)
ScopedRenderContext(SkCanvas *, const RenderContext *)
ScopedRenderContext && modulateColorFilter(sk_sp< SkColorFilter >)
ScopedRenderContext && modulateBlender(sk_sp< SkBlender >)
ScopedRenderContext && modulateShader(sk_sp< SkShader >, const SkMatrix &shader_ctm)
void render(SkCanvas *, const RenderContext *=nullptr) const
virtual const RenderNode * onNodeAt(const SkPoint &p) const =0
const RenderNode * nodeAt(const SkPoint &point) const
virtual void onRender(SkCanvas *, const RenderContext *) const =0
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)
constexpr float x() const
bool contains(SkScalar x, SkScalar y) const
sk_sp< SkBlender > fBlender
sk_sp< SkColorFilter > fColorFilter
void modulatePaint(const SkMatrix &ctm, SkPaint *, bool is_layer_paint=false) const
bool requiresIsolation() const
sk_sp< SkShader > fMaskShader