diff options
author | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-19 13:49:50 +0000 |
---|---|---|
committer | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-19 13:49:50 +0000 |
commit | 8dd90a926a8660da2bacc7af149f4ac5b2e7c64c (patch) | |
tree | 98464f9b4f989508f0807355ffc74773a6a3a01a /src/core | |
parent | 26936d071f9e426e11db9a8cf67f5ce86e83feb1 (diff) |
(SSE2) acceleration for rectangular opaque erases.
15% speedup for rectangles < 31 px wide, 5% for larger.
http://codereview.appspot.com/5843050/
git-svn-id: http://skia.googlecode.com/svn/trunk@3423 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBlitRow_D32.cpp | 20 | ||||
-rw-r--r-- | src/core/SkBlitter_ARGB32.cpp | 13 | ||||
-rw-r--r-- | src/core/SkCoreBlitters.h | 1 |
3 files changed, 30 insertions, 4 deletions
diff --git a/src/core/SkBlitRow_D32.cpp b/src/core/SkBlitRow_D32.cpp index 97aa665cb9..f1bf0ca1e1 100644 --- a/src/core/SkBlitRow_D32.cpp +++ b/src/core/SkBlitRow_D32.cpp @@ -12,6 +12,8 @@ #define UNROLL +SkBlitRow::ColorRectProc PlatformColorRectProcFactory(); + static void S32_Opaque_BlitRow32(SkPMColor* SK_RESTRICT dst, const SkPMColor* SK_RESTRICT src, int count, U8CPU alpha) { @@ -178,3 +180,21 @@ void SkBlitRow::Color32(SkPMColor* SK_RESTRICT dst, } } +void SkBlitRow::ColorRect32(SkPMColor* dst, int width, int height, + size_t rowBytes, SkPMColor color) { + SkBlitRow::ColorProc proc = SkBlitRow::ColorProcFactory(); + while (--height >= 0) { + (*proc)(dst, dst, width, color); + dst = (SkPMColor*) ((char*)dst + rowBytes); + } +} + +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 24ab330769..977c961583 100644 --- a/src/core/SkBlitter_ARGB32.cpp +++ b/src/core/SkBlitter_ARGB32.cpp @@ -53,6 +53,7 @@ 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) { @@ -213,10 +214,14 @@ void SkARGB32_Blitter::blitRect(int x, int y, int width, int height) { uint32_t color = fPMColor; size_t rowBytes = fDevice.rowBytes(); - while (--height >= 0) { - fColor32Proc(device, device, width, color); - device = (uint32_t*)((char*)device + 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); + //} + //} } #if defined _WIN32 && _MSC_VER >= 1300 diff --git a/src/core/SkCoreBlitters.h b/src/core/SkCoreBlitters.h index 4947198bcd..4a03a53169 100644 --- a/src/core/SkCoreBlitters.h +++ b/src/core/SkCoreBlitters.h @@ -94,6 +94,7 @@ protected: SkColor fColor; SkPMColor fPMColor; SkBlitRow::ColorProc fColor32Proc; + SkBlitRow::ColorRectProc fColorRect32Proc; private: unsigned fSrcA, fSrcR, fSrcG, fSrcB; |