aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/SkImageFilter.cpp31
-rwxr-xr-xsrc/effects/SkColorFilterImageFilter.cpp1
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp3
-rw-r--r--src/effects/SkTileImageFilter.cpp31
4 files changed, 12 insertions, 54 deletions
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index f63d1bf13b..7233ec6706 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -32,37 +32,6 @@
enum { kDefaultCacheSize = 128 * 1024 * 1024 };
#endif
-#ifndef SK_IGNORE_TO_STRING
-void SkImageFilter::CropRect::toString(SkString* str) const {
- if (!fFlags) {
- return;
- }
-
- str->appendf("cropRect (");
- if (fFlags & CropRect::kHasLeft_CropEdge) {
- str->appendf("%.2f, ", fRect.fLeft);
- } else {
- str->appendf("X, ");
- }
- if (fFlags & CropRect::kHasTop_CropEdge) {
- str->appendf("%.2f, ", fRect.fTop);
- } else {
- str->appendf("X, ");
- }
- if (fFlags & CropRect::kHasRight_CropEdge) {
- str->appendf("%.2f, ", fRect.fRight);
- } else {
- str->appendf("X, ");
- }
- if (fFlags & CropRect::kHasBottom_CropEdge) {
- str->appendf("%.2f", fRect.fBottom);
- } else {
- str->appendf("X");
- }
- str->appendf(") ");
-}
-#endif
-
static int32_t next_image_filter_unique_id() {
static int32_t gImageFilterUniqueID;
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index d7a5ff848c..2eb720e5c4 100755
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -101,7 +101,6 @@ bool SkColorFilterImageFilter::onIsColorFilterNode(SkColorFilter** filter) const
#ifndef SK_IGNORE_TO_STRING
void SkColorFilterImageFilter::toString(SkString* str) const {
str->appendf("SkColorFilterImageFilter: (");
- this->getCropRect().toString(str);
str->appendf("input: (");
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 0eac80ff8a..d7d92c82b9 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -269,7 +269,7 @@ void SkDisplacementMapEffect::computeFastBounds(const SkRect& src, SkRect* dst)
}
bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
- SkIRect* dst) const {
+ SkIRect* dst) const {
SkIRect bounds = src;
SkVector scale = SkVector::Make(fScale, fScale);
ctm.mapVectors(&scale, 1);
@@ -285,7 +285,6 @@ bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix&
#ifndef SK_IGNORE_TO_STRING
void SkDisplacementMapEffect::toString(SkString* str) const {
str->appendf("SkDisplacementMapEffect: (");
- this->getCropRect().toString(str);
str->appendf("scale: %f ", fScale);
str->appendf("displacement: (");
if (this->getDisplacementInput()) {
diff --git a/src/effects/SkTileImageFilter.cpp b/src/effects/SkTileImageFilter.cpp
index 64e9a43f5a..2b7ed940d2 100644
--- a/src/effects/SkTileImageFilter.cpp
+++ b/src/effects/SkTileImageFilter.cpp
@@ -27,27 +27,19 @@ SkTileImageFilter* SkTileImageFilter::Create(const SkRect& srcRect, const SkRect
bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
const Context& ctx,
SkBitmap* dst, SkIPoint* offset) const {
+ SkBitmap source = src;
+ SkImageFilter* input = getInput(0);
+ SkIPoint srcOffset = SkIPoint::Make(0, 0);
+ if (input && !input->filterImage(proxy, src, ctx, &source, &srcOffset)) {
+ return false;
+ }
SkRect dstRect;
ctx.ctm().mapRect(&dstRect, fDstRect);
const SkIRect dstIRect = dstRect.roundOut();
- if (fSrcRect.isEmpty() || dstIRect.isEmpty()) {
- return false;
- }
-
- // TODO: the actual clip that needs to be applied to the src should be (roughly) determined by:
- // intersect ctx.clip and dstIRect
- // determine if that rect lies wholly inside fSrcRect
- // if so pass it on as the clip
- // if not pass the entire fSrcRect as the clip
- // For now don't apply any clip to the source (since it is usually very small and all of it
- // will be required anyway).
- Context srcCtx(ctx.ctm(), SkIRect::MakeLargest(), ctx.cache());
-
- SkBitmap source = src;
- SkImageFilter* input = this->getInput(0);
- SkIPoint srcOffset = SkIPoint::Make(0, 0);
- if (input && !input->filterImage(proxy, src, srcCtx, &source, &srcOffset)) {
+ int w = dstIRect.width();
+ int h = dstIRect.height();
+ if (!fSrcRect.width() || !fSrcRect.height() || !w || !h) {
return false;
}
@@ -67,7 +59,7 @@ bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
return false;
}
- SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(dstIRect.width(), dstIRect.height()));
+ SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(w, h));
if (NULL == device.get()) {
return false;
}
@@ -124,13 +116,12 @@ void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const {
#ifndef SK_IGNORE_TO_STRING
void SkTileImageFilter::toString(SkString* str) const {
str->appendf("SkTileImageFilter: (");
- this->getCropRect().toString(str);
str->appendf("src: %.2f %.2f %.2f %.2f",
fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBottom);
str->appendf(" dst: %.2f %.2f %.2f %.2f",
fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBottom);
if (this->getInput(0)) {
- str->appendf(" input: (");
+ str->appendf("input: (");
this->getInput(0)->toString(str);
str->appendf(")");
}