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

Unified Diff: tests/ShaderTest.cpp

Issue 2195893002: Always return ImageShader, even from SkShader::MakeBitmapShader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update serialize-8888 ignore list: skbug.com/5595 Created 4 years, 5 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
Index: tests/ShaderTest.cpp
diff --git a/tests/ShaderTest.cpp b/tests/ShaderTest.cpp
index d3f74ffb3d384e35a604ef7ffa4be10b6ed51051..83240478ad98c145762c6d70fe31ffb09e907e66 100644
--- a/tests/ShaderTest.cpp
+++ b/tests/ShaderTest.cpp
@@ -15,8 +15,7 @@
static void check_isabitmap(skiatest::Reporter* reporter, SkShader* shader,
int expectedW, int expectedH,
SkShader::TileMode expectedX, SkShader::TileMode expectedY,
- const SkMatrix& expectedM,
- bool expectedImage) {
+ const SkMatrix& expectedM) {
SkBitmap bm;
SkShader::TileMode tileModes[2];
SkMatrix localM;
@@ -32,14 +31,12 @@ static void check_isabitmap(skiatest::Reporter* reporter, SkShader* shader,
tileModes[0] = tileModes[1] = (SkShader::TileMode)99;
SkImage* image = shader->isAImage(&localM, tileModes);
- REPORTER_ASSERT(reporter, (image != nullptr) == expectedImage);
- if (image) {
- REPORTER_ASSERT(reporter, image->width() == expectedW);
- REPORTER_ASSERT(reporter, image->height() == expectedH);
- REPORTER_ASSERT(reporter, localM == expectedM);
- REPORTER_ASSERT(reporter, tileModes[0] == expectedX);
- REPORTER_ASSERT(reporter, tileModes[1] == expectedY);
- }
+ REPORTER_ASSERT(reporter, image);
+ REPORTER_ASSERT(reporter, image->width() == expectedW);
+ REPORTER_ASSERT(reporter, image->height() == expectedH);
+ REPORTER_ASSERT(reporter, localM == expectedM);
+ REPORTER_ASSERT(reporter, tileModes[0] == expectedX);
+ REPORTER_ASSERT(reporter, tileModes[1] == expectedY);
}
DEF_TEST(Shader_isABitmap, reporter) {
@@ -55,6 +52,6 @@ DEF_TEST(Shader_isABitmap, reporter) {
auto shader0 = SkShader::MakeBitmapShader(bm, tmx, tmy, &localM);
auto shader1 = SkImage::MakeFromBitmap(bm)->makeShader(tmx, tmy, &localM);
- check_isabitmap(reporter, shader0.get(), W, H, tmx, tmy, localM, false);
- check_isabitmap(reporter, shader1.get(), W, H, tmx, tmy, localM, true);
+ check_isabitmap(reporter, shader0.get(), W, H, tmx, tmy, localM);
+ check_isabitmap(reporter, shader1.get(), W, H, tmx, tmy, localM);
}
« src/image/SkImageShader.h ('K') | « tests/BlitRowTest.cpp ('k') | tools/dm_flags.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698