diff options
author | Stan Iliev <stani@google.com> | 2017-03-15 16:37:10 -0400 |
---|---|---|
committer | Stan Iliev <stani@google.com> | 2017-03-20 11:49:51 -0400 |
commit | cc29a5dde1ef0a3cf0fcec10eb9d37d9e8fa3afb (patch) | |
tree | 3212df1c8e0fad9cd218829804b498ab51f5d27f /libs/hwui/tests/unit/VectorDrawableTests.cpp | |
parent | f87e2344880fde52ec0b619c0bb91fdfb29c0fc4 (diff) |
Modify VectorDrawable to scale path through canvas matrix
Apply the path matrix to the canvas instead of creating a new path.
Delete logic that scales the stroke, because this is done through
the matrix as well. Merge/delete some functions.
Bug: 36392701
Test: CTS graphics tests pass with minor changes in 6 golden images.
Quick settings and settings app drawables are OK. Vector icon app
draws identical paths.
Change-Id: If623bc0a535fad95a2839f79bd997c016bcd9d4d
Diffstat (limited to 'libs/hwui/tests/unit/VectorDrawableTests.cpp')
-rw-r--r-- | libs/hwui/tests/unit/VectorDrawableTests.cpp | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/libs/hwui/tests/unit/VectorDrawableTests.cpp b/libs/hwui/tests/unit/VectorDrawableTests.cpp index 8e0d3ee572a6..6f264e1ebf62 100644 --- a/libs/hwui/tests/unit/VectorDrawableTests.cpp +++ b/libs/hwui/tests/unit/VectorDrawableTests.cpp @@ -347,51 +347,6 @@ TEST(VectorDrawableUtils, interpolatePathData) { } } -TEST(VectorDrawable, matrixScale) { - struct MatrixAndScale { - float buffer[9]; - float matrixScale; - }; - - const MatrixAndScale sMatrixAndScales[] { - { - {1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - 1.0 - }, - { - {1.0f, 0.0f, 240.0f, 0.0f, 1.0f, 240.0f, 0.0f, 0.0f, 1.0f}, - 1.0f, - }, - { - {1.5f, 0.0f, 24.0f, 0.0f, 1.5f, 24.0f, 0.0f, 0.0f, 1.0f}, - 1.5f, - }, - { - {0.99999994f, 0.0f, 300.0f, 0.0f, 0.99999994f, 158.57864f, 0.0f, 0.0f, 1.0f}, - 0.99999994f, - }, - { - {0.7071067f, 0.7071067f, 402.5305f, -0.7071067f, 0.7071067f, 169.18524f, 0.0f, 0.0f, 1.0f}, - 0.99999994f, - }, - { - {0.0f, 0.9999999f, 482.5305f, -0.9999999f, 0.0f, 104.18525f, 0.0f, 0.0f, 1.0f}, - 0.9999999f, - }, - { - {-0.35810637f, -0.93368083f, 76.55821f, 0.93368083f, -0.35810637f, 89.538506f, 0.0f, 0.0f, 1.0f}, - 1.0000001f, - }, - }; - - for (MatrixAndScale matrixAndScale : sMatrixAndScales) { - SkMatrix matrix; - matrix.set9(matrixAndScale.buffer); - float actualMatrixScale = VectorDrawable::Path::getMatrixScale(matrix); - EXPECT_EQ(matrixAndScale.matrixScale, actualMatrixScale); - } -} - TEST(VectorDrawable, groupProperties) { //TODO: Also need to test property sync and dirty flag when properties change. VectorDrawable::Group group; @@ -458,7 +413,7 @@ TEST(VectorDrawable, drawPathWithoutIncrementingShaderRefCount) { // Setting the fill gradient increments the ref count of the shader by 1 path.mutateStagingProperties()->setFillGradient(shader); - path.draw(&canvas, SkMatrix::I(), 1.0f, 1.0f, true); + path.draw(&canvas, true); // Resetting the fill gradient decrements the ref count of the shader by 1 path.mutateStagingProperties()->setFillGradient(nullptr); |