Defer loading particle effect to load time.
Moving this out of the constructor means less going on at slide creation
time, making debugging easier.
Change-Id: I37bdd249abef663931bc8ef152a92a3a3436dcf4
Reviewed-on: https://skia-review.googlesource.com/c/192600
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
diff --git a/tools/viewer/ParticlesSlide.cpp b/tools/viewer/ParticlesSlide.cpp
index 5c34f3c..c91e9bf 100644
--- a/tools/viewer/ParticlesSlide.cpp
+++ b/tools/viewer/ParticlesSlide.cpp
@@ -234,8 +234,10 @@
REGISTER_REFLECTED(SkReflected);
SkParticleAffector::RegisterAffectorTypes();
SkParticleEmitter::RegisterEmitterTypes();
-
fName = "Particles";
+}
+
+void ParticlesSlide::load(SkScalar winWidth, SkScalar winHeight) {
fEffect.reset(new SkParticleEffect(LoadEffectParams("resources/particles/default.json")));
}
diff --git a/tools/viewer/ParticlesSlide.h b/tools/viewer/ParticlesSlide.h
index 7f0e5b8..07c9cfa 100644
--- a/tools/viewer/ParticlesSlide.h
+++ b/tools/viewer/ParticlesSlide.h
@@ -22,6 +22,7 @@
// TODO: We need a way for primarily interactive slides to always be as large as the window
SkISize getDimensions() const override { return SkISize::MakeEmpty(); }
+ void load(SkScalar winWidth, SkScalar winHeight) override;
void draw(SkCanvas* canvas) override;
bool animate(const SkAnimTimer& timer) override;