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

Side by Side Diff: tests/KtxTest.cpp

Issue 1371983003: Revert of change pixel-serializer to support reencoding existing data (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 | « tests/ImageTest.cpp ('k') | tools/sk_tool_utils.h » ('j') | 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"
11 #include "SkImage.h"
12 #include "SkImageGenerator.h" 11 #include "SkImageGenerator.h"
13 #include "SkForceLinking.h" 12 #include "SkForceLinking.h"
14 #include "SkImageDecoder.h" 13 #include "SkImageDecoder.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; 19 __SK_FORCE_IMAGE_DECODER_LINKING;
21 20
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 SkString pkmFilename = GetResourcePath("mandrill_128.pkm"); 142 SkString pkmFilename = GetResourcePath("mandrill_128.pkm");
144 143
145 // Load PKM file into a bitmap 144 // Load PKM file into a bitmap
146 SkBitmap etcBitmap; 145 SkBitmap etcBitmap;
147 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(pkmFilename.c_str())); 146 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(pkmFilename.c_str()));
148 if (nullptr == fileData) { 147 if (nullptr == fileData) {
149 SkDebugf("KtxReexportPKM: can't load test file %s\n", pkmFilename.c_str( )); 148 SkDebugf("KtxReexportPKM: can't load test file %s\n", pkmFilename.c_str( ));
150 return; 149 return;
151 } 150 }
152 151
153 SkAutoTUnref<SkImage> image(SkImage::NewFromEncoded(fileData)); 152 bool installDiscardablePixelRefSuccess =
154 REPORTER_ASSERT(reporter, image.get()); 153 SkDEPRECATED_InstallDiscardablePixelRef(fileData, &etcBitmap);
154 REPORTER_ASSERT(reporter, installDiscardablePixelRefSuccess);
155 155
156 SkAutoDataUnref newKtxData(image->encode(SkImageEncoder::kKTX_Type, 0)); 156 // Write the bitmap out to a KTX file.
157 REPORTER_ASSERT(reporter, newKtxData.get()); 157 SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::k KTX_Type, 0);
158 SkAutoDataUnref newKtxData(ktxDataPtr);
159 REPORTER_ASSERT(reporter, ktxDataPtr);
158 160
159 // 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.
160 SkString ktxFilename = GetResourcePath("mandrill_128.ktx"); 162 SkString ktxFilename = GetResourcePath("mandrill_128.ktx");
161 SkAutoDataUnref oldKtxData(SkData::NewFromFileName(ktxFilename.c_str())); 163 SkAutoDataUnref oldKtxData(SkData::NewFromFileName(ktxFilename.c_str()));
162 REPORTER_ASSERT(reporter, oldKtxData->equals(newKtxData)); 164 REPORTER_ASSERT(reporter, oldKtxData->equals(newKtxData));
163 } 165 }
OLDNEW
« no previous file with comments | « tests/ImageTest.cpp ('k') | tools/sk_tool_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698