Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: src/core/SkConvolver.cpp

Issue 1563183003: Refactor resize filter to go faster (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make mitchell filter locals conform to skia style Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkConvolver.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkConvolver.cpp
diff --git a/src/core/SkConvolver.cpp b/src/core/SkConvolver.cpp
index 28d3ab139ce1d54bc2e9542d5d03be84b703aad0..c662e2ddaf0db82e0e40b5dd1c5c86ed4dd39206 100644
--- a/src/core/SkConvolver.cpp
+++ b/src/core/SkConvolver.cpp
@@ -3,9 +3,7 @@
// found in the LICENSE file.
#include "SkConvolver.h"
-#include "SkMath.h"
-#include "SkSize.h"
-#include "SkTypes.h"
+#include "SkTArray.h"
namespace {
@@ -285,21 +283,6 @@ SkConvolutionFilter1D::~SkConvolutionFilter1D() {
}
void SkConvolutionFilter1D::AddFilter(int filterOffset,
- const float* filterValues,
- int filterLength) {
- SkASSERT(filterLength > 0);
-
- SkTArray<ConvolutionFixed> fixedValues;
- fixedValues.reset(filterLength);
-
- for (int i = 0; i < filterLength; ++i) {
- fixedValues.push_back(FloatToFixed(filterValues[i]));
- }
-
- AddFilter(filterOffset, &fixedValues[0], filterLength);
-}
-
-void SkConvolutionFilter1D::AddFilter(int filterOffset,
const ConvolutionFixed* filterValues,
int filterLength) {
// It is common for leading/trailing filter values to be zeros. In such
@@ -323,9 +306,7 @@ void SkConvolutionFilter1D::AddFilter(int filterOffset,
filterLength = lastNonZero + 1 - firstNonZero;
SkASSERT(filterLength > 0);
- for (int i = firstNonZero; i <= lastNonZero; i++) {
- fFilterValues.push_back(filterValues[i]);
- }
+ fFilterValues.append(filterLength, &filterValues[firstNonZero]);
} else {
// Here all the factors were zeroes.
filterLength = 0;
@@ -339,7 +320,7 @@ void SkConvolutionFilter1D::AddFilter(int filterOffset,
instance.fOffset = filterOffset;
instance.fTrimmedLength = filterLength;
instance.fLength = filterSize;
- fFilters.push_back(instance);
+ fFilters.push(instance);
fMaxFilter = SkTMax(fMaxFilter, filterLength);
}
« no previous file with comments | « src/core/SkConvolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698