OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkTileImageFilter.h" | 8 #include "SkTileImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 const Context& ctx, | 28 const Context& ctx, |
29 SkBitmap* dst, SkIPoint* offset) const { | 29 SkBitmap* dst, SkIPoint* offset) const { |
30 SkBitmap source = src; | 30 SkBitmap source = src; |
31 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 31 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
32 if (!this->filterInput(0, proxy, src, ctx, &source, &srcOffset)) { | 32 if (!this->filterInput(0, proxy, src, ctx, &source, &srcOffset)) { |
33 return false; | 33 return false; |
34 } | 34 } |
35 | 35 |
36 SkRect dstRect; | 36 SkRect dstRect; |
37 ctx.ctm().mapRect(&dstRect, fDstRect); | 37 ctx.ctm().mapRect(&dstRect, fDstRect); |
| 38 #ifndef SK_DISABLE_TILE_IMAGE_FILTER_DEST_OPTIMIZATION |
| 39 if (!dstRect.intersect(SkRect::Make(ctx.clipBounds()))) { |
| 40 offset->fX = offset->fY = 0; |
| 41 return true; |
| 42 } |
| 43 #endif |
38 const SkIRect dstIRect = dstRect.roundOut(); | 44 const SkIRect dstIRect = dstRect.roundOut(); |
39 int w = dstIRect.width(); | 45 int w = dstIRect.width(); |
40 int h = dstIRect.height(); | 46 int h = dstIRect.height(); |
41 if (!fSrcRect.width() || !fSrcRect.height() || !w || !h) { | 47 if (!fSrcRect.width() || !fSrcRect.height() || !w || !h) { |
42 return false; | 48 return false; |
43 } | 49 } |
44 | 50 |
45 SkRect srcRect; | 51 SkRect srcRect; |
46 ctx.ctm().mapRect(&srcRect, fSrcRect); | 52 ctx.ctm().mapRect(&srcRect, fSrcRect); |
47 SkIRect srcIRect; | 53 SkIRect srcIRect; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 str->appendf(" dst: %.2f %.2f %.2f %.2f", | 135 str->appendf(" dst: %.2f %.2f %.2f %.2f", |
130 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); | 136 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); |
131 if (this->getInput(0)) { | 137 if (this->getInput(0)) { |
132 str->appendf("input: ("); | 138 str->appendf("input: ("); |
133 this->getInput(0)->toString(str); | 139 this->getInput(0)->toString(str); |
134 str->appendf(")"); | 140 str->appendf(")"); |
135 } | 141 } |
136 str->append(")"); | 142 str->append(")"); |
137 } | 143 } |
138 #endif | 144 #endif |
OLD | NEW |