| 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" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 // Load PKM file into a bitmap | 144 // Load PKM file into a bitmap |
| 145 SkBitmap etcBitmap; | 145 SkBitmap etcBitmap; |
| 146 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(pkmFilename.c_str())); | 146 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(pkmFilename.c_str())); |
| 147 if (nullptr == fileData) { | 147 if (nullptr == fileData) { |
| 148 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(
)); |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool installDiscardablePixelRefSuccess = | 152 bool installDiscardablePixelRefSuccess = |
| 153 SkInstallDiscardablePixelRef(fileData, &etcBitmap); | 153 SkDEPRECATED_InstallDiscardablePixelRef(fileData, &etcBitmap); |
| 154 REPORTER_ASSERT(reporter, installDiscardablePixelRefSuccess); | 154 REPORTER_ASSERT(reporter, installDiscardablePixelRefSuccess); |
| 155 | 155 |
| 156 // Write the bitmap out to a KTX file. | 156 // Write the bitmap out to a KTX file. |
| 157 SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::k
KTX_Type, 0); | 157 SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::k
KTX_Type, 0); |
| 158 SkAutoDataUnref newKtxData(ktxDataPtr); | 158 SkAutoDataUnref newKtxData(ktxDataPtr); |
| 159 REPORTER_ASSERT(reporter, ktxDataPtr); | 159 REPORTER_ASSERT(reporter, ktxDataPtr); |
| 160 | 160 |
| 161 // 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. |
| 162 SkString ktxFilename = GetResourcePath("mandrill_128.ktx"); | 162 SkString ktxFilename = GetResourcePath("mandrill_128.ktx"); |
| 163 SkAutoDataUnref oldKtxData(SkData::NewFromFileName(ktxFilename.c_str())); | 163 SkAutoDataUnref oldKtxData(SkData::NewFromFileName(ktxFilename.c_str())); |
| 164 REPORTER_ASSERT(reporter, oldKtxData->equals(newKtxData)); | 164 REPORTER_ASSERT(reporter, oldKtxData->equals(newKtxData)); |
| 165 } | 165 } |
| OLD | NEW |