Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
skottie::internal::TextAdapter::GlyphDecoratorNode Class Referencefinal
Inheritance diagram for skottie::internal::TextAdapter::GlyphDecoratorNode:
sksg::Group sksg::RenderNode sksg::Node SkRefCnt SkRefCntBase

Public Member Functions

 GlyphDecoratorNode (sk_sp< GlyphDecorator > decorator, float scale)
 
 ~GlyphDecoratorNode () override=default
 
void updateFragmentData (const std::vector< TextAdapter::FragmentRec > &recs)
 
SkRect onRevalidate (sksg::InvalidationController *ic, const SkMatrix &ctm) override
 
void onRender (SkCanvas *canvas, const RenderContext *ctx) const override
 
- Public Member Functions inherited from sksg::Group
void addChild (sk_sp< RenderNode >)
 
void removeChild (const sk_sp< RenderNode > &)
 
size_t size () const
 
bool empty () const
 
void clear ()
 
- Public Member Functions inherited from sksg::RenderNode
void render (SkCanvas *, const RenderContext *=nullptr) const
 
const RenderNodenodeAt (const SkPoint &point) const
 
bool isVisible () const
 
void setVisible (bool)
 
- Public Member Functions inherited from sksg::Node
const SkRectrevalidate (InvalidationController *, const SkMatrix &)
 
void invalidate (bool damage=true)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Static Public Member Functions inherited from sksg::Group
static sk_sp< GroupMake ()
 
static sk_sp< GroupMake (std::vector< sk_sp< RenderNode > > children)
 
- Protected Types inherited from sksg::Node
enum  InvalTraits { kBubbleDamage_Trait = 1 << 0 , kOverrideDamage_Trait = 1 << 1 }
 
- Protected Member Functions inherited from sksg::Group
 Group ()
 
 Group (std::vector< sk_sp< RenderNode > >)
 
 ~Group () override
 
void onRender (SkCanvas *, const RenderContext *) const override
 
const RenderNodeonNodeAt (const SkPoint &) const override
 
SkRect onRevalidate (InvalidationController *, const SkMatrix &) override
 
- Protected Member Functions inherited from sksg::RenderNode
 RenderNode (uint32_t inval_traits=0)
 
virtual void onRender (SkCanvas *, const RenderContext *) const =0
 
virtual const RenderNodeonNodeAt (const SkPoint &p) const =0
 
- Protected Member Functions inherited from sksg::Node
 Node (uint32_t invalTraits)
 
 ~Node () override
 
const SkRectbounds () const
 
bool hasInval () const
 
virtual SkRect onRevalidate (InvalidationController *, const SkMatrix &ctm)=0
 
void observeInval (const sk_sp< Node > &)
 
void unobserveInval (const sk_sp< Node > &)
 

Detailed Description

Definition at line 109 of file TextAdapter.cpp.

Constructor & Destructor Documentation

◆ GlyphDecoratorNode()

skottie::internal::TextAdapter::GlyphDecoratorNode::GlyphDecoratorNode ( sk_sp< GlyphDecorator decorator,
float  scale 
)
inline

Definition at line 111 of file TextAdapter.cpp.

112 : fDecorator(std::move(decorator))
113 , fScale(scale)
114 {}
const Scalar scale

◆ ~GlyphDecoratorNode()

skottie::internal::TextAdapter::GlyphDecoratorNode::~GlyphDecoratorNode ( )
overridedefault

Member Function Documentation

◆ onRender()

void skottie::internal::TextAdapter::GlyphDecoratorNode::onRender ( SkCanvas canvas,
const RenderContext ctx 
) const
inlineoverridevirtual

Implements sksg::RenderNode.

Definition at line 149 of file TextAdapter.cpp.

149 {
150 auto local_ctx = ScopedRenderContext(canvas, ctx).setIsolation(this->bounds(),
151 canvas->getTotalMatrix(),
152 true);
153 this->INHERITED::onRender(canvas, local_ctx);
154
155 fDecorator->onDecorate(canvas, {
156 SkSpan(fDecoratorInfo.get(), fFragCount),
157 fScale
158 });
159 }
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >
SkMatrix getTotalMatrix() const
Definition: SkCanvas.cpp:1629
const SkRect & bounds() const
Definition: SkSGNode.h:55

◆ onRevalidate()

SkRect skottie::internal::TextAdapter::GlyphDecoratorNode::onRevalidate ( sksg::InvalidationController ic,
const SkMatrix ctm 
)
inlineoverridevirtual

Implements sksg::Node.

Definition at line 133 of file TextAdapter.cpp.

133 {
134 const auto child_bounds = INHERITED::onRevalidate(ic, ctm);
135
136 for (size_t i = 0; i < fFragCount; ++i) {
137 const auto* glyphs = fFragInfo[i].fGlyphs;
138 fDecoratorInfo[i].fBounds =
140 fDecoratorInfo[i].fMatrix = sksg::TransformPriv::As<SkMatrix>(fFragInfo[i].fMatrixNode);
141
142 fDecoratorInfo[i].fCluster = glyphs->fClusters.empty() ? 0 : glyphs->fClusters.front();
143 fDecoratorInfo[i].fAdvance = fFragInfo[i].fAdvance;
144 }
145
146 return child_bounds;
147 }
uint16_t glyphs[5]
Definition: FontMgrTest.cpp:46

◆ updateFragmentData()

void skottie::internal::TextAdapter::GlyphDecoratorNode::updateFragmentData ( const std::vector< TextAdapter::FragmentRec > &  recs)
inline

Definition at line 118 of file TextAdapter.cpp.

118 {
119 fFragCount = recs.size();
120
121 SkASSERT(!fFragInfo);
122 fFragInfo = std::make_unique<FragmentInfo[]>(recs.size());
123
124 for (size_t i = 0; i < recs.size(); ++i) {
125 const auto& rec = recs[i];
126 fFragInfo[i] = {rec.fGlyphs, rec.fMatrixNode, rec.fAdvance};
127 }
128
129 SkASSERT(!fDecoratorInfo);
130 fDecoratorInfo = std::make_unique<GlyphDecorator::GlyphInfo[]>(recs.size());
131 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

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