Fix clang 12 Wsuggest-override and Wsuggest-destructor-override
Change-Id: Ic44e24057b95bb014504f02a736fb4341afc8971
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304856
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/bench/AAClipBench.cpp b/bench/AAClipBench.cpp
index 57af3be..d0e224f 100644
--- a/bench/AAClipBench.cpp
+++ b/bench/AAClipBench.cpp
@@ -41,8 +41,8 @@
}
protected:
- virtual const char* onGetName() { return fName.c_str(); }
- virtual void onDraw(int loops, SkCanvas* canvas) {
+ const char* onGetName() override { return fName.c_str(); }
+ void onDraw(int loops, SkCanvas* canvas) override {
SkPaint paint;
this->setupPaint(&paint);
@@ -111,7 +111,7 @@
}
protected:
- virtual const char* onGetName() { return fName.c_str(); }
+ const char* onGetName() override { return fName.c_str(); }
void recurse(SkCanvas* canvas,
@@ -156,7 +156,7 @@
canvas->restore();
}
- virtual void onDraw(int loops, SkCanvas* canvas) {
+ void onDraw(int loops, SkCanvas* canvas) override {
for (int i = 0; i < loops; ++i) {
SkPoint offset = SkPoint::Make(0, 0);
@@ -192,8 +192,8 @@
}
protected:
- virtual const char* onGetName() { return fName.c_str(); }
- virtual void onDraw(int loops, SkCanvas*) {
+ const char* onGetName() override { return fName.c_str(); }
+ void onDraw(int loops, SkCanvas*) override {
SkPaint paint;
this->setupPaint(&paint);
@@ -227,8 +227,8 @@
}
protected:
- virtual const char* onGetName() { return "aaclip_setregion"; }
- virtual void onDraw(int loops, SkCanvas*) {
+ const char* onGetName() override { return "aaclip_setregion"; }
+ void onDraw(int loops, SkCanvas*) override {
for (int i = 0; i < loops; ++i) {
SkAAClip clip;
clip.setRegion(fRegion);
diff --git a/bench/BezierBench.cpp b/bench/BezierBench.cpp
index 395cdde..64cc1fe 100644
--- a/bench/BezierBench.cpp
+++ b/bench/BezierBench.cpp
@@ -75,11 +75,11 @@
}
protected:
- virtual const char* onGetName() {
+ const char* onGetName() override {
return fName.c_str();
}
- virtual void onDraw(int loops, SkCanvas* canvas) {
+ void onDraw(int loops, SkCanvas* canvas) override {
fRec.fCanvas = canvas;
this->setupPaint(&fRec.fPaint);
fRec.fPaint.setStyle(SkPaint::kStroke_Style);
diff --git a/bench/BlurRectBench.cpp b/bench/BlurRectBench.cpp
index 2fe92bd..807e426 100644
--- a/bench/BlurRectBench.cpp
+++ b/bench/BlurRectBench.cpp
@@ -39,7 +39,7 @@
}
protected:
- virtual const char* onGetName() {
+ const char* onGetName() override {
return fName.c_str();
}
@@ -51,7 +51,7 @@
fName = name;
}
- virtual void onDraw(int loops, SkCanvas*) {
+ void onDraw(int loops, SkCanvas*) override {
SkPaint paint;
this->setupPaint(&paint);
diff --git a/bench/ChromeBench.cpp b/bench/ChromeBench.cpp
index a4f56e9..56ba15f 100644
--- a/bench/ChromeBench.cpp
+++ b/bench/ChromeBench.cpp
@@ -460,8 +460,8 @@
protected:
- virtual const char* onGetName() { return "chrome_scrollGmail"; }
- virtual void onDraw(int loops, SkCanvas* canvas) {
+ const char* onGetName() override { return "chrome_scrollGmail"; }
+ void onDraw(int loops, SkCanvas* canvas) override {
SkDEBUGCODE(this->validateBounds(canvas));
SkPaint paint;
this->setupPaint(&paint);
@@ -473,7 +473,7 @@
}
}
}
- virtual SkIPoint onGetSize() { return SkIPoint::Make(W, H); }
+ SkIPoint onGetSize() override { return SkIPoint::Make(W, H); }
void setRectangle(SkRect& current, int i) {
current.setWH(SkIntToScalar(gmailScrollingRectSpec[i*3+1]),
diff --git a/bench/GeometryBench.cpp b/bench/GeometryBench.cpp
index abaf678..7de4717 100644
--- a/bench/GeometryBench.cpp
+++ b/bench/GeometryBench.cpp
@@ -46,7 +46,7 @@
protected:
SkRect fRects[2048];
- virtual void onDelayedSetup() {
+ void onDelayedSetup() override {
const SkScalar min = -100;
const SkScalar max = 100;
SkRandom rand;
diff --git a/bench/GradientBench.cpp b/bench/GradientBench.cpp
index e202350..eebd55c 100644
--- a/bench/GradientBench.cpp
+++ b/bench/GradientBench.cpp
@@ -319,11 +319,11 @@
}
protected:
- virtual const char* onGetName() {
+ const char* onGetName() override {
return fName.c_str();
}
- virtual void onDraw(int loops, SkCanvas* canvas) {
+ void onDraw(int loops, SkCanvas* canvas) override {
SkPaint paint;
this->setupPaint(&paint);
diff --git a/bench/SKPAnimationBench.cpp b/bench/SKPAnimationBench.cpp
index 2bd3efb..72cdef3 100644
--- a/bench/SKPAnimationBench.cpp
+++ b/bench/SKPAnimationBench.cpp
@@ -46,10 +46,10 @@
, fZoomPeriodMs(zoomPeriodMs) {
}
- virtual const char* getTag() { return "zoom"; }
+ const char* getTag() override { return "zoom"; }
- virtual void preConcatFrameMatrix(double animationTimeMs, const SkIRect& devBounds,
- SkMatrix* drawMatrix) {
+ void preConcatFrameMatrix(double animationTimeMs, const SkIRect& devBounds,
+ SkMatrix* drawMatrix) override {
double t = fmod(animationTimeMs / fZoomPeriodMs, 1.0); // t is in [0, 1).
t = fabs(2 * t - 1); // Make t ping-pong between 0 and 1
SkScalar zoom = static_cast<SkScalar>(pow(fZoomMax, t));
diff --git a/bench/SKPAnimationBench.h b/bench/SKPAnimationBench.h
index 153f1fd..573af1d 100644
--- a/bench/SKPAnimationBench.h
+++ b/bench/SKPAnimationBench.h
@@ -23,7 +23,6 @@
virtual const char* getTag() = 0;
virtual void preConcatFrameMatrix(double animationTimeMs, const SkIRect& devBounds,
SkMatrix* drawMatrix) = 0;
- virtual ~Animation() {}
};
SKPAnimationBench(const char* name, const SkPicture*, const SkIRect& devClip, sk_sp<Animation>,
diff --git a/bench/ScalarBench.cpp b/bench/ScalarBench.cpp
index 714eecc..f22b344 100644
--- a/bench/ScalarBench.cpp
+++ b/bench/ScalarBench.cpp
@@ -56,8 +56,8 @@
init9(fArray);
}
protected:
- virtual int mulLoopCount() const { return 4; }
- virtual void performTest() {
+ int mulLoopCount() const override { return 4; }
+ void performTest() override {
// xoring into a volatile prevents the compiler from optimizing these checks away.
volatile bool junk = false;
junk ^= (fArray[6] != 0.0f || fArray[7] != 0.0f || fArray[8] != 1.0f);
@@ -75,8 +75,8 @@
init9(fArray);
}
protected:
- virtual int mulLoopCount() const { return 4; }
- virtual void performTest() {
+ int mulLoopCount() const override { return 4; }
+ void performTest() override {
// xoring into a volatile prevents the compiler from optimizing these checks away.
volatile int32_t junk = 0;
junk ^= (SkScalarAs2sCompliment(fArray[6]) |
diff --git a/bench/TableBench.cpp b/bench/TableBench.cpp
index 33654c0..c1e1b95 100644
--- a/bench/TableBench.cpp
+++ b/bench/TableBench.cpp
@@ -29,11 +29,11 @@
static const int kNumCols = 32;
protected:
- virtual const char* onGetName() {
+ const char* onGetName() override {
return "tablebench";
}
- virtual void onDraw(int loops, SkCanvas* canvas) {
+ void onDraw(int loops, SkCanvas* canvas) override {
SkPaint cellPaint;
cellPaint.setColor(0xFFFFFFF);
diff --git a/bench/TileBench.cpp b/bench/TileBench.cpp
index 0a944dd..9a53773 100644
--- a/bench/TileBench.cpp
+++ b/bench/TileBench.cpp
@@ -73,11 +73,11 @@
}
protected:
- virtual const char* onGetName() {
+ const char* onGetName() override {
return fName.c_str();
}
- virtual void onDraw(int loops, SkCanvas* canvas) {
+ void onDraw(int loops, SkCanvas* canvas) override {
SkPaint paint(fPaint);
this->setupPaint(&paint);
paint.setFilterQuality(fDoFilter ? kLow_SkFilterQuality
diff --git a/experimental/svg/model/SkSVGClipPath.h b/experimental/svg/model/SkSVGClipPath.h
index 269d1d0..303b47e 100644
--- a/experimental/svg/model/SkSVGClipPath.h
+++ b/experimental/svg/model/SkSVGClipPath.h
@@ -13,13 +13,10 @@
class SkSVGClipPath final : public SkSVGHiddenContainer {
public:
- virtual ~SkSVGClipPath() = default;
static sk_sp<SkSVGClipPath> Make() {
return sk_sp<SkSVGClipPath>(new SkSVGClipPath());
}
-protected:
-
private:
SkSVGClipPath();
diff --git a/experimental/svg/model/SkSVGDOM.h b/experimental/svg/model/SkSVGDOM.h
index c565913..96e9956 100644
--- a/experimental/svg/model/SkSVGDOM.h
+++ b/experimental/svg/model/SkSVGDOM.h
@@ -21,7 +21,6 @@
class SkSVGDOM : public SkRefCnt {
public:
SkSVGDOM();
- ~SkSVGDOM() = default;
static sk_sp<SkSVGDOM> MakeFromDOM(const SkDOM&);
static sk_sp<SkSVGDOM> MakeFromStream(SkStream&);
diff --git a/experimental/svg/model/SkSVGDefs.h b/experimental/svg/model/SkSVGDefs.h
index 1f4fa07..17ce30e 100644
--- a/experimental/svg/model/SkSVGDefs.h
+++ b/experimental/svg/model/SkSVGDefs.h
@@ -12,7 +12,6 @@
class SkSVGDefs : public SkSVGHiddenContainer {
public:
- virtual ~SkSVGDefs() = default;
static sk_sp<SkSVGDefs> Make() { return sk_sp<SkSVGDefs>(new SkSVGDefs()); }
private:
diff --git a/experimental/svg/model/SkSVGG.h b/experimental/svg/model/SkSVGG.h
index ca1c71c..9229269 100644
--- a/experimental/svg/model/SkSVGG.h
+++ b/experimental/svg/model/SkSVGG.h
@@ -12,8 +12,6 @@
class SkSVGG : public SkSVGContainer {
public:
- virtual ~SkSVGG() = default;
-
static sk_sp<SkSVGG> Make() { return sk_sp<SkSVGG>(new SkSVGG()); }
private:
diff --git a/experimental/svg/model/SkSVGHiddenContainer.h b/experimental/svg/model/SkSVGHiddenContainer.h
index b28cd00..14d82c3 100644
--- a/experimental/svg/model/SkSVGHiddenContainer.h
+++ b/experimental/svg/model/SkSVGHiddenContainer.h
@@ -11,9 +11,6 @@
#include "experimental/svg/model/SkSVGContainer.h"
class SkSVGHiddenContainer : public SkSVGContainer {
-public:
- virtual ~SkSVGHiddenContainer() = default;
-
protected:
explicit SkSVGHiddenContainer(SkSVGTag t) : INHERITED(t) {}
diff --git a/experimental/svg/model/SkSVGNode.h b/experimental/svg/model/SkSVGNode.h
index aa37e02..5c97949 100644
--- a/experimental/svg/model/SkSVGNode.h
+++ b/experimental/svg/model/SkSVGNode.h
@@ -40,7 +40,7 @@
class SkSVGNode : public SkRefCnt {
public:
- virtual ~SkSVGNode();
+ ~SkSVGNode() override;
SkSVGTag tag() const { return fTag; }
diff --git a/gm/complexclip3.cpp b/gm/complexclip3.cpp
index f95fa2e..b6fea1f 100644
--- a/gm/complexclip3.cpp
+++ b/gm/complexclip3.cpp
@@ -36,15 +36,15 @@
protected:
- SkString onShortName() {
+ SkString onShortName() override {
SkString str;
str.printf("complexclip3_%s", fDoSimpleClipFirst ? "simple" : "complex");
return str;
}
- SkISize onISize() { return SkISize::Make(400, 950); }
+ SkISize onISize() override { return SkISize::Make(400, 950); }
- virtual void onDraw(SkCanvas* canvas) {
+ void onDraw(SkCanvas* canvas) override {
SkPath clipSimple;
clipSimple.addCircle(SkIntToScalar(70), SkIntToScalar(50), SkIntToScalar(20));
diff --git a/gm/complexclip4.cpp b/gm/complexclip4.cpp
index ce34bfa..2709e2e 100644
--- a/gm/complexclip4.cpp
+++ b/gm/complexclip4.cpp
@@ -29,16 +29,14 @@
}
protected:
-
-
- SkString onShortName() {
+ SkString onShortName() override {
SkString str;
str.printf("complexclip4_%s",
fDoAAClip ? "aa" : "bw");
return str;
}
- SkISize onISize() { return SkISize::Make(970, 780); }
+ SkISize onISize() override { return SkISize::Make(970, 780); }
// Android Framework will still support the legacy kReplace SkClipOp on older devices, so
// this represents how to do so while also respecting the device restriction using the newer
@@ -71,7 +69,7 @@
canvas->clipPath(path, SkClipOp::kIntersect, aa);
}
- virtual void onDraw(SkCanvas* canvas) {
+ void onDraw(SkCanvas* canvas) override {
SkPaint p;
p.setAntiAlias(fDoAAClip);
p.setColor(SK_ColorYELLOW);
diff --git a/gm/compositor_quads.cpp b/gm/compositor_quads.cpp
index 8a12132..b4ef7f8 100644
--- a/gm/compositor_quads.cpp
+++ b/gm/compositor_quads.cpp
@@ -199,8 +199,6 @@
class ClipTileRenderer : public SkRefCntBase {
public:
- virtual ~ClipTileRenderer() {}
-
// Draw the base rect, possibly clipped by 'clip' if that is not null. The edges to antialias
// are specified in 'edgeAA' (to make manipulation easier than an unsigned bitfield). 'tileID'
// represents the location of rect within the tile grid, 'quadID' is the unique ID of the clip
diff --git a/include/core/SkBBHFactory.h b/include/core/SkBBHFactory.h
index a41c73d..5a7b06e 100644
--- a/include/core/SkBBHFactory.h
+++ b/include/core/SkBBHFactory.h
@@ -16,7 +16,6 @@
class SkBBoxHierarchy : public SkRefCnt {
public:
SkBBoxHierarchy() {}
- virtual ~SkBBoxHierarchy() {}
struct Metadata {
bool isDraw; // The corresponding SkRect bounds a draw command, not a pure state change.
diff --git a/include/core/SkDataTable.h b/include/core/SkDataTable.h
index 8a4834f..aa4bcb1 100644
--- a/include/core/SkDataTable.h
+++ b/include/core/SkDataTable.h
@@ -108,7 +108,7 @@
SkDataTable(const void* array, size_t elemSize, int count,
FreeProc, void* context);
SkDataTable(const Dir*, int count, FreeProc, void* context);
- virtual ~SkDataTable();
+ ~SkDataTable() override;
friend class SkDataTableBuilder; // access to Dir
diff --git a/include/core/SkDocument.h b/include/core/SkDocument.h
index 0548711..375f6db 100644
--- a/include/core/SkDocument.h
+++ b/include/core/SkDocument.h
@@ -64,7 +64,7 @@
// note: subclasses must call close() in their destructor, as the base class
// cannot do this for them.
- virtual ~SkDocument();
+ ~SkDocument() override;
virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height) = 0;
virtual void onEndPage() = 0;
diff --git a/include/core/SkRWBuffer.h b/include/core/SkRWBuffer.h
index c0d24f6..9daf3f5 100644
--- a/include/core/SkRWBuffer.h
+++ b/include/core/SkRWBuffer.h
@@ -59,7 +59,7 @@
private:
SkROBuffer(const SkBufferHead* head, size_t available, const SkBufferBlock* fTail);
- virtual ~SkROBuffer();
+ ~SkROBuffer() override;
const SkBufferHead* fHead;
const size_t fAvailable;
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h
index 778588e..032fd71 100644
--- a/include/core/SkTypeface.h
+++ b/include/core/SkTypeface.h
@@ -345,7 +345,7 @@
/** uniqueID must be unique and non-zero
*/
SkTypeface(const SkFontStyle& style, bool isFixedPitch = false);
- virtual ~SkTypeface();
+ ~SkTypeface() override;
virtual sk_sp<SkTypeface> onMakeClone(const SkFontArguments&) const = 0;
diff --git a/include/effects/SkRuntimeEffect.h b/include/effects/SkRuntimeEffect.h
index 72d03b3..84be79f 100644
--- a/include/effects/SkRuntimeEffect.h
+++ b/include/effects/SkRuntimeEffect.h
@@ -131,7 +131,7 @@
bool usesSampleCoords() const { return fMainFunctionHasSampleCoords; }
static void RegisterFlattenables();
- ~SkRuntimeEffect();
+ ~SkRuntimeEffect() override;
private:
SkRuntimeEffect(SkString sksl,
diff --git a/include/private/GrContext_Base.h b/include/private/GrContext_Base.h
index b347f17..f84d0b5 100644
--- a/include/private/GrContext_Base.h
+++ b/include/private/GrContext_Base.h
@@ -22,7 +22,7 @@
class GrContext_Base : public SkRefCnt {
public:
- virtual ~GrContext_Base();
+ ~GrContext_Base() override;
/*
* Safely downcast to a GrDirectContext.
diff --git a/modules/skottie/src/SkottieTest.cpp b/modules/skottie/src/SkottieTest.cpp
index c68fc7c9e..cb217c0 100644
--- a/modules/skottie/src/SkottieTest.cpp
+++ b/modules/skottie/src/SkottieTest.cpp
@@ -706,7 +706,7 @@
private:
sk_sp<ImageAsset> loadImageAsset(const char path[],
const char name[],
- const char id[]) const {
+ const char id[]) const override {
return strcmp(id, "single_frame")
? fMultiFrameAsset
: fSingleFrameAsset;
diff --git a/modules/skottie/src/animator/Animator.h b/modules/skottie/src/animator/Animator.h
index 399d98c..0ad4d2a 100644
--- a/modules/skottie/src/animator/Animator.h
+++ b/modules/skottie/src/animator/Animator.h
@@ -28,8 +28,6 @@
class Animator : public SkRefCnt {
public:
- virtual ~Animator() = default;
-
using StateChanged = bool;
StateChanged seek(float t) { return this->onSeek(t); }
diff --git a/modules/skottie/src/layers/PrecompLayer.cpp b/modules/skottie/src/layers/PrecompLayer.cpp
index 40de742..3ba7d80 100644
--- a/modules/skottie/src/layers/PrecompLayer.cpp
+++ b/modules/skottie/src/layers/PrecompLayer.cpp
@@ -144,7 +144,7 @@
, fFps(fps) {}
private:
- StateChanged onSeek(float t) {
+ StateChanged onSeek(float t) override {
fSGAdapter->setT(t / fFps);
return true;
diff --git a/modules/skparagraph/include/FontCollection.h b/modules/skparagraph/include/FontCollection.h
index f733628..ded17bf 100644
--- a/modules/skparagraph/include/FontCollection.h
+++ b/modules/skparagraph/include/FontCollection.h
@@ -19,8 +19,6 @@
public:
FontCollection();
- ~FontCollection() = default;
-
size_t getFontManagersCount() const;
void setAssetFontManager(sk_sp<SkFontMgr> fontManager);
diff --git a/modules/skparagraph/tests/SkParagraphTest.cpp b/modules/skparagraph/tests/SkParagraphTest.cpp
index e4f821d..8a3a9ac 100644
--- a/modules/skparagraph/tests/SkParagraphTest.cpp
+++ b/modules/skparagraph/tests/SkParagraphTest.cpp
@@ -107,8 +107,6 @@
this->disableFontFallback();
}
- ~ResourceFontCollection() = default;
-
size_t resolvedFonts() const { return fResolvedFonts; }
// TODO: temp solution until we check in fonts
diff --git a/modules/skparagraph/utils/TestFontCollection.h b/modules/skparagraph/utils/TestFontCollection.h
index 9d92ed8..f1c6175 100644
--- a/modules/skparagraph/utils/TestFontCollection.h
+++ b/modules/skparagraph/utils/TestFontCollection.h
@@ -8,7 +8,6 @@
class TestFontCollection : public FontCollection {
public:
TestFontCollection(const std::string& resourceDir, bool testOnly = false, bool loadFonts = true);
- ~TestFontCollection() = default;
size_t fontsFound() const { return fFontsFound; }
bool addFontFromFile(const std::string& path, const std::string& familyName = "");
diff --git a/samplecode/Sample2PtRadial.cpp b/samplecode/Sample2PtRadial.cpp
index 64f9e66..4aadacb 100644
--- a/samplecode/Sample2PtRadial.cpp
+++ b/samplecode/Sample2PtRadial.cpp
@@ -14,9 +14,9 @@
TwoPtConicalView() {}
protected:
- virtual SkString name() { return SkString("2PtConical"); }
+ SkString name() override { return SkString("2PtConical"); }
- virtual void onDrawContent(SkCanvas* canvas) {
+ void onDrawContent(SkCanvas* canvas) override {
canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
diff --git a/samplecode/SampleAAGeometry.cpp b/samplecode/SampleAAGeometry.cpp
index 8eb82b9..b500785 100644
--- a/samplecode/SampleAAGeometry.cpp
+++ b/samplecode/SampleAAGeometry.cpp
@@ -541,9 +541,7 @@
, fValHi(fMax) {
}
- virtual ~BiControl() {}
-
- virtual void draw(SkCanvas* canvas, const ControlPaints& paints) {
+ void draw(SkCanvas* canvas, const ControlPaints& paints) override {
UniControl::draw(canvas, paints);
if (!fVisible || fValHi == fValLo) {
return;
diff --git a/samplecode/SampleEffects.cpp b/samplecode/SampleEffects.cpp
index f22aea1..91bb523 100644
--- a/samplecode/SampleEffects.cpp
+++ b/samplecode/SampleEffects.cpp
@@ -86,9 +86,9 @@
}
protected:
- virtual SkString name() { return SkString("Effects"); }
+ SkString name() override { return SkString("Effects"); }
- virtual void onDrawContent(SkCanvas* canvas) {
+ void onDrawContent(SkCanvas* canvas) override {
canvas->scale(3, 3);
canvas->translate(10, 30);
for (size_t i = 0; i < SK_ARRAY_COUNT(fPaint); i++) {
diff --git a/samplecode/SampleEmboss.cpp b/samplecode/SampleEmboss.cpp
index beacecb..d36dc29 100644
--- a/samplecode/SampleEmboss.cpp
+++ b/samplecode/SampleEmboss.cpp
@@ -33,9 +33,9 @@
}
protected:
- virtual SkString name() { return SkString("Emboss"); }
+ SkString name() override { return SkString("Emboss"); }
- virtual void onDrawContent(SkCanvas* canvas) {
+ void onDrawContent(SkCanvas* canvas) override {
SkPaint paint;
paint.setAntiAlias(true);
diff --git a/samplecode/SampleFillType.cpp b/samplecode/SampleFillType.cpp
index 230f41b..3aa4cb2 100644
--- a/samplecode/SampleFillType.cpp
+++ b/samplecode/SampleFillType.cpp
@@ -25,7 +25,7 @@
}
protected:
- virtual SkString name() { return SkString("FillType"); }
+ SkString name() override{ return SkString("FillType"); }
void showPath(SkCanvas* canvas, int x, int y, SkPathFillType ft,
SkScalar scale, const SkPaint& paint) {
@@ -55,7 +55,7 @@
scale, paint);
}
- virtual void onDrawContent(SkCanvas* canvas) {
+ void onDrawContent(SkCanvas* canvas) override {
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
SkPaint paint;
diff --git a/samplecode/SampleLayerMask.cpp b/samplecode/SampleLayerMask.cpp
index 546c6c4..7e00267 100644
--- a/samplecode/SampleLayerMask.cpp
+++ b/samplecode/SampleLayerMask.cpp
@@ -20,7 +20,7 @@
}
protected:
- virtual SkString name() { return SkString("LayerMask"); }
+ SkString name() override { return SkString("LayerMask"); }
void drawMask(SkCanvas* canvas, const SkRect& r) {
SkPaint paint;
@@ -48,7 +48,7 @@
}
}
- virtual void onDrawContent(SkCanvas* canvas) {
+ void onDrawContent(SkCanvas* canvas) override {
SkRect r;
r.setLTRB(20, 20, 120, 120);
canvas->saveLayer(&r, nullptr);
diff --git a/samplecode/SamplePolyToPoly.cpp b/samplecode/SamplePolyToPoly.cpp
index f8caf38..942a722 100644
--- a/samplecode/SamplePolyToPoly.cpp
+++ b/samplecode/SamplePolyToPoly.cpp
@@ -69,7 +69,7 @@
}
protected:
- virtual SkString name() { return SkString("PolyToPolyView"); }
+ SkString name() override { return SkString("PolyToPolyView"); }
static void doDraw(SkCanvas* canvas, SkPaint* paint, const SkFont& font, const int isrc[],
const int idst[], int count) {
@@ -105,7 +105,7 @@
canvas->restore();
}
- virtual void onDrawContent(SkCanvas* canvas) {
+ void onDrawContent(SkCanvas* canvas) override {
SkPaint paint;
paint.setAntiAlias(true);
paint.setStrokeWidth(SkIntToScalar(4));
diff --git a/samplecode/SampleStrokeRect.cpp b/samplecode/SampleStrokeRect.cpp
index 669a357..f172c47 100644
--- a/samplecode/SampleStrokeRect.cpp
+++ b/samplecode/SampleStrokeRect.cpp
@@ -13,9 +13,9 @@
StrokeRectSample() {}
protected:
- virtual SkString name() { return SkString("Stroke Rects"); }
+ SkString name() override { return SkString("Stroke Rects"); }
- virtual void onDrawContent(SkCanvas* canvas) {
+ void onDrawContent(SkCanvas* canvas) override {
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
diff --git a/samplecode/SampleThinAA.cpp b/samplecode/SampleThinAA.cpp
index 8b22aea..d7499ba 100644
--- a/samplecode/SampleThinAA.cpp
+++ b/samplecode/SampleThinAA.cpp
@@ -21,8 +21,6 @@
static constexpr SkScalar kTileWidth = 20.f;
static constexpr SkScalar kTileHeight = 20.f;
- virtual ~ShapeRenderer() {}
-
// Draw the shape, limited to kTileWidth x kTileHeight. It must apply the local subpixel (tx,
// ty) translation and rotation by angle. Prior to these transform adjustments, the SkCanvas
// will only have pixel aligned translations (these are separated to make super-sampling
diff --git a/samplecode/SampleWritePixels.cpp b/samplecode/SampleWritePixels.cpp
index f6d31e5..d014e86 100644
--- a/samplecode/SampleWritePixels.cpp
+++ b/samplecode/SampleWritePixels.cpp
@@ -32,9 +32,9 @@
WritePixelsView() {}
protected:
- virtual SkString name() { return SkString("WritePixels"); }
+ SkString name() override { return SkString("WritePixels"); }
- virtual void onDrawContent(SkCanvas* canvas) {
+ void onDrawContent(SkCanvas* canvas) override {
SkBitmap bitmap;
create_bitmap(&bitmap);
int x = bitmap.width() / 2;
diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp
index 592cf71..b565b79 100644
--- a/samplecode/SampleXfermodesBlur.cpp
+++ b/samplecode/SampleXfermodesBlur.cpp
@@ -73,9 +73,9 @@
}
protected:
- virtual SkString name() { return SkString("XfermodesBlur"); }
+ SkString name() override { return SkString("XfermodesBlur"); }
- virtual void onDrawContent(SkCanvas* canvas) {
+ void onDrawContent(SkCanvas* canvas) override {
canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
const SkBlendMode gModes[] = {
diff --git a/src/core/SkCoreBlitters.h b/src/core/SkCoreBlitters.h
index 18d468b..5b3c218 100644
--- a/src/core/SkCoreBlitters.h
+++ b/src/core/SkCoreBlitters.h
@@ -35,7 +35,7 @@
*/
SkShaderBlitter(const SkPixmap& device, const SkPaint& paint,
SkShaderBase::Context* shaderContext);
- virtual ~SkShaderBlitter();
+ ~SkShaderBlitter() override;
protected:
uint32_t fShaderFlags;
diff --git a/src/core/SkImageFilterCache.h b/src/core/SkImageFilterCache.h
index b82f4da..24d9449 100644
--- a/src/core/SkImageFilterCache.h
+++ b/src/core/SkImageFilterCache.h
@@ -55,7 +55,7 @@
enum { kDefaultTransientSize = 32 * 1024 * 1024 };
- virtual ~SkImageFilterCache() {}
+ ~SkImageFilterCache() override {}
static SkImageFilterCache* Create(size_t maxBytes);
static SkImageFilterCache* Get();
diff --git a/src/core/SkPtrRecorder.h b/src/core/SkPtrRecorder.h
index 2ea550f..389751d 100644
--- a/src/core/SkPtrRecorder.h
+++ b/src/core/SkPtrRecorder.h
@@ -127,12 +127,12 @@
*/
class SkRefCntSet : public SkTPtrSet<SkRefCnt*> {
public:
- virtual ~SkRefCntSet();
+ ~SkRefCntSet() override;
protected:
// overrides
- virtual void incPtr(void*);
- virtual void decPtr(void*);
+ virtual void incPtr(void*) override ;
+ virtual void decPtr(void*) override ;
};
class SkFactorySet : public SkTPtrSet<SkFlattenable::Factory> {};
diff --git a/src/core/SkRecord.h b/src/core/SkRecord.h
index 10a385f..d62cb15 100644
--- a/src/core/SkRecord.h
+++ b/src/core/SkRecord.h
@@ -28,7 +28,7 @@
class SkRecord : public SkRefCnt {
public:
SkRecord() = default;
- ~SkRecord();
+ ~SkRecord() override;
// Returns the number of canvas commands in this SkRecord.
int count() const { return fCount; }
diff --git a/src/core/SkSpecialSurface.cpp b/src/core/SkSpecialSurface.cpp
index ee52cd4..90e3e45 100644
--- a/src/core/SkSpecialSurface.cpp
+++ b/src/core/SkSpecialSurface.cpp
@@ -18,8 +18,6 @@
, fCanvas(nullptr) {
}
- virtual ~SkSpecialSurface_Base() { }
-
// reset is called after an SkSpecialImage has been snapped
void reset() { fCanvas.reset(); }
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index ad627b9..05fe10d 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -726,7 +726,7 @@
public:
explicit SkBlockMemoryRefCnt(SkDynamicMemoryWStream::Block* head) : fHead(head) { }
- virtual ~SkBlockMemoryRefCnt() {
+ ~SkBlockMemoryRefCnt() override {
SkDynamicMemoryWStream::Block* block = fHead;
while (block != nullptr) {
SkDynamicMemoryWStream::Block* next = block->fNext;
diff --git a/src/gpu/GrRingBuffer.h b/src/gpu/GrRingBuffer.h
index 2498c0d..e46afb7 100644
--- a/src/gpu/GrRingBuffer.h
+++ b/src/gpu/GrRingBuffer.h
@@ -31,7 +31,6 @@
// Because of this, size needs to be a power of two.
SkASSERT(SkIsPow2(size));
}
- virtual ~GrRingBuffer() = default;
struct Slice {
sk_sp<GrGpuBuffer> fBuffer;
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index 08da3f3..6f2e4b5 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -63,7 +63,7 @@
int vertexStride,
int instanceStride);
- ~GrGLProgram();
+ ~GrGLProgram() override;
/**
* Call to abandon GL objects owned by this program.
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index 86161d3..8828d69 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -34,7 +34,7 @@
class SkImage_Base : public SkImage {
public:
- virtual ~SkImage_Base();
+ ~SkImage_Base() override;
virtual SkIRect onGetSubset() const {
return { 0, 0, this->width(), this->height() };
diff --git a/src/image/SkSurface_Base.h b/src/image/SkSurface_Base.h
index 7883cea..ad3c70f 100644
--- a/src/image/SkSurface_Base.h
+++ b/src/image/SkSurface_Base.h
@@ -18,7 +18,7 @@
public:
SkSurface_Base(int width, int height, const SkSurfaceProps*);
SkSurface_Base(const SkImageInfo&, const SkSurfaceProps*);
- virtual ~SkSurface_Base();
+ ~SkSurface_Base() override;
virtual GrContext* onGetContext_deprecated();
virtual GrRecordingContext* onGetRecordingContext();
diff --git a/src/lazy/SkDiscardableMemoryPool.h b/src/lazy/SkDiscardableMemoryPool.h
index 46519e3..793e58a 100644
--- a/src/lazy/SkDiscardableMemoryPool.h
+++ b/src/lazy/SkDiscardableMemoryPool.h
@@ -27,8 +27,6 @@
*/
class SkDiscardableMemoryPool : public SkDiscardableMemory::Factory {
public:
- virtual ~SkDiscardableMemoryPool() { }
-
virtual size_t getRAMUsed() = 0;
virtual void setRAMBudget(size_t budget) = 0;
virtual size_t getRAMBudget() = 0;
diff --git a/tests/ArenaAllocTest.cpp b/tests/ArenaAllocTest.cpp
index 55c3c61..b186d59 100644
--- a/tests/ArenaAllocTest.cpp
+++ b/tests/ArenaAllocTest.cpp
@@ -55,7 +55,7 @@
struct FooRefCnt : public SkRefCnt {
FooRefCnt() : x(-2), y(-3.0f) { created++; }
FooRefCnt(int X, float Y) : x(X), y(Y) { created++; }
- ~FooRefCnt() { destroyed++; }
+ ~FooRefCnt() override { destroyed++; }
int x;
float y;
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 4c228dc..d8e7788 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -482,7 +482,7 @@
LifeLineCanvas(int w, int h, bool* lifeline) : SkCanvas(w, h), fLifeLine(lifeline) {
*fLifeLine = true;
}
- ~LifeLineCanvas() {
+ ~LifeLineCanvas() override {
*fLifeLine = false;
}
};
diff --git a/tests/GrMemoryPoolTest.cpp b/tests/GrMemoryPoolTest.cpp
index 1220754..aaa8f07 100644
--- a/tests/GrMemoryPoolTest.cpp
+++ b/tests/GrMemoryPoolTest.cpp
@@ -66,15 +66,14 @@
class B : public A {
public:
B() {}
- virtual void setValues(int v) {
+ void setValues(int v) override {
fDouble = static_cast<double>(v);
this->INHERITED::setValues(v);
}
- virtual bool checkValues(int v) {
+ bool checkValues(int v) override {
return fDouble == static_cast<double>(v) &&
this->INHERITED::checkValues(v);
}
- virtual ~B() {}
private:
double fDouble;
@@ -85,15 +84,14 @@
class C : public A {
public:
C() {}
- virtual void setValues(int v) {
+ void setValues(int v) override {
fInt64 = static_cast<int64_t>(v);
this->INHERITED::setValues(v);
}
- virtual bool checkValues(int v) {
+ bool checkValues(int v) override {
return fInt64 == static_cast<int64_t>(v) &&
this->INHERITED::checkValues(v);
}
- virtual ~C() {}
private:
int64_t fInt64;
@@ -107,17 +105,17 @@
D() {
fB = new B();
}
- virtual void setValues(int v) {
+ void setValues(int v) override {
fVoidStar = reinterpret_cast<void*>(static_cast<intptr_t>(v));
this->INHERITED::setValues(v);
fB->setValues(v);
}
- virtual bool checkValues(int v) {
+ bool checkValues(int v) override {
return fVoidStar == reinterpret_cast<void*>(static_cast<intptr_t>(v)) &&
fB->checkValues(v) &&
this->INHERITED::checkValues(v);
}
- virtual ~D() {
+ ~D() override {
delete fB;
}
private:
@@ -130,13 +128,13 @@
class E : public A {
public:
E() {}
- virtual void setValues(int v) {
+ void setValues(int v) override {
for (size_t i = 0; i < SK_ARRAY_COUNT(fIntArray); ++i) {
fIntArray[i] = v;
}
this->INHERITED::setValues(v);
}
- virtual bool checkValues(int v) {
+ bool checkValues(int v) override {
bool ok = true;
for (size_t i = 0; ok && i < SK_ARRAY_COUNT(fIntArray); ++i) {
if (fIntArray[i] != v) {
@@ -145,7 +143,6 @@
}
return ok && this->INHERITED::checkValues(v);
}
- virtual ~E() {}
private:
int fIntArray[20];
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index ecf5585..3f32b45 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -728,12 +728,12 @@
, fCurrIndex(0)
{}
- ~TestAnnotationCanvas() {
+ ~TestAnnotationCanvas() override {
REPORTER_ASSERT(fReporter, fCount == fCurrIndex);
}
protected:
- void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) {
+ void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) override {
REPORTER_ASSERT(fReporter, fCurrIndex < fCount);
REPORTER_ASSERT(fReporter, rect == fRec[fCurrIndex].fRect);
REPORTER_ASSERT(fReporter, !strcmp(key, fRec[fCurrIndex].fKey));
diff --git a/tools/DDLPromiseImageHelper.h b/tools/DDLPromiseImageHelper.h
index 6756fc1..130f1ec 100644
--- a/tools/DDLPromiseImageHelper.h
+++ b/tools/DDLPromiseImageHelper.h
@@ -38,7 +38,7 @@
: fContext(direct)
, fBackendFormat(backendFormat) {}
- ~PromiseImageCallbackContext();
+ ~PromiseImageCallbackContext() override;
const GrBackendFormat& backendFormat() const { return fBackendFormat; }
diff --git a/tools/fonts/TestTypeface.h b/tools/fonts/TestTypeface.h
index 0d43d09..fc52070 100644
--- a/tools/fonts/TestTypeface.h
+++ b/tools/fonts/TestTypeface.h
@@ -47,7 +47,7 @@
class SkTestFont : public SkRefCnt {
public:
SkTestFont(const SkTestFontData&);
- virtual ~SkTestFont();
+ ~SkTestFont() override;
SkGlyphID glyphForUnichar(SkUnichar charCode) const;
void init(const SkScalar* pts, const unsigned char* verbs);
diff --git a/tools/using_skia_and_harfbuzz.cpp b/tools/using_skia_and_harfbuzz.cpp
index 03fcf30..7f8d593 100644
--- a/tools/using_skia_and_harfbuzz.cpp
+++ b/tools/using_skia_and_harfbuzz.cpp
@@ -77,8 +77,8 @@
}
struct DoubleOption : Option<double> {
- virtual void set(std::string _value) { value = atof(_value.c_str()); }
- virtual std::string valueToString() {
+ void set(std::string _value) override { value = atof(_value.c_str()); }
+ std::string valueToString() override {
std::ostringstream stm;
stm << value;
return stm.str();
@@ -90,8 +90,8 @@
};
struct StringOption : Option<std::string> {
- virtual void set(std::string _value) { value = _value; }
- virtual std::string valueToString() { return value; }
+ void set(std::string _value) override { value = _value; }
+ std::string valueToString() override { return value; }
StringOption(std::string _selector,
std::string _description,
std::string defaultValue)
diff --git a/tools/viewer/Slide.h b/tools/viewer/Slide.h
index cc02077..bdd8e5e 100644
--- a/tools/viewer/Slide.h
+++ b/tools/viewer/Slide.h
@@ -18,8 +18,6 @@
class Slide : public SkRefCnt {
public:
- virtual ~Slide() {}
-
virtual SkISize getDimensions() const = 0;
virtual void gpuTeardown() { }
diff --git a/tools/viewer/SlideDir.cpp b/tools/viewer/SlideDir.cpp
index 017febe..5cce6b1 100644
--- a/tools/viewer/SlideDir.cpp
+++ b/tools/viewer/SlideDir.cpp
@@ -26,7 +26,6 @@
class SlideDir::Animator : public SkRefCnt {
public:
- virtual ~Animator() = default;
Animator(const Animator&) = delete;
Animator& operator=(const Animator&) = delete;
@@ -195,7 +194,7 @@
}
protected:
- void onTick(float t) {
+ void onTick(float t) override {
if (!this->isAnimating())
return;