aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-06 14:57:46 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-06 14:57:46 +0000
commit5b70e7e2df94410e7e3ceeb6e54f4ebe72b87b7d (patch)
treee5de3339e0331046156c6ccdb8824e4c0a45b6d1 /src/core
parent759cf4846804be137229393e04925752423de2d0 (diff)
Manually set fFilterValues in SkConvolutionFilter1D.
Using fFilterValues.reset() or a loop of fFilterValues.push_back() is about 5x slower than calling fFilterValues.resize_back() and then looping using primitive [] and =. This is only going to show up if you apply https://codereview.chromium.org/183763047/, where it yields about 2.5% speedup in the bitmap resize microbenchmarks on a Linux desktop. Ceteris paribus, it should actually improve rasterization time of drawBitmapRectToRect() with a resize by about 5% in Chromium. BUG=skia:2258 R=humper@google.com, tomhudson@google.com Author: tomhudson@chromium.org Review URL: https://codereview.chromium.org/184323003 git-svn-id: http://skia.googlecode.com/svn/trunk@13681 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkConvolver.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/SkConvolver.cpp b/src/core/SkConvolver.cpp
index 7666e6fadc..e26c8e79e6 100644
--- a/src/core/SkConvolver.cpp
+++ b/src/core/SkConvolver.cpp
@@ -294,8 +294,10 @@ void SkConvolutionFilter1D::AddFilter(int filterOffset,
filterLength = lastNonZero + 1 - firstNonZero;
SkASSERT(filterLength > 0);
+ // Calling fFilterValues.reset(), or push_back() in a loop, are expensive.
+ fFilterValues.resize_back(filterLength);
for (int i = firstNonZero; i <= lastNonZero; i++) {
- fFilterValues.push_back(filterValues[i]);
+ fFilterValues[i - firstNonZero] = filterValues[i];
}
} else {
// Here all the factors were zeroes.