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>
This commit is contained in:
parent
efc17ce2ca
commit
3977088e23
@ -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:
|
CheckOptions:
|
||||||
- key: llvm-namespace-comment.SpacesBeforeComments
|
- key: llvm-namespace-comment.SpacesBeforeComments
|
||||||
value: 2
|
value: 2
|
||||||
|
@ -247,7 +247,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// position the current test on the canvas
|
// 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,
|
canvas->translate(SK_Scalar1 * 100 * (testCount % 10) + SK_Scalar1 / 4,
|
||||||
SK_Scalar1 * 100 * (testCount / 10) + 3 * 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 i = 0; i < fPaints.count(); ++i) {
|
||||||
for (int j = 0; j < fRects.count(); ++j, ++testCount) {
|
for (int j = 0; j < fRects.count(); ++j, ++testCount) {
|
||||||
canvas->save();
|
canvas->save();
|
||||||
this->position(canvas, testCount);
|
Position(canvas, testCount);
|
||||||
SkPaint p = fPaints[i];
|
SkPaint p = fPaints[i];
|
||||||
if (p.getColor() == kLooperColorSentinel) {
|
if (p.getColor() == kLooperColorSentinel) {
|
||||||
p.setColor(SK_ColorWHITE);
|
p.setColor(SK_ColorWHITE);
|
||||||
@ -282,7 +282,7 @@ protected:
|
|||||||
for (int i = 0; i < fMatrices.count(); ++i) {
|
for (int i = 0; i < fMatrices.count(); ++i) {
|
||||||
for (int j = 0; j < fRects.count(); ++j, ++testCount) {
|
for (int j = 0; j < fRects.count(); ++j, ++testCount) {
|
||||||
canvas->save();
|
canvas->save();
|
||||||
this->position(canvas, testCount);
|
Position(canvas, testCount);
|
||||||
canvas->concat(fMatrices[i]);
|
canvas->concat(fMatrices[i]);
|
||||||
canvas->drawRect(fRects[j], paint);
|
canvas->drawRect(fRects[j], paint);
|
||||||
canvas->restore();
|
canvas->restore();
|
||||||
|
@ -15,21 +15,21 @@ public:
|
|||||||
|
|
||||||
void onColorProperty(const char node_name[],
|
void onColorProperty(const char node_name[],
|
||||||
const LazyHandle<skottie::ColorPropertyHandle>& c) override {
|
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";
|
const auto key = markedKey.empty() ? markedKey : fMgr->fCurrentNode + ".Color";
|
||||||
fMgr->fColorMap[key].push_back(c());
|
fMgr->fColorMap[key].push_back(c());
|
||||||
}
|
}
|
||||||
|
|
||||||
void onOpacityProperty(const char node_name[],
|
void onOpacityProperty(const char node_name[],
|
||||||
const LazyHandle<skottie::OpacityPropertyHandle>& o) override {
|
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";
|
const auto key = markedKey.empty() ? markedKey : fMgr->fCurrentNode + ".Opacity";
|
||||||
fMgr->fOpacityMap[key].push_back(o());
|
fMgr->fOpacityMap[key].push_back(o());
|
||||||
}
|
}
|
||||||
|
|
||||||
void onTransformProperty(const char node_name[],
|
void onTransformProperty(const char node_name[],
|
||||||
const LazyHandle<skottie::TransformPropertyHandle>& t) override {
|
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";
|
const auto key = markedKey.empty() ? markedKey : fMgr->fCurrentNode + ".Transform";
|
||||||
fMgr->fTransformMap[key].push_back(t());
|
fMgr->fTransformMap[key].push_back(t());
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
void onTextProperty(const char node_name[],
|
void onTextProperty(const char node_name[],
|
||||||
const LazyHandle<skottie::TextPropertyHandle>& t) override {
|
const LazyHandle<skottie::TextPropertyHandle>& t) override {
|
||||||
const auto key = fMgr->acceptKey(node_name);
|
const auto key = CustomPropertyManager::AcceptKey(node_name);
|
||||||
if (!key.empty()) {
|
if (!key.empty()) {
|
||||||
fMgr->fTextMap[key].push_back(t());
|
fMgr->fTextMap[key].push_back(t());
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
explicit MarkerInterceptor(CustomPropertyManager* mgr) : fMgr(mgr) {}
|
explicit MarkerInterceptor(CustomPropertyManager* mgr) : fMgr(mgr) {}
|
||||||
|
|
||||||
void onMarker(const char name[], float t0, float t1) override {
|
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()) {
|
if (!key.empty()) {
|
||||||
fMgr->fMarkers.push_back({ std::move(key), t0, t1 });
|
fMgr->fMarkers.push_back({ std::move(key), t0, t1 });
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ private:
|
|||||||
class PropertyInterceptor;
|
class PropertyInterceptor;
|
||||||
class MarkerInterceptor;
|
class MarkerInterceptor;
|
||||||
|
|
||||||
static std::string acceptKey(const char* name) {
|
static std::string AcceptKey(const char* name) {
|
||||||
static constexpr char kPrefix = '$';
|
static constexpr char kPrefix = '$';
|
||||||
|
|
||||||
return (name[0] == kPrefix && name[1] != '\0')
|
return (name[0] == kPrefix && name[1] != '\0')
|
||||||
|
@ -1248,7 +1248,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void quad_coverage(SkPoint pts[3], uint8_t* distanceMap, int w, int h) {
|
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) {
|
if (dist < gCurveDistance) {
|
||||||
(void) coverage(pts[0], pts[2], distanceMap, w, h);
|
(void) coverage(pts[0], pts[2], distanceMap, w, h);
|
||||||
return;
|
return;
|
||||||
@ -1260,7 +1260,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void conic_coverage(SkPoint pts[3], SkScalar weight, uint8_t* distanceMap, int w, int h) {
|
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) {
|
if (dist < gCurveDistance) {
|
||||||
(void) coverage(pts[0], pts[2], distanceMap, w, h);
|
(void) coverage(pts[0], pts[2], distanceMap, w, h);
|
||||||
return;
|
return;
|
||||||
@ -1275,7 +1275,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cubic_coverage(SkPoint pts[4], uint8_t* distanceMap, int w, int h) {
|
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) {
|
if (dist < gCurveDistance) {
|
||||||
(void) coverage(pts[0], pts[3], distanceMap, w, h);
|
(void) coverage(pts[0], pts[3], distanceMap, w, h);
|
||||||
return;
|
return;
|
||||||
|
@ -64,7 +64,7 @@ void SkPictureRecord::recordSave() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SkPictureRecord::onMarkCTM(const char* name) {
|
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 size = sizeof(kUInt32Size) + nameLen; // op + name
|
||||||
size_t initialOffset = this->addDraw(MARK_CTM, &size);
|
size_t initialOffset = this->addDraw(MARK_CTM, &size);
|
||||||
fWriter.writeString(name);
|
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) {
|
void SkPictureRecord::onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) {
|
||||||
size_t keyLen = fWriter.WriteStringSize(key);
|
size_t keyLen = SkWriter32::WriteStringSize(key);
|
||||||
size_t valueLen = fWriter.WriteDataSize(value);
|
size_t valueLen = SkWriter32::WriteDataSize(value);
|
||||||
size_t size = 4 + sizeof(SkRect) + keyLen + valueLen;
|
size_t size = 4 + sizeof(SkRect) + keyLen + valueLen;
|
||||||
|
|
||||||
size_t initialOffset = this->addDraw(DRAW_ANNOTATION, &size);
|
size_t initialOffset = this->addDraw(DRAW_ANNOTATION, &size);
|
||||||
|
@ -195,11 +195,11 @@ bool SkDCubic::hullIntersects(const SkDPoint* pts, int ptCount, bool* isLinear)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkDCubic::hullIntersects(const SkDCubic& c2, bool* isLinear) const {
|
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 {
|
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 {
|
bool SkDCubic::hullIntersects(const SkDConic& conic, bool* isLinear) const {
|
||||||
|
Loading…
Reference in New Issue
Block a user