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

Side by Side Diff: src/images/SkImageDecoder_libgif.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_ktx.cpp ('k') | src/images/SkImageDecoder_libpng.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkColor.h" 8 #include "SkColor.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkColorTable.h" 10 #include "SkColorTable.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 /** 188 /**
189 * GIFs with fewer then 256 color entries will sometimes index out of 189 * GIFs with fewer then 256 color entries will sometimes index out of
190 * bounds of the color table (this is malformed, but libgif does not 190 * bounds of the color table (this is malformed, but libgif does not
191 * check sicne it is rare). This function checks for this error and 191 * check sicne it is rare). This function checks for this error and
192 * fixes it. This makes the output image consistantly deterministic. 192 * fixes it. This makes the output image consistantly deterministic.
193 */ 193 */
194 static void sanitize_indexed_bitmap(SkBitmap* bm) { 194 static void sanitize_indexed_bitmap(SkBitmap* bm) {
195 if ((kIndex_8_SkColorType == bm->colorType()) && !(bm->empty())) { 195 if ((kIndex_8_SkColorType == bm->colorType()) && !(bm->empty())) {
196 SkAutoLockPixels alp(*bm); 196 SkAutoLockPixels alp(*bm);
197 if (NULL != bm->getPixels()) { 197 if (bm->getPixels()) {
198 SkColorTable* ct = bm->getColorTable(); // Index8 must have it. 198 SkColorTable* ct = bm->getColorTable(); // Index8 must have it.
199 SkASSERT(ct != NULL); 199 SkASSERT(ct != NULL);
200 uint32_t count = ct->count(); 200 uint32_t count = ct->count();
201 SkASSERT(count > 0); 201 SkASSERT(count > 0);
202 SkASSERT(count <= 0x100); 202 SkASSERT(count <= 0x100);
203 if (count != 0x100) { // Full colortables can't go wrong. 203 if (count != 0x100) { // Full colortables can't go wrong.
204 // Count is a power of 2; asserted elsewhere. 204 // Count is a power of 2; asserted elsewhere.
205 uint8_t byteMask = (~(count - 1)); 205 uint8_t byteMask = (~(count - 1));
206 bool warning = false; 206 bool warning = false;
207 uint8_t* addr = static_cast<uint8_t*>(bm->getPixels()); 207 uint8_t* addr = static_cast<uint8_t*>(bm->getPixels());
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); 531 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory);
532 532
533 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { 533 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) {
534 if (is_gif(stream)) { 534 if (is_gif(stream)) {
535 return SkImageDecoder::kGIF_Format; 535 return SkImageDecoder::kGIF_Format;
536 } 536 }
537 return SkImageDecoder::kUnknown_Format; 537 return SkImageDecoder::kUnknown_Format;
538 } 538 }
539 539
540 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); 540 static SkImageDecoder_FormatReg gFormatReg(get_format_gif);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_ktx.cpp ('k') | src/images/SkImageDecoder_libpng.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698