Add samples to Viewer.
This adds support with animation, assuming the sample has
implemented onAnimate. Event handling has not been
implemented.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2056343004
Committed: https://skia.googlesource.com/skia/+/76963e73704a42a18c29d6fbdcccb566e5c67658
Review-Url: https://codereview.chromium.org/2056343004
diff --git a/samplecode/ClockFaceView.cpp b/samplecode/ClockFaceView.cpp
index ef0fec7..9cee95b 100644
--- a/samplecode/ClockFaceView.cpp
+++ b/samplecode/ClockFaceView.cpp
@@ -72,7 +72,14 @@
: Sk2DPathEffect(matrix), fRadius(radius), fPts(pts) {}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect)
-
+ class Registrar {
+ public:
+ Registrar() {
+ SkFlattenable::Register("Dot2DPathEffect",
+ Dot2DPathEffect::CreateProc,
+ Dot2DPathEffect::GetFlattenableType());
+ }
+ };
protected:
void begin(const SkIRect& uvBounds, SkPath* dst) const override {
if (fPts) {
@@ -101,6 +108,8 @@
typedef Sk2DPathEffect INHERITED;
};
+static Dot2DPathEffect::Registrar gReg0;
+
sk_sp<SkFlattenable> Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) {
SkMatrix matrix;
buffer.readMatrix(&matrix);