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 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 REPORTER_ASSERT(reporter, bm8888.height() == goodJpegImageHeight); | 430 REPORTER_ASSERT(reporter, bm8888.height() == goodJpegImageHeight); |
431 REPORTER_ASSERT(reporter, !(bm8888.empty())); | 431 REPORTER_ASSERT(reporter, !(bm8888.empty())); |
432 | 432 |
433 // Pick a few pixels and verify that their colors match the colors | 433 // Pick a few pixels and verify that their colors match the colors |
434 // we expect (given the original image). | 434 // we expect (given the original image). |
435 REPORTER_ASSERT(reporter, bm8888.getColor(7, 9) == 0xffffffff); | 435 REPORTER_ASSERT(reporter, bm8888.getColor(7, 9) == 0xffffffff); |
436 REPORTER_ASSERT(reporter, bm8888.getColor(28, 3) == 0xff000000); | 436 REPORTER_ASSERT(reporter, bm8888.getColor(28, 3) == 0xff000000); |
437 REPORTER_ASSERT(reporter, bm8888.getColor(27, 34) == 0xffffffff); | 437 REPORTER_ASSERT(reporter, bm8888.getColor(27, 34) == 0xffffffff); |
438 REPORTER_ASSERT(reporter, bm8888.getColor(71, 18) == 0xff000000); | 438 REPORTER_ASSERT(reporter, bm8888.getColor(71, 18) == 0xff000000); |
439 | 439 |
| 440 #ifdef SK_BUILD_FOR_IOS // the iOS jpeg decoder fills to gray |
| 441 REPORTER_ASSERT(reporter, bm8888.getColor(127, 127) == 0xff808080 |
| 442 || bm8888.getColor(127, 127) == SK_ColorWHITE); |
| 443 #else |
440 // This is the fill color | 444 // This is the fill color |
441 REPORTER_ASSERT(reporter, bm8888.getColor(127, 127) == SK_ColorWHITE); | 445 REPORTER_ASSERT(reporter, bm8888.getColor(127, 127) == SK_ColorWHITE); |
| 446 #endif |
442 | 447 |
443 #if JPEG_TEST_WRITE_TO_FILE_FOR_DEBUGGING | 448 #if JPEG_TEST_WRITE_TO_FILE_FOR_DEBUGGING |
444 // Check to see that the resulting bitmap is nice | 449 // Check to see that the resulting bitmap is nice |
445 bool writeSuccess = (!(bm8888.empty())) && SkImageEncoder::EncodeFile( | 450 bool writeSuccess = (!(bm8888.empty())) && SkImageEncoder::EncodeFile( |
446 "HalfOfAJpeg.png", bm8888, SkImageEncoder::kPNG_Type, 100); | 451 "HalfOfAJpeg.png", bm8888, SkImageEncoder::kPNG_Type, 100); |
447 SkASSERT(writeSuccess); | 452 SkASSERT(writeSuccess); |
448 #endif | 453 #endif |
449 } | 454 } |
OLD | NEW |