diff options
author | John Reck <jreck@google.com> | 2017-11-03 10:12:19 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2017-11-03 10:57:44 -0700 |
commit | 1bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52 (patch) | |
tree | 4a1366cf2d1cf50b5ec4ed1a8cf0f437053cd0d7 /libs/hwui/tests/common/scenes/SimpleGradientAnimation.cpp | |
parent | 30ec71c0fe194a551d2e4abaff2159e0730488e0 (diff) |
Format the world (or just HWUI)
Test: No code changes, just ran through clang-format
Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
Diffstat (limited to 'libs/hwui/tests/common/scenes/SimpleGradientAnimation.cpp')
-rw-r--r-- | libs/hwui/tests/common/scenes/SimpleGradientAnimation.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/libs/hwui/tests/common/scenes/SimpleGradientAnimation.cpp b/libs/hwui/tests/common/scenes/SimpleGradientAnimation.cpp index 053eb6dee31c..016c65c17c4c 100644 --- a/libs/hwui/tests/common/scenes/SimpleGradientAnimation.cpp +++ b/libs/hwui/tests/common/scenes/SimpleGradientAnimation.cpp @@ -14,7 +14,6 @@ * limitations under the License. */ - #include "TestSceneBase.h" #include <SkGradientShader.h> @@ -22,14 +21,13 @@ class SimpleGradientAnimation; static TestScene::Registrar _SimpleGradient(TestScene::Info{ - "simpleGradient", - "A benchmark of shader performance of linear, 2 color gradients with black in them.", - TestScene::simpleCreateScene<SimpleGradientAnimation> -}); + "simpleGradient", + "A benchmark of shader performance of linear, 2 color gradients with black in them.", + TestScene::simpleCreateScene<SimpleGradientAnimation>}); class SimpleGradientAnimation : public TestScene { public: - std::vector< sp<RenderNode> > cards; + std::vector<sp<RenderNode> > cards; void createContent(int width, int height, Canvas& canvas) override { canvas.drawColor(Color::White, SkBlendMode::kSrcOver); @@ -45,21 +43,23 @@ public: cards[ci]->setPropertyFieldsDirty(RenderNode::X | RenderNode::Y); } } + private: sp<RenderNode> createCard(int x, int y, int width, int height) { - return TestUtils::createNode(x, y, x + width, y + height, + return TestUtils::createNode( + x, y, x + width, y + height, [width, height](RenderProperties& props, Canvas& canvas) { - float pos[] = { 0, 1 }; - SkPoint pts[] = { SkPoint::Make(0, 0), SkPoint::Make(width, height) }; - SkPaint paint; - // overdraw several times to emphasize shader cost - for (int i = 0; i < 10; i++) { - // use i%2 start position to pick 2 color combo with black in it - SkColor colors[3] = { Color::Transparent, Color::Black, Color::Cyan_500 }; - paint.setShader(SkGradientShader::MakeLinear(pts, colors + (i % 2), pos, 2, - SkShader::kClamp_TileMode)); - canvas.drawRect(i, i, width, height, paint); - } - }); + float pos[] = {0, 1}; + SkPoint pts[] = {SkPoint::Make(0, 0), SkPoint::Make(width, height)}; + SkPaint paint; + // overdraw several times to emphasize shader cost + for (int i = 0; i < 10; i++) { + // use i%2 start position to pick 2 color combo with black in it + SkColor colors[3] = {Color::Transparent, Color::Black, Color::Cyan_500}; + paint.setShader(SkGradientShader::MakeLinear(pts, colors + (i % 2), pos, 2, + SkShader::kClamp_TileMode)); + canvas.drawRect(i, i, width, height, paint); + } + }); } }; |