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

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

Issue 338493005: stop using SkBitmap::Config (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
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 return true; 185 return true;
186 } 186 }
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 ((SkBitmap::kIndex8_Config == bm->config()) && !(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 (NULL != 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));
(...skipping 325 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

Powered by Google App Engine
This is Rietveld 408576698