diff options
author | 2017-05-26 11:09:01 -0400 | |
---|---|---|
committer | 2017-05-26 18:31:18 +0000 | |
commit | eb9f278e8c5af0fe4c39df3d5647b7ea1441d861 (patch) | |
tree | c2a7021f42a360c58441ac62f53275b33e500eef /src | |
parent | a1fab3cec2b4a1de4caf115520b8e5c63f6e32db (diff) |
Delete onChooseBlitProcs() and related code
All dead code now.
Change-Id: I3d88103fef90d9e2ceee8b13db143ac9704689f5
Reviewed-on: https://skia-review.googlesource.com/18034
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBitmapProcShader.cpp | 23 | ||||
-rw-r--r-- | src/core/SkColorShader.cpp | 65 | ||||
-rw-r--r-- | src/core/SkColorShader.h | 6 | ||||
-rw-r--r-- | src/core/SkLinearBitmapPipeline.cpp | 32 | ||||
-rw-r--r-- | src/core/SkLinearBitmapPipeline.h | 10 | ||||
-rw-r--r-- | src/core/SkShaderBase.h | 31 | ||||
-rw-r--r-- | src/effects/gradients/Sk4fGradientPriv.h | 63 | ||||
-rw-r--r-- | src/effects/gradients/Sk4fLinearGradient.cpp | 98 | ||||
-rw-r--r-- | src/effects/gradients/Sk4fLinearGradient.h | 5 |
9 files changed, 2 insertions, 331 deletions
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp index e52982354d..5410447d6d 100644 --- a/src/core/SkBitmapProcShader.cpp +++ b/src/core/SkBitmapProcShader.cpp @@ -145,33 +145,10 @@ public: } } - bool onChooseBlitProcs(const SkImageInfo& dstInfo, BlitState* state) override { - if ((fBlitterPipeline = SkLinearBitmapPipeline::ClonePipelineForBlitting( - *fShaderPipeline, - fMatrixTypeMask, - fFilterQuality, fSrcPixmap, - fAlpha, state->fMode, dstInfo, fAllocator))) - { - state->fStorage[0] = fBlitterPipeline; - state->fBlitBW = &LinearPipelineContext::ForwardToPipeline; - - return true; - } - - return false; - } - - static void ForwardToPipeline(BlitState* state, int x, int y, const SkPixmap& dst, int count) { - SkLinearBitmapPipeline* pipeline = static_cast<SkLinearBitmapPipeline*>(state->fStorage[0]); - void* addr = dst.writable_addr32(x, y); - pipeline->blitSpan(x, y, addr, count); - } - private: // Store the allocator from the context creation incase we are asked to build a blitter. SkArenaAlloc* fAllocator; SkLinearBitmapPipeline* fShaderPipeline; - SkLinearBitmapPipeline* fBlitterPipeline; SkXfermode::D32Proc fSrcModeProc; SkPixmap fSrcPixmap; float fAlpha; diff --git a/src/core/SkColorShader.cpp b/src/core/SkColorShader.cpp index 32b2c54d71..7b6d0a9068 100644 --- a/src/core/SkColorShader.cpp +++ b/src/core/SkColorShader.cpp @@ -250,71 +250,6 @@ sk_sp<SkShader> SkShader::MakeColorShader(const SkColor4f& color, sk_sp<SkColorS } /////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -static void D32_BlitBW(SkShaderBase::Context::BlitState* state, int x, int y, const SkPixmap& dst, - int count) { - SkXfermode::D32Proc proc = (SkXfermode::D32Proc)state->fStorage[0]; - const SkPM4f* src = (const SkPM4f*)state->fStorage[1]; - proc(state->fMode, dst.writable_addr32(x, y), src, count, nullptr); -} - -static void D32_BlitAA(SkShaderBase::Context::BlitState* state, int x, int y, const SkPixmap& dst, - int count, const SkAlpha aa[]) { - SkXfermode::D32Proc proc = (SkXfermode::D32Proc)state->fStorage[0]; - const SkPM4f* src = (const SkPM4f*)state->fStorage[1]; - proc(state->fMode, dst.writable_addr32(x, y), src, count, aa); -} - -static void F16_BlitBW(SkShaderBase::Context::BlitState* state, int x, int y, const SkPixmap& dst, - int count) { - SkXfermode::F16Proc proc = (SkXfermode::F16Proc)state->fStorage[0]; - const SkPM4f* src = (const SkPM4f*)state->fStorage[1]; - proc(state->fMode, dst.writable_addr64(x, y), src, count, nullptr); -} - -static void F16_BlitAA(SkShaderBase::Context::BlitState* state, int x, int y, const SkPixmap& dst, - int count, const SkAlpha aa[]) { - SkXfermode::F16Proc proc = (SkXfermode::F16Proc)state->fStorage[0]; - const SkPM4f* src = (const SkPM4f*)state->fStorage[1]; - proc(state->fMode, dst.writable_addr64(x, y), src, count, aa); -} - -static bool choose_blitprocs(const SkPM4f* pm4, const SkImageInfo& info, - SkShaderBase::Context::BlitState* state) { - uint32_t flags = SkXfermode::kSrcIsSingle_D32Flag; - if (pm4->a() == 1) { - flags |= SkXfermode::kSrcIsOpaque_D32Flag; - } - switch (info.colorType()) { - case kN32_SkColorType: - if (info.gammaCloseToSRGB()) { - flags |= SkXfermode::kDstIsSRGB_D32Flag; - } - state->fStorage[0] = (void*)SkXfermode::GetD32Proc(state->fMode, flags); - state->fStorage[1] = (void*)pm4; - state->fBlitBW = D32_BlitBW; - state->fBlitAA = D32_BlitAA; - return true; - case kRGBA_F16_SkColorType: - state->fStorage[0] = (void*)SkXfermode::GetF16Proc(state->fMode, flags); - state->fStorage[1] = (void*)pm4; - state->fBlitBW = F16_BlitBW; - state->fBlitAA = F16_BlitAA; - return true; - default: - return false; - } -} - -bool SkColorShader::ColorShaderContext::onChooseBlitProcs(const SkImageInfo& info, - BlitState* state) { - return choose_blitprocs(&fPM4f, info, state); -} - -bool SkColor4Shader::Color4Context::onChooseBlitProcs(const SkImageInfo& info, BlitState* state) { - return choose_blitprocs(&fPM4f, info, state); -} bool SkColorShader::onAppendStages(SkRasterPipeline* p, SkColorSpace* dst, diff --git a/src/core/SkColorShader.h b/src/core/SkColorShader.h index 929ab4326f..969064946e 100644 --- a/src/core/SkColorShader.h +++ b/src/core/SkColorShader.h @@ -37,9 +37,6 @@ public: void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) override; void shadeSpan4f(int x, int y, SkPM4f[], int count) override; - protected: - bool onChooseBlitProcs(const SkImageInfo&, BlitState*) override; - private: SkPM4f fPM4f; SkPMColor fPMColor; @@ -98,9 +95,6 @@ public: void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) override; void shadeSpan4f(int x, int y, SkPM4f[], int count) override; - protected: - bool onChooseBlitProcs(const SkImageInfo&, BlitState*) override; - private: SkPM4f fPM4f; SkPMColor fPMColor; diff --git a/src/core/SkLinearBitmapPipeline.cpp b/src/core/SkLinearBitmapPipeline.cpp index 2878f19a9f..cf2dfdc09f 100644 --- a/src/core/SkLinearBitmapPipeline.cpp +++ b/src/core/SkLinearBitmapPipeline.cpp @@ -417,38 +417,6 @@ SkLinearBitmapPipeline::SkLinearBitmapPipeline( fFirstStage = matrixStage; } -SkLinearBitmapPipeline* SkLinearBitmapPipeline::ClonePipelineForBlitting( - const SkLinearBitmapPipeline& pipeline, - SkMatrix::TypeMask matrixMask, - SkFilterQuality filterQuality, - const SkPixmap& srcPixmap, - float finalAlpha, - SkBlendMode blendMode, - const SkImageInfo& dstInfo, - SkArenaAlloc* allocator) -{ - if (blendMode == SkBlendMode::kSrcOver && srcPixmap.info().alphaType() == kOpaque_SkAlphaType) { - blendMode = SkBlendMode::kSrc; - } - - if (matrixMask & ~SkMatrix::kTranslate_Mask ) { return nullptr; } - if (filterQuality != SkFilterQuality::kNone_SkFilterQuality) { return nullptr; } - if (finalAlpha != 1.0f) { return nullptr; } - if (srcPixmap.info().colorType() != kRGBA_8888_SkColorType - || dstInfo.colorType() != kRGBA_8888_SkColorType) { return nullptr; } - - if (!srcPixmap.info().gammaCloseToSRGB() || !dstInfo.gammaCloseToSRGB()) { - return nullptr; - } - - if (blendMode != SkBlendMode::kSrc && blendMode != SkBlendMode::kSrcOver) { - return nullptr; - } - - return allocator->make<SkLinearBitmapPipeline>( - pipeline, srcPixmap, blendMode, dstInfo, allocator); -} - void SkLinearBitmapPipeline::shadeSpan4f(int x, int y, SkPM4f* dst, int count) { SkASSERT(count > 0); this->blitSpan(x, y, dst, count); diff --git a/src/core/SkLinearBitmapPipeline.h b/src/core/SkLinearBitmapPipeline.h index 8ce02009b2..6f6e2ae602 100644 --- a/src/core/SkLinearBitmapPipeline.h +++ b/src/core/SkLinearBitmapPipeline.h @@ -43,16 +43,6 @@ public: const SkImageInfo& dstInfo, SkArenaAlloc* allocator); - static SkLinearBitmapPipeline* ClonePipelineForBlitting( - const SkLinearBitmapPipeline& pipeline, - SkMatrix::TypeMask matrixMask, - SkFilterQuality filterQuality, - const SkPixmap& srcPixmap, - float finalAlpha, - SkBlendMode, - const SkImageInfo& dstInfo, - SkArenaAlloc* allocator); - ~SkLinearBitmapPipeline(); void shadeSpan4f(int x, int y, SkPM4f* dst, int count); diff --git a/src/core/SkShaderBase.h b/src/core/SkShaderBase.h index 895fc6cf05..c613cb948d 100644 --- a/src/core/SkShaderBase.h +++ b/src/core/SkShaderBase.h @@ -100,35 +100,6 @@ public: virtual void shadeSpan4f(int x, int y, SkPM4f[], int count); - struct BlitState; - typedef void (*BlitBW)(BlitState*, - int x, int y, const SkPixmap&, int count); - typedef void (*BlitAA)(BlitState*, - int x, int y, const SkPixmap&, int count, const SkAlpha[]); - - struct BlitState { - // inputs - Context* fCtx; - SkBlendMode fMode; - - // outputs - enum { N = 2 }; - void* fStorage[N]; - BlitBW fBlitBW; - BlitAA fBlitAA; - }; - - // Returns true if one or more of the blitprocs are set in the BlitState - bool chooseBlitProcs(const SkImageInfo& info, BlitState* state) { - state->fBlitBW = nullptr; - state->fBlitAA = nullptr; - if (this->onChooseBlitProcs(info, state)) { - SkASSERT(state->fBlitBW || state->fBlitAA); - return true; - } - return false; - } - /** * The const void* ctx is only const because all the implementations are const. * This can be changed to non-const if a new shade proc needs to change the ctx. @@ -163,8 +134,6 @@ public: MatrixClass getInverseClass() const { return (MatrixClass)fTotalInverseClass; } const SkMatrix& getCTM() const { return fCTM; } - virtual bool onChooseBlitProcs(const SkImageInfo&, BlitState*) { return false; } - private: SkMatrix fCTM; SkMatrix fTotalInverse; diff --git a/src/effects/gradients/Sk4fGradientPriv.h b/src/effects/gradients/Sk4fGradientPriv.h index b8f4bcaee1..f18d6ced7b 100644 --- a/src/effects/gradients/Sk4fGradientPriv.h +++ b/src/effects/gradients/Sk4fGradientPriv.h @@ -23,10 +23,8 @@ namespace { enum class ApplyPremul { True, False }; enum class DstType { - L32, // Linear 32bit. Used for both shader/blitter paths. - S32, // SRGB 32bit. Used for the blitter path only. - F16, // Linear half-float. Used for blitters only. - F32, // Linear float. Used for shaders only. + L32, // Linear 32bit. + F32, // Linear float. }; template <ApplyPremul> @@ -103,63 +101,6 @@ struct DstTraits<DstType::L32, premul> { }; template <ApplyPremul premul> -struct DstTraits<DstType::S32, premul> { - using PM = PremulTraits<premul>; - using Type = SkPMColor; - - static Sk4f load(const SkPM4f& c) { - return c.to4f_pmorder(); - } - - static void store(const Sk4f& c, Type* dst) { - // FIXME: this assumes opaque colors. Handle unpremultiplication. - *dst = Sk4f_toS32(PM::apply(c)); - } - - static void store(const Sk4f& c, Type* dst, int n) { - sk_memset32(dst, Sk4f_toS32(PM::apply(c)), n); - } - - static void store4x(const Sk4f& c0, const Sk4f& c1, - const Sk4f& c2, const Sk4f& c3, - Type* dst) { - store(c0, dst + 0); - store(c1, dst + 1); - store(c2, dst + 2); - store(c3, dst + 3); - } -}; - -template <ApplyPremul premul> -struct DstTraits<DstType::F16, premul> { - using PM = PremulTraits<premul>; - using Type = uint64_t; - - static Sk4f load(const SkPM4f& c) { - return c.to4f(); - } - - static void store(const Sk4f& c, Type* dst) { - SkFloatToHalf_finite_ftz(PM::apply(c)).store(dst); - } - - static void store(const Sk4f& c, Type* dst, int n) { - uint64_t color; - SkFloatToHalf_finite_ftz(PM::apply(c)).store(&color); - sk_memset64(dst, color, n); - } - - static void store4x(const Sk4f& c0, const Sk4f& c1, - const Sk4f& c2, const Sk4f& c3, - Type* dst) { - store(c0, dst + 0); - store(c1, dst + 1); - store(c2, dst + 2); - store(c3, dst + 3); - } -}; - -template <ApplyPremul premul> struct DstTraits<DstType::F32, premul> { using PM = PremulTraits<premul>; using Type = SkPM4f; diff --git a/src/effects/gradients/Sk4fLinearGradient.cpp b/src/effects/gradients/Sk4fLinearGradient.cpp index 49b98fd86e..7b7498eaef 100644 --- a/src/effects/gradients/Sk4fLinearGradient.cpp +++ b/src/effects/gradients/Sk4fLinearGradient.cpp @@ -44,43 +44,6 @@ void ramp(const Sk4f& c, const Sk4f& dc, typename DstTraits<dstType, premul>::Ty } } -// Planar version of ramp (S32 no-premul only). -template<> -void ramp<DstType::S32, ApplyPremul::False>(const Sk4f& c, const Sk4f& dc, SkPMColor dst[], int n) { - SkASSERT(n > 0); - - const Sk4f dc4 = dc * 4; - const Sk4x4f dc4x = { Sk4f(dc4[0]), Sk4f(dc4[1]), Sk4f(dc4[2]), Sk4f(dc4[3]) }; - Sk4x4f c4x = Sk4x4f::Transpose(c, c + dc, c + dc * 2, c + dc * 3); - - while (n >= 4) { - ( sk_linear_to_srgb(c4x.r) << 0 - | sk_linear_to_srgb(c4x.g) << 8 - | sk_linear_to_srgb(c4x.b) << 16 - | Sk4f_round(255.0f*c4x.a) << 24).store(dst); - - c4x.r += dc4x.r; - c4x.g += dc4x.g; - c4x.b += dc4x.b; - c4x.a += dc4x.a; - - dst += 4; - n -= 4; - } - - if (n & 2) { - DstTraits<DstType::S32, ApplyPremul::False> - ::store(Sk4f(c4x.r[0], c4x.g[0], c4x.b[0], c4x.a[0]), dst++); - DstTraits<DstType::S32, ApplyPremul::False> - ::store(Sk4f(c4x.r[1], c4x.g[1], c4x.b[1], c4x.a[1]), dst++); - } - - if (n & 1) { - DstTraits<DstType::S32, ApplyPremul::False> - ::store(Sk4f(c4x.r[n & 2], c4x.g[n & 2], c4x.b[n & 2], c4x.a[n & 2]), dst); - } -} - template<SkShader::TileMode> SkScalar pinFx(SkScalar); @@ -465,64 +428,3 @@ LinearGradient4fContext::mapTs(int x, int y, SkScalar ts[], int count) const { } } } - -bool SkLinearGradient::LinearGradient4fContext::onChooseBlitProcs(const SkImageInfo& info, - BlitState* state) { - if (state->fMode != SkBlendMode::kSrc && - !(state->fMode == SkBlendMode::kSrcOver && (fFlags & kOpaqueAlpha_Flag))) { - return false; - } - - switch (info.colorType()) { - case kN32_SkColorType: - state->fBlitBW = D32_BlitBW; - return true; - case kRGBA_F16_SkColorType: - state->fBlitBW = D64_BlitBW; - return true; - default: - return false; - } -} - -void SkLinearGradient:: -LinearGradient4fContext::D32_BlitBW(BlitState* state, int x, int y, const SkPixmap& dst, - int count) { - // FIXME: ignoring coverage for now - const LinearGradient4fContext* ctx = - static_cast<const LinearGradient4fContext*>(state->fCtx); - - if (!dst.info().gammaCloseToSRGB()) { - if (ctx->fColorsArePremul) { - ctx->shadePremulSpan<DstType::L32, ApplyPremul::False>( - x, y, dst.writable_addr32(x, y), count); - } else { - ctx->shadePremulSpan<DstType::L32, ApplyPremul::True>( - x, y, dst.writable_addr32(x, y), count); - } - } else { - if (ctx->fColorsArePremul) { - ctx->shadePremulSpan<DstType::S32, ApplyPremul::False>( - x, y, dst.writable_addr32(x, y), count); - } else { - ctx->shadePremulSpan<DstType::S32, ApplyPremul::True>( - x, y, dst.writable_addr32(x, y), count); - } - } -} - -void SkLinearGradient:: -LinearGradient4fContext::D64_BlitBW(BlitState* state, int x, int y, const SkPixmap& dst, - int count) { - // FIXME: ignoring coverage for now - const LinearGradient4fContext* ctx = - static_cast<const LinearGradient4fContext*>(state->fCtx); - - if (ctx->fColorsArePremul) { - ctx->shadePremulSpan<DstType::F16, ApplyPremul::False>( - x, y, dst.writable_addr64(x, y), count); - } else { - ctx->shadePremulSpan<DstType::F16, ApplyPremul::True>( - x, y, dst.writable_addr64(x, y), count); - } -} diff --git a/src/effects/gradients/Sk4fLinearGradient.h b/src/effects/gradients/Sk4fLinearGradient.h index eebd30fbf5..f1c0bb5a30 100644 --- a/src/effects/gradients/Sk4fLinearGradient.h +++ b/src/effects/gradients/Sk4fLinearGradient.h @@ -22,8 +22,6 @@ public: protected: void mapTs(int x, int y, SkScalar ts[], int count) const override; - bool onChooseBlitProcs(const SkImageInfo&, BlitState*) override; - private: using INHERITED = GradientShaderBase4fContext; @@ -42,9 +40,6 @@ private: bool isFast() const { return fDstToPosClass == kLinear_MatrixClass; } - static void D32_BlitBW(BlitState*, int x, int y, const SkPixmap& dst, int count); - static void D64_BlitBW(BlitState*, int x, int y, const SkPixmap& dst, int count); - mutable const Sk4fGradientInterval* fCachedInterval; }; |