Clean up some lint complaints
authorrobertphillips <robertphillips@google.com>
Thu, 3 Sep 2015 19:58:48 +0000 (12:58 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 3 Sep 2015 19:58:49 +0000 (12:58 -0700)
BUG=skia:4287

Review URL: https://codereview.chromium.org/1327943003

src/core/SkPictureShader.cpp
src/gpu/batches/GrAAConvexPathRenderer.cpp
src/gpu/batches/GrAAConvexTessellator.cpp
src/gpu/batches/GrAAHairLinePathRenderer.cpp

index 81e8ab42eed69e18efdd551a3a22ebf56e30ea29..80d5974b057e1de0428d10267bfee60d5706cf64 100644 (file)
@@ -155,12 +155,12 @@ void SkPictureShader::flatten(SkWriteBuffer& buffer) const {
     }
 }
 
-SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatrix* localM,
-                                            const int maxTextureSize) const {
+SkShader* SkPictureShader::refBitmapShader(const SkMatrix& viewMatrix, const SkMatrix* localM,
+                                           const int maxTextureSize) const {
     SkASSERT(fPicture && !fPicture->cullRect().isEmpty());
 
     SkMatrix m;
-    m.setConcat(matrix, this->getLocalMatrix());
+    m.setConcat(viewMatrix, this->getLocalMatrix());
     if (localM) {
         m.preConcat(*localM);
     }
@@ -215,12 +215,12 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri
                         this->getLocalMatrix());
 
     if (!SkResourceCache::Find(key, BitmapShaderRec::Visitor, &tileShader)) {
-        SkMatrix matrix;
-        matrix.setRectToRect(fTile, SkRect::MakeIWH(tileSize.width(), tileSize.height()),
+        SkMatrix tileMatrix;
+        tileMatrix.setRectToRect(fTile, SkRect::MakeIWH(tileSize.width(), tileSize.height()),
                              SkMatrix::kFill_ScaleToFit);
         SkBitmap bm;
         if (!SkInstallDiscardablePixelRef(
-            SkImageGenerator::NewFromPicture(tileSize, fPicture, &matrix, nullptr), &bm)) {
+            SkImageGenerator::NewFromPicture(tileSize, fPicture, &tileMatrix, nullptr), &bm)) {
             return nullptr;
         }
 
index 6023f188df8535127180c8480227068d59315d13..613b416601c7361190addb34d4564cd815c65c93 100644 (file)
@@ -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);
index c111b8b56293859fd8590cee31c6dcd40e4ae88d..5ef9aefddd4afc46d46c6d76cc7c92e86a409861 100644 (file)
@@ -721,11 +721,11 @@ bool GrAAConvexTessellator::createInsetRing(const Ring& lastRing, Ring* nextRing
         dst[i] = nextRing->index(dst[i]);
     }
 
-    for (int cur = 0; cur < lastRing.numPts(); ++cur) {
-        int next = (cur + 1) % lastRing.numPts();
+    for (int i = 0; i < lastRing.numPts(); ++i) {
+        int next = (i + 1) % lastRing.numPts();
 
-        this->addTri(lastRing.index(cur), lastRing.index(next), dst[next]);
-        this->addTri(lastRing.index(cur), dst[next], dst[cur]);
+        this->addTri(lastRing.index(i), lastRing.index(next), dst[next]);
+        this->addTri(lastRing.index(i), dst[next], dst[i]);
     }
 
     if (done && fStrokeWidth < 0.0f) {
index e102db27a09c22e3a4cb7b3ef90d8cff6150d170..c6bdd055bb9eccb8bbdbc8cb98416745984e7fe1 100644 (file)
@@ -908,28 +908,28 @@ void AAHairlineBatch::onPrepareDraws(Target* target) {
         }
 
         // Setup vertices
-        BezierVertex* verts = reinterpret_cast<BezierVertex*>(vertices);
+        BezierVertex* bezVerts = reinterpret_cast<BezierVertex*>(vertices);
 
         int unsubdivQuadCnt = quads.count() / 3;
         for (int i = 0; i < unsubdivQuadCnt; ++i) {
             SkASSERT(qSubdivs[i] >= 0);
-            add_quads(&quads[3*i], qSubdivs[i], toDevice, toSrc, &verts);
+            add_quads(&quads[3*i], qSubdivs[i], toDevice, toSrc, &bezVerts);
         }
 
         // Start Conics
         for (int i = 0; i < conicCount; ++i) {
-            add_conics(&conics[3*i], cWeights[i], toDevice, toSrc, &verts);
+            add_conics(&conics[3*i], cWeights[i], toDevice, toSrc, &bezVerts);
         }
 
         if (quadCount > 0) {
             target->initDraw(quadGP, this->pipeline());
 
             {
-                GrVertices verts;
-                verts.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
-                                    firstVertex, kQuadNumVertices, kIdxsPerQuad, quadCount,
-                                    kQuadsNumInIdxBuffer);
-                target->draw(verts);
+                GrVertices tempVerts;
+                tempVerts.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
+                                        firstVertex, kQuadNumVertices, kIdxsPerQuad, quadCount,
+                                        kQuadsNumInIdxBuffer);
+                target->draw(tempVerts);
                 firstVertex += quadCount * kQuadNumVertices;
            }
         }
@@ -938,11 +938,11 @@ void AAHairlineBatch::onPrepareDraws(Target* target) {
             target->initDraw(conicGP, this->pipeline());
 
             {
-                GrVertices verts;
-                verts.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
-                                    firstVertex, kQuadNumVertices, kIdxsPerQuad, conicCount,
-                                    kQuadsNumInIdxBuffer);
-                target->draw(verts);
+                GrVertices tempVerts;
+                tempVerts.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
+                                        firstVertex, kQuadNumVertices, kIdxsPerQuad, conicCount,
+                                        kQuadsNumInIdxBuffer);
+                target->draw(tempVerts);
             }
         }
     }