Use onOnceBeforeDraw instead of constructor for glyphs.
The PathText samples extracted glyph paths in the constructor, which means that this is done when the sample is created instead of when it is actually going to be drawn. This interferes with debugging other samples, so delay extracting the glyph paths until onOnceBeforeDraw. Change-Id: I342cc728b79426203273e5a19fb5ba3718c50fd6 Reviewed-on: https://skia-review.googlesource.com/155000 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
bc9a1a837d
commit
9d289e2775
@ -23,7 +23,15 @@ public:
|
||||
constexpr static int kNumPaths = 1500;
|
||||
virtual const char* getName() const { return "PathText"; }
|
||||
|
||||
PathText() {
|
||||
PathText() {}
|
||||
|
||||
virtual void reset() {
|
||||
for (Glyph& glyph : fGlyphs) {
|
||||
glyph.reset(fRand, this->width(), this->height());
|
||||
}
|
||||
}
|
||||
|
||||
void onOnceBeforeDraw() final {
|
||||
SkPaint defaultPaint;
|
||||
auto cache = SkStrikeCache::FindOrCreateStrikeExclusive(defaultPaint);
|
||||
SkPath glyphPaths[52];
|
||||
@ -38,15 +46,10 @@ public:
|
||||
const SkPath& p = glyphPaths[i % 52];
|
||||
fGlyphs[i].init(fRand, p);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void reset() {
|
||||
for (Glyph& glyph : fGlyphs) {
|
||||
glyph.reset(fRand, this->width(), this->height());
|
||||
}
|
||||
this->INHERITED::onOnceBeforeDraw();
|
||||
this->reset();
|
||||
}
|
||||
|
||||
void onOnceBeforeDraw() final { this->INHERITED::onOnceBeforeDraw(); this->reset(); }
|
||||
void onSizeChange() final { this->INHERITED::onSizeChange(); this->reset(); }
|
||||
|
||||
bool onQuery(Sample::Event* evt) final {
|
||||
|
Loading…
Reference in New Issue
Block a user