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

Side by Side Diff: tests/KtxTest.cpp

Issue 340533002: hide SkBitmap::Config entirely (behind a flag) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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.cpp ('k') | third_party/ktx/ktx.cpp » ('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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkDecodingImageGenerator.h" 10 #include "SkDecodingImageGenerator.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 SkAutoDataUnref encodedData(SkImageEncoder::EncodeData(bm8888, SkImageEncode r::kKTX_Type, 0)); 55 SkAutoDataUnref encodedData(SkImageEncoder::EncodeData(bm8888, SkImageEncode r::kKTX_Type, 0));
56 REPORTER_ASSERT(reporter, NULL != encodedData); 56 REPORTER_ASSERT(reporter, NULL != encodedData);
57 57
58 SkAutoTUnref<SkMemoryStream> stream(SkNEW_ARGS(SkMemoryStream, (encodedData) )); 58 SkAutoTUnref<SkMemoryStream> stream(SkNEW_ARGS(SkMemoryStream, (encodedData) ));
59 REPORTER_ASSERT(reporter, NULL != stream); 59 REPORTER_ASSERT(reporter, NULL != stream);
60 60
61 SkBitmap decodedBitmap; 61 SkBitmap decodedBitmap;
62 bool imageDecodeSuccess = SkImageDecoder::DecodeStream(stream, &decodedBitma p); 62 bool imageDecodeSuccess = SkImageDecoder::DecodeStream(stream, &decodedBitma p);
63 REPORTER_ASSERT(reporter, imageDecodeSuccess); 63 REPORTER_ASSERT(reporter, imageDecodeSuccess);
64 64
65 REPORTER_ASSERT(reporter, decodedBitmap.config() == bm8888.config()); 65 REPORTER_ASSERT(reporter, decodedBitmap.colorType() == bm8888.colorType());
66 REPORTER_ASSERT(reporter, decodedBitmap.alphaType() == bm8888.alphaType()); 66 REPORTER_ASSERT(reporter, decodedBitmap.alphaType() == bm8888.alphaType());
67 REPORTER_ASSERT(reporter, decodedBitmap.width() == bm8888.width()); 67 REPORTER_ASSERT(reporter, decodedBitmap.width() == bm8888.width());
68 REPORTER_ASSERT(reporter, decodedBitmap.height() == bm8888.height()); 68 REPORTER_ASSERT(reporter, decodedBitmap.height() == bm8888.height());
69 REPORTER_ASSERT(reporter, !(decodedBitmap.empty())); 69 REPORTER_ASSERT(reporter, !(decodedBitmap.empty()));
70 70
71 uint8_t *decodedPixels = reinterpret_cast<uint8_t*>(decodedBitmap.getPixels( )); 71 uint8_t *decodedPixels = reinterpret_cast<uint8_t*>(decodedBitmap.getPixels( ));
72 REPORTER_ASSERT(reporter, NULL != decodedPixels); 72 REPORTER_ASSERT(reporter, NULL != decodedPixels);
73 REPORTER_ASSERT(reporter, decodedBitmap.getSize() == bm8888.getSize()); 73 REPORTER_ASSERT(reporter, decodedBitmap.getSize() == bm8888.getSize());
74 74
75 if (NULL == decodedPixels) { 75 if (NULL == decodedPixels) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // Write the bitmap out to a KTX file. 157 // Write the bitmap out to a KTX file.
158 SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::k KTX_Type, 0); 158 SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::k KTX_Type, 0);
159 SkAutoDataUnref newKtxData(ktxDataPtr); 159 SkAutoDataUnref newKtxData(ktxDataPtr);
160 REPORTER_ASSERT(reporter, NULL != ktxDataPtr); 160 REPORTER_ASSERT(reporter, NULL != ktxDataPtr);
161 161
162 // 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.
163 SkString ktxFilename = SkOSPath::SkPathJoin(resourcePath.c_str(), "mandrill_ 128.ktx"); 163 SkString ktxFilename = SkOSPath::SkPathJoin(resourcePath.c_str(), "mandrill_ 128.ktx");
164 SkAutoDataUnref oldKtxData(SkData::NewFromFileName(ktxFilename.c_str())); 164 SkAutoDataUnref oldKtxData(SkData::NewFromFileName(ktxFilename.c_str()));
165 REPORTER_ASSERT(reporter, oldKtxData->equals(newKtxData)); 165 REPORTER_ASSERT(reporter, oldKtxData->equals(newKtxData));
166 } 166 }
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder.cpp ('k') | third_party/ktx/ktx.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698