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/SkBmpCodec.cpp

Issue 1372973002: Move all knowledge of X sampling into SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@codecSDmerge
Patch Set: Attempt to fix RLE overflow Created 5 years, 2 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/SkBmpCodec.h ('k') | src/codec/SkBmpMaskCodec.h » ('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 "SkBmpCodec.h" 8 #include "SkBmpCodec.h"
9 #include "SkBmpMaskCodec.h" 9 #include "SkBmpMaskCodec.h"
10 #include "SkBmpRLECodec.h" 10 #include "SkBmpRLECodec.h"
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 } 573 }
574 return numColors; 574 return numColors;
575 } 575 }
576 576
577 SkCodec::Result SkBmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, 577 SkCodec::Result SkBmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
578 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo lorCount) { 578 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo lorCount) {
579 if (options.fSubset) { 579 if (options.fSubset) {
580 // Subsets are not supported. 580 // Subsets are not supported.
581 return kUnimplemented; 581 return kUnimplemented;
582 } 582 }
583 if (dstInfo.dimensions() != this->getInfo().dimensions()) {
584 if (!SkScaledCodec::DimensionsSupportedForSampling(this->getInfo(), dstI nfo)) {
585 return SkCodec::kInvalidScale;
586 }
587 }
588 if (!conversion_possible(dstInfo, this->getInfo())) { 583 if (!conversion_possible(dstInfo, this->getInfo())) {
589 SkCodecPrintf("Error: cannot convert input type to output type.\n"); 584 SkCodecPrintf("Error: cannot convert input type to output type.\n");
590 return kInvalidConversion; 585 return kInvalidConversion;
591 } 586 }
592 587
593 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount); 588 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount);
594 } 589 }
595 590
596 SkCodec::Result SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes ) { 591 SkCodec::Result SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes ) {
597 // Create a new image info representing the portion of the image to decode 592 // Create a new image info representing the portion of the image to decode
598 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count) ; 593 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count) ;
599 594
600 // Decode the requested rows 595 // Decode the requested rows
601 return this->decodeRows(rowInfo, dst, rowBytes, this->options()); 596 return this->decodeRows(rowInfo, dst, rowBytes, this->options());
602 } 597 }
603 598
604 int SkBmpCodec::onNextScanline() const { 599 int SkBmpCodec::onNextScanline() const {
605 return this->getDstRow(this->INHERITED::onNextScanline(), this->dstInfo().he ight()); 600 return this->getDstRow(this->INHERITED::onNextScanline(), this->dstInfo().he ight());
606 } 601 }
OLDNEW
« no previous file with comments | « src/codec/SkBmpCodec.h ('k') | src/codec/SkBmpMaskCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698