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>
This commit is contained in:
Florin Malita 2018-01-16 17:04:30 -05:00 committed by Skia Commit-Bot
parent d452434d17
commit 54f65c473f
16 changed files with 104 additions and 105 deletions

View File

@ -1321,13 +1321,13 @@ if (skia_enable_tools) {
]
}
test_lib("experimental_skotty") {
public_include_dirs = [ "experimental/skotty" ]
test_lib("experimental_skottie") {
public_include_dirs = [ "experimental/skottie" ]
include_dirs = [ "tools" ]
sources = [
"experimental/skotty/Skotty.cpp",
"experimental/skotty/SkottyAnimator.cpp",
"experimental/skotty/SkottyProperties.cpp",
"experimental/skottie/Skottie.cpp",
"experimental/skottie/SkottieAnimator.cpp",
"experimental/skottie/SkottieProperties.cpp",
]
deps = [
":experimental_sksg",
@ -1511,7 +1511,7 @@ if (skia_enable_tools) {
include_dirs = [ "tests" ]
deps = [
":common_flags",
":experimental_skotty",
":experimental_skottie",
":experimental_sksg",
":experimental_svg_model",
":flags",
@ -1913,8 +1913,8 @@ if (skia_enable_tools) {
"tools/viewer/ImageSlide.cpp",
"tools/viewer/SKPSlide.cpp",
"tools/viewer/SampleSlide.cpp",
"tools/viewer/SkottySlide.cpp",
"tools/viewer/SkottySlide2.cpp",
"tools/viewer/SkottieSlide.cpp",
"tools/viewer/SkottieSlide2.cpp",
"tools/viewer/StatsLayer.cpp",
"tools/viewer/Viewer.cpp",
]
@ -1922,7 +1922,7 @@ if (skia_enable_tools) {
include_dirs = []
deps = [
":experimental_skotty",
":experimental_skottie",
":flags",
":gm",
":gpu_tool_utils",

View File

@ -785,7 +785,7 @@ static bool gather_srcs() {
}
gather_file_srcs<MSKPSrc>(FLAGS_mskps, "mskp");
#if !defined(SK_BUILD_FOR_GOOGLE3)
gather_file_srcs<SkottySrc>(FLAGS_jsons, "json");
gather_file_srcs<SkottieSrc>(FLAGS_jsons, "json");
#endif
#if defined(SK_XML)
gather_file_srcs<SVGSrc>(FLAGS_svgs, "svg");

View File

@ -61,7 +61,7 @@
#endif
#if !defined(SK_BUILD_FOR_GOOGLE3)
#include "Skotty.h"
#include "Skottie.h"
#endif
#if defined(SK_XML)
@ -1317,10 +1317,10 @@ Name DDLSKPSrc::name() const { return SkOSPath::Basename(fPath.c_str()); }
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#if !defined(SK_BUILD_FOR_GOOGLE3)
SkottySrc::SkottySrc(Path path)
SkottieSrc::SkottieSrc(Path path)
: fName(SkOSPath::Basename(path.c_str())) {
fAnimation = skotty::Animation::MakeFromFile(path.c_str());
fAnimation = skottie::Animation::MakeFromFile(path.c_str());
if (!fAnimation) {
return;
}
@ -1334,7 +1334,7 @@ SkottySrc::SkottySrc(Path path)
}
Error SkottySrc::draw(SkCanvas* canvas) const {
Error SkottieSrc::draw(SkCanvas* canvas) const {
if (!fAnimation) {
return SkStringPrintf("Unable to parse file: %s", fName.c_str());
}
@ -1383,15 +1383,15 @@ Error SkottySrc::draw(SkCanvas* canvas) const {
return "";
}
SkISize SkottySrc::size() const {
SkISize SkottieSrc::size() const {
// Padding for grid.
return SkISize::Make(kTileCount * (fTileSize.width() + 1),
kTileCount * (fTileSize.height() + 1));
}
Name SkottySrc::name() const { return fName; }
Name SkottieSrc::name() const { return fName; }
bool SkottySrc::veto(SinkFlags flags) const {
bool SkottieSrc::veto(SinkFlags flags) const {
// No need to test to non-(raster||gpu||vector) or indirect backends.
bool type_ok = flags.type == SinkFlags::kRaster
|| flags.type == SinkFlags::kGPU

View File

@ -21,7 +21,7 @@
//#define TEST_VIA_SVG
namespace skotty { class Animation; }
namespace skottie { class Animation; }
namespace DM {
@ -263,9 +263,9 @@ private:
};
#if !defined(SK_BUILD_FOR_GOOGLE3)
class SkottySrc final : public Src {
class SkottieSrc final : public Src {
public:
explicit SkottySrc(Path path);
explicit SkottieSrc(Path path);
Error draw(SkCanvas*) const override;
SkISize size() const override;
@ -278,7 +278,7 @@ private:
Name fName;
SkISize fTileSize = SkISize::MakeEmpty();
std::unique_ptr<skotty::Animation> fAnimation;
std::unique_ptr<skottie::Animation> fAnimation;
};
#endif

View File

@ -5,12 +5,12 @@
* found in the LICENSE file.
*/
#include "Skotty.h"
#include "Skottie.h"
#include "SkCanvas.h"
#include "SkottyAnimator.h"
#include "SkottyPriv.h"
#include "SkottyProperties.h"
#include "SkottieAnimator.h"
#include "SkottiePriv.h"
#include "SkottieProperties.h"
#include "SkData.h"
#include "SkImage.h"
#include "SkMakeUnique.h"
@ -42,7 +42,7 @@
#include "stdlib.h"
namespace skotty {
namespace skottie {
namespace {
@ -1048,4 +1048,4 @@ void Animation::animationTick(SkMSec ms) {
}
}
} // namespace skotty
} // namespace skottie

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#ifndef Skotty_DEFINED
#define Skotty_DEFINED
#ifndef Skottie_DEFINED
#define Skottie_DEFINED
#include "SkRefCnt.h"
#include "SkSize.h"
@ -25,7 +25,7 @@ namespace Json { class Value; }
namespace sksg { class RenderNode; }
namespace skotty {
namespace skottie {
class AnimatorBase;
@ -75,6 +75,6 @@ private:
typedef SkNoncopyable INHERITED;
};
} // namespace skotty
} // namespace skottie
#endif // Skotty_DEFINED
#endif // Skottie_DEFINED

View File

@ -5,9 +5,9 @@
* found in the LICENSE file.
*/
#include "SkottyAnimator.h"
#include "SkottieAnimator.h"
namespace skotty {
namespace skottie {
namespace {
@ -91,4 +91,4 @@ void KeyframeInterval<ShapeValue>::lerp(float t, ShapeValue* v) const {
v->setIsVolatile(true);
}
} // namespace skotty
} // namespace skottie

View File

@ -5,19 +5,19 @@
* found in the LICENSE file.
*/
#ifndef SkottyAnimator_DEFINED
#define SkottyAnimator_DEFINED
#ifndef SkottieAnimator_DEFINED
#define SkottieAnimator_DEFINED
#include "SkCubicMap.h"
#include "SkMakeUnique.h"
#include "SkottyPriv.h"
#include "SkottyProperties.h"
#include "SkottiePriv.h"
#include "SkottieProperties.h"
#include "SkTypes.h"
#include <memory>
#include <vector>
namespace skotty {
namespace skottie {
class AnimatorBase : public SkNoncopyable {
public:
@ -188,6 +188,6 @@ const KeyframeInterval<ValT>& Animator<ValT, NodeT>::findFrame(float t) const {
return *f0;
}
} // namespace skotty
} // namespace skottie
#endif // SkottyAnimator_DEFINED
#endif // SkottieAnimator_DEFINED

View File

@ -5,15 +5,15 @@
* found in the LICENSE file.
*/
#ifndef SkottyPriv_DEFINED
#define SkottyPriv_DEFINED
#ifndef SkottiePriv_DEFINED
#define SkottiePriv_DEFINED
#include "SkJSONCPP.h"
#include "SkPoint.h"
#include "SkScalar.h"
#include "SkString.h"
namespace skotty {
namespace skottie {
#define LOG SkDebugf
@ -46,4 +46,4 @@ static inline SkPoint ParsePoint(const Json::Value& v, const SkPoint& defaultVal
} // namespace
#endif // SkottyPriv_DEFINED
#endif // SkottiePriv_DEFINED

View File

@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
#include "SkottyProperties.h"
#include "SkottieProperties.h"
#include "SkColor.h"
#include "SkottyPriv.h"
#include "SkottiePriv.h"
#include "SkPath.h"
#include "SkSGColor.h"
#include "SkSGGradient.h"
@ -18,7 +18,7 @@
#include <cmath>
namespace skotty {
namespace skottie {
namespace {
@ -287,4 +287,4 @@ void CompositeRadialGradient::onApply() {
grad->setEndRadius(SkPoint::Distance(this->startPoint(), this->endPoint()));
}
} // namespace skotty
} // namespace skottie

View File

@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
#ifndef SkottyProperties_DEFINED
#define SkottyProperties_DEFINED
#ifndef SkottieProperties_DEFINED
#define SkottieProperties_DEFINED
#include "SkColor.h"
#include "SkPath.h"
#include "SkPoint.h"
#include "SkSize.h"
#include "SkottyPriv.h"
#include "SkottiePriv.h"
#include "SkRefCnt.h"
#include "SkTArray.h"
#include "SkTypes.h"
@ -31,7 +31,7 @@ class RRect;
class RenderNode;;
}
namespace skotty {
namespace skottie {
template <typename T>
struct ValueTraits {
@ -163,6 +163,6 @@ private:
#undef COMPOSITE_PROPERTY
} // namespace skotty
} // namespace skottie
#endif // SkottyProperties_DEFINED
#endif // SkottieProperties_DEFINED

View File

@ -78,4 +78,4 @@ SkRect Merge::onRevalidate(InvalidationController* ic, const SkMatrix& ctm) {
return fMerged.computeTightBounds();
}
} // namespace skotty
} // namespace sksg

View File

@ -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) {

View File

@ -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

View File

@ -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;
}

View File

@ -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())));
}
}
}