diff options
author | Mike Reed <reed@google.com> | 2019-04-10 16:57:52 -0400 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2019-04-11 09:56:42 -0400 |
commit | 1c2f5fcc7e35312877531069ece5cbee2d9ee040 (patch) | |
tree | af7664ed6dc2a35d5a61093ee7451d81f84d649a /libs/hwui/tests | |
parent | f0f8a1bfe12ddad1e18dc0982686eaafc3daba81 (diff) |
Update to new factories for effects
Test: make
Change-Id: Ib342878524b51d0eacf6c60ece3c7da8bf27d2c0
Diffstat (limited to 'libs/hwui/tests')
7 files changed, 11 insertions, 14 deletions
diff --git a/libs/hwui/tests/common/scenes/BitmapShaders.cpp b/libs/hwui/tests/common/scenes/BitmapShaders.cpp index 510766073b08..400196b203b9 100644 --- a/libs/hwui/tests/common/scenes/BitmapShaders.cpp +++ b/libs/hwui/tests/common/scenes/BitmapShaders.cpp @@ -46,14 +46,12 @@ public: SkPaint paint; sk_sp<SkImage> image = hwuiBitmap->makeImage(); sk_sp<SkShader> repeatShader = - image->makeShader(SkShader::TileMode::kRepeat_TileMode, - SkShader::TileMode::kRepeat_TileMode, nullptr); + image->makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat); paint.setShader(std::move(repeatShader)); canvas.drawRoundRect(0, 0, 500, 500, 50.0f, 50.0f, paint); sk_sp<SkShader> mirrorShader = - image->makeShader(SkShader::TileMode::kMirror_TileMode, - SkShader::TileMode::kMirror_TileMode, nullptr); + image->makeShader(SkTileMode::kMirror, SkTileMode::kMirror); paint.setShader(std::move(mirrorShader)); canvas.drawRoundRect(0, 600, 500, 1100, 50.0f, 50.0f, paint); } diff --git a/libs/hwui/tests/common/scenes/HwBitmapInCompositeShader.cpp b/libs/hwui/tests/common/scenes/HwBitmapInCompositeShader.cpp index 2af955fbb711..659926bae06f 100644 --- a/libs/hwui/tests/common/scenes/HwBitmapInCompositeShader.cpp +++ b/libs/hwui/tests/common/scenes/HwBitmapInCompositeShader.cpp @@ -60,10 +60,10 @@ public: colors[0] = Color::Black; colors[1] = Color::White; sk_sp<SkShader> gradientShader = SkGradientShader::MakeRadial( - center, 50, colors, nullptr, 2, SkShader::TileMode::kRepeat_TileMode); + center, 50, colors, nullptr, 2, SkTileMode::kRepeat); sk_sp<SkShader> compositeShader( - SkShader::MakeComposeShader(hardwareShader, gradientShader, SkBlendMode::kDstATop)); + SkShaders::Blend(SkBlendMode::kDstATop, hardwareShader, gradientShader)); SkPaint paint; paint.setShader(std::move(compositeShader)); @@ -74,7 +74,6 @@ public: sk_sp<SkShader> createBitmapShader(Bitmap& bitmap) { sk_sp<SkImage> image = bitmap.makeImage(); - return image->makeShader(SkShader::TileMode::kClamp_TileMode, - SkShader::TileMode::kClamp_TileMode); + return image->makeShader(); } }; diff --git a/libs/hwui/tests/common/scenes/ListOfFadedTextAnimation.cpp b/libs/hwui/tests/common/scenes/ListOfFadedTextAnimation.cpp index ecaaf487e4f8..c6b60aaec9c5 100644 --- a/libs/hwui/tests/common/scenes/ListOfFadedTextAnimation.cpp +++ b/libs/hwui/tests/common/scenes/ListOfFadedTextAnimation.cpp @@ -44,7 +44,7 @@ class ListOfFadedTextAnimation : public TestListViewSceneBase { SkColor colors[2] = {Color::Black, Color::Transparent}; sk_sp<SkShader> s( - SkGradientShader::MakeLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode)); + SkGradientShader::MakeLinear(pts, colors, NULL, 2, SkTileMode::kClamp)); SkMatrix matrix; matrix.setScale(1, length); diff --git a/libs/hwui/tests/common/scenes/SimpleColorMatrixAnimation.cpp b/libs/hwui/tests/common/scenes/SimpleColorMatrixAnimation.cpp index ff0cb3705cb8..2572d71947b2 100644 --- a/libs/hwui/tests/common/scenes/SimpleColorMatrixAnimation.cpp +++ b/libs/hwui/tests/common/scenes/SimpleColorMatrixAnimation.cpp @@ -66,7 +66,7 @@ private: matrix[SkColorMatrix::kB_Trans] = 5.0f; matrix[SkColorMatrix::kA_Trans] = 10.0f; - paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix)); + paint.setColorFilter(SkColorFilters::MatrixRowMajor255(matrix)); // set a shader so it's not likely for the matrix to be optimized away (since a // clever @@ -75,7 +75,7 @@ private: SkPoint pts[] = {SkPoint::Make(0, 0), SkPoint::Make(width, height)}; SkColor colors[2] = {Color::DeepPurple_500, Color::DeepOrange_500}; paint.setShader(SkGradientShader::MakeLinear(pts, colors, pos, 2, - SkShader::kClamp_TileMode)); + SkTileMode::kClamp)); // overdraw several times to emphasize shader cost for (int i = 0; i < 10; i++) { diff --git a/libs/hwui/tests/common/scenes/SimpleGradientAnimation.cpp b/libs/hwui/tests/common/scenes/SimpleGradientAnimation.cpp index 016c65c17c4c..8bd804e75674 100644 --- a/libs/hwui/tests/common/scenes/SimpleGradientAnimation.cpp +++ b/libs/hwui/tests/common/scenes/SimpleGradientAnimation.cpp @@ -57,7 +57,7 @@ private: // 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)); + SkTileMode::kClamp)); canvas.drawRect(i, i, width, height, paint); } }); diff --git a/libs/hwui/tests/common/scenes/TvApp.cpp b/libs/hwui/tests/common/scenes/TvApp.cpp index 229c7f392629..76f02888f994 100644 --- a/libs/hwui/tests/common/scenes/TvApp.cpp +++ b/libs/hwui/tests/common/scenes/TvApp.cpp @@ -219,7 +219,7 @@ private: image.get())); SkPaint paint; sk_sp<SkColorFilter> filter( - SkColorFilter::MakeModeFilter((curFrame % 150) << 24, SkBlendMode::kSrcATop)); + SkColorFilters::Blend((curFrame % 150) << 24, SkBlendMode::kSrcATop)); paint.setColorFilter(filter); sk_sp<Bitmap> bitmap = mCachedBitmaps[ci]; canvas->drawBitmap(*bitmap, 0, 0, &paint); diff --git a/libs/hwui/tests/unit/VectorDrawableTests.cpp b/libs/hwui/tests/unit/VectorDrawableTests.cpp index 5db002862fcd..60fd7a753f2d 100644 --- a/libs/hwui/tests/unit/VectorDrawableTests.cpp +++ b/libs/hwui/tests/unit/VectorDrawableTests.cpp @@ -395,7 +395,7 @@ TEST(VectorDrawable, drawPathWithoutIncrementingShaderRefCount) { bitmap.allocN32Pixels(5, 5, false); SkCanvas canvas(bitmap); - sk_sp<SkShader> shader = SkShader::MakeColorShader(SK_ColorBLACK); + sk_sp<SkShader> shader = SkShaders::Color(SK_ColorBLACK); // Initial ref count is 1 EXPECT_TRUE(shader->unique()); |