Reverting r9245 due to Chrome breakage

git-svn-id: http://skia.googlecode.com/svn/trunk@9250 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2013-05-22 23:56:49 +00:00
parent be879bcda3
commit f0656c140a
8 changed files with 26 additions and 34 deletions

View File

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

View File

@ -137,11 +137,7 @@ 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 = source;
if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, offset)) {
return false;
}
SkBitmap src = this->getInputResult(0, proxy, source, ctm, offset);
if (src.config() != SkBitmap::kARGB_8888_Config) {
return false;
}

View File

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

View File

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

View File

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

View File

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