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

Side by Side Diff: src/images/SkImageDecoder_ktx.cpp

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 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') | src/images/SkImageDecoder_libgif.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 "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 typedef SkImageEncoder INHERITED; 265 typedef SkImageEncoder INHERITED;
266 }; 266 };
267 267
268 bool SkKTXImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int) { 268 bool SkKTXImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int) {
269 if (!bitmap.pixelRef()) { 269 if (!bitmap.pixelRef()) {
270 return false; 270 return false;
271 } 271 }
272 SkAutoDataUnref data(bitmap.pixelRef()->refEncodedData()); 272 SkAutoDataUnref data(bitmap.pixelRef()->refEncodedData());
273 273
274 // Is this even encoded data? 274 // Is this even encoded data?
275 if (NULL != data) { 275 if (data) {
276 const uint8_t *bytes = data->bytes(); 276 const uint8_t *bytes = data->bytes();
277 if (etc1_pkm_is_valid(bytes)) { 277 if (etc1_pkm_is_valid(bytes)) {
278 return this->encodePKM(stream, data); 278 return this->encodePKM(stream, data);
279 } 279 }
280 280
281 // Is it a KTX file?? 281 // Is it a KTX file??
282 if (SkKTXFile::is_ktx(bytes)) { 282 if (SkKTXFile::is_ktx(bytes)) {
283 return stream->write(bytes, data->size()); 283 return stream->write(bytes, data->size());
284 } 284 }
285 285
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return SkImageDecoder::kUnknown_Format; 328 return SkImageDecoder::kUnknown_Format;
329 } 329 }
330 330
331 SkImageEncoder* sk_libktx_efactory(SkImageEncoder::Type t) { 331 SkImageEncoder* sk_libktx_efactory(SkImageEncoder::Type t) {
332 return (SkImageEncoder::kKTX_Type == t) ? SkNEW(SkKTXImageEncoder) : NULL; 332 return (SkImageEncoder::kKTX_Type == t) ? SkNEW(SkKTXImageEncoder) : NULL;
333 } 333 }
334 334
335 static SkImageDecoder_DecodeReg gReg(sk_libktx_dfactory); 335 static SkImageDecoder_DecodeReg gReg(sk_libktx_dfactory);
336 static SkImageDecoder_FormatReg gFormatReg(get_format_ktx); 336 static SkImageDecoder_FormatReg gFormatReg(get_format_ktx);
337 static SkImageEncoder_EncodeReg gEReg(sk_libktx_efactory); 337 static SkImageEncoder_EncodeReg gEReg(sk_libktx_efactory);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder.cpp ('k') | src/images/SkImageDecoder_libgif.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698