Use SkSurfaceValidateRasterInfo in some lesser-used canvas factories
The previous version would reject valid configs (like non-N32 8888).
This changes the results of some unit tests:
- Creating a zero-sized canvas via MakeRasterDirect now fails (like
it would if you tried to create a zero-sized surface).
- The picture image generator can now produce BGRA and RGBA results,
regardless of N32, and can produce unpremul.
Bug: skia:
Change-Id: Ifd9fe98adf56748f73eaea01118c928b0a13606b
Reviewed-on: https://skia-review.googlesource.com/c/161120
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 2a4c26c..08b6df6 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -625,10 +625,10 @@
info = SkImageInfo::Make(10, 10, kUnknown_SkColorType, info.alphaType());
REPORTER_ASSERT(reporter, nullptr == SkCanvas::MakeRasterDirect(info, baseAddr, minRowBytes));
- // We should succeed with a zero-sized valid info
+ // We should not succeed with a zero-sized valid info
info = SkImageInfo::MakeN32Premul(0, 0);
canvas = SkCanvas::MakeRasterDirect(info, baseAddr, minRowBytes);
- REPORTER_ASSERT(reporter, canvas);
+ REPORTER_ASSERT(reporter, nullptr == canvas);
}
DEF_TEST(Canvas, reporter) {