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

Side by Side Diff: src/codec/SkCodec_libgif.cpp

Issue 1061713007: Adding png scanline decoding to kIndex8 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ctableCount requirements Created 5 years, 8 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 2015 Google Inc. 2 * Copyright 2015 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 "SkCodec_libgif.h" 8 #include "SkCodec_libgif.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 imageTop = 0; 336 imageTop = 0;
337 } 337 }
338 338
339 // Create a color table to store colors the giflib colorMap 339 // Create a color table to store colors the giflib colorMap
340 SkPMColor alternateColorPtr[256]; 340 SkPMColor alternateColorPtr[256];
341 SkPMColor* colorTable; 341 SkPMColor* colorTable;
342 SkColorType dstColorType = dstInfo.colorType(); 342 SkColorType dstColorType = dstInfo.colorType();
343 if (kIndex_8_SkColorType == dstColorType) { 343 if (kIndex_8_SkColorType == dstColorType) {
344 SkASSERT(NULL != inputColorPtr); 344 SkASSERT(NULL != inputColorPtr);
345 SkASSERT(NULL != inputColorCount); 345 SkASSERT(NULL != inputColorCount);
346 SkASSERT(256 == *inputColorCount);
347 colorTable = inputColorPtr; 346 colorTable = inputColorPtr;
348 } else { 347 } else {
349 colorTable = alternateColorPtr; 348 colorTable = alternateColorPtr;
350 } 349 }
351 350
352 // Set up the color table 351 // Set up the color table
353 uint32_t colorCount = 0; 352 uint32_t colorCount = 0;
354 // Allocate maximum storage to deal with invalid indices safely 353 // Allocate maximum storage to deal with invalid indices safely
355 const uint32_t maxColors = 256; 354 const uint32_t maxColors = 256;
356 ColorMapObject* colorMap = fGif->Image.ColorMap; 355 ColorMapObject* colorMap = fGif->Image.ColorMap;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 // giflib returns an error code if the record type is not known. 561 // giflib returns an error code if the record type is not known.
563 // We should catch this error immediately. 562 // We should catch this error immediately.
564 SkASSERT(false); 563 SkASSERT(false);
565 break; 564 break;
566 } 565 }
567 } while (TERMINATE_RECORD_TYPE != recordType); 566 } while (TERMINATE_RECORD_TYPE != recordType);
568 567
569 return gif_error("Could not find any images to decode in gif file.\n", 568 return gif_error("Could not find any images to decode in gif file.\n",
570 kInvalidInput); 569 kInvalidInput);
571 } 570 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698