OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "Resources.h" | 8 #include "Resources.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
11 #include "SkDecodingImageGenerator.h" | 11 #include "SkDecodingImageGenerator.h" |
12 #include "SkForceLinking.h" | |
13 #include "SkImageDecoder.h" | 12 #include "SkImageDecoder.h" |
14 #include "SkOSFile.h" | 13 #include "SkOSFile.h" |
15 #include "SkRandom.h" | 14 #include "SkRandom.h" |
16 #include "SkStream.h" | 15 #include "SkStream.h" |
17 #include "Test.h" | 16 #include "Test.h" |
18 | 17 |
19 __SK_FORCE_IMAGE_DECODER_LINKING; | |
20 | |
21 /** | 18 /** |
22 * First, make sure that writing an 8-bit RGBA KTX file and then | 19 * First, make sure that writing an 8-bit RGBA KTX file and then |
23 * reading it produces the same bitmap. | 20 * reading it produces the same bitmap. |
24 */ | 21 */ |
25 DEF_TEST(KtxReadWrite, reporter) { | 22 DEF_TEST(KtxReadWrite, reporter) { |
26 | 23 |
27 // Random number generator with explicit seed for reproducibility | 24 // Random number generator with explicit seed for reproducibility |
28 SkRandom rand(0x1005cbad); | 25 SkRandom rand(0x1005cbad); |
29 | 26 |
30 SkBitmap bm8888; | 27 SkBitmap bm8888; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Write the bitmap out to a KTX file. | 156 // Write the bitmap out to a KTX file. |
160 SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::k
KTX_Type, 0); | 157 SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::k
KTX_Type, 0); |
161 SkAutoDataUnref newKtxData(ktxDataPtr); | 158 SkAutoDataUnref newKtxData(ktxDataPtr); |
162 REPORTER_ASSERT(reporter, ktxDataPtr); | 159 REPORTER_ASSERT(reporter, ktxDataPtr); |
163 | 160 |
164 // See is this data is identical to data in existing ktx file. | 161 // See is this data is identical to data in existing ktx file. |
165 SkString ktxFilename = GetResourcePath("mandrill_128.ktx"); | 162 SkString ktxFilename = GetResourcePath("mandrill_128.ktx"); |
166 SkAutoDataUnref oldKtxData(SkData::NewFromFileName(ktxFilename.c_str())); | 163 SkAutoDataUnref oldKtxData(SkData::NewFromFileName(ktxFilename.c_str())); |
167 REPORTER_ASSERT(reporter, oldKtxData->equals(newKtxData)); | 164 REPORTER_ASSERT(reporter, oldKtxData->equals(newKtxData)); |
168 } | 165 } |
OLD | NEW |