change particleslide to use Resources

standard way to find assets across different platforms

Bug: skia:
Change-Id: I4cb464be1e643a59431eba66b5caad70ecfed1e9
Reviewed-on: https://skia-review.googlesource.com/c/196775
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2019-03-02 17:57:20 -05:00 committed by Skia Commit-Bot
parent 0d7012a80c
commit 58a75383a7

View File

@ -8,6 +8,7 @@
#include "ParticlesSlide.h"
#include "ImGuiLayer.h"
#include "Resources.h"
#include "SkParticleAffector.h"
#include "SkParticleDrawable.h"
#include "SkParticleEffect.h"
@ -183,7 +184,7 @@ private:
static sk_sp<SkParticleEffectParams> LoadEffectParams(const char* filename) {
sk_sp<SkParticleEffectParams> params(new SkParticleEffectParams());
if (auto fileData = SkData::MakeFromFileName(filename)) {
if (auto fileData = GetResourceAsData(filename)) {
skjson::DOM dom(static_cast<const char*>(fileData->data()), fileData->size());
SkFromJsonVisitor fromJson(dom.root());
params->visitFields(&fromJson);
@ -200,7 +201,7 @@ ParticlesSlide::ParticlesSlide() {
}
void ParticlesSlide::load(SkScalar winWidth, SkScalar winHeight) {
fEffect.reset(new SkParticleEffect(LoadEffectParams("resources/particles/default.json"),
fEffect.reset(new SkParticleEffect(LoadEffectParams("particles/default.json"),
fRandom));
}