diff options
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleAARects.cpp | 10 | ||||
-rw-r--r-- | samplecode/SampleDither.cpp | 9 |
2 files changed, 12 insertions, 7 deletions
diff --git a/samplecode/SampleAARects.cpp b/samplecode/SampleAARects.cpp index 942242b02e..c50c39f5af 100644 --- a/samplecode/SampleAARects.cpp +++ b/samplecode/SampleAARects.cpp @@ -39,14 +39,16 @@ class AARectView : public SampleView { }; public: AARectView() { - fBitmap = createBitmap(N); + } +protected: + void onOnceBeforeDraw() override { + fBitmap = createBitmap(N); fWidth = N; } -protected: // overrides from SkEventSink - virtual bool onQuery(SkEvent* evt) { + bool onQuery(SkEvent* evt) override { if (SampleCode::TitleQ(*evt)) { SampleCode::TitleR(evt, "AA Rects"); return true; @@ -54,7 +56,7 @@ protected: return this->INHERITED::onQuery(evt); } - virtual void onDrawContent(SkCanvas* canvas) { + void onDrawContent(SkCanvas* canvas) override { canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); SkPaint bluePaint; diff --git a/samplecode/SampleDither.cpp b/samplecode/SampleDither.cpp index fbe25ddcaa..79adc629fa 100644 --- a/samplecode/SampleDither.cpp +++ b/samplecode/SampleDither.cpp @@ -109,6 +109,10 @@ public: SkScalar fAngle; DitherView() { + } + +protected: + void onOnceBeforeDraw() override { make_bm(&fBM); make_bm(&fBMPreDither); pre_dither(fBMPreDither); @@ -119,9 +123,8 @@ public: this->setBGColor(0xFF181818); } -protected: // overrides from SkEventSink - virtual bool onQuery(SkEvent* evt) { + bool onQuery(SkEvent* evt) override { if (SampleCode::TitleQ(*evt)) { SampleCode::TitleR(evt, "Dither"); return true; @@ -129,7 +132,7 @@ protected: return this->INHERITED::onQuery(evt); } - virtual void onDrawContent(SkCanvas* canvas) { + void onDrawContent(SkCanvas* canvas) override { SkPaint paint; SkScalar x = SkIntToScalar(10); SkScalar y = SkIntToScalar(10); |