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

Unified Diff: tests/BitmapTest.cpp

Issue 164203003: replace setConfig+allocPixels with alloc-or-install-pixels (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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/BitmapHeapTest.cpp ('k') | tests/BlitRowTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/BitmapTest.cpp
diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp
index e304076a34dd9e69f8944d710e4c304b45438fa9..0167d52d02b2a261d11ff5af35cd3a84a8f12aa2 100644
--- a/tests/BitmapTest.cpp
+++ b/tests/BitmapTest.cpp
@@ -13,8 +13,11 @@ static void test_bigwidth(skiatest::Reporter* reporter) {
SkBitmap bm;
int width = 1 << 29; // *4 will be the high-bit of 32bit int
- REPORTER_ASSERT(reporter, bm.setConfig(SkBitmap::kA8_Config, width, 1));
- REPORTER_ASSERT(reporter, bm.setConfig(SkBitmap::kRGB_565_Config, width, 1));
+ SkImageInfo info = SkImageInfo::Make(width, 1, kAlpha_8_SkColorType,
+ kPremul_SkAlphaType);
+ REPORTER_ASSERT(reporter, bm.setConfig(info));
+ info.fColorType = kRGB_565_SkColorType;
+ REPORTER_ASSERT(reporter, bm.setConfig(info));
// for a 4-byte config, this width will compute a rowbytes of 0x80000000,
// which does not fit in a int32_t. setConfig should detect this, and fail.
@@ -22,19 +25,20 @@ static void test_bigwidth(skiatest::Reporter* reporter) {
// TODO: perhaps skia can relax this, and only require that rowBytes fit
// in a uint32_t (or larger), but for now this is the constraint.
- REPORTER_ASSERT(reporter, !bm.setConfig(SkBitmap::kARGB_8888_Config, width, 1));
+ info.fColorType = kPMColor_SkColorType;
+ REPORTER_ASSERT(reporter, !bm.setConfig(info));
}
/**
* This test contains basic sanity checks concerning bitmaps.
*/
DEF_TEST(Bitmap, reporter) {
- const SkBitmap::Config conf = SkBitmap::kARGB_8888_Config;
// Zero-sized bitmaps are allowed
for (int width = 0; width < 2; ++width) {
for (int height = 0; height < 2; ++height) {
SkBitmap bm;
- bool setConf = bm.setConfig(conf, width, height);
+ bool setConf = bm.setConfig(SkImageInfo::MakeN32Premul(width,
+ height));
REPORTER_ASSERT(reporter, setConf);
if (setConf) {
REPORTER_ASSERT(reporter, bm.allocPixels(NULL));
« no previous file with comments | « tests/BitmapHeapTest.cpp ('k') | tests/BlitRowTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698