Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: src/gpu/batches/GrAAConvexPathRenderer.cpp

Issue 1327943003: Clean up some lint complaints and fix center_of_mass() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPictureShader.cpp ('k') | src/gpu/batches/GrAAConvexTessellator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrAAConvexPathRenderer.cpp
diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp
index 6023f188df8535127180c8480227068d59315d13..613b416601c7361190addb34d4564cd815c65c93 100644
--- a/src/gpu/batches/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp
@@ -81,15 +81,15 @@ static void center_of_mass(const SegmentArray& segments, SkPoint* c) {
pj = segments[1].endPt() - p0;
for (int i = 1; i < count - 1; ++i) {
pi = pj;
- const SkPoint pj = segments[i + 1].endPt() - p0;
+ pj = segments[i + 1].endPt() - p0;
- SkScalar t = SkScalarMul(pi.fX, pj.fY) - SkScalarMul(pj.fX, pi.fY);
+ SkScalar t = SkPoint::CrossProduct(pi, pj);
area += t;
center.fX += (pi.fX + pj.fX) * t;
center.fY += (pi.fY + pj.fY) * t;
-
}
}
+
// If the poly has no area then we instead return the average of
// its points.
if (SkScalarNearlyZero(area)) {
@@ -106,8 +106,7 @@ static void center_of_mass(const SegmentArray& segments, SkPoint* c) {
} else {
area *= 3;
area = SkScalarInvert(area);
- center.fX = SkScalarMul(center.fX, area);
- center.fY = SkScalarMul(center.fY, area);
+ center.scale(area);
// undo the translate of p0 to the origin.
*c = center + p0;
}
@@ -916,8 +915,8 @@ private:
GrVertices vertices;
- for (int i = 0; i < draws.count(); ++i) {
- const Draw& draw = draws[i];
+ for (int j = 0; j < draws.count(); ++j) {
+ const Draw& draw = draws[j];
vertices.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer,
firstVertex, firstIndex, draw.fVertexCnt, draw.fIndexCnt);
target->draw(vertices);
« no previous file with comments | « src/core/SkPictureShader.cpp ('k') | src/gpu/batches/GrAAConvexTessellator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698