aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-05 20:31:17 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-05 20:31:17 +0000
commitfed04b34315ed72dbb20e630908638d1c829c760 (patch)
tree1a306b22dbe4f62c6de3ee441cde4f374b3af979 /src/core
parentbca421b468f53a591333918248f54bbd958389d2 (diff)
remove fConvolutionProcs from State, and just use it locally
BUG= R=humper@google.com Review URL: https://codereview.chromium.org/23796005 git-svn-id: http://skia.googlecode.com/svn/trunk@11118 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkBitmapProcState.cpp12
-rw-r--r--src/core/SkBitmapProcState.h4
-rw-r--r--src/core/SkBitmapScaler.cpp16
-rw-r--r--src/core/SkBitmapScaler.h4
-rw-r--r--src/core/SkConvolver.cpp18
-rw-r--r--src/core/SkConvolver.h2
6 files changed, 24 insertions, 32 deletions
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 821d383e15..353248f627 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -124,15 +124,9 @@ void SkBitmapProcState::possiblyScaleImage() {
// recompiles a lot less painful.
SkConvolutionProcs simd;
- fConvolutionProcs = &simd;
+ sk_bzero(&simd, sizeof(simd));
- fConvolutionProcs->fExtraHorizontalReads = 0;
- fConvolutionProcs->fConvolveVertically = NULL;
- fConvolutionProcs->fConvolve4RowsHorizontally = NULL;
- fConvolutionProcs->fConvolveHorizontally = NULL;
- fConvolutionProcs->fApplySIMDPadding = NULL;
-
- this->platformConvolutionProcs();
+ this->platformConvolutionProcs(&simd);
// STEP 1: Highest quality direct scale?
@@ -162,7 +156,7 @@ void SkBitmapProcState::possiblyScaleImage() {
SkBitmapScaler::RESIZE_BEST,
dest_width,
dest_height,
- fConvolutionProcs)) {
+ simd)) {
// we failed to create fScaledBitmap, so just return and let
// the scanline proc handle it.
return;
diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h
index 3a1d7bad62..2522a69e7f 100644
--- a/src/core/SkBitmapProcState.h
+++ b/src/core/SkBitmapProcState.h
@@ -79,8 +79,6 @@ struct SkBitmapProcState {
SkFixed fFilterOneX;
SkFixed fFilterOneY;
- SkConvolutionProcs* fConvolutionProcs; // possiblyScaleImage
-
SkPMColor fPaintPMColor; // chooseProcs - A8 config
SkFixed fInvSx; // chooseProcs
SkFixed fInvKy; // chooseProcs
@@ -115,7 +113,7 @@ struct SkBitmapProcState {
if we have SIMD versions of them.
*/
- void platformConvolutionProcs();
+ void platformConvolutionProcs(SkConvolutionProcs*);
/** Given the byte size of the index buffer to be passed to the matrix proc,
return the maximum number of resulting pixels that can be computed
diff --git a/src/core/SkBitmapScaler.cpp b/src/core/SkBitmapScaler.cpp
index 807696277e..114836dd79 100644
--- a/src/core/SkBitmapScaler.cpp
+++ b/src/core/SkBitmapScaler.cpp
@@ -15,7 +15,7 @@ public:
int srcFullWidth, int srcFullHeight,
int destWidth, int destHeight,
const SkIRect& destSubset,
- SkConvolutionProcs* convolveProcs);
+ const SkConvolutionProcs& convolveProcs);
~SkResizeFilter() {
SkDELETE( fBitmapFilter );
}
@@ -43,7 +43,7 @@ private:
int destSubsetLo, int destSubsetSize,
float scale,
SkConvolutionFilter1D* output,
- SkConvolutionProcs* convolveProcs);
+ const SkConvolutionProcs& convolveProcs);
SkConvolutionFilter1D fXFilter;
SkConvolutionFilter1D fYFilter;
@@ -53,7 +53,7 @@ SkResizeFilter::SkResizeFilter(SkBitmapScaler::ResizeMethod method,
int srcFullWidth, int srcFullHeight,
int destWidth, int destHeight,
const SkIRect& destSubset,
- SkConvolutionProcs* convolveProcs) {
+ const SkConvolutionProcs& convolveProcs) {
// method will only ever refer to an "algorithm method".
SkASSERT((SkBitmapScaler::RESIZE_FIRST_ALGORITHM_METHOD <= method) &&
@@ -108,7 +108,7 @@ void SkResizeFilter::computeFilters(int srcSize,
int destSubsetLo, int destSubsetSize,
float scale,
SkConvolutionFilter1D* output,
- SkConvolutionProcs* convolveProcs) {
+ const SkConvolutionProcs& convolveProcs) {
int destSubsetHi = destSubsetLo + destSubsetSize; // [lo, hi)
// When we're doing a magnification, the scale will be larger than one. This
@@ -197,8 +197,8 @@ void SkResizeFilter::computeFilters(int srcSize,
static_cast<int>(fixedFilterValues.count()));
}
- if (convolveProcs->fApplySIMDPadding) {
- convolveProcs->fApplySIMDPadding( output );
+ if (convolveProcs.fApplySIMDPadding) {
+ convolveProcs.fApplySIMDPadding( output );
}
}
@@ -238,7 +238,7 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr,
ResizeMethod method,
int destWidth, int destHeight,
const SkIRect& destSubset,
- SkConvolutionProcs* convolveProcs,
+ const SkConvolutionProcs& convolveProcs,
SkBitmap::Allocator* allocator) {
// Ensure that the ResizeMethod enumeration is sound.
SkASSERT(((RESIZE_FIRST_QUALITY_METHOD <= method) &&
@@ -310,7 +310,7 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr,
const SkBitmap& source,
ResizeMethod method,
int destWidth, int destHeight,
- SkConvolutionProcs* convolveProcs,
+ const SkConvolutionProcs& convolveProcs,
SkBitmap::Allocator* allocator) {
SkIRect destSubset = { 0, 0, destWidth, destHeight };
return Resize(resultPtr, source, method, destWidth, destHeight, destSubset,
diff --git a/src/core/SkBitmapScaler.h b/src/core/SkBitmapScaler.h
index b88fb9e775..c8d8a84185 100644
--- a/src/core/SkBitmapScaler.h
+++ b/src/core/SkBitmapScaler.h
@@ -92,7 +92,7 @@ public:
ResizeMethod method,
int dest_width, int dest_height,
const SkIRect& dest_subset,
- SkConvolutionProcs *convolveProcs = NULL,
+ const SkConvolutionProcs&,
SkBitmap::Allocator* allocator = NULL);
// Alternate version for resizing and returning the entire bitmap rather than
@@ -101,7 +101,7 @@ public:
const SkBitmap& source,
ResizeMethod method,
int dest_width, int dest_height,
- SkConvolutionProcs *convolveProcs = NULL,
+ const SkConvolutionProcs&,
SkBitmap::Allocator* allocator = NULL);
};
diff --git a/src/core/SkConvolver.cpp b/src/core/SkConvolver.cpp
index f426ef00d1..7666e6fadc 100644
--- a/src/core/SkConvolver.cpp
+++ b/src/core/SkConvolver.cpp
@@ -337,7 +337,7 @@ void BGRAConvolve2D(const unsigned char* sourceData,
const SkConvolutionFilter1D& filterY,
int outputByteRowStride,
unsigned char* output,
- SkConvolutionProcs* convolveProcs,
+ const SkConvolutionProcs& convolveProcs,
bool useSimdIfPossible) {
int maxYFilterSize = filterY.maxFilter();
@@ -364,7 +364,7 @@ void BGRAConvolve2D(const unsigned char* sourceData,
// convolution pass yet. Somehow Windows does not like it.
int rowBufferWidth = (filterX.numValues() + 15) & ~0xF;
int rowBufferHeight = maxYFilterSize +
- (convolveProcs->fConvolve4RowsHorizontally ? 4 : 0);
+ (convolveProcs.fConvolve4RowsHorizontally ? 4 : 0);
CircularRowBuffer rowBuffer(rowBufferWidth,
rowBufferHeight,
filterOffset);
@@ -387,7 +387,7 @@ void BGRAConvolve2D(const unsigned char* sourceData,
// rows we need to avoid the SSE implementation for here.
filterX.FilterForValue(filterX.numValues() - 1, &lastFilterOffset,
&lastFilterLength);
- int avoidSimdRows = 1 + convolveProcs->fExtraHorizontalReads /
+ int avoidSimdRows = 1 + convolveProcs.fExtraHorizontalReads /
(lastFilterOffset + lastFilterLength);
filterY.FilterForValue(numOutputRows - 1, &lastFilterOffset,
@@ -399,7 +399,7 @@ void BGRAConvolve2D(const unsigned char* sourceData,
// Generate output rows until we have enough to run the current filter.
while (nextXRow < filterOffset + filterLength) {
- if (convolveProcs->fConvolve4RowsHorizontally &&
+ if (convolveProcs.fConvolve4RowsHorizontally &&
nextXRow + 3 < lastFilterOffset + lastFilterLength -
avoidSimdRows) {
const unsigned char* src[4];
@@ -408,14 +408,14 @@ void BGRAConvolve2D(const unsigned char* sourceData,
src[i] = &sourceData[(nextXRow + i) * sourceByteRowStride];
outRow[i] = rowBuffer.advanceRow();
}
- convolveProcs->fConvolve4RowsHorizontally(src, filterX, outRow);
+ convolveProcs.fConvolve4RowsHorizontally(src, filterX, outRow);
nextXRow += 4;
} else {
// Check if we need to avoid SSE2 for this row.
- if (convolveProcs->fConvolveHorizontally &&
+ if (convolveProcs.fConvolveHorizontally &&
nextXRow < lastFilterOffset + lastFilterLength -
avoidSimdRows) {
- convolveProcs->fConvolveHorizontally(
+ convolveProcs.fConvolveHorizontally(
&sourceData[nextXRow * sourceByteRowStride],
filterX, rowBuffer.advanceRow(), sourceHasAlpha);
} else {
@@ -446,8 +446,8 @@ void BGRAConvolve2D(const unsigned char* sourceData,
unsigned char* const* firstRowForFilter =
&rowsToConvolve[filterOffset - firstRowInCircularBuffer];
- if (convolveProcs->fConvolveVertically) {
- convolveProcs->fConvolveVertically(filterValues, filterLength,
+ if (convolveProcs.fConvolveVertically) {
+ convolveProcs.fConvolveVertically(filterValues, filterLength,
firstRowForFilter,
filterX.numValues(), curOutputRow,
sourceHasAlpha);
diff --git a/src/core/SkConvolver.h b/src/core/SkConvolver.h
index 4327afaf18..94a5e91598 100644
--- a/src/core/SkConvolver.h
+++ b/src/core/SkConvolver.h
@@ -197,7 +197,7 @@ SK_API void BGRAConvolve2D(const unsigned char* sourceData,
const SkConvolutionFilter1D& yfilter,
int outputByteRowStride,
unsigned char* output,
- SkConvolutionProcs* convolveProcs,
+ const SkConvolutionProcs&,
bool useSimdIfPossible);
#endif // SK_CONVOLVER_H