Reland "[skottie] skottie_tool updates"
This reverts commitd424d6a3bd
. Reason for revert: ready to reland Original change's description: > Revert "[skottie] skottie_tool updates" > > This reverts commit6499e7fb4c
. > > Reason for revert: G3 roll > > Original change's description: > > [skottie] skottie_tool updates > > > > 1) plumb a precomp interceptor to support nested animations, following > > the same naming pattern as viewer and dm > > > > 2) clear background with white instead of transparent, to match other > > tools > > > > TBR= > > Change-Id: Ic1d1f8c6493a3ca98a9b75f5e2aa2230a46f54d9 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298139 > > Reviewed-by: Florin Malita <fmalita@chromium.org> > > Commit-Queue: Florin Malita <fmalita@google.com> > > TBR=fmalita@chromium.org,fmalita@google.com > > Change-Id: Ibd320e9f7f30004e80ff4d2b2012a18703910842 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298337 > Reviewed-by: Florin Malita <fmalita@google.com> > Commit-Queue: Florin Malita <fmalita@google.com> TBR=fmalita@chromium.org,fmalita@google.com # Not skipping CQ checks because this is a reland. Change-Id: Id20c88771caf580519e1e92dc293933041522f7a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298561 Reviewed-by: Florin Malita <fmalita@google.com> Commit-Queue: Florin Malita <fmalita@google.com>
This commit is contained in:
parent
322e4be6a1
commit
8268108731
@ -12,6 +12,7 @@
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/encode/SkPngEncoder.h"
|
||||
#include "modules/skottie/include/Skottie.h"
|
||||
#include "modules/skottie/utils/SkottieUtils.h"
|
||||
#include "modules/skresources/include/SkResources.h"
|
||||
#include "src/core/SkOSFile.h"
|
||||
#include "src/core/SkTaskGroup.h"
|
||||
@ -45,6 +46,8 @@ static DEFINE_int(threads, 0, "Number of worker threads (0 -> cores count).");
|
||||
|
||||
namespace {
|
||||
|
||||
static constexpr SkColor kClearColor = SK_ColorWHITE;
|
||||
|
||||
std::unique_ptr<SkFILEWStream> MakeFrameStream(size_t idx, const char* ext) {
|
||||
const auto frame_file = SkStringPrintf("0%06zu.%s", idx, ext);
|
||||
auto stream = std::make_unique<SkFILEWStream>(SkOSPath::Join(FLAGS_writePath[0],
|
||||
@ -87,7 +90,7 @@ private:
|
||||
|
||||
SkCanvas* beginFrame(size_t) override {
|
||||
auto* canvas = fSurface->getCanvas();
|
||||
canvas->clear(SK_ColorTRANSPARENT);
|
||||
canvas->clear(kClearColor);
|
||||
return canvas;
|
||||
}
|
||||
|
||||
@ -161,7 +164,7 @@ private:
|
||||
|
||||
SkCanvas* beginFrame(size_t) override {
|
||||
auto* canvas = fSurface->getCanvas();
|
||||
canvas->clear(SK_ColorTRANSPARENT);
|
||||
canvas->clear(kClearColor);
|
||||
return canvas;
|
||||
}
|
||||
|
||||
@ -182,7 +185,7 @@ struct MP4Sink final : public Sink {
|
||||
|
||||
SkCanvas* beginFrame(size_t) override {
|
||||
SkCanvas* canvas = fSurface->getCanvas();
|
||||
canvas->clear(SK_ColorTRANSPARENT);
|
||||
canvas->clear(kClearColor);
|
||||
return canvas;
|
||||
}
|
||||
|
||||
@ -265,6 +268,8 @@ int main(int argc, char** argv) {
|
||||
/*predecode=*/true),
|
||||
/*predecode=*/true));
|
||||
auto data = SkData::MakeFromFileName(FLAGS_input[0]);
|
||||
auto precomp_interceptor =
|
||||
sk_make_sp<skottie_utils::ExternalAnimationPrecompInterceptor>(rp, "__");
|
||||
|
||||
if (!data) {
|
||||
SkDebugf("Could not load %s.\n", FLAGS_input[0]);
|
||||
@ -334,12 +339,14 @@ int main(int argc, char** argv) {
|
||||
// iOS doesn't support thread_local on versions less than 9.0.
|
||||
auto anim = skottie::Animation::Builder()
|
||||
.setResourceProvider(rp)
|
||||
.setPrecompInterceptor(precomp_interceptor)
|
||||
.make(static_cast<const char*>(data->data()), data->size());
|
||||
auto sink = MakeSink(FLAGS_format[0], scale_matrix);
|
||||
#else
|
||||
thread_local static auto* anim =
|
||||
skottie::Animation::Builder()
|
||||
.setResourceProvider(rp)
|
||||
.setPrecompInterceptor(precomp_interceptor)
|
||||
.make(static_cast<const char*>(data->data()), data->size())
|
||||
.release();
|
||||
thread_local static auto* sink = MakeSink(FLAGS_format[0], scale_matrix).release();
|
||||
|
Loading…
Reference in New Issue
Block a user