use rasterpipeline for filtering for very large images

Bug: skia:
Change-Id: I8d1c2fca1bf2ad94cdfbef32d068f47503ea1e03
Reviewed-on: https://skia-review.googlesource.com/24140
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
This commit is contained in:
Mike Reed 2017-07-21 16:03:14 -04:00 committed by Skia Commit-Bot
parent de6e5bf33f
commit 97d4cf0e7e

View File

@ -77,10 +77,20 @@ bool SkImageShader::IsRasterPipelineOnly(SkColorType ct, SkAlphaType at,
return false;
}
static bool valid_for_legacy_filtering(unsigned dimension) {
// for filtering, width and height must fit in 14bits, since we use steal
// 2 bits from each to store our 4bit subpixel data
return (dimension & ~0x3FFF) == 0;
}
bool SkImageShader::onIsRasterPipelineOnly() const {
SkBitmapProvider provider(fImage.get(), nullptr);
return IsRasterPipelineOnly(provider.info().colorType(), provider.info().alphaType(),
fTileModeX, fTileModeY);
const SkImageInfo info = provider.info();
if (!valid_for_legacy_filtering(info.width()) || !valid_for_legacy_filtering(info.height())) {
return true;
}
return IsRasterPipelineOnly(info.colorType(), info.alphaType(), fTileModeX, fTileModeY);
}
SkShaderBase::Context* SkImageShader::onMakeContext(const ContextRec& rec,