Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Unified Diff: src/effects/SkTileImageFilter.cpp

Issue 1217303004: Revert of Revert of Revert of Fix SkTileImageFilter clipping/cropRect interaction issue (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkTileImageFilter.cpp
diff --git a/src/effects/SkTileImageFilter.cpp b/src/effects/SkTileImageFilter.cpp
index 64e9a43f5a81804c070058fe9bc0719ad9e41ca9..2b7ed940d244ae9b333206b922ff6e7501931d77 100644
--- a/src/effects/SkTileImageFilter.cpp
+++ b/src/effects/SkTileImageFilter.cpp
@@ -27,27 +27,19 @@
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 @@
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 @@
#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(")");
}
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698