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" |
11 #include "SkImageDecoder.h" | 11 #include "SkImageDecoder.h" |
12 #include "SkImage.h" | 12 #include "SkImage.h" |
13 #include "SkStream.h" | 13 #include "SkStream.h" |
14 #include "Test.h" | 14 #include "Test.h" |
15 | 15 |
16 __SK_FORCE_IMAGE_DECODER_LINKING; | 16 __SK_FORCE_IMAGE_DECODER_LINKING; |
17 | 17 |
18 #define JPEG_TEST_WRITE_TO_FILE_FOR_DEBUGGING 0 // do not do this for | 18 #define JPEG_TEST_WRITE_TO_FILE_FOR_DEBUGGING 0 // do not do this for |
19 // normal unit testing. | 19 // normal unit testing. |
20 | 20 |
21 namespace { | 21 namespace { |
22 char goodJpegImage[] = { | 22 unsigned char goodJpegImage[] = { |
23 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, | 23 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, |
24 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x8F, | 24 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x8F, |
25 0x00, 0x8F, 0x00, 0x00, 0xFF, 0xDB, 0x00, 0x43, | 25 0x00, 0x8F, 0x00, 0x00, 0xFF, 0xDB, 0x00, 0x43, |
26 0x00, 0x05, 0x03, 0x04, 0x04, 0x04, 0x03, 0x05, | 26 0x00, 0x05, 0x03, 0x04, 0x04, 0x04, 0x03, 0x05, |
27 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x06, 0x07, | 27 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x06, 0x07, |
28 0x0C, 0x08, 0x07, 0x07, 0x07, 0x07, 0x0F, 0x0B, | 28 0x0C, 0x08, 0x07, 0x07, 0x07, 0x07, 0x0F, 0x0B, |
29 0x0B, 0x09, 0x0C, 0x11, 0x0F, 0x12, 0x12, 0x11, | 29 0x0B, 0x09, 0x0C, 0x11, 0x0F, 0x12, 0x12, 0x11, |
30 0x0F, 0x11, 0x11, 0x13, 0x16, 0x1C, 0x17, 0x13, | 30 0x0F, 0x11, 0x11, 0x13, 0x16, 0x1C, 0x17, 0x13, |
31 0x14, 0x1A, 0x15, 0x11, 0x11, 0x18, 0x21, 0x18, | 31 0x14, 0x1A, 0x15, 0x11, 0x11, 0x18, 0x21, 0x18, |
32 0x1A, 0x1D, 0x1D, 0x1F, 0x1F, 0x1F, 0x13, 0x17, | 32 0x1A, 0x1D, 0x1D, 0x1F, 0x1F, 0x1F, 0x13, 0x17, |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 // Check to see that the resulting bitmap is nice | 447 // Check to see that the resulting bitmap is nice |
448 bool writeSuccess = (!(bm8888.empty())) && SkImageEncoder::EncodeFile( | 448 bool writeSuccess = (!(bm8888.empty())) && SkImageEncoder::EncodeFile( |
449 "HalfOfAJpeg.png", bm8888, SkImageEncoder::kPNG_Type, 100); | 449 "HalfOfAJpeg.png", bm8888, SkImageEncoder::kPNG_Type, 100); |
450 SkASSERT(writeSuccess); | 450 SkASSERT(writeSuccess); |
451 #endif | 451 #endif |
452 } | 452 } |
453 | 453 |
454 #include "TestClassDef.h" | 454 #include "TestClassDef.h" |
455 DEFINE_TESTCLASS("JpegTest", JpegTestClass, TestJpeg) | 455 DEFINE_TESTCLASS("JpegTest", JpegTestClass, TestJpeg) |
456 | 456 |
OLD | NEW |