Remove SkImageFilter::getInputResult(), since its return value is not

style-compliant, and doesn't allow us to abort on failure.

R=reed@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@9245 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
senorblanco@chromium.org 2013-05-22 18:59:58 +00:00
parent 88c9ec968f
commit be1d02e528
8 changed files with 34 additions and 26 deletions

View File

@ -159,11 +159,6 @@ protected:
// Default impl copies src into dst and returns true
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*);
// Return the result of processing the given input, or the source bitmap
// if we have no connected input at that index.
SkBitmap getInputResult(int index, Proxy*, const SkBitmap& src, const SkMatrix&,
SkIPoint*);
private:
typedef SkFlattenable INHERITED;
int fInputCount;

View File

@ -69,20 +69,6 @@ void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
}
}
SkBitmap SkImageFilter::getInputResult(int index, Proxy* proxy,
const SkBitmap& src, const SkMatrix& ctm,
SkIPoint* loc) {
SkASSERT(index < fInputCount);
SkImageFilter* input = getInput(index);
SkBitmap result;
if (input && input->filterImage(proxy, src, ctm, &result, loc)) {
return result;
} else {
return src;
}
}
bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* result, SkIPoint* loc) {

View File

@ -81,7 +81,11 @@ bool SkBicubicImageFilter::onFilterImage(Proxy* proxy,
const SkMatrix& matrix,
SkBitmap* result,
SkIPoint* loc) {
SkBitmap src = this->getInputResult(0, proxy, source, matrix, loc);
SkBitmap src = source;
if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, loc)) {
return false;
}
if (src.config() != SkBitmap::kARGB_8888_Config) {
return false;
}

View File

@ -137,7 +137,11 @@ static void getBox3Params(SkScalar s, int *kernelSize, int* kernelSize3, int *lo
bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source, const SkMatrix& ctm,
SkBitmap* dst, SkIPoint* offset) {
SkBitmap src = this->getInputResult(0, proxy, source, ctm, offset);
SkBitmap src = source;
if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, offset)) {
return false;
}
if (src.config() != SkBitmap::kARGB_8888_Config) {
return false;
}

View File

@ -98,7 +98,11 @@ bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& sourc
const SkMatrix& matrix,
SkBitmap* result,
SkIPoint* loc) {
SkBitmap src = this->getInputResult(0, proxy, source, matrix, loc);
SkBitmap src = source;
if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, loc)) {
return false;
}
SkAutoTUnref<SkDevice> device(proxy->createDevice(src.width(), src.height()));
SkCanvas canvas(device.get());
SkPaint paint;

View File

@ -203,7 +203,11 @@ bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy,
const SkMatrix& matrix,
SkBitmap* result,
SkIPoint* loc) {
SkBitmap src = this->getInputResult(0, proxy, source, matrix, loc);
SkBitmap src = source;
if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, loc)) {
return false;
}
if (src.config() != SkBitmap::kARGB_8888_Config) {
return false;
}

View File

@ -136,7 +136,11 @@ static void dilateY(const SkBitmap& src, SkBitmap* dst, int radiusY)
bool SkErodeImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source, const SkMatrix& ctm,
SkBitmap* dst, SkIPoint* offset) {
SkBitmap src = this->getInputResult(0, proxy, source, ctm, offset);
SkBitmap src = source;
if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, offset)) {
return false;
}
if (src.config() != SkBitmap::kARGB_8888_Config) {
return false;
}
@ -181,7 +185,10 @@ bool SkErodeImageFilter::onFilterImage(Proxy* proxy,
bool SkDilateImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source, const SkMatrix& ctm,
SkBitmap* dst, SkIPoint* offset) {
SkBitmap src = this->getInputResult(0, proxy, source, ctm, offset);
SkBitmap src = source;
if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, offset)) {
return false;
}
if (src.config() != SkBitmap::kARGB_8888_Config) {
return false;
}

View File

@ -14,7 +14,11 @@ bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source,
const SkMatrix& matrix,
SkBitmap* result,
SkIPoint* loc) {
SkBitmap src = this->getInputResult(0, proxy, source, matrix, loc);
SkBitmap src = source;
if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, loc)) {
return false;
}
SkVector vec;
matrix.mapVectors(&vec, &fOffset, 1);