aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkSwizzler.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-01-11 06:16:26 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-11 06:16:26 -0800
commit3d00db39c6637607a2a1f184be2f31e4fe17d9ad (patch)
tree5e74d6c753b64b31588c34119185a28f09849949 /src/codec/SkSwizzler.cpp
parent4645e4687d39b87a430e925c2d209dca70250652 (diff)
Might as well inline these premultiplies.
We're paying quite a bit of function-call overhead per pixel. On one test image we spend 3.5% of our total time in swizzle_rgba_to_n32_premul() and 8.8% of our total time in SkPreMultiplyARGB(). That turns into just 8.8% of our total time in swizzle_rgba_to_n32_premul() after inlining. That's about a 30% speedup. This will make SIMD procs look worse, so it's nice to land this first. BUG=skia:4767 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1571923002 Review URL: https://codereview.chromium.org/1571923002
Diffstat (limited to 'src/codec/SkSwizzler.cpp')
-rw-r--r--src/codec/SkSwizzler.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp
index d783380294..aa58120451 100644
--- a/src/codec/SkSwizzler.cpp
+++ b/src/codec/SkSwizzler.cpp
@@ -395,7 +395,7 @@ static SkSwizzler::ResultAlpha swizzle_bgra_to_n32_premul(
for (int x = 0; x < dstWidth; x++) {
uint8_t alpha = src[3];
UPDATE_RESULT_ALPHA(alpha);
- dst[x] = SkPreMultiplyARGB(alpha, src[2], src[1], src[0]);
+ dst[x] = SkPremultiplyARGBInline(alpha, src[2], src[1], src[0]);
src += deltaSrc;
}
return COMPUTE_RESULT_ALPHA;
@@ -440,7 +440,7 @@ static SkSwizzler::ResultAlpha swizzle_rgba_to_n32_premul(
for (int x = 0; x < dstWidth; x++) {
unsigned alpha = src[3];
UPDATE_RESULT_ALPHA(alpha);
- dst[x] = SkPreMultiplyARGB(alpha, src[0], src[1], src[2]);
+ dst[x] = SkPremultiplyARGBInline(alpha, src[0], src[1], src[2]);
src += deltaSrc;
}
return COMPUTE_RESULT_ALPHA;
@@ -473,7 +473,7 @@ static SkSwizzler::ResultAlpha swizzle_rgba_to_n32_premul_skipZ(
unsigned alpha = src[3];
UPDATE_RESULT_ALPHA(alpha);
if (0 != alpha) {
- dst[x] = SkPreMultiplyARGB(alpha, src[0], src[1], src[2]);
+ dst[x] = SkPremultiplyARGBInline(alpha, src[0], src[1], src[2]);
}
src += deltaSrc;
}
@@ -779,7 +779,7 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc,
// Store bpp in bytes if it is an even multiple, otherwise use bits
int srcBPP = SkIsAlign8(BitsPerPixel(sc)) ? BytesPerPixel(sc) : BitsPerPixel(sc);
int dstBPP = SkColorTypeBytesPerPixel(dstInfo.colorType());
-
+
int srcOffset = 0;
int srcWidth = dstInfo.width();
int dstOffset = 0;