OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 | 9 |
10 #include "Test.h" | 10 #include "Test.h" |
11 #include "TestClassDef.h" | |
12 | 11 |
13 static void test_bigwidth(skiatest::Reporter* reporter) { | 12 static void test_bigwidth(skiatest::Reporter* reporter) { |
14 SkBitmap bm; | 13 SkBitmap bm; |
15 int width = 1 << 29; // *4 will be the high-bit of 32bit int | 14 int width = 1 << 29; // *4 will be the high-bit of 32bit int |
16 | 15 |
17 REPORTER_ASSERT(reporter, bm.setConfig(SkBitmap::kA8_Config, width, 1)); | 16 REPORTER_ASSERT(reporter, bm.setConfig(SkBitmap::kA8_Config, width, 1)); |
18 REPORTER_ASSERT(reporter, bm.setConfig(SkBitmap::kRGB_565_Config, width, 1))
; | 17 REPORTER_ASSERT(reporter, bm.setConfig(SkBitmap::kRGB_565_Config, width, 1))
; |
19 | 18 |
20 // for a 4-byte config, this width will compute a rowbytes of 0x80000000, | 19 // for a 4-byte config, this width will compute a rowbytes of 0x80000000, |
21 // which does not fit in a int32_t. setConfig should detect this, and fail. | 20 // which does not fit in a int32_t. setConfig should detect this, and fail. |
(...skipping 17 matching lines...) Expand all Loading... |
39 REPORTER_ASSERT(reporter, setConf); | 38 REPORTER_ASSERT(reporter, setConf); |
40 if (setConf) { | 39 if (setConf) { |
41 REPORTER_ASSERT(reporter, bm.allocPixels(NULL)); | 40 REPORTER_ASSERT(reporter, bm.allocPixels(NULL)); |
42 } | 41 } |
43 REPORTER_ASSERT(reporter, SkToBool(width & height) != bm.empty()); | 42 REPORTER_ASSERT(reporter, SkToBool(width & height) != bm.empty()); |
44 } | 43 } |
45 } | 44 } |
46 | 45 |
47 test_bigwidth(reporter); | 46 test_bigwidth(reporter); |
48 } | 47 } |
OLD | NEW |