diff options
author | mtklein <mtklein@chromium.org> | 2015-02-25 12:52:57 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-25 12:52:57 -0800 |
commit | edeccc58606e0421a1ae275e391ee4347c6f52f6 (patch) | |
tree | 1e0801033607b4245ab407d05fb42dc07e037fb0 /src | |
parent | 59c9203321cf4afb48597f39e4bdd4ae91da12a0 (diff) |
Clean up ColorRectProc plumbing.
We've always been using the portable ColorRect32, so we don't need the
ColorRectProc plumbing.
Furthermore, ColorRect32 doesn't seem to be very important (we're only using
it in the opaque case, which our row-by-row procs already specialize for).
Remove that too.
If we find we want specialization for really narrow rects again, let's put it in
blitRect() directly. It's pretty unlikely we're going to get platform-specific
speedup for blits to non-contiguous memory.
My local SKP comparison is +- 3%... most neutral I've ever seen.
BUG=skia:
Review URL: https://codereview.chromium.org/959873002
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBlitRow_D32.cpp | 83 | ||||
-rw-r--r-- | src/core/SkBlitter_ARGB32.cpp | 11 | ||||
-rw-r--r-- | src/core/SkCoreBlitters.h | 1 | ||||
-rw-r--r-- | src/opts/SkBlitRow_opts_arm.cpp | 3 | ||||
-rw-r--r-- | src/opts/SkBlitRow_opts_mips_dsp.cpp | 4 | ||||
-rw-r--r-- | src/opts/SkBlitRow_opts_none.cpp | 3 | ||||
-rw-r--r-- | src/opts/opts_check_x86.cpp | 6 |
7 files changed, 3 insertions, 108 deletions
diff --git a/src/core/SkBlitRow_D32.cpp b/src/core/SkBlitRow_D32.cpp index f8cf9a34a9..509eeeb1a0 100644 --- a/src/core/SkBlitRow_D32.cpp +++ b/src/core/SkBlitRow_D32.cpp @@ -12,8 +12,6 @@ #define UNROLL -SkBlitRow::ColorRectProc PlatformColorRectProcFactory(); - static void S32_Opaque_BlitRow32(SkPMColor* SK_RESTRICT dst, const SkPMColor* SK_RESTRICT src, int count, U8CPU alpha) { @@ -166,84 +164,3 @@ void SkBlitRow::Color32(SkPMColor* SK_RESTRICT dst, } } -template <size_t N> void assignLoop(SkPMColor* dst, SkPMColor color) { - for (size_t i = 0; i < N; ++i) { - *dst++ = color; - } -} - -static inline void assignLoop(SkPMColor dst[], SkPMColor color, int count) { - while (count >= 4) { - *dst++ = color; - *dst++ = color; - *dst++ = color; - *dst++ = color; - count -= 4; - } - if (count >= 2) { - *dst++ = color; - *dst++ = color; - count -= 2; - } - if (count > 0) { - *dst++ = color; - } -} - -void SkBlitRow::ColorRect32(SkPMColor* dst, int width, int height, - size_t rowBytes, SkPMColor color) { - if (width <= 0 || height <= 0 || 0 == color) { - return; - } - - // Just made up this value, since I saw it once in a SSE2 file. - // We should consider writing some tests to find the optimimal break-point - // (or query the Platform proc?) - static const int MIN_WIDTH_FOR_SCANLINE_PROC = 32; - - bool isOpaque = (0xFF == SkGetPackedA32(color)); - - if (!isOpaque || width >= MIN_WIDTH_FOR_SCANLINE_PROC) { - SkBlitRow::ColorProc proc = SkBlitRow::ColorProcFactory(); - while (--height >= 0) { - (*proc)(dst, dst, width, color); - dst = (SkPMColor*) ((char*)dst + rowBytes); - } - } else { - switch (width) { - case 1: - while (--height >= 0) { - assignLoop<1>(dst, color); - dst = (SkPMColor*) ((char*)dst + rowBytes); - } - break; - case 2: - while (--height >= 0) { - assignLoop<2>(dst, color); - dst = (SkPMColor*) ((char*)dst + rowBytes); - } - break; - case 3: - while (--height >= 0) { - assignLoop<3>(dst, color); - dst = (SkPMColor*) ((char*)dst + rowBytes); - } - break; - default: - while (--height >= 0) { - assignLoop(dst, color, width); - dst = (SkPMColor*) ((char*)dst + rowBytes); - } - break; - } - } -} - -SkBlitRow::ColorRectProc SkBlitRow::ColorRectProcFactory() { - SkBlitRow::ColorRectProc proc = PlatformColorRectProcFactory(); - if (NULL == proc) { - proc = ColorRect32; - } - SkASSERT(proc); - return proc; -} diff --git a/src/core/SkBlitter_ARGB32.cpp b/src/core/SkBlitter_ARGB32.cpp index f86bc47074..bbad6c7926 100644 --- a/src/core/SkBlitter_ARGB32.cpp +++ b/src/core/SkBlitter_ARGB32.cpp @@ -53,7 +53,6 @@ SkARGB32_Blitter::SkARGB32_Blitter(const SkBitmap& device, const SkPaint& paint) fPMColor = SkPackARGB32(fSrcA, fSrcR, fSrcG, fSrcB); fColor32Proc = SkBlitRow::ColorProcFactory(); - fColorRect32Proc = SkBlitRow::ColorRectProcFactory(); } const SkBitmap* SkARGB32_Blitter::justAnOpaqueColor(uint32_t* value) { @@ -214,13 +213,9 @@ void SkARGB32_Blitter::blitRect(int x, int y, int width, int height) { uint32_t color = fPMColor; size_t rowBytes = fDevice.rowBytes(); - if (255 == SkGetPackedA32(color)) { - fColorRect32Proc(device, width, height, rowBytes, color); - } else { - while (--height >= 0) { - fColor32Proc(device, device, width, color); - device = (uint32_t*)((char*)device + rowBytes); - } + while (--height >= 0) { + fColor32Proc(device, device, width, color); + device = (uint32_t*)((char*)device + rowBytes); } } diff --git a/src/core/SkCoreBlitters.h b/src/core/SkCoreBlitters.h index 60211c98b3..e6be38a583 100644 --- a/src/core/SkCoreBlitters.h +++ b/src/core/SkCoreBlitters.h @@ -125,7 +125,6 @@ protected: SkColor fColor; SkPMColor fPMColor; SkBlitRow::ColorProc fColor32Proc; - SkBlitRow::ColorRectProc fColorRect32Proc; private: unsigned fSrcA, fSrcR, fSrcG, fSrcB; diff --git a/src/opts/SkBlitRow_opts_arm.cpp b/src/opts/SkBlitRow_opts_arm.cpp index eacaa402c3..a8ab8ce114 100644 --- a/src/opts/SkBlitRow_opts_arm.cpp +++ b/src/opts/SkBlitRow_opts_arm.cpp @@ -396,6 +396,3 @@ SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() { return SK_ARM_NEON_WRAP(Color32_arm); } -SkBlitRow::ColorRectProc PlatformColorRectProcFactory() { - return NULL; -} diff --git a/src/opts/SkBlitRow_opts_mips_dsp.cpp b/src/opts/SkBlitRow_opts_mips_dsp.cpp index 1db38baf5f..528eb07eb5 100644 --- a/src/opts/SkBlitRow_opts_mips_dsp.cpp +++ b/src/opts/SkBlitRow_opts_mips_dsp.cpp @@ -954,10 +954,6 @@ SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) { return platform_32_procs_mips_dsp[flags]; } -SkBlitRow::ColorRectProc PlatformColorRectProcFactory() { - return NULL; -} - SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() { return NULL; } diff --git a/src/opts/SkBlitRow_opts_none.cpp b/src/opts/SkBlitRow_opts_none.cpp index 9558f14337..87ceb69760 100644 --- a/src/opts/SkBlitRow_opts_none.cpp +++ b/src/opts/SkBlitRow_opts_none.cpp @@ -25,6 +25,3 @@ SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() { return NULL; } -SkBlitRow::ColorRectProc PlatformColorRectProcFactory() { - return NULL; -} diff --git a/src/opts/opts_check_x86.cpp b/src/opts/opts_check_x86.cpp index cfd4a3b46b..6b9758c123 100644 --- a/src/opts/opts_check_x86.cpp +++ b/src/opts/opts_check_x86.cpp @@ -261,12 +261,6 @@ SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() { } } -SkBlitRow::ColorRectProc PlatformColorRectProcFactory(); // suppress warning - -SkBlitRow::ColorRectProc PlatformColorRectProcFactory() { - return NULL; -} - //////////////////////////////////////////////////////////////////////////////// SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkColorType dstCT, |