[skrive] Initial artboard plumbing
"Artboards" are top-level Rive containers (similar to AE compositions),
holding the scene graphics and related animations.
Artboard properties:
- name
- width/height (size)
- translation (position)
- origin (anchor point for transforms?)
- (background) color
- clip contents flag
Plumb artboard parsing + background rendering, and hook into viewer.
TBR=
Change-Id: Ib188245ce41a76197cf9e0937689adf8243826d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295244
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 2e657d0..ad8e7c3 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -53,6 +53,9 @@
#if defined(SK_ENABLE_SKOTTIE)
#include "tools/viewer/SkottieSlide.h"
#endif
+#if defined(SK_ENABLE_SKRIVE)
+ #include "tools/viewer/SkRiveSlide.h"
+#endif
class CapturingShaderErrorHandler : public GrContextOptions::ShaderErrorHandler {
public:
@@ -135,10 +138,13 @@
static DEFINE_string(skps, "/data/local/tmp/skps", "Directory to read skps from.");
static DEFINE_string(lotties, "/data/local/tmp/lotties",
"Directory to read (Bodymovin) jsons from.");
+ static DEFINE_string(rives, "/data/local/tmp/rives",
+ "Directory to read Rive (Flare) files from.");
#else
static DEFINE_string(jpgs, "jpgs", "Directory to read jpgs from.");
static DEFINE_string(skps, "skps", "Directory to read skps from.");
static DEFINE_string(lotties, "lotties", "Directory to read (Bodymovin) jsons from.");
+ static DEFINE_string(rives, "rives", "Directory to read Rive (Flare) files from.");
#endif
static DEFINE_string(svgs, "", "Directory to read SVGs from, or a single SVG file.");
@@ -694,6 +700,12 @@
return sk_make_sp<SkottieSlide>(name, path);}
},
#endif
+ #if defined(SK_ENABLE_SKRIVE)
+ { ".flr", "skrive-dir", FLAGS_rives,
+ [](const SkString& name, const SkString& path) -> sk_sp<Slide> {
+ return sk_make_sp<SkRiveSlide>(name, path);}
+ },
+ #endif
#if defined(SK_XML)
{ ".svg", "svg-dir", FLAGS_svgs,
[](const SkString& name, const SkString& path) -> sk_sp<Slide> {