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:
parent
0015df93b3
commit
d10913b8a9
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user