Make DMSrcSink fail fatally when decodeRegion() fails for BRDSrcs

This involves disabling webps for kCanvas_Strategy.
We have not yet implemented webp subset decodes for this
strategy.

BUG=skia:4521

Review URL: https://codereview.chromium.org/1405273004
This commit is contained in:
msarett 2015-10-27 13:28:25 -07:00 committed by Commit bot
parent 3f65e93b19
commit c37799282f
2 changed files with 9 additions and 9 deletions

View File

@ -128,10 +128,7 @@ Error BRDSrc::draw(SkCanvas* canvas) const {
SkBitmap bitmap;
if (!brd->decodeRegion(&bitmap, nullptr, SkIRect::MakeXYWH(0, 0, width, height),
fSampleSize, colorType, false)) {
// FIXME: Make this a fatal error. We need to disable webps for kCanvas_Strategy
// because we have not implemented kCanvas_Strategy for webp. We may also need to
// deal with color conversion errors for kOriginal_Strategy.
return Error::Nonfatal("Cannot decode region.\n");
return "Cannot decode region.\n";
}
if (colorType != bitmap.colorType()) {
return Error::Nonfatal("Cannot convert to color type.\n");
@ -187,11 +184,7 @@ Error BRDSrc::draw(SkCanvas* canvas) const {
SkBitmap bitmap;
if (!brd->decodeRegion(&bitmap, nullptr, SkIRect::MakeXYWH(decodeLeft,
decodeTop, decodeWidth, decodeHeight), fSampleSize, colorType, false)) {
// FIXME: Make this a fatal error. We need to disable webps for
// kCanvas_Strategy because we have not implemented kCanvas_Strategy for
// webp. We may also need to deal with color conversion errors for
// kOriginal_Strategy.
return Error::Nonfatal("Cannot not decode region.\n");
return "Cannot not decode region.\n";
}
if (colorType != bitmap.colorType()) {
return Error::Nonfatal("Cannot convert to color type.\n");

View File

@ -44,6 +44,13 @@ SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegi
SkCodecPrintf("Error: Failed to create decoder.\n");
return nullptr;
}
if (SkEncodedFormat::kWEBP_SkEncodedFormat == codec->getEncodedFormat()) {
// FIXME: Support webp using a special case. Webp does not support
// scanline decoding.
return nullptr;
}
switch (codec->getScanlineOrder()) {
case SkCodec::kTopDown_SkScanlineOrder:
case SkCodec::kNone_SkScanlineOrder: