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 <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2018-11-30 16:11:24 -05:00 committed by Skia Commit-Bot
parent 9cfefdb765
commit ee4db8eb59

View File

@ -84,19 +84,7 @@ public:
sk_sp<MyDrawable> fAnimatingDrawable;
sk_sp<SkDrawable> 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<MyDrawable>(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<MyDrawable>(fRect);
SkPictureRecorder recorder;
this->drawRoot(recorder.beginRecording(SkRect::MakeWH(800, 500)));
fRootDrawable = recorder.finishRecordingAsDrawable();
}
void onDrawContent(SkCanvas* canvas) override {
canvas->drawDrawable(fRootDrawable.get());
}