From ee4db8eb593e80c591e78fa752195f00be54bc9b Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Fri, 30 Nov 2018 16:11:24 -0500 Subject: [PATCH] Move Arc sample to onOnceBeforeDraw. Doing work in the constructor makes it difficult to debug other tests. Change-Id: I0aabd031ce7caf492cde6e7d32be7586c7f0b9d3 Reviewed-on: https://skia-review.googlesource.com/c/173767 Auto-Submit: Ben Wagner Reviewed-by: Ben Wagner Commit-Queue: Ben Wagner --- samplecode/SampleArc.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/samplecode/SampleArc.cpp b/samplecode/SampleArc.cpp index a64c47fec0..4e11301097 100644 --- a/samplecode/SampleArc.cpp +++ b/samplecode/SampleArc.cpp @@ -84,19 +84,7 @@ public: sk_sp fAnimatingDrawable; sk_sp fRootDrawable; - ArcsView() { - testparse(); - fSweep = SkIntToScalar(100); - this->setBGColor(0xFFDDDDDD); - - fRect.set(0, 0, SkIntToScalar(200), SkIntToScalar(200)); - fRect.offset(SkIntToScalar(20), SkIntToScalar(20)); - fAnimatingDrawable = sk_make_sp(fRect); - - SkPictureRecorder recorder; - this->drawRoot(recorder.beginRecording(SkRect::MakeWH(800, 500))); - fRootDrawable = recorder.finishRecordingAsDrawable(); - } + ArcsView() { } protected: bool onQuery(Sample::Event* evt) override { @@ -183,6 +171,20 @@ protected: DrawArcs(canvas); } + void onOnceBeforeDraw() override { + testparse(); + fSweep = SkIntToScalar(100); + this->setBGColor(0xFFDDDDDD); + + fRect.set(0, 0, SkIntToScalar(200), SkIntToScalar(200)); + fRect.offset(SkIntToScalar(20), SkIntToScalar(20)); + fAnimatingDrawable = sk_make_sp(fRect); + + SkPictureRecorder recorder; + this->drawRoot(recorder.beginRecording(SkRect::MakeWH(800, 500))); + fRootDrawable = recorder.finishRecordingAsDrawable(); + } + void onDrawContent(SkCanvas* canvas) override { canvas->drawDrawable(fRootDrawable.get()); }