diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2010-12-16 19:07:45 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2010-12-16 19:07:45 +0000 |
commit | 29e5054dd07c97c2195c5f64bf67aaa6b5afa204 (patch) | |
tree | bdd024a5cce23ce7f26151fe09b6e4a0d5f8ede4 /src/core/SkBlitRow_D32.cpp | |
parent | 31e623003472d98d8623b72b8535220c400c4058 (diff) |
Fix perf regression in Color32.
The regression was due to the fact that we were calling PlatformColorProc() for
every span (which in turns makes CPUID, a fairly expensive call). Since we draw
a lot of rects, and rects have 1-pixel wide spans for the vertical segments,
that's a lot of CPUID.
Fixed by cacheing the result of PlatformColorProc(), as is done for the other
platform-specific blitters.
Review URL: http://codereview.appspot.com/3669042/
git-svn-id: http://skia.googlecode.com/svn/trunk@636 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkBlitRow_D32.cpp')
-rw-r--r-- | src/core/SkBlitRow_D32.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/core/SkBlitRow_D32.cpp b/src/core/SkBlitRow_D32.cpp index 1f154a486a..f1dcb309a1 100644 --- a/src/core/SkBlitRow_D32.cpp +++ b/src/core/SkBlitRow_D32.cpp @@ -86,18 +86,17 @@ SkBlitRow::Proc32 SkBlitRow::Factory32(unsigned flags) { return proc; } -void SkBlitRow::Color32(SkPMColor dst[], const SkPMColor src[], int count, - SkPMColor color) { +SkBlitRow::Proc32 SkBlitRow::ColorProcFactory() { SkBlitRow::ColorProc proc = PlatformColorProc(); if (NULL == proc) { - Color32_BlitRow32(dst, src, count, color); - return; + proc = Color32; } - proc(dst, src, count, color); + SkASSERT(proc); + return proc; } -void SkBlitRow::Color32_BlitRow32(SkPMColor dst[], const SkPMColor src[], - int count, SkPMColor color) { +void SkBlitRow::Color32(SkPMColor dst[], const SkPMColor src[], + int count, SkPMColor color) { if (count > 0) { if (0 == color) { if (src != dst) { |