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

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

Issue 1694023002: Revert of Fix colorType/alphaType checks in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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/SkGifCodec.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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 int* inputColorCount, const Options& opts) { 429 int* inputColorCount, const Options& opts) {
430 // Check for valid input parameters 430 // Check for valid input parameters
431 if (!conversion_possible(dstInfo, this->getInfo())) { 431 if (!conversion_possible(dstInfo, this->getInfo())) {
432 return gif_error("Cannot convert input type to output type.\n", 432 return gif_error("Cannot convert input type to output type.\n",
433 kInvalidConversion); 433 kInvalidConversion);
434 } 434 }
435 435
436 // Initialize color table and copy to the client if necessary 436 // Initialize color table and copy to the client if necessary
437 this->initializeColorTable(dstInfo, inputColorPtr, inputColorCount); 437 this->initializeColorTable(dstInfo, inputColorPtr, inputColorCount);
438 438
439 this->initializeSwizzler(dstInfo, opts); 439 return this->initializeSwizzler(dstInfo, opts);
440 return kSuccess;
441 } 440 }
442 441
443 void SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& o pts) { 442 SkCodec::Result SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts) {
444 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); 443 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
445 const SkIRect* frameRect = fFrameIsSubset ? &fFrameRect : nullptr; 444 const SkIRect* frameRect = fFrameIsSubset ? &fFrameRect : nullptr;
446 fSwizzler.reset(SkSwizzler::CreateSwizzler(SkSwizzler::kIndex, colorPtr, dst Info, opts, 445 fSwizzler.reset(SkSwizzler::CreateSwizzler(SkSwizzler::kIndex, colorPtr, dst Info, opts,
447 frameRect)); 446 frameRect));
448 SkASSERT(fSwizzler); 447
448 if (nullptr != fSwizzler.get()) {
449 return kSuccess;
450 }
451 return kUnimplemented;
449 } 452 }
450 453
451 bool SkGifCodec::readRow() { 454 bool SkGifCodec::readRow() {
452 return GIF_ERROR != DGifGetLine(fGif, fSrcBuffer.get(), fFrameRect.width()); 455 return GIF_ERROR != DGifGetLine(fGif, fSrcBuffer.get(), fFrameRect.width());
453 } 456 }
454 457
455 /* 458 /*
456 * Initiates the gif decode 459 * Initiates the gif decode
457 */ 460 */
458 SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo, 461 SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 int SkGifCodec::onOutputScanline(int inputScanline) const { 579 int SkGifCodec::onOutputScanline(int inputScanline) const {
577 if (fGif->Image.Interlace) { 580 if (fGif->Image.Interlace) {
578 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott om()) { 581 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott om()) {
579 return inputScanline; 582 return inputScanline;
580 } 583 }
581 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram eRect.height()) + 584 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram eRect.height()) +
582 fFrameRect.top(); 585 fFrameRect.top();
583 } 586 }
584 return inputScanline; 587 return inputScanline;
585 } 588 }
OLDNEW
« no previous file with comments | « src/codec/SkGifCodec.h ('k') | src/codec/SkJpegCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698