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

Unified Diff: tests/ShaderOpacityTest.cpp

Issue 1793303002: Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make pictureRef a value, so its clearer what's going on 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 | « tests/RecorderTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ShaderOpacityTest.cpp
diff --git a/tests/ShaderOpacityTest.cpp b/tests/ShaderOpacityTest.cpp
index 90d25d731acfaa43467f0b60c0b5b3c52c963a91..698d5442d8eea115ba1769c47e82fe3938bc2e33 100644
--- a/tests/ShaderOpacityTest.cpp
+++ b/tests/ShaderOpacityTest.cpp
@@ -17,42 +17,36 @@ static void test_bitmap(skiatest::Reporter* reporter) {
bmp.setInfo(info);
// test 1: bitmap without pixel data
- SkShader* shader = SkShader::CreateBitmapShader(bmp,
+ auto shader = SkShader::MakeBitmapShader(bmp,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
REPORTER_ASSERT(reporter, shader);
REPORTER_ASSERT(reporter, !shader->isOpaque());
- shader->unref();
// From this point on, we have pixels
bmp.allocPixels(info);
// test 2: not opaque by default
- shader = SkShader::CreateBitmapShader(bmp,
+ shader = SkShader::MakeBitmapShader(bmp,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
REPORTER_ASSERT(reporter, shader);
REPORTER_ASSERT(reporter, !shader->isOpaque());
- shader->unref();
// test 3: explicitly opaque
bmp.setAlphaType(kOpaque_SkAlphaType);
- shader = SkShader::CreateBitmapShader(bmp,
+ shader = SkShader::MakeBitmapShader(bmp,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
REPORTER_ASSERT(reporter, shader);
REPORTER_ASSERT(reporter, shader->isOpaque());
- shader->unref();
// test 4: explicitly not opaque
bmp.setAlphaType(kPremul_SkAlphaType);
- shader = SkShader::CreateBitmapShader(bmp,
+ shader = SkShader::MakeBitmapShader(bmp,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
REPORTER_ASSERT(reporter, shader);
REPORTER_ASSERT(reporter, !shader->isOpaque());
- shader->unref();
-
}
-static void test_gradient(skiatest::Reporter* reporter)
-{
+static void test_gradient(skiatest::Reporter* reporter) {
SkPoint pts[2];
pts[0].iset(0, 0);
pts[1].iset(1, 0);
@@ -64,39 +58,33 @@ static void test_gradient(skiatest::Reporter* reporter)
// test 1: all opaque
colors[0] = SkColorSetARGB(0xFF, 0, 0, 0);
colors[1] = SkColorSetARGB(0xFF, 0, 0, 0);
- SkShader* grad = SkGradientShader::CreateLinear(pts, colors, pos, count,
- mode);
+ auto grad = SkGradientShader::MakeLinear(pts, colors, pos, count, mode);
REPORTER_ASSERT(reporter, grad);
REPORTER_ASSERT(reporter, grad->isOpaque());
- grad->unref();
// test 2: all 0 alpha
colors[0] = SkColorSetARGB(0, 0, 0, 0);
colors[1] = SkColorSetARGB(0, 0, 0, 0);
- grad = SkGradientShader::CreateLinear(pts, colors, pos, count, mode);
+ grad = SkGradientShader::MakeLinear(pts, colors, pos, count, mode);
REPORTER_ASSERT(reporter, grad);
REPORTER_ASSERT(reporter, !grad->isOpaque());
- grad->unref();
// test 3: one opaque, one transparent
colors[0] = SkColorSetARGB(0xFF, 0, 0, 0);
colors[1] = SkColorSetARGB(0x40, 0, 0, 0);
- grad = SkGradientShader::CreateLinear(pts, colors, pos, count, mode);
+ grad = SkGradientShader::MakeLinear(pts, colors, pos, count, mode);
REPORTER_ASSERT(reporter, grad);
REPORTER_ASSERT(reporter, !grad->isOpaque());
- grad->unref();
// test 4: test 3, swapped
colors[0] = SkColorSetARGB(0x40, 0, 0, 0);
colors[1] = SkColorSetARGB(0xFF, 0, 0, 0);
- grad = SkGradientShader::CreateLinear(pts, colors, pos, count, mode);
+ grad = SkGradientShader::MakeLinear(pts, colors, pos, count, mode);
REPORTER_ASSERT(reporter, grad);
REPORTER_ASSERT(reporter, !grad->isOpaque());
- grad->unref();
}
-static void test_color(skiatest::Reporter* reporter)
-{
+static void test_color(skiatest::Reporter* reporter) {
SkColorShader colorShader1(SkColorSetARGB(0,0,0,0));
REPORTER_ASSERT(reporter, !colorShader1.isOpaque());
SkColorShader colorShader2(SkColorSetARGB(0xFF,0,0,0));
« no previous file with comments | « tests/RecorderTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698