Enable ClangTidy check readability-static-accessed-through-instance.

Our codebase generally tends to avoid this pattern naturally, and this
can catch real mistakes, e.g. http://review.skia.org/308659

https://clang.llvm.org/extra/clang-tidy/checks/readability-static-accessed-through-instance.html

Change-Id: I3b37ab6242bcca310bbbec718facdd8687f9c4ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308658
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/.clang-tidy b/.clang-tidy
index a9a2c42..ed73cb9 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,4 +1,4 @@
-Checks: '-*,bugprone-use-after-move,bugprone-unused-raii,bugprone-undelegated-constructor,bugprone-argument-comment,performance-for-range-copy,bugprone-bool-pointer-implicit-conversion,readability-redundant-preprocessor,misc-definitions-in-headers,modernize-make-unique,llvm-namespace-comment,google-build-namespaces'
+Checks: '-*,bugprone-use-after-move,bugprone-unused-raii,bugprone-undelegated-constructor,bugprone-argument-comment,performance-for-range-copy,bugprone-bool-pointer-implicit-conversion,readability-redundant-preprocessor,misc-definitions-in-headers,modernize-make-unique,llvm-namespace-comment,readability-static-accessed-through-instance,google-build-namespaces'
 CheckOptions:
   - key:             llvm-namespace-comment.SpacesBeforeComments
     value:           2
diff --git a/gm/rects.cpp b/gm/rects.cpp
index bf69763..63153d4 100644
--- a/gm/rects.cpp
+++ b/gm/rects.cpp
@@ -247,7 +247,7 @@
     }
 
     // position the current test on the canvas
-    static void position(SkCanvas* canvas, int testCount) {
+    static void Position(SkCanvas* canvas, int testCount) {
         canvas->translate(SK_Scalar1 * 100 * (testCount % 10) + SK_Scalar1 / 4,
                           SK_Scalar1 * 100 * (testCount / 10) + 3 * SK_Scalar1 / 4);
     }
@@ -260,7 +260,7 @@
         for (int i = 0; i < fPaints.count(); ++i) {
             for (int j = 0; j < fRects.count(); ++j, ++testCount) {
                 canvas->save();
-                this->position(canvas, testCount);
+                Position(canvas, testCount);
                 SkPaint p = fPaints[i];
                 if (p.getColor() == kLooperColorSentinel) {
                     p.setColor(SK_ColorWHITE);
@@ -282,7 +282,7 @@
         for (int i = 0; i < fMatrices.count(); ++i) {
             for (int j = 0; j < fRects.count(); ++j, ++testCount) {
                 canvas->save();
-                this->position(canvas, testCount);
+                Position(canvas, testCount);
                 canvas->concat(fMatrices[i]);
                 canvas->drawRect(fRects[j], paint);
                 canvas->restore();
diff --git a/modules/skottie/utils/SkottieUtils.cpp b/modules/skottie/utils/SkottieUtils.cpp
index 6969c50..0da67d0 100644
--- a/modules/skottie/utils/SkottieUtils.cpp
+++ b/modules/skottie/utils/SkottieUtils.cpp
@@ -15,21 +15,21 @@
 
     void onColorProperty(const char node_name[],
                          const LazyHandle<skottie::ColorPropertyHandle>& c) override {
-        const auto markedKey = fMgr->acceptKey(node_name);
+        const auto markedKey = CustomPropertyManager::AcceptKey(node_name);
         const auto key = markedKey.empty() ? markedKey : fMgr->fCurrentNode + ".Color";
         fMgr->fColorMap[key].push_back(c());
     }
 
     void onOpacityProperty(const char node_name[],
                            const LazyHandle<skottie::OpacityPropertyHandle>& o) override {
-        const auto markedKey = fMgr->acceptKey(node_name);
+        const auto markedKey = CustomPropertyManager::AcceptKey(node_name);
         const auto key = markedKey.empty() ? markedKey : fMgr->fCurrentNode + ".Opacity";
         fMgr->fOpacityMap[key].push_back(o());
     }
 
     void onTransformProperty(const char node_name[],
                              const LazyHandle<skottie::TransformPropertyHandle>& t) override {
-        const auto markedKey = fMgr->acceptKey(node_name);
+        const auto markedKey = CustomPropertyManager::AcceptKey(node_name);
         const auto key = markedKey.empty() ? markedKey : fMgr->fCurrentNode + ".Transform";
         fMgr->fTransformMap[key].push_back(t());
     }
@@ -50,7 +50,7 @@
 
     void onTextProperty(const char node_name[],
                         const LazyHandle<skottie::TextPropertyHandle>& t) override {
-        const auto key = fMgr->acceptKey(node_name);
+        const auto key = CustomPropertyManager::AcceptKey(node_name);
         if (!key.empty()) {
             fMgr->fTextMap[key].push_back(t());
         }
@@ -65,7 +65,7 @@
     explicit MarkerInterceptor(CustomPropertyManager* mgr) : fMgr(mgr) {}
 
     void onMarker(const char name[], float t0, float t1) override {
-        const auto key = fMgr->acceptKey(name);
+        const auto key = CustomPropertyManager::AcceptKey(name);
         if (!key.empty()) {
             fMgr->fMarkers.push_back({ std::move(key), t0, t1 });
         }
diff --git a/modules/skottie/utils/SkottieUtils.h b/modules/skottie/utils/SkottieUtils.h
index c62090a..98f9e77 100644
--- a/modules/skottie/utils/SkottieUtils.h
+++ b/modules/skottie/utils/SkottieUtils.h
@@ -70,7 +70,7 @@
     class PropertyInterceptor;
     class MarkerInterceptor;
 
-    static std::string acceptKey(const char* name) {
+    static std::string AcceptKey(const char* name) {
         static constexpr char kPrefix = '$';
 
         return (name[0] == kPrefix && name[1] != '\0')
diff --git a/samplecode/SampleAAGeometry.cpp b/samplecode/SampleAAGeometry.cpp
index b500785..3ac60c1 100644
--- a/samplecode/SampleAAGeometry.cpp
+++ b/samplecode/SampleAAGeometry.cpp
@@ -1248,7 +1248,7 @@
     }
 
     void quad_coverage(SkPoint pts[3], uint8_t* distanceMap, int w, int h) {
-        SkScalar dist = pts[0].Distance(pts[0], pts[2]);
+        SkScalar dist = SkPoint::Distance(pts[0], pts[2]);
         if (dist < gCurveDistance) {
             (void) coverage(pts[0], pts[2], distanceMap, w, h);
             return;
@@ -1260,7 +1260,7 @@
     }
 
     void conic_coverage(SkPoint pts[3], SkScalar weight, uint8_t* distanceMap, int w, int h) {
-        SkScalar dist = pts[0].Distance(pts[0], pts[2]);
+        SkScalar dist = SkPoint::Distance(pts[0], pts[2]);
         if (dist < gCurveDistance) {
             (void) coverage(pts[0], pts[2], distanceMap, w, h);
             return;
@@ -1275,7 +1275,7 @@
     }
 
     void cubic_coverage(SkPoint pts[4], uint8_t* distanceMap, int w, int h) {
-        SkScalar dist = pts[0].Distance(pts[0], pts[3]);
+        SkScalar dist = SkPoint::Distance(pts[0], pts[3]);
         if (dist < gCurveDistance) {
             (void) coverage(pts[0], pts[3], distanceMap, w, h);
             return;
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 50ffb99..eb94496 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -64,7 +64,7 @@
 }
 
 void SkPictureRecord::onMarkCTM(const char* name) {
-    size_t nameLen = fWriter.WriteStringSize(name);
+    size_t nameLen = SkWriter32::WriteStringSize(name);
     size_t size = sizeof(kUInt32Size) + nameLen; // op + name
     size_t initialOffset = this->addDraw(MARK_CTM, &size);
     fWriter.writeString(name);
@@ -761,8 +761,8 @@
 }
 
 void SkPictureRecord::onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) {
-    size_t keyLen = fWriter.WriteStringSize(key);
-    size_t valueLen = fWriter.WriteDataSize(value);
+    size_t keyLen = SkWriter32::WriteStringSize(key);
+    size_t valueLen = SkWriter32::WriteDataSize(value);
     size_t size = 4 + sizeof(SkRect) + keyLen + valueLen;
 
     size_t initialOffset = this->addDraw(DRAW_ANNOTATION, &size);
diff --git a/src/pathops/SkPathOpsCubic.cpp b/src/pathops/SkPathOpsCubic.cpp
index a7e9d4f..1617520 100644
--- a/src/pathops/SkPathOpsCubic.cpp
+++ b/src/pathops/SkPathOpsCubic.cpp
@@ -195,11 +195,11 @@
 }
 
 bool SkDCubic::hullIntersects(const SkDCubic& c2, bool* isLinear) const {
-    return hullIntersects(c2.fPts, c2.kPointCount, isLinear);
+    return hullIntersects(c2.fPts, SkDCubic::kPointCount, isLinear);
 }
 
 bool SkDCubic::hullIntersects(const SkDQuad& quad, bool* isLinear) const {
-    return hullIntersects(quad.fPts, quad.kPointCount, isLinear);
+    return hullIntersects(quad.fPts, SkDQuad::kPointCount, isLinear);
 }
 
 bool SkDCubic::hullIntersects(const SkDConic& conic, bool* isLinear) const {