From 97d4cf0e7eb15340b1f513ff8cfba4e55ee3acf2 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Fri, 21 Jul 2017 16:03:14 -0400 Subject: [PATCH] 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 Reviewed-by: Mike Klein Reviewed-by: Florin Malita --- src/shaders/SkImageShader.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp index dd0537ef92..6cd63bb6fb 100644 --- a/src/shaders/SkImageShader.cpp +++ b/src/shaders/SkImageShader.cpp @@ -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,