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

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

Issue 1907593004: Support the non-native (RGBA/BGRA) swizzle (Closed) Base URL: https://skia.googlesource.com/skia.git@tryagain
Patch Set: Multiple bug fixes Created 4 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
« no previous file with comments | « src/codec/SkCodecPriv.h ('k') | src/codec/SkJpegCodec.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 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 "SkCodecPriv.h" 8 #include "SkCodecPriv.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkColorTable.h" 10 #include "SkColorTable.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 if (NULL == colorMap) { 403 if (NULL == colorMap) {
404 colorMap = fGif->SColorMap; 404 colorMap = fGif->SColorMap;
405 } 405 }
406 406
407 uint32_t colorCount = 0; 407 uint32_t colorCount = 0;
408 if (NULL != colorMap) { 408 if (NULL != colorMap) {
409 colorCount = colorMap->ColorCount; 409 colorCount = colorMap->ColorCount;
410 // giflib guarantees these properties 410 // giflib guarantees these properties
411 SkASSERT(colorCount == (unsigned) (1 << (colorMap->BitsPerPixel))); 411 SkASSERT(colorCount == (unsigned) (1 << (colorMap->BitsPerPixel)));
412 SkASSERT(colorCount <= 256); 412 SkASSERT(colorCount <= 256);
413 PackColorProc proc = choose_pack_color_proc(false, dstInfo.colorType());
413 for (uint32_t i = 0; i < colorCount; i++) { 414 for (uint32_t i = 0; i < colorCount; i++) {
414 colorPtr[i] = SkPackARGB32(0xFF, colorMap->Colors[i].Red, 415 colorPtr[i] = proc(0xFF, colorMap->Colors[i].Red,
415 colorMap->Colors[i].Green, colorMap->Colors[i].Blue); 416 colorMap->Colors[i].Green, colorMap->Colors[i].Blue);
416 } 417 }
417 } 418 }
418 419
419 // Fill in the color table for indices greater than color count. 420 // Fill in the color table for indices greater than color count.
420 // This allows for predictable, safe behavior. 421 // This allows for predictable, safe behavior.
421 if (colorCount > 0) { 422 if (colorCount > 0) {
422 // Gifs have the option to specify the color at a single index of the co lor 423 // Gifs have the option to specify the color at a single index of the co lor
423 // table as transparent. If the transparent index is greater than the 424 // table as transparent. If the transparent index is greater than the
424 // colorCount, we know that there is no valid transparent color in the c olor 425 // colorCount, we know that there is no valid transparent color in the c olor
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 int SkGifCodec::onOutputScanline(int inputScanline) const { 598 int SkGifCodec::onOutputScanline(int inputScanline) const {
598 if (fGif->Image.Interlace) { 599 if (fGif->Image.Interlace) {
599 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott om()) { 600 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott om()) {
600 return inputScanline; 601 return inputScanline;
601 } 602 }
602 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram eRect.height()) + 603 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram eRect.height()) +
603 fFrameRect.top(); 604 fFrameRect.top();
604 } 605 }
605 return inputScanline; 606 return inputScanline;
606 } 607 }
OLDNEW
« no previous file with comments | « src/codec/SkCodecPriv.h ('k') | src/codec/SkJpegCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698