Revert "[skottie] Remove defensive seek(0) from Animation ctor"
This reverts commit 042fe0847b06d63fa95d419f3c299710d0247d32.
Reason for revert: SkottieTracing bots not happy.
Original change's description:
> [skottie] Remove defensive seek(0) from Animation ctor
>
> It potentially causes unnecessary image frame loads.
>
> Well-behaved clients should always seek() before calling render().
>
> Bug: skia:9686
> Change-Id: If16257dc947941541d9ae8906b5ec7b1754dd7df
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257625
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>
TBR=fmalita@chromium.org,reed@google.com,aparchur@google.com
Change-Id: I3b7efdfc8e0aed1deb8756d585f946b4309d469d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9686
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257630
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/modules/skottie/include/Skottie.h b/modules/skottie/include/Skottie.h
index 723f674..0741d91 100644
--- a/modules/skottie/include/Skottie.h
+++ b/modules/skottie/include/Skottie.h
@@ -148,9 +148,6 @@
/**
* Draws the current animation frame.
*
- * It is undefined behavior to call render() on a newly created Animation
- * before specifying an initial frame via one of the seek() variants.
- *
* @param canvas destination canvas
* @param dst optional destination rect
* @param flags optional RenderFlags
diff --git a/modules/skottie/src/Skottie.cpp b/modules/skottie/src/Skottie.cpp
index 25be33d..9479806 100644
--- a/modules/skottie/src/Skottie.cpp
+++ b/modules/skottie/src/Skottie.cpp
@@ -550,7 +550,11 @@
, fOutPoint(outPoint)
, fDuration(duration)
, fFPS(fps)
- , fFlags(flags) {}
+ , fFlags(flags) {
+
+ // In case the client calls render before the first tick.
+ this->seek(0);
+}
Animation::~Animation() = default;