diff --git a/.clang-tidy b/.clang-tidy index a9a2c421af..ed73cb9717 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 bf697636ad..63153d4079 100644 --- a/gm/rects.cpp +++ b/gm/rects.cpp @@ -247,7 +247,7 @@ protected: } // 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 @@ protected: 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 @@ protected: 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 6969c50c3a..0da67d08e1 100644 --- a/modules/skottie/utils/SkottieUtils.cpp +++ b/modules/skottie/utils/SkottieUtils.cpp @@ -15,21 +15,21 @@ public: void onColorProperty(const char node_name[], const LazyHandle& 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& 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& 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 @@ public: void onTextProperty(const char node_name[], const LazyHandle& 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 @@ public: 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 c62090af86..98f9e779b4 100644 --- a/modules/skottie/utils/SkottieUtils.h +++ b/modules/skottie/utils/SkottieUtils.h @@ -70,7 +70,7 @@ private: 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 b500785ff5..3ac60c1fd9 100644 --- a/samplecode/SampleAAGeometry.cpp +++ b/samplecode/SampleAAGeometry.cpp @@ -1248,7 +1248,7 @@ public: } 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 @@ public: } 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 @@ public: } 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 50ffb99079..eb94496d46 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -64,7 +64,7 @@ void SkPictureRecord::recordSave() { } 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::onDrawShadowRec(const SkPath& path, const SkDrawShadowRec& } 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 a7e9d4fe16..1617520466 100644 --- a/src/pathops/SkPathOpsCubic.cpp +++ b/src/pathops/SkPathOpsCubic.cpp @@ -195,11 +195,11 @@ bool SkDCubic::hullIntersects(const SkDPoint* pts, int ptCount, bool* isLinear) } 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 {