diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index 1d737d6ff2..d05f13fc26 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -234,13 +234,6 @@ public: return this->makeShader(tmx, tmy, mode, nullptr, nullptr); } -#ifdef SK_SUPPORT_LEGACY_PICTURESHADER_NOFILTER - sk_sp makeShader(SkTileMode tmx, SkTileMode tmy, - const SkMatrix* localMatrix, const SkRect* tileRect) const; - sk_sp makeShader(SkTileMode tmx, SkTileMode tmy, - const SkMatrix* localMatrix = nullptr) const; -#endif - private: // Allowed subclasses. SkPicture(); diff --git a/src/core/SkPicturePriv.h b/src/core/SkPicturePriv.h index 8230efc0f0..4dc5bced97 100644 --- a/src/core/SkPicturePriv.h +++ b/src/core/SkPicturePriv.h @@ -105,10 +105,11 @@ public: kPictureShaderFilterParam_Version = 82, kMatrixImageFilterSampling_Version = 83, kImageFilterImageSampling_Version = 84, + kNoFilterQualityShaders_Version = 85, // Only SKPs within the min/current picture version range (inclusive) can be read. kMin_Version = kEdgeAAQuadColor4f_Version, - kCurrent_Version = kImageFilterImageSampling_Version + kCurrent_Version = kNoFilterQualityShaders_Version }; static_assert(SkPicturePriv::kMin_Version <= SkPicturePriv::kCubicResamplerImageShader_Version, diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp index 02cc35485d..2545c6215f 100644 --- a/src/core/SkPixmap.cpp +++ b/src/core/SkPixmap.cpp @@ -239,7 +239,7 @@ bool SkPixmap::scalePixels(const SkPixmap& actualDst, const SkSamplingOptions& s sk_sp shader = SkImageShader::Make(bitmap.asImage(), SkTileMode::kClamp, SkTileMode::kClamp, - &sampling, + sampling, &scale, clampAsIfUnpremul); diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index aa68e0e893..cce9a42299 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -142,7 +142,7 @@ sk_sp SkImage::makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions& sampling, const SkMatrix* localMatrix) const { return SkImageShader::Make(sk_ref_sp(const_cast(this)), tmx, tmy, - &sampling, localMatrix); + sampling, localMatrix); } sk_sp SkImage::encodeToData(SkEncodedImageFormat type, int quality) const { diff --git a/src/shaders/SkBitmapProcShader.cpp b/src/shaders/SkBitmapProcShader.cpp index 908c2b18a5..8eca28e7b9 100644 --- a/src/shaders/SkBitmapProcShader.cpp +++ b/src/shaders/SkBitmapProcShader.cpp @@ -76,7 +76,7 @@ private: /////////////////////////////////////////////////////////////////////////////////////////////////// SkShaderBase::Context* SkBitmapProcLegacyShader::MakeContext( - const SkShaderBase& shader, SkTileMode tmx, SkTileMode tmy, + const SkShaderBase& shader, SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions& sampling, const SkImage_Base* image, const ContextRec& rec, SkArenaAlloc* alloc) { SkMatrix totalInverse; @@ -86,7 +86,7 @@ SkShaderBase::Context* SkBitmapProcLegacyShader::MakeContext( } SkBitmapProcState* state = alloc->make(image, tmx, tmy); - if (!state->setup(totalInverse, rec.fPaintAlpha, rec.fPaintSampling)) { + if (!state->setup(totalInverse, rec.fPaintAlpha, sampling)) { return nullptr; } return alloc->make(shader, rec, state); diff --git a/src/shaders/SkBitmapProcShader.h b/src/shaders/SkBitmapProcShader.h index 696e9524ae..763f304d8b 100644 --- a/src/shaders/SkBitmapProcShader.h +++ b/src/shaders/SkBitmapProcShader.h @@ -17,7 +17,8 @@ private: friend class SkImageShader; static Context* MakeContext(const SkShaderBase&, SkTileMode tmx, SkTileMode tmy, - const SkImage_Base*, const ContextRec&, SkArenaAlloc* alloc); + const SkSamplingOptions&, const SkImage_Base*, + const ContextRec&, SkArenaAlloc* alloc); using INHERITED = SkShaderBase; }; diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp index 443eb5d49d..1fdfed2544 100755 --- a/src/shaders/SkImageShader.cpp +++ b/src/shaders/SkImageShader.cpp @@ -65,16 +65,15 @@ static SkTileMode optimize(SkTileMode tm, int dimension) { SkImageShader::SkImageShader(sk_sp img, SkTileMode tmx, SkTileMode tmy, - const SkSamplingOptions* sampling, + const SkSamplingOptions& sampling, const SkMatrix* localMatrix, bool clampAsIfUnpremul) : INHERITED(localMatrix) , fImage(std::move(img)) - , fSampling(sampling ? *sampling : SkSamplingOptions()) + , fSampling(sampling) , fTileModeX(optimize(tmx, fImage->width())) , fTileModeY(optimize(tmy, fImage->height())) , fClampAsIfUnpremul(clampAsIfUnpremul) - , fUseSamplingOptions(sampling != nullptr) {} // just used for legacy-unflattening @@ -132,18 +131,7 @@ sk_sp SkImageShader::PreSamplingCreate(SkReadBuffer& buffer) { SkMatrix localMatrix; buffer.readMatrix(&localMatrix); sk_sp img = buffer.readImage(); - if (!img) { - return nullptr; - } - - switch (fe) { - case LegacyFilterEnum::kUseFilterOptions: - case LegacyFilterEnum::kUseCubicResampler: - return SkImageShader::Make(std::move(img), tmx, tmy, &op, &localMatrix); - default: - break; - } - return SkImageShader::Make(std::move(img), tmx, tmy, nullptr, &localMatrix); + return img ? SkImageShader::Make(std::move(img), tmx, tmy, op, &localMatrix) : nullptr; } // fClampAsIfUnpremul is always false when constructed through public APIs, @@ -157,12 +145,16 @@ sk_sp SkImageShader::CreateProc(SkReadBuffer& buffer) { auto tmx = buffer.read32LE(SkTileMode::kLastTileMode); auto tmy = buffer.read32LE(SkTileMode::kLastTileMode); - SkSamplingOptions sampling, - *samplingPtr = nullptr; - - if (buffer.readBool()) { // fUseSamplingOptions + SkSamplingOptions sampling; + bool readSampling = true; + if (buffer.isVersionLT(SkPicturePriv::kNoFilterQualityShaders_Version) && + !buffer.readBool() /* legacy has_sampling */) + { + readSampling = false; + // we just default to Nearest in sampling + } + if (readSampling) { sampling = SkSamplingPriv::Read(buffer); - samplingPtr = &sampling; } SkMatrix localMatrix; @@ -172,17 +164,14 @@ sk_sp SkImageShader::CreateProc(SkReadBuffer& buffer) { return nullptr; } - return SkImageShader::Make(std::move(img), tmx, tmy, samplingPtr, &localMatrix); + return SkImageShader::Make(std::move(img), tmx, tmy, sampling, &localMatrix); } void SkImageShader::flatten(SkWriteBuffer& buffer) const { buffer.writeUInt((unsigned)fTileModeX); buffer.writeUInt((unsigned)fTileModeY); - buffer.writeBool(fUseSamplingOptions); - if (fUseSamplingOptions) { - SkSamplingPriv::Write(buffer, fSampling); - } + SkSamplingPriv::Write(buffer, fSampling); buffer.writeMatrix(this->getLocalMatrix()); buffer.writeImage(fImage.get()); @@ -242,9 +231,6 @@ SkShaderBase::Context* SkImageShader::onMakeContext(const ContextRec& rec, return nullptr; } - SkSamplingOptions sampling = fUseSamplingOptions ? fSampling - : rec.fPaintSampling; - auto supported = [](const SkSamplingOptions& sampling) { const std::tuple supported[] = { {SkFilterMode::kNearest, SkMipmapMode::kNone}, // legacy kNone_SkFilterQuality @@ -258,7 +244,7 @@ SkShaderBase::Context* SkImageShader::onMakeContext(const ContextRec& rec, } return false; }; - if (sampling.useCubic || !supported(sampling)) { + if (fSampling.useCubic || !supported(fSampling)) { return nullptr; } @@ -287,12 +273,8 @@ SkShaderBase::Context* SkImageShader::onMakeContext(const ContextRec& rec, return nullptr; } - // Can remove this once fUseSamplingOptions is always true - ContextRec modifiedRec = rec; - modifiedRec.fPaintSampling = sampling; - - return SkBitmapProcLegacyShader::MakeContext(*this, fTileModeX, fTileModeY, - as_IB(fImage.get()), modifiedRec, alloc); + return SkBitmapProcLegacyShader::MakeContext(*this, fTileModeX, fTileModeY, fSampling, + as_IB(fImage.get()), rec, alloc); } #endif @@ -309,14 +291,14 @@ SkImage* SkImageShader::onIsAImage(SkMatrix* texM, SkTileMode xy[]) const { sk_sp SkImageShader::Make(sk_sp image, SkTileMode tmx, SkTileMode tmy, - const SkSamplingOptions* options, + const SkSamplingOptions& options, const SkMatrix* localMatrix, bool clampAsIfUnpremul) { auto is_unit = [](float x) { return x >= 0 && x <= 1; }; - if (options && options->useCubic) { - if (!is_unit(options->cubic.B) || !is_unit(options->cubic.C)) { + if (options.useCubic) { + if (!is_unit(options.cubic.B) || !is_unit(options.cubic.C)) { return nullptr; } } @@ -358,33 +340,22 @@ std::unique_ptr SkImageShader::asFragmentProcessor( // below we check the matrix scale factors to determine how to interpret the filter // quality setting. This completely ignores the complexity of the drawVertices case // where explicit local coords are provided by the caller. - bool sharpen = args.fContext->priv().options().fSharpenMipmappedTextures; GrSamplerState::Filter fm = GrSamplerState::Filter::kNearest; GrSamplerState::MipmapMode mm = GrSamplerState::MipmapMode::kNone; SkCubicResampler kernel = kInvalidCubicResampler; - if (fUseSamplingOptions) { - if (fSampling.useCubic) { - kernel = fSampling.cubic; - } else { - switch (fSampling.filter) { - case SkFilterMode::kNearest: fm = GrSamplerState::Filter::kNearest; break; - case SkFilterMode::kLinear : fm = GrSamplerState::Filter::kLinear ; break; - } - switch (fSampling.mipmap) { - case SkMipmapMode::kNone : mm = GrSamplerState::MipmapMode::kNone ; break; - case SkMipmapMode::kNearest: mm = GrSamplerState::MipmapMode::kNearest; break; - case SkMipmapMode::kLinear : mm = GrSamplerState::MipmapMode::kLinear ; break; - } + if (fSampling.useCubic) { + kernel = fSampling.cubic; + } else { + switch (fSampling.filter) { + case SkFilterMode::kNearest: fm = GrSamplerState::Filter::kNearest; break; + case SkFilterMode::kLinear : fm = GrSamplerState::Filter::kLinear ; break; + } + switch (fSampling.mipmap) { + case SkMipmapMode::kNone : mm = GrSamplerState::MipmapMode::kNone ; break; + case SkMipmapMode::kNearest: mm = GrSamplerState::MipmapMode::kNearest; break; + case SkMipmapMode::kLinear : mm = GrSamplerState::MipmapMode::kLinear ; break; } - } else { // inherit filterquality from paint - std::tie(fm, mm, kernel) = - GrInterpretSamplingOptions(fImage->dimensions(), - args.fSampling, - args.fMatrixProvider.localToDevice(), - *lm, - sharpen, - args.fAllowFilterQualityReduction); } std::unique_ptr fp; @@ -453,7 +424,7 @@ sk_sp SkMakeBitmapShaderForPaint(const SkPaint& paint, const SkBitmap& const SkSamplingOptions& sampling, const SkMatrix* localMatrix, SkCopyPixelsMode mode) { auto s = SkImageShader::Make(SkMakeImageFromRasterBitmap(src, mode), - tmx, tmy, &sampling, localMatrix); + tmx, tmy, sampling, localMatrix); if (!s) { return nullptr; } @@ -550,10 +521,8 @@ static SkMatrix tweak_inv_matrix(SkFilterMode filter, SkMatrix matrix) { } bool SkImageShader::doStages(const SkStageRec& rec, SkImageStageUpdater* updater) const { - auto sampling = fUseSamplingOptions ? fSampling - : SkSamplingOptions(rec.fPaint.getFilterQuality()); - // We only support certain sampling options in stages so far + auto sampling = fSampling; if (sampling.useCubic) { if (!is_default_cubic_resampler(sampling.cubic)) { return false; @@ -842,7 +811,7 @@ SkStageUpdater* SkImageShader::onAppendUpdatableStages(const SkStageRec& rec) co skvm::Color SkImageShader::onProgram(skvm::Builder* p, skvm::Coord device, skvm::Coord origLocal, skvm::Color paint, const SkMatrixProvider& matrices, const SkMatrix* localM, - SkFilterQuality paintQuality, const SkColorInfo& dst, + SkFilterQuality, const SkColorInfo& dst, skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const { SkMatrix baseInv; if (!this->computeTotalInverse(matrices.localToDevice(), localM, &baseInv)) { @@ -850,7 +819,7 @@ skvm::Color SkImageShader::onProgram(skvm::Builder* p, } baseInv.normalizePerspective(); - auto sampling = fUseSamplingOptions ? fSampling : SkSamplingOptions(paintQuality); + auto sampling = fSampling; auto* access = SkMipmapAccessor::Make(alloc, fImage.get(), baseInv, sampling.mipmap); if (!access) { return {}; diff --git a/src/shaders/SkImageShader.h b/src/shaders/SkImageShader.h index fe4ab232a6..0d2e1d083b 100644 --- a/src/shaders/SkImageShader.h +++ b/src/shaders/SkImageShader.h @@ -20,7 +20,7 @@ public: static sk_sp Make(sk_sp, SkTileMode tmx, SkTileMode tmy, - const SkSamplingOptions*, // null means inherit-from-paint-fq + const SkSamplingOptions&, const SkMatrix* localMatrix, bool clampAsIfUnpremul = false); @@ -38,7 +38,7 @@ private: SkImageShader(sk_sp, SkTileMode tmx, SkTileMode tmy, - const SkSamplingOptions*, + const SkSamplingOptions&, const SkMatrix* localMatrix, bool clampAsIfUnpremul = false); @@ -63,7 +63,6 @@ private: const SkTileMode fTileModeX; const SkTileMode fTileModeY; const bool fClampAsIfUnpremul; - const bool fUseSamplingOptions; // else inherit filterquality from paint friend class SkShaderBase; using INHERITED = SkShaderBase; diff --git a/src/shaders/SkPictureShader.cpp b/src/shaders/SkPictureShader.cpp index 2ccb683baa..268878e591 100644 --- a/src/shaders/SkPictureShader.cpp +++ b/src/shaders/SkPictureShader.cpp @@ -40,26 +40,9 @@ sk_sp SkPicture::makeShader(SkTileMode tmx, SkTileMode tmy, SkFilterMo if (localMatrix && !localMatrix->invert(nullptr)) { return nullptr; } - return SkPictureShader::Make(sk_ref_sp(this), tmx, tmy, (SkPictureShader::FilterEnum)filter, - localMatrix, tile); + return SkPictureShader::Make(sk_ref_sp(this), tmx, tmy, filter, localMatrix, tile); } -#ifdef SK_SUPPORT_LEGACY_PICTURESHADER_NOFILTER -sk_sp SkPicture::makeShader(SkTileMode tmx, SkTileMode tmy, const SkMatrix* localMatrix, - const SkRect* tile) const { - if (localMatrix && !localMatrix->invert(nullptr)) { - return nullptr; - } - return SkPictureShader::Make(sk_ref_sp(this), tmx, tmy, SkPictureShader::kInheritFromPaint, - localMatrix, tile); -} - -sk_sp SkPicture::makeShader(SkTileMode tmx, SkTileMode tmy, - const SkMatrix* localMatrix) const { - return this->makeShader(tmx, tmy, localMatrix, nullptr); -} -#endif - namespace { static unsigned gImageFromPictureKeyNamespaceLabel; @@ -124,7 +107,7 @@ struct ImageFromPictureRec : public SkResourceCache::Rec { } // namespace SkPictureShader::SkPictureShader(sk_sp picture, SkTileMode tmx, SkTileMode tmy, - FilterEnum filter, const SkMatrix* localMatrix, const SkRect* tile) + SkFilterMode filter, const SkMatrix* localMatrix, const SkRect* tile) : INHERITED(localMatrix) , fPicture(std::move(picture)) , fTile(tile ? *tile : fPicture->cullRect()) @@ -133,7 +116,7 @@ SkPictureShader::SkPictureShader(sk_sp picture, SkTileMode tmx, SkTil , fFilter(filter) {} sk_sp SkPictureShader::Make(sk_sp picture, SkTileMode tmx, SkTileMode tmy, - FilterEnum filter, const SkMatrix* lm, const SkRect* tile) { + SkFilterMode filter, const SkMatrix* lm, const SkRect* tile) { if (!picture || picture->cullRect().isEmpty() || (tile && tile->isEmpty())) { return SkShaders::Empty(); } @@ -148,15 +131,23 @@ sk_sp SkPictureShader::CreateProc(SkReadBuffer& buffer) { SkRect tile = buffer.readRect(); sk_sp picture; - FilterEnum filter; - if (buffer.isVersionLT(SkPicturePriv::kPictureShaderFilterParam_Version)) { - filter = kInheritFromPaint; - bool didSerialize = buffer.readBool(); - if (didSerialize) { + + SkFilterMode filter = SkFilterMode::kNearest; + if (buffer.isVersionLT(SkPicturePriv::kNoFilterQualityShaders_Version)) { + if (buffer.isVersionLT(SkPicturePriv::kPictureShaderFilterParam_Version)) { + bool didSerialize = buffer.readBool(); + if (didSerialize) { + picture = SkPicturePriv::MakeFromBuffer(buffer); + } + } else { + unsigned legacyFilter = buffer.read32(); + if (legacyFilter <= (unsigned)SkFilterMode::kLast) { + filter = (SkFilterMode)legacyFilter; + } picture = SkPicturePriv::MakeFromBuffer(buffer); } } else { - filter = buffer.read32LE(SkPictureShader::kLastFilterEnum); + filter = buffer.read32LE(SkFilterMode::kLast); picture = SkPicturePriv::MakeFromBuffer(buffer); } return SkPictureShader::Make(picture, tmx, tmy, filter, &lm, &tile); @@ -171,25 +162,6 @@ void SkPictureShader::flatten(SkWriteBuffer& buffer) const { SkPicturePriv::Flatten(fPicture, buffer); } -// These are tricky "downscales" -- need to deduce the caller's intention. -// For now, map anything that is not "nearest/none" to kLinear -// -// The "modern" version of pictureshader explicitly takes SkFilterMode. -// The legacy version inherits it from the paint, hence the extra conversions/plumbing -// needed to downscale either filter-quality or sampling (from the paint) if we're in -// legacy mode. When all clients only use the modern/explicit version, we can eliminate -// all of this extra stuff. - -static SkFilterMode sampling_to_filter(const SkSamplingOptions& sampling) { - return sampling == SkSamplingOptions() ? SkFilterMode::kNearest - : SkFilterMode::kLinear; -} - -static SkFilterMode quality_to_filter(SkFilterQuality quality) { - return quality == kNone_SkFilterQuality ? SkFilterMode::kNearest - : SkFilterMode::kLinear; -} - static sk_sp ref_or_srgb(SkColorSpace* cs) { return cs ? sk_ref_sp(cs) : SkColorSpace::MakeSRGB(); } @@ -280,8 +252,7 @@ struct CachedImageInfo { sk_sp SkPictureShader::rasterShader(const SkMatrix& viewMatrix, SkTCopyOnFirstWrite* localMatrix, SkColorType dstColorType, - SkColorSpace* dstColorSpace, - SkFilterMode paintFilter) const { + SkColorSpace* dstColorSpace) const { const int maxTextureSize_NotUsedForCPU = 0; CachedImageInfo info = CachedImageInfo::Make(fTile, viewMatrix, localMatrix, dstColorType, dstColorSpace, @@ -303,17 +274,7 @@ sk_sp SkPictureShader::rasterShader(const SkMatrix& viewMatrix, SkResourceCache::Add(new ImageFromPictureRec(key, image)); SkPicturePriv::AddedToCache(fPicture.get()); } - return this->makeShader(image.get(), paintFilter); -} - -sk_sp SkPictureShader::makeShader(const SkImage* image, SkFilterMode paintFilter) const { - SkFilterMode filter; - if (fFilter == kInheritFromPaint) { - filter = paintFilter; - } else { - filter = (SkFilterMode)fFilter; - } - return image->makeShader(fTmx, fTmy, SkSamplingOptions(filter), nullptr); + return image->makeShader(fTmx, fTmy, SkSamplingOptions(fFilter), nullptr); } bool SkPictureShader::onAppendStages(const SkStageRec& rec) const { @@ -321,8 +282,7 @@ bool SkPictureShader::onAppendStages(const SkStageRec& rec) const { // Keep bitmapShader alive by using alloc instead of stack memory auto& bitmapShader = *rec.fAlloc->make>(); bitmapShader = this->rasterShader(rec.fMatrixProvider.localToDevice(), &lm, - rec.fDstColorType, rec.fDstCS, - quality_to_filter(rec.fPaint.getFilterQuality())); + rec.fDstColorType, rec.fDstCS); if (!bitmapShader) { return false; } @@ -343,8 +303,7 @@ skvm::Color SkPictureShader::onProgram(skvm::Builder* p, // Keep bitmapShader alive by using alloc instead of stack memory auto& bitmapShader = *alloc->make>(); bitmapShader = this->rasterShader(matrices.localToDevice(), &lm, - dst.colorType(), dst.colorSpace(), - quality_to_filter(quality)); + dst.colorType(), dst.colorSpace()); if (!bitmapShader) { return {}; } @@ -362,8 +321,7 @@ SkShaderBase::Context* SkPictureShader::onMakeContext(const ContextRec& rec, SkA const { auto lm = this->totalLocalMatrix(rec.fLocalMatrix); sk_sp bitmapShader = this->rasterShader(*rec.fMatrix, &lm, rec.fDstColorType, - rec.fDstColorSpace, - sampling_to_filter(rec.fPaintSampling)); + rec.fDstColorSpace); if (!bitmapShader) { return nullptr; } @@ -467,7 +425,7 @@ std::unique_ptr SkPictureShader::asFragmentProcessor( const GrSamplerState sampler(static_cast(fTmx), static_cast(fTmy), - sampling_to_filter(args.fSampling)); + fFilter); return GrTextureEffect::Make(std::move(view), kPremul_SkAlphaType, inv, sampler, *ctx->priv().caps()); } diff --git a/src/shaders/SkPictureShader.h b/src/shaders/SkPictureShader.h index 9bbc5e8782..837622910c 100644 --- a/src/shaders/SkPictureShader.h +++ b/src/shaders/SkPictureShader.h @@ -24,15 +24,7 @@ class SkPicture; */ class SkPictureShader : public SkShaderBase { public: - enum FilterEnum { - kNearest, // SkFilterMode::kNearest - kLinear, // SkFilterMode::kLinear - kInheritFromPaint, - - kLastFilterEnum = kInheritFromPaint, - }; - - static sk_sp Make(sk_sp, SkTileMode, SkTileMode, FilterEnum, + static sk_sp Make(sk_sp, SkTileMode, SkTileMode, SkFilterMode, const SkMatrix*, const SkRect*); #if SK_SUPPORT_GPU @@ -55,14 +47,11 @@ protected: private: SK_FLATTENABLE_HOOKS(SkPictureShader) - SkPictureShader(sk_sp, SkTileMode, SkTileMode, FilterEnum, + SkPictureShader(sk_sp, SkTileMode, SkTileMode, SkFilterMode, const SkMatrix*, const SkRect*); sk_sp rasterShader(const SkMatrix&, SkTCopyOnFirstWrite* localMatrix, - SkColorType dstColorType, SkColorSpace* dstColorSpace, - SkFilterMode paintFilter) const; - - sk_sp makeShader(const SkImage*, SkFilterMode paintFilter) const; + SkColorType dstColorType, SkColorSpace* dstColorSpace) const; class PictureShaderContext : public Context { public: @@ -83,7 +72,7 @@ private: sk_sp fPicture; SkRect fTile; SkTileMode fTmx, fTmy; - FilterEnum fFilter; + SkFilterMode fFilter; using INHERITED = SkShaderBase; }; diff --git a/src/shaders/SkShader.cpp b/src/shaders/SkShader.cpp index 9bd17765ca..58675b8ae9 100644 --- a/src/shaders/SkShader.cpp +++ b/src/shaders/SkShader.cpp @@ -145,7 +145,7 @@ sk_sp SkBitmap::makeShader(SkTileMode tmx, SkTileMode tmy, return nullptr; } return SkImageShader::Make(SkMakeImageFromRasterBitmap(*this, kIfMutable_SkCopyPixelsMode), - tmx, tmy, &sampling, lm); + tmx, tmy, sampling, lm); } bool SkShaderBase::appendStages(const SkStageRec& rec) const { diff --git a/src/shaders/SkShaderBase.h b/src/shaders/SkShaderBase.h index ec4322185c..680cf1bd5a 100644 --- a/src/shaders/SkShaderBase.h +++ b/src/shaders/SkShaderBase.h @@ -90,7 +90,6 @@ public: , fLocalMatrix(localM) , fDstColorType(dstColorType) , fDstColorSpace(dstColorSpace) { - fPaintSampling = SkSamplingOptions(paint.getFilterQuality()); fPaintAlpha = paint.getAlpha(); fPaintDither = paint.isDither(); } @@ -99,7 +98,6 @@ public: const SkMatrix* fLocalMatrix; // optional local matrix SkColorType fDstColorType; // the color type of the dest surface SkColorSpace* fDstColorSpace; // the color space of the dest surface (if any) - SkSamplingOptions fPaintSampling; // only used for legacy-built shaders (inherit sampling) SkAlpha fPaintAlpha; bool fPaintDither;