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