diff options
-rw-r--r-- | bench/BitmapBench.cpp | 35 | ||||
-rw-r--r-- | src/core/SkBitmapProcState.cpp | 59 |
2 files changed, 12 insertions, 82 deletions
diff --git a/bench/BitmapBench.cpp b/bench/BitmapBench.cpp index da2e829a4d..efd6d96684 100644 --- a/bench/BitmapBench.cpp +++ b/bench/BitmapBench.cpp @@ -75,7 +75,6 @@ class BitmapBench : public Benchmark { const SkAlphaType fAlphaType; const bool fForceUpdate; //bitmap marked as dirty before each draw. forces bitmap to be updated on device cache const bool fIsVolatile; - const bool fDoScale; SkBitmap fBitmap; SkPaint fPaint; @@ -84,12 +83,11 @@ class BitmapBench : public Benchmark { enum { W = 128 }; enum { H = 128 }; public: - BitmapBench(SkColorType ct, SkAlphaType at, bool forceUpdate, bool isVolatile, bool doScale) + BitmapBench(SkColorType ct, SkAlphaType at, bool forceUpdate = false, bool isVolatile = false) : fColorType(ct) , fAlphaType(at) , fForceUpdate(forceUpdate) , fIsVolatile(isVolatile) - , fDoScale(doScale) {} protected: @@ -97,15 +95,10 @@ protected: fName.set("bitmap"); fName.appendf("_%s%s", sk_tool_utils::colortype_name(fColorType), kOpaque_SkAlphaType == fAlphaType ? "" : "_A"); - if (fDoScale) { - fName.append("_scale"); - } - if (fForceUpdate) { + if (fForceUpdate) fName.append("_update"); - } - if (fIsVolatile) { + if (fIsVolatile) fName.append("_volatile"); - } return fName.c_str(); } @@ -132,9 +125,6 @@ protected: } virtual void onDraw(const int loops, SkCanvas* canvas) { - if (fDoScale) { - canvas->scale(.99f, .99f); - } SkIPoint dim = this->getSize(); SkRandom rand; @@ -203,7 +193,7 @@ class FilterBitmapBench : public BitmapBench { public: FilterBitmapBench(SkColorType ct, SkAlphaType at, bool forceUpdate, bool isVolitile, uint32_t flags) - : INHERITED(ct, at, forceUpdate, isVolitile, false) + : INHERITED(ct, at, forceUpdate, isVolitile) , fFlags(flags) { } @@ -282,7 +272,7 @@ private: public: SourceAlphaBitmapBench(SourceAlpha alpha, SkColorType ct, bool forceUpdate = false, bool bitmapVolatile = false) - : INHERITED(ct, kPremul_SkAlphaType, forceUpdate, bitmapVolatile, false) + : INHERITED(ct, kPremul_SkAlphaType, forceUpdate, bitmapVolatile) , fSourceAlpha(alpha) { } @@ -359,14 +349,13 @@ private: typedef BitmapBench INHERITED; }; -DEF_BENCH( return new BitmapBench(kN32_SkColorType, kPremul_SkAlphaType, false, false, false); ) -DEF_BENCH( return new BitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, false, false, false); ) -DEF_BENCH( return new BitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, false, false, true); ) -DEF_BENCH( return new BitmapBench(kRGB_565_SkColorType, kOpaque_SkAlphaType, false, false, false); ) -DEF_BENCH( return new BitmapBench(kIndex_8_SkColorType, kPremul_SkAlphaType, false, false, false); ) -DEF_BENCH( return new BitmapBench(kIndex_8_SkColorType, kOpaque_SkAlphaType, false, false, false); ) -DEF_BENCH( return new BitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, true, true, false); ) -DEF_BENCH( return new BitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, true, false, false); ) +DEF_BENCH( return new BitmapBench(kN32_SkColorType, kPremul_SkAlphaType); ) +DEF_BENCH( return new BitmapBench(kN32_SkColorType, kOpaque_SkAlphaType); ) +DEF_BENCH( return new BitmapBench(kRGB_565_SkColorType, kOpaque_SkAlphaType); ) +DEF_BENCH( return new BitmapBench(kIndex_8_SkColorType, kPremul_SkAlphaType); ) +DEF_BENCH( return new BitmapBench(kIndex_8_SkColorType, kOpaque_SkAlphaType); ) +DEF_BENCH( return new BitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, true, true); ) +DEF_BENCH( return new BitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, true, false); ) // scale filter -> S32_opaque_D32_filter_DX_{SSE2,SSSE3} and Fact9 is also for S32_D16_filter_DX_SSE2 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, false, false, kScale_Flag | kBilerp_Flag); ) diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp index b1b50b0c32..2a449d6d8f 100644 --- a/src/core/SkBitmapProcState.cpp +++ b/src/core/SkBitmapProcState.cpp @@ -30,8 +30,6 @@ extern void SI8_opaque_D32_filter_DX_shaderproc_neon(const SkBitmapProcState&, extern void Clamp_SI8_opaque_D32_filter_DX_shaderproc_neon(const SkBitmapProcState&, int, int, uint32_t*, int); #endif -extern void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const SkBitmapProcState&, int, int, uint32_t*, int); - #define NAME_WRAP(x) x #include "SkBitmapProcState_filter.h" #include "SkBitmapProcState_procs.h" @@ -591,8 +589,6 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { } } else if (SK_ARM_NEON_WRAP(SI8_opaque_D32_filter_DX) == fSampleProc32 && clampClamp) { fShaderProc32 = SK_ARM_NEON_WRAP(Clamp_SI8_opaque_D32_filter_DX_shaderproc); - } else if (S32_opaque_D32_nofilter_DX == fSampleProc32 && clampClamp) { - fShaderProc32 = Clamp_S32_opaque_D32_nofilter_DX_shaderproc; } if (NULL == fShaderProc32) { @@ -1023,58 +1019,3 @@ int SkBitmapProcState::maxCountForBufferSize(size_t bufferSize) const { return size; } - -/////////////////////// - -void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const SkBitmapProcState& s, int x, int y, - SkPMColor* SK_RESTRICT dst, int count) { - SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | - SkMatrix::kScale_Mask)) == 0); - - const unsigned maxX = s.fBitmap->width() - 1; - SkFractionalInt fx; - int dstY; - { - SkPoint pt; - s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, SkIntToScalar(y) + SK_ScalarHalf, - &pt); - fx = SkScalarToFractionalInt(pt.fY); - const unsigned maxY = s.fBitmap->height() - 1; - dstY = SkClampMax(SkFractionalIntToInt(fx), maxY); - fx = SkScalarToFractionalInt(pt.fX); - } - - const SkPMColor* SK_RESTRICT src = s.fBitmap->getAddr32(0, dstY); - const SkFractionalInt dx = s.fInvSxFractionalInt; - - // Check if we're safely inside [0...maxX] so no need to clamp each computed index. - // - if ((uint64_t)SkFractionalIntToInt(fx) <= maxX && - (uint64_t)SkFractionalIntToInt(fx + dx * (count - 1)) <= maxX) - { - int count4 = count >> 2; - for (int i = 0; i < count4; ++i) { - SkPMColor src0 = src[SkFractionalIntToInt(fx)]; fx += dx; - SkPMColor src1 = src[SkFractionalIntToInt(fx)]; fx += dx; - SkPMColor src2 = src[SkFractionalIntToInt(fx)]; fx += dx; - SkPMColor src3 = src[SkFractionalIntToInt(fx)]; fx += dx; - dst[0] = src0; - dst[1] = src1; - dst[2] = src2; - dst[3] = src3; - dst += 4; - } - for (int i = (count4 << 2); i < count; ++i) { - unsigned index = SkFractionalIntToInt(fx); - SkASSERT(index <= maxX); - *dst++ = src[index]; - fx += dx; - } - } else { - for (int i = 0; i < count; ++i) { - dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; - fx += dx; - } - } -} - |