From a1b644e88cfe5319e9ada7ad24e6cd215a7ea402 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Tue, 11 Dec 2018 11:09:20 -0800 Subject: Fix performance-for-range-copy warnings Bug: 30413223 Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,performance* Change-Id: Ie481e88025a7a1f3abde8ff63420d5ccd8577e52 --- libs/hwui/tests/common/scenes/ShapeAnimation.cpp | 2 +- libs/hwui/tests/unit/VectorDrawableTests.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'libs') diff --git a/libs/hwui/tests/common/scenes/ShapeAnimation.cpp b/libs/hwui/tests/common/scenes/ShapeAnimation.cpp index 0d87776e083e..d189a9379c33 100644 --- a/libs/hwui/tests/common/scenes/ShapeAnimation.cpp +++ b/libs/hwui/tests/common/scenes/ShapeAnimation.cpp @@ -76,7 +76,7 @@ public: paint.setStrokeWidth(strokeWidth); // fill column with each op int middleCount = canvas.save(SaveFlags::MatrixClip); - for (auto op : ops) { + for (const auto& op : ops) { int innerCount = canvas.save(SaveFlags::MatrixClip); canvas.clipRect(0, 0, cellSize, cellSize, SkClipOp::kIntersect); canvas.drawColor(Color::White, SkBlendMode::kSrcOver); diff --git a/libs/hwui/tests/unit/VectorDrawableTests.cpp b/libs/hwui/tests/unit/VectorDrawableTests.cpp index 02f740cee096..4f299e377f09 100644 --- a/libs/hwui/tests/unit/VectorDrawableTests.cpp +++ b/libs/hwui/tests/unit/VectorDrawableTests.cpp @@ -251,7 +251,7 @@ static bool hasSameVerbs(const PathData& from, const PathData& to) { } TEST(PathParser, parseStringForData) { - for (TestData testData : sTestDataSet) { + for (const TestData& testData : sTestDataSet) { PathParser::ParseResult result; // Test generated path data against the given data. PathData pathData; @@ -271,7 +271,7 @@ TEST(PathParser, parseStringForData) { } TEST(VectorDrawableUtils, createSkPathFromPathData) { - for (TestData testData : sTestDataSet) { + for (const TestData& testData : sTestDataSet) { SkPath expectedPath; testData.skPathLamda(&expectedPath); SkPath actualPath; @@ -281,7 +281,7 @@ TEST(VectorDrawableUtils, createSkPathFromPathData) { } TEST(PathParser, parseAsciiStringForSkPath) { - for (TestData testData : sTestDataSet) { + for (const TestData& testData : sTestDataSet) { PathParser::ParseResult result; size_t length = strlen(testData.pathString); // Check the return value as well as the SkPath generated. @@ -304,8 +304,8 @@ TEST(PathParser, parseAsciiStringForSkPath) { } TEST(VectorDrawableUtils, morphPathData) { - for (TestData fromData : sTestDataSet) { - for (TestData toData : sTestDataSet) { + for (const TestData& fromData : sTestDataSet) { + for (const TestData& toData : sTestDataSet) { bool canMorph = VectorDrawableUtils::canMorph(fromData.pathData, toData.pathData); if (fromData.pathData == toData.pathData) { EXPECT_TRUE(canMorph); @@ -319,8 +319,8 @@ TEST(VectorDrawableUtils, morphPathData) { TEST(VectorDrawableUtils, interpolatePathData) { // Interpolate path data with itself and every other path data - for (TestData fromData : sTestDataSet) { - for (TestData toData : sTestDataSet) { + for (const TestData& fromData : sTestDataSet) { + for (const TestData& toData : sTestDataSet) { PathData outData; bool success = VectorDrawableUtils::interpolatePathData(&outData, fromData.pathData, toData.pathData, 0.5); @@ -331,7 +331,7 @@ TEST(VectorDrawableUtils, interpolatePathData) { float fractions[] = {0, 0.00001, 0.28, 0.5, 0.7777, 0.9999999, 1}; // Now try to interpolate with a slightly modified version of self and expect success - for (TestData fromData : sTestDataSet) { + for (const TestData& fromData : sTestDataSet) { PathData toPathData = fromData.pathData; for (size_t i = 0; i < toPathData.points.size(); i++) { toPathData.points[i]++; -- cgit v1.2.3-59-g8ed1b