aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar senorblanco <senorblanco@chromium.org>2016-01-06 09:46:24 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-06 09:46:24 -0800
commitb50b97d70a62d90f5266113c9a5ba6cd1b912edd (patch)
tree79106c2d25862fbf98e8996786e263d154da3dd4 /src
parent5b1dec7cde2fae7b48618407cb4ff5a644ca28d2 (diff)
Optimize SkTileImageFilter destination bitmap size.
The destination bitmap size was not being clipped by the clip bounds, so tiled rendering (ie., clipping to a small region and rendering a SkTileImageFilter with a large dstRect) was much slower than non-tiled rendering. Correctness is covered by unit test ImageFilterDrawTiled, and performance by TileImageFilterBench. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1563873002 Review URL: https://codereview.chromium.org/1563873002
Diffstat (limited to 'src')
-rw-r--r--src/effects/SkTileImageFilter.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/effects/SkTileImageFilter.cpp b/src/effects/SkTileImageFilter.cpp
index 8ef617d520..8d15801387 100644
--- a/src/effects/SkTileImageFilter.cpp
+++ b/src/effects/SkTileImageFilter.cpp
@@ -35,6 +35,12 @@ bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
SkRect dstRect;
ctx.ctm().mapRect(&dstRect, fDstRect);
+#ifndef SK_DISABLE_TILE_IMAGE_FILTER_DEST_OPTIMIZATION
+ if (!dstRect.intersect(SkRect::Make(ctx.clipBounds()))) {
+ offset->fX = offset->fY = 0;
+ return true;
+ }
+#endif
const SkIRect dstIRect = dstRect.roundOut();
int w = dstIRect.width();
int h = dstIRect.height();