diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-12 15:38:00 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-12 15:38:00 +0000 |
commit | f31fa24914c683abcc2c860093b142725c43fbe6 (patch) | |
tree | 1a50aa9fc85a19fff6f0ed83f2ebfcb7706cb2e4 /include/core/SkColorPriv.h | |
parent | 205ce48c38c55ec7527d26042b5cea689369be8b (diff) |
Make gMask_00FF00FF a constant
This is to optimize SkAlphaMulQ() in PIC mode. With the visibility=default
symbol the constant is not known at compile time (and is not a constant), but
instead is fetched through a double indirection through GOT. The function is
quite hot on one of the chromium benchmarks:
rasterize_and_record_micro.key_silk_cases.
This change replaces the symbol with a compile-time constant. As a bonus the
variable is not exported from the dynamic library, i. e. a cleaner library
interface.
See specific performance improvements on Android here:
http://goo.gl/iMuTDt
R=skyostil@chromium.org, tomhudson@chromium.org, mtklein@google.com, reed@google.com, tomhudson@google.com
Author: pasko@chromium.org
Review URL: https://codereview.chromium.org/270473003
git-svn-id: http://skia.googlecode.com/svn/trunk@14696 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkColorPriv.h')
-rw-r--r-- | include/core/SkColorPriv.h | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/include/core/SkColorPriv.h b/include/core/SkColorPriv.h index d5571dfea9..8fd1e57fa7 100644 --- a/include/core/SkColorPriv.h +++ b/include/core/SkColorPriv.h @@ -524,10 +524,8 @@ SkPMColor SkPremultiplyARGBInline(U8CPU a, U8CPU r, U8CPU g, U8CPU b) { return SkPackARGB32(a, r, g, b); } -SK_API extern const uint32_t gMask_00FF00FF; - static inline uint32_t SkAlphaMulQ(uint32_t c, unsigned scale) { - uint32_t mask = gMask_00FF00FF; + uint32_t mask = 0xFF00FF; uint32_t rb = ((c & mask) * scale) >> 8; uint32_t ag = ((c >> 8) & mask) * scale; @@ -787,8 +785,6 @@ static inline SkPMColor16 SkPackARGB4444(unsigned a, unsigned r, (g << SK_G4444_SHIFT) | (b << SK_B4444_SHIFT)); } -extern const uint16_t gMask_0F0F; - static inline U16CPU SkAlphaMulQ4(U16CPU c, unsigned scale) { SkASSERT(scale <= 16); |