10#if defined(SK_ENABLE_SVG)
26class AnimatedSVGSlide :
public Slide {
27 inline static constexpr auto kAnimationIterations = 5;
34 const char* fResource =
nullptr;
35 State fState = kZoomIn;
36 int fAnimationLoop = kAnimationIterations;
40 AnimatedSVGSlide(
const char* r,
const char* n) : fResource(r) {
fName = n; }
46 SkDebugf(
"Resource not found: \"%s\"\n", fResource);
67 canvas->
scale(fDelta, fDelta);
70 if (fAnimationLoop > kAnimationIterations/2) {
75 canvas->
scale(fDelta, fDelta);
80 canvas->
scale(fDelta, fDelta);
94 bool animate(
double nanos)
override {
100 if (fAnimationLoop == 0) {
101 fAnimationLoop = kAnimationIterations;
122DEF_SLIDE(
return new AnimatedSVGSlide(
"Cowboy.svg",
"SampleCowboy"); )
sk_sp< SkData > GetResourceAsData(const char *resource)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void translate(SkScalar dx, SkScalar dy)
void setMatrix(const SkM44 &matrix)
void scale(SkScalar sx, SkScalar sy)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
void render(SkCanvas *) const
void setContainerSize(const SkSize &)
virtual void resize(SkScalar winWidth, SkScalar winHeight)
virtual void load(SkScalar winWidth, SkScalar winHeight)
virtual bool animate(double nanos)
virtual void draw(SkCanvas *canvas)=0
sk_sp< Factory > BestAvailable()
DlVertices::Builder Builder
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
static constexpr SkSize Make(SkScalar w, SkScalar h)
std::shared_ptr< const fml::Mapping > data