Cache/inline ishardbreak
~ 5% improvement Change-Id: I6411bce47301af038202cf2de408e52e43e660cc Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386563 Reviewed-by: Julia Lavrova <jlavrova@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
7b39c3d1ae
commit
adbaeaa365
@ -358,10 +358,6 @@ SkFont Cluster::font() const {
|
||||
return fOwner->run(fRunIndex).font();
|
||||
}
|
||||
|
||||
bool Cluster::isHardBreak() const {
|
||||
return fOwner->codeUnitHasProperty(fTextRange.end, CodeUnitFlags::kHardLineBreakBefore);
|
||||
}
|
||||
|
||||
bool Cluster::isSoftBreak() const {
|
||||
return fOwner->codeUnitHasProperty(fTextRange.end, CodeUnitFlags::kSoftLineBreakBefore);
|
||||
}
|
||||
@ -390,6 +386,7 @@ Cluster::Cluster(ParagraphImpl* owner,
|
||||
size_t len = fOwner->getWhitespacesLength(fTextRange);
|
||||
fIsWhiteSpaces = (len == this->fTextRange.width());
|
||||
fIsSpaces = fOwner->isSpace(fTextRange);
|
||||
fIsHardBreak = fOwner->codeUnitHasProperty(fTextRange.end, CodeUnitFlags::kHardLineBreakBefore);
|
||||
}
|
||||
|
||||
} // namespace textlayout
|
||||
|
@ -249,7 +249,7 @@ public:
|
||||
|
||||
bool isWhitespaces() const { return fIsWhiteSpaces; }
|
||||
bool isSpaces() const { return fIsSpaces; }
|
||||
bool isHardBreak() const;
|
||||
bool isHardBreak() const { return fIsHardBreak; }
|
||||
bool isSoftBreak() const;
|
||||
bool isGraphemeBreak() const;
|
||||
bool canBreakLineAfter() const { return isHardBreak() || isSoftBreak(); }
|
||||
@ -300,6 +300,7 @@ private:
|
||||
SkScalar fHalfLetterSpacing;
|
||||
bool fIsWhiteSpaces;
|
||||
bool fIsSpaces;
|
||||
bool fIsHardBreak;
|
||||
};
|
||||
|
||||
class InternalLineMetrics {
|
||||
|
Loading…
Reference in New Issue
Block a user