Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: tests/KtxTest.cpp

Issue 1707053002: Delete KTX tests to fix Android build (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Delete SkImageDecoderGenerator as well Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/images/SkImageDecoder_ktx.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 uint8_t *row = decodedPixels; 136 uint8_t *row = decodedPixels;
137 for (int j = 0; j < decodedBitmap.height(); ++j) { 137 for (int j = 0; j < decodedBitmap.height(); ++j) {
138 for (int i = 0; i < decodedBitmap.width(); ++i) { 138 for (int i = 0; i < decodedBitmap.width(); ++i) {
139 SkPMColor pixel = *(reinterpret_cast<SkPMColor*>(row + i*sizeof(SkPM Color))); 139 SkPMColor pixel = *(reinterpret_cast<SkPMColor*>(row + i*sizeof(SkPM Color)));
140 REPORTER_ASSERT(reporter, SkPreMultiplyARGB(0x80, 0xFF, 0xFF, 0xFF) == pixel); 140 REPORTER_ASSERT(reporter, SkPreMultiplyARGB(0x80, 0xFF, 0xFF, 0xFF) == pixel);
141 } 141 }
142 row += decodedBitmap.rowBytes(); 142 row += decodedBitmap.rowBytes();
143 } 143 }
144 } 144 }
145
146 // For KtxReexportPKM, below. Defined in SkImageDecoder_ktx.cpp
147 extern SkImageGenerator* decoder_image_generator(SkData*);
148
149 /**
150 * Finally, make sure that if we get ETC1 data from a PKM file that we can then
151 * accurately write it out into a KTX file (i.e. transferring the ETC1 data from
152 * the PKM to the KTX should produce an identical KTX to the one we have on file )
153 */
154 DEF_TEST(KtxReexportPKM, reporter) {
155 SkString pkmFilename = GetResourcePath("mandrill_128.pkm");
156
157 // Load PKM file into a bitmap
158 SkBitmap etcBitmap;
159 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(pkmFilename.c_str()));
160 if (nullptr == fileData) {
161 SkDebugf("KtxReexportPKM: can't load test file %s\n", pkmFilename.c_str( ));
162 return;
163 }
164
165 bool installDiscardablePixelRefSuccess =
166 SkDEPRECATED_InstallDiscardablePixelRef(decoder_image_generator(fileData ), &etcBitmap);
167 if (!installDiscardablePixelRefSuccess) {
168 ERRORF(reporter, "failed to create discardable pixelRef from KTX file");
169 return;
170 }
171
172 // Write the bitmap out to a KTX file.
173 SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::k KTX_Type, 0);
174 SkAutoDataUnref newKtxData(ktxDataPtr);
175 REPORTER_ASSERT(reporter, ktxDataPtr);
176
177 // See is this data is identical to data in existing ktx file.
178 SkString ktxFilename = GetResourcePath("mandrill_128.ktx");
179 SkAutoDataUnref oldKtxData(SkData::NewFromFileName(ktxFilename.c_str()));
180 REPORTER_ASSERT(reporter, oldKtxData->equals(newKtxData));
181 }
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_ktx.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698