Clean up SkImageFilter.
Rename more occurences of 'target' to 'kernelOffset'.
This is a follow-up patch to
https://codereview.chromium.org/182983003/
BUG=skia:2187
R=senorblanco@chromium.org
Author: dominikg@chromium.org
Review URL: https://codereview.chromium.org/197013003
git-svn-id: http://skia.googlecode.com/svn/trunk@13768 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/MatrixConvolutionBench.cpp b/bench/MatrixConvolutionBench.cpp
index 8252973..77910c9 100644
--- a/bench/MatrixConvolutionBench.cpp
+++ b/bench/MatrixConvolutionBench.cpp
@@ -22,8 +22,8 @@
SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
};
SkScalar gain = 0.3f, bias = SkIntToScalar(100);
- SkIPoint target = SkIPoint::Make(1, 1);
- fFilter = SkMatrixConvolutionImageFilter::Create(kernelSize, kernel, gain, bias, target, tileMode, convolveAlpha);
+ SkIPoint kernelOffset = SkIPoint::Make(1, 1);
+ fFilter = SkMatrixConvolutionImageFilter::Create(kernelSize, kernel, gain, bias, kernelOffset, tileMode, convolveAlpha);
}
~MatrixConvolutionBench() {
diff --git a/gm/matrixconvolution.cpp b/gm/matrixconvolution.cpp
index 5976a40..c37f7ad 100644
--- a/gm/matrixconvolution.cpp
+++ b/gm/matrixconvolution.cpp
@@ -45,7 +45,7 @@
return make_isize(500, 300);
}
- void draw(SkCanvas* canvas, int x, int y, const SkIPoint& target,
+ void draw(SkCanvas* canvas, int x, int y, const SkIPoint& kernelOffset,
SkMatrixConvolutionImageFilter::TileMode tileMode, bool convolveAlpha,
const SkImageFilter::CropRect* cropRect = NULL) {
SkScalar kernel[9] = {
@@ -61,7 +61,7 @@
kernel,
gain,
bias,
- target,
+ kernelOffset,
tileMode,
convolveAlpha,
NULL,
@@ -83,22 +83,22 @@
fInitialized = true;
}
canvas->clear(0x00000000);
- SkIPoint target = SkIPoint::Make(1, 0);
+ SkIPoint kernelOffset = SkIPoint::Make(1, 0);
for (int x = 10; x < 310; x += 100) {
- this->draw(canvas, x, 10, target, MCIF::kClamp_TileMode, true);
- this->draw(canvas, x, 110, target, MCIF::kClampToBlack_TileMode, true);
- this->draw(canvas, x, 210, target, MCIF::kRepeat_TileMode, true);
- target.fY++;
+ this->draw(canvas, x, 10, kernelOffset, MCIF::kClamp_TileMode, true);
+ this->draw(canvas, x, 110, kernelOffset, MCIF::kClampToBlack_TileMode, true);
+ this->draw(canvas, x, 210, kernelOffset, MCIF::kRepeat_TileMode, true);
+ kernelOffset.fY++;
}
- target.fY = 1;
+ kernelOffset.fY = 1;
SkImageFilter::CropRect rect(SkRect::MakeXYWH(10, 5, 60, 60));
- this->draw(canvas, 310, 10, target, MCIF::kClamp_TileMode, true, &rect);
- this->draw(canvas, 310, 110, target, MCIF::kClampToBlack_TileMode, true, &rect);
- this->draw(canvas, 310, 210, target, MCIF::kRepeat_TileMode, true, &rect);
+ this->draw(canvas, 310, 10, kernelOffset, MCIF::kClamp_TileMode, true, &rect);
+ this->draw(canvas, 310, 110, kernelOffset, MCIF::kClampToBlack_TileMode, true, &rect);
+ this->draw(canvas, 310, 210, kernelOffset, MCIF::kRepeat_TileMode, true, &rect);
- this->draw(canvas, 410, 10, target, MCIF::kClamp_TileMode, false);
- this->draw(canvas, 410, 110, target, MCIF::kClampToBlack_TileMode, false);
- this->draw(canvas, 410, 210, target, MCIF::kRepeat_TileMode, false);
+ this->draw(canvas, 410, 10, kernelOffset, MCIF::kClamp_TileMode, false);
+ this->draw(canvas, 410, 110, kernelOffset, MCIF::kClampToBlack_TileMode, false);
+ this->draw(canvas, 410, 210, kernelOffset, MCIF::kRepeat_TileMode, false);
}
private:
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 9e4ad63..679764a 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -412,7 +412,7 @@
UniformHandle fBoundsUni;
UniformHandle fKernelUni;
UniformHandle fImageIncrementUni;
- UniformHandle fTargetUni;
+ UniformHandle fKernelOffsetUni;
UniformHandle fGainUni;
UniformHandle fBiasUni;
@@ -467,15 +467,15 @@
kFloat_GrSLType,
"Kernel",
fKernelSize.width() * fKernelSize.height());
- fTargetUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
- kVec2f_GrSLType, "Target");
+ fKernelOffsetUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
+ kVec2f_GrSLType, "KernelOffset");
fGainUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
kFloat_GrSLType, "Gain");
fBiasUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
kFloat_GrSLType, "Bias");
const char* bounds = builder->getUniformCStr(fBoundsUni);
- const char* kernelOffset = builder->getUniformCStr(fTargetUni);
+ const char* kernelOffset = builder->getUniformCStr(fKernelOffsetUni);
const char* imgInc = builder->getUniformCStr(fImageIncrementUni);
const char* kernel = builder->getUniformCStr(fKernelUni);
const char* gain = builder->getUniformCStr(fGainUni);
@@ -545,7 +545,7 @@
imageIncrement[0] = 1.0f / texture.width();
imageIncrement[1] = ySign / texture.height();
uman.set2fv(fImageIncrementUni, 1, imageIncrement);
- uman.set2fv(fTargetUni, 1, conv.kernelOffset());
+ uman.set2fv(fKernelOffsetUni, 1, conv.kernelOffset());
uman.set1fv(fKernelUni, fKernelSize.width() * fKernelSize.height(), conv.kernel());
uman.set1f(fGainUni, conv.gain());
uman.set1f(fBiasUni, conv.bias());