Avoid recomputing two consecutive identical 1D filters.

If the arguments to the X and Y filter computation are identical,
the results will be identical; copying is much faster than recomputing.

With a change like https://codereview.chromium.org/183763047/ applied
this speeds up BitmapScaleBench on Linux by around 10%.

BUG=skia:2236
R=humper@google.com, tomhudson@google.com

Author: tomhudson@chromium.org

Review URL: https://codereview.chromium.org/188743002

git-svn-id: http://skia.googlecode.com/svn/trunk@13687 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-03-06 19:10:44 +00:00
parent 0015df93b3
commit d10913b8a9

View File

@ -89,8 +89,15 @@ SkResizeFilter::SkResizeFilter(SkBitmapScaler::ResizeMethod method,
this->computeFilters(srcFullWidth, destSubset.fLeft, destSubset.width(),
scaleX, &fXFilter, convolveProcs);
this->computeFilters(srcFullHeight, destSubset.fTop, destSubset.height(),
scaleY, &fYFilter, convolveProcs);
if (srcFullWidth == srcFullHeight &&
destSubset.fLeft == destSubset.fTop &&
destSubset.width() == destSubset.height()&&
scaleX == scaleY) {
fYFilter = fXFilter;
} else {
this->computeFilters(srcFullHeight, destSubset.fTop, destSubset.height(),
scaleY, &fYFilter, convolveProcs);
}
}
// TODO(egouriou): Take advantage of periods in the convolution.