aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkDropShadowImageFilter.cpp37
-rw-r--r--src/effects/SkTransparentShader.cpp3
2 files changed, 10 insertions, 30 deletions
diff --git a/src/effects/SkDropShadowImageFilter.cpp b/src/effects/SkDropShadowImageFilter.cpp
index 5be633ea54..b4d8689f33 100644
--- a/src/effects/SkDropShadowImageFilter.cpp
+++ b/src/effects/SkDropShadowImageFilter.cpp
@@ -15,21 +15,10 @@
#include "SkFlattenableBuffers.h"
SkDropShadowImageFilter::SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigma, SkColor color, SkImageFilter* input)
- : INHERITED(input)
+ : SkImageFilter(input)
, fDx(dx)
, fDy(dy)
- , fSigmaX(sigma)
- , fSigmaY(sigma)
- , fColor(color)
-{
-}
-
-SkDropShadowImageFilter::SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor color, SkImageFilter* input, const CropRect* cropRect)
- : INHERITED(input, cropRect)
- , fDx(dx)
- , fDy(dy)
- , fSigmaX(sigmaX)
- , fSigmaY(sigmaY)
+ , fSigma(sigma)
, fColor(color)
{
}
@@ -38,13 +27,11 @@ SkDropShadowImageFilter::SkDropShadowImageFilter(SkFlattenableReadBuffer& buffer
: INHERITED(1, buffer) {
fDx = buffer.readScalar();
fDy = buffer.readScalar();
- fSigmaX = buffer.readScalar();
- fSigmaY = buffer.readScalar();
+ fSigma = buffer.readScalar();
fColor = buffer.readColor();
buffer.validate(SkScalarIsFinite(fDx) &&
SkScalarIsFinite(fDy) &&
- SkScalarIsFinite(fSigmaX) &&
- SkScalarIsFinite(fSigmaY));
+ SkScalarIsFinite(fSigma));
}
void SkDropShadowImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const
@@ -52,8 +39,7 @@ void SkDropShadowImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const
this->INHERITED::flatten(buffer);
buffer.writeScalar(fDx);
buffer.writeScalar(fDy);
- buffer.writeScalar(fSigmaX);
- buffer.writeScalar(fSigmaY);
+ buffer.writeScalar(fSigma);
buffer.writeColor(fColor);
}
@@ -63,26 +49,17 @@ bool SkDropShadowImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source
if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, loc))
return false;
- SkIRect bounds;
- src.getBounds(&bounds);
- if (!this->applyCropRect(&bounds, matrix)) {
- return false;
- }
-
- SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
+ SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(src.width(), src.height()));
SkCanvas canvas(device.get());
- SkAutoTUnref<SkImageFilter> blurFilter(new SkBlurImageFilter(fSigmaX, fSigmaY));
+ SkAutoTUnref<SkImageFilter> blurFilter(new SkBlurImageFilter(fSigma, fSigma));
SkAutoTUnref<SkColorFilter> colorFilter(SkColorFilter::CreateModeFilter(fColor, SkXfermode::kSrcIn_Mode));
SkPaint paint;
paint.setImageFilter(blurFilter.get());
paint.setColorFilter(colorFilter.get());
paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
- canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop));
canvas.drawBitmap(src, fDx, fDy, &paint);
canvas.drawBitmap(src, 0, 0);
*result = device->accessBitmap(false);
- loc->fX += bounds.fLeft;
- loc->fY += bounds.fTop;
return true;
}
diff --git a/src/effects/SkTransparentShader.cpp b/src/effects/SkTransparentShader.cpp
index 1d7e80877e..970e74faa8 100644
--- a/src/effects/SkTransparentShader.cpp
+++ b/src/effects/SkTransparentShader.cpp
@@ -94,6 +94,9 @@ void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) {
}
break;
}
+ case SkBitmap::kA1_Config:
+ SkDEBUGFAIL("kA1_Config umimplemented at this time");
+ break;
default: // to avoid warnings
break;
}