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/core/SkBlitRow_D32.cpp | |
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/core/SkBlitRow_D32.cpp')
-rw-r--r-- | src/core/SkBlitRow_D32.cpp | 83 |
1 files changed, 0 insertions, 83 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; -} |