aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-12 15:38:00 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-12 15:38:00 +0000
commitf31fa24914c683abcc2c860093b142725c43fbe6 (patch)
tree1a50aa9fc85a19fff6f0ed83f2ebfcb7706cb2e4 /src
parent205ce48c38c55ec7527d26042b5cea689369be8b (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 'src')
-rw-r--r--src/core/SkBitmapProcState_filter.h8
-rw-r--r--src/core/SkBlitMask_D32.cpp3
-rw-r--r--src/core/SkBlitter.cpp5
-rw-r--r--src/opts/SkColor_opts_SSE2.h2
4 files changed, 5 insertions, 13 deletions
diff --git a/src/core/SkBitmapProcState_filter.h b/src/core/SkBitmapProcState_filter.h
index 12606656dd..99f40eca56 100644
--- a/src/core/SkBitmapProcState_filter.h
+++ b/src/core/SkBitmapProcState_filter.h
@@ -26,7 +26,7 @@ static inline void Filter_32_opaque(unsigned x, unsigned y,
SkASSERT((unsigned)y <= 0xF);
int xy = x * y;
- static const uint32_t mask = gMask_00FF00FF; //0xFF00FF;
+ const uint32_t mask = 0xFF00FF;
int scale = 256 - 16*y - 16*x + xy;
uint32_t lo = (a00 & mask) * scale;
@@ -56,7 +56,7 @@ static inline void Filter_32_alpha(unsigned x, unsigned y,
SkASSERT(alphaScale <= 256);
int xy = x * y;
- static const uint32_t mask = gMask_00FF00FF; //0xFF00FF;
+ const uint32_t mask = 0xFF00FF;
int scale = 256 - 16*y - 16*x + xy;
uint32_t lo = (a00 & mask) * scale;
@@ -86,7 +86,7 @@ static inline void Filter_32_opaque(unsigned t,
SkPMColor* dstColor) {
SkASSERT((unsigned)t <= 0xF);
- static const uint32_t mask = gMask_00FF00FF; //0x00FF00FF;
+ const uint32_t mask = 0xFF00FF;
int scale = 256 - 16*t;
uint32_t lo = (color0 & mask) * scale;
@@ -108,7 +108,7 @@ static inline void Filter_32_alpha(unsigned t,
SkASSERT((unsigned)t <= 0xF);
SkASSERT(alphaScale <= 256);
- static const uint32_t mask = gMask_00FF00FF; //0x00FF00FF;
+ const uint32_t mask = 0xFF00FF;
int scale = 256 - 16*t;
uint32_t lo = (color0 & mask) * scale;
diff --git a/src/core/SkBlitMask_D32.cpp b/src/core/SkBlitMask_D32.cpp
index 1f16d775b5..008386caa5 100644
--- a/src/core/SkBlitMask_D32.cpp
+++ b/src/core/SkBlitMask_D32.cpp
@@ -353,9 +353,6 @@ static void A8_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
static void A8_RowProc_Opaque(SkPMColor* SK_RESTRICT dst,
const uint8_t* SK_RESTRICT mask,
const SkPMColor* SK_RESTRICT src, int count) {
-#if 0 // suppress warning
- const uint32_t rbmask = gMask_00FF00FF;
-#endif
for (int i = 0; i < count; ++i) {
int m = mask[i];
if (m) {
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index 81e46c5622..a86881ad37 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -993,11 +993,6 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
///////////////////////////////////////////////////////////////////////////////
-const uint16_t gMask_0F0F = 0xF0F;
-const uint32_t gMask_00FF00FF = 0xFF00FF;
-
-///////////////////////////////////////////////////////////////////////////////
-
class SkTransparentShaderContext : public SkShader::Context {
public:
SkTransparentShaderContext(const SkShader& shader, const SkShader::ContextRec& rec)
diff --git a/src/opts/SkColor_opts_SSE2.h b/src/opts/SkColor_opts_SSE2.h
index b06fe1a76f..7e61d526b3 100644
--- a/src/opts/SkColor_opts_SSE2.h
+++ b/src/opts/SkColor_opts_SSE2.h
@@ -42,7 +42,7 @@ static inline __m128i SkAlphaMulAlpha_SSE2(const __m128i& a,
// Portable version SkAlphaMulQ is in SkColorPriv.h.
static inline __m128i SkAlphaMulQ_SSE2(const __m128i& c, const __m128i& scale) {
- __m128i mask = _mm_set1_epi32(gMask_00FF00FF);
+ __m128i mask = _mm_set1_epi32(0xFF00FF);
__m128i s = _mm_or_si128(_mm_slli_epi32(scale, 16), scale);
// uint32_t rb = ((c & mask) * scale) >> 8