aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2018-01-16 17:04:30 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-17 14:15:36 +0000
commit54f65c473fd6bf6919dfcbad22e924dff7586568 (patch)
treee241fc08b1dff9c41621bd52afca21c6059ed34b /tools/viewer
parentd452434d1717aa42993a4c671ffc5625fe273957 (diff)
Skotty -> Skottie
Change-Id: If8b6516024c69b0fc256208874f6666a4e70e12c Reviewed-on: https://skia-review.googlesource.com/95241 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'tools/viewer')
-rw-r--r--tools/viewer/SkottieSlide.cpp (renamed from tools/viewer/SkottySlide.cpp)20
-rw-r--r--tools/viewer/SkottieSlide.h (renamed from tools/viewer/SkottySlide.h)38
-rw-r--r--tools/viewer/SkottieSlide2.cpp (renamed from tools/viewer/SkottySlide2.cpp)29
-rw-r--r--tools/viewer/Viewer.cpp8
4 files changed, 47 insertions, 48 deletions
diff --git a/tools/viewer/SkottySlide.cpp b/tools/viewer/SkottieSlide.cpp
index 99f182a7bb..8880916a16 100644
--- a/tools/viewer/SkottySlide.cpp
+++ b/tools/viewer/SkottieSlide.cpp
@@ -5,19 +5,19 @@
* found in the LICENSE file.
*/
-#include "SkottySlide.h"
+#include "SkottieSlide.h"
#include "SkAnimTimer.h"
#include "SkCanvas.h"
-#include "Skotty.h"
+#include "Skottie.h"
-SkottySlide::SkottySlide(const SkString& name, const SkString& path)
+SkottieSlide::SkottieSlide(const SkString& name, const SkString& path)
: fPath(path) {
fName = name;
}
-void SkottySlide::load(SkScalar, SkScalar) {
- fAnimation = skotty::Animation::MakeFromFile(fPath.c_str());
+void SkottieSlide::load(SkScalar, SkScalar) {
+ fAnimation = skottie::Animation::MakeFromFile(fPath.c_str());
fTimeBase = 0; // force a time reset
if (fAnimation) {
@@ -32,15 +32,15 @@ void SkottySlide::load(SkScalar, SkScalar) {
}
}
-void SkottySlide::unload() {
+void SkottieSlide::unload() {
fAnimation.reset();
}
-SkISize SkottySlide::getDimensions() const {
+SkISize SkottieSlide::getDimensions() const {
return fAnimation? fAnimation->size().toCeil() : SkISize::Make(0, 0);
}
-void SkottySlide::draw(SkCanvas* canvas) {
+void SkottieSlide::draw(SkCanvas* canvas) {
if (fAnimation) {
SkAutoCanvasRestore acr(canvas, true);
const SkRect dstR = SkRect::Make(canvas->imageInfo().bounds());
@@ -48,7 +48,7 @@ void SkottySlide::draw(SkCanvas* canvas) {
}
}
-bool SkottySlide::animate(const SkAnimTimer& timer) {
+bool SkottieSlide::animate(const SkAnimTimer& timer) {
if (fTimeBase == 0) {
// Reset the animation time.
fTimeBase = timer.msec();
@@ -61,7 +61,7 @@ bool SkottySlide::animate(const SkAnimTimer& timer) {
return true;
}
-bool SkottySlide::onChar(SkUnichar c) {
+bool SkottieSlide::onChar(SkUnichar c) {
switch (c) {
case 'I':
if (fAnimation) {
diff --git a/tools/viewer/SkottySlide.h b/tools/viewer/SkottieSlide.h
index ed0662f2ce..6c278d484f 100644
--- a/tools/viewer/SkottySlide.h
+++ b/tools/viewer/SkottieSlide.h
@@ -5,17 +5,17 @@
* found in the LICENSE file.
*/
-#ifndef SkottySlide_DEFINED
-#define SkottySlide_DEFINED
+#ifndef SkottieSlide_DEFINED
+#define SkottieSlide_DEFINED
#include "Slide.h"
-namespace skotty { class Animation; }
+namespace skottie { class Animation; }
-class SkottySlide : public Slide {
+class SkottieSlide : public Slide {
public:
- SkottySlide(const SkString& name, const SkString& path);
- ~SkottySlide() override = default;
+ SkottieSlide(const SkString& name, const SkString& path);
+ ~SkottieSlide() override = default;
void load(SkScalar winWidth, SkScalar winHeight) override;
void unload() override;
@@ -28,18 +28,18 @@ public:
bool onChar(SkUnichar) override;
private:
- SkString fPath;
- std::unique_ptr<skotty::Animation> fAnimation;
- SkMSec fTimeBase = 0;
- bool fShowAnimationInval = false;
+ SkString fPath;
+ std::unique_ptr<skottie::Animation> fAnimation;
+ SkMSec fTimeBase = 0;
+ bool fShowAnimationInval = false;
typedef Slide INHERITED;
};
-class SkottySlide2 : public Slide {
+class SkottieSlide2 : public Slide {
public:
- SkottySlide2(const SkString& path);
- ~SkottySlide2() override = default;
+ SkottieSlide2(const SkString& path);
+ ~SkottieSlide2() override = default;
void load(SkScalar winWidth, SkScalar winHeight) override;
void unload() override;
@@ -51,12 +51,12 @@ public:
bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override;
private:
struct Rec {
- std::unique_ptr<skotty::Animation> fAnimation;
- SkMSec fTimeBase = 0;
- SkString fName;
- bool fShowAnimationInval = false;
+ std::unique_ptr<skottie::Animation> fAnimation;
+ SkMSec fTimeBase = 0;
+ SkString fName;
+ bool fShowAnimationInval = false;
- Rec(std::unique_ptr<skotty::Animation> anim);
+ Rec(std::unique_ptr<skottie::Animation> anim);
Rec(Rec&& o);
};
@@ -70,4 +70,4 @@ private:
typedef Slide INHERITED;
};
-#endif // SkottySlide_DEFINED
+#endif // SkottieSlide_DEFINED
diff --git a/tools/viewer/SkottySlide2.cpp b/tools/viewer/SkottieSlide2.cpp
index 180c7ad411..0c643b724e 100644
--- a/tools/viewer/SkottySlide2.cpp
+++ b/tools/viewer/SkottieSlide2.cpp
@@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
-#include "SkottySlide.h"
+#include "SkottieSlide.h"
#include "SkAnimTimer.h"
#include "SkCanvas.h"
-#include "Skotty.h"
+#include "Skottie.h"
#include "SkOSFile.h"
#include "SkOSPath.h"
#include "SkStream.h"
@@ -21,38 +21,38 @@ const int SPACER_X = 12;
const int SPACER_Y = 24;
const int MARGIN = 8;
-SkottySlide2::Rec::Rec(std::unique_ptr<skotty::Animation> anim) : fAnimation(std::move(anim))
+SkottieSlide2::Rec::Rec(std::unique_ptr<skottie::Animation> anim) : fAnimation(std::move(anim))
{}
-SkottySlide2::Rec::Rec(Rec&& o)
+SkottieSlide2::Rec::Rec(Rec&& o)
: fAnimation(std::move(o.fAnimation))
, fTimeBase(o.fTimeBase)
, fName(o.fName)
, fShowAnimationInval(o.fShowAnimationInval)
{}
-SkottySlide2::SkottySlide2(const SkString& path)
+SkottieSlide2::SkottieSlide2(const SkString& path)
: fPath(path)
{
- fName.set("skotty-dir");
+ fName.set("skottie-dir");
}
-void SkottySlide2::load(SkScalar, SkScalar) {
+void SkottieSlide2::load(SkScalar, SkScalar) {
SkString name;
SkOSFile::Iter iter(fPath.c_str(), "json");
while (iter.next(&name)) {
SkString path = SkOSPath::Join(fPath.c_str(), name.c_str());
- if (auto anim = skotty::Animation::MakeFromFile(path.c_str())) {
+ if (auto anim = skottie::Animation::MakeFromFile(path.c_str())) {
fAnims.push_back(Rec(std::move(anim))).fName = name;
}
}
}
-void SkottySlide2::unload() {
+void SkottieSlide2::unload() {
fAnims.reset();
}
-SkISize SkottySlide2::getDimensions() const {
+SkISize SkottieSlide2::getDimensions() const {
const int rows = (fAnims.count() + COL_COUNT - 1) / COL_COUNT;
return {
MARGIN + (COL_COUNT - 1) * SPACER_X + COL_COUNT * CELL_WIDTH + MARGIN,
@@ -60,7 +60,7 @@ SkISize SkottySlide2::getDimensions() const {
};
}
-void SkottySlide2::draw(SkCanvas* canvas) {
+void SkottieSlide2::draw(SkCanvas* canvas) {
SkPaint paint;
paint.setTextSize(12);
paint.setAntiAlias(true);
@@ -83,7 +83,7 @@ void SkottySlide2::draw(SkCanvas* canvas) {
}
}
-bool SkottySlide2::animate(const SkAnimTimer& timer) {
+bool SkottieSlide2::animate(const SkAnimTimer& timer) {
for (auto& rec : fAnims) {
if (rec.fTimeBase == 0) {
// Reset the animation time.
@@ -94,7 +94,7 @@ bool SkottySlide2::animate(const SkAnimTimer& timer) {
return true;
}
-bool SkottySlide2::onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState state,
+bool SkottieSlide2::onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState state,
uint32_t modifiers) {
if (fTrackingCell < 0 && state == sk_app::Window::kDown_InputState) {
fTrackingCell = this->findCell(x, y);
@@ -110,7 +110,7 @@ bool SkottySlide2::onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState st
return fTrackingCell >= 0;
}
-int SkottySlide2::findCell(float x, float y) const {
+int SkottieSlide2::findCell(float x, float y) const {
x -= MARGIN;
y -= MARGIN;
int index = -1;
@@ -126,4 +126,3 @@ int SkottySlide2::findCell(float x, float y) const {
}
return index;
}
-
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 59d5e50d5a..1ba32eee9d 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -11,7 +11,7 @@
#include "ImageSlide.h"
#include "Resources.h"
#include "SampleSlide.h"
-#include "SkottySlide.h"
+#include "SkottieSlide.h"
#include "SKPSlide.h"
#include "GrContext.h"
@@ -486,7 +486,7 @@ void Viewer::initSlides() {
// JSONs
for (const auto& json : FLAGS_jsons) {
- fSlides.push_back(sk_make_sp<SkottySlide2>(json));
+ fSlides.push_back(sk_make_sp<SkottieSlide2>(json));
SkOSFile::Iter it(json.c_str(), ".json");
SkString jsonName;
@@ -494,8 +494,8 @@ void Viewer::initSlides() {
if (SkCommandLineFlags::ShouldSkip(FLAGS_match, jsonName.c_str())) {
continue;
}
- fSlides.push_back(sk_make_sp<SkottySlide>(jsonName, SkOSPath::Join(json.c_str(),
- jsonName.c_str())));
+ fSlides.push_back(sk_make_sp<SkottieSlide>(jsonName, SkOSPath::Join(json.c_str(),
+ jsonName.c_str())));
}
}
}