Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: tests/BlurTest.cpp

Issue 1821533002: guard rasterizer and drawlooper setters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: guard google3 Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkLayerRasterizer.cpp ('k') | tests/LayerDrawLooperTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/BlurTest.cpp
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 30f218aa924909bfdf2102ad0dd55a9a10919664..39ef7382883f49582af458eeba87c1908bf22e62 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -418,12 +418,12 @@ static void test_blurDrawLooper(skiatest::Reporter* reporter, SkScalar sigma,
const SkBlurQuality quality = blurMaskFilterFlags_as_quality(blurMaskFilterFlags);
uint32_t flags = blurMaskFilterFlags_to_blurDrawLooperFlags(blurMaskFilterFlags);
- SkAutoTUnref<SkDrawLooper> lp(SkBlurDrawLooper::Create(color, sigma, dx, dy, flags));
+ sk_sp<SkDrawLooper> lp(SkBlurDrawLooper::Make(color, sigma, dx, dy, flags));
const bool expectSuccess = sigma > 0 &&
0 == (flags & SkBlurDrawLooper::kIgnoreTransform_BlurFlag);
- if (nullptr == lp.get()) {
+ if (nullptr == lp) {
REPORTER_ASSERT(reporter, sigma <= 0);
} else {
SkDrawLooper::BlurShadowRec rec;
@@ -440,8 +440,8 @@ static void test_blurDrawLooper(skiatest::Reporter* reporter, SkScalar sigma,
}
}
-static void test_delete_looper(skiatest::Reporter* reporter, SkDrawLooper* lp, SkScalar sigma,
- SkBlurStyle style, SkBlurQuality quality, bool expectSuccess) {
+static void test_looper(skiatest::Reporter* reporter, sk_sp<SkDrawLooper> lp, SkScalar sigma,
+ SkBlurStyle style, SkBlurQuality quality, bool expectSuccess) {
SkDrawLooper::BlurShadowRec rec;
bool success = lp->asABlurShadow(&rec);
REPORTER_ASSERT(reporter, success == expectSuccess);
@@ -453,7 +453,6 @@ static void test_delete_looper(skiatest::Reporter* reporter, SkDrawLooper* lp, S
REPORTER_ASSERT(reporter, rec.fStyle == style);
REPORTER_ASSERT(reporter, rec.fQuality == quality);
}
- lp->unref();
}
static void make_noop_layer(SkLayerDrawLooper::Builder* builder) {
@@ -481,23 +480,23 @@ static void test_layerDrawLooper(skiatest::Reporter* reporter, SkMaskFilter* mf,
// 1 layer is too few
make_noop_layer(&builder);
- test_delete_looper(reporter, builder.detachLooper(), sigma, style, quality, false);
+ test_looper(reporter, builder.detach(), sigma, style, quality, false);
// 2 layers is good, but need blur
make_noop_layer(&builder);
make_noop_layer(&builder);
- test_delete_looper(reporter, builder.detachLooper(), sigma, style, quality, false);
+ test_looper(reporter, builder.detach(), sigma, style, quality, false);
// 2 layers is just right
make_noop_layer(&builder);
make_blur_layer(&builder, mf);
- test_delete_looper(reporter, builder.detachLooper(), sigma, style, quality, expectSuccess);
+ test_looper(reporter, builder.detach(), sigma, style, quality, expectSuccess);
// 3 layers is too many
make_noop_layer(&builder);
make_blur_layer(&builder, mf);
make_noop_layer(&builder);
- test_delete_looper(reporter, builder.detachLooper(), sigma, style, quality, false);
+ test_looper(reporter, builder.detach(), sigma, style, quality, false);
}
DEF_TEST(BlurAsABlur, reporter) {
« no previous file with comments | « src/effects/SkLayerRasterizer.cpp ('k') | tests/LayerDrawLooperTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698