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 18 matching lines...) Expand all Loading... |
29 SkBitmap* dst, SkIPoint* offset) const { | 29 SkBitmap* dst, SkIPoint* offset) const { |
30 SkBitmap source = src; | 30 SkBitmap source = src; |
31 SkImageFilter* input = getInput(0); | 31 SkImageFilter* input = getInput(0); |
32 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 32 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
33 if (input && !input->filterImage(proxy, src, ctx, &source, &srcOffset)) { | 33 if (input && !input->filterImage(proxy, src, ctx, &source, &srcOffset)) { |
34 return false; | 34 return false; |
35 } | 35 } |
36 | 36 |
37 SkRect dstRect; | 37 SkRect dstRect; |
38 ctx.ctm().mapRect(&dstRect, fDstRect); | 38 ctx.ctm().mapRect(&dstRect, fDstRect); |
39 SkIRect dstIRect; | 39 const SkIRect dstIRect = dstRect.roundOut(); |
40 dstRect.roundOut(&dstIRect); | |
41 int w = dstIRect.width(); | 40 int w = dstIRect.width(); |
42 int h = dstIRect.height(); | 41 int h = dstIRect.height(); |
43 if (!fSrcRect.width() || !fSrcRect.height() || !w || !h) { | 42 if (!fSrcRect.width() || !fSrcRect.height() || !w || !h) { |
44 return false; | 43 return false; |
45 } | 44 } |
46 | 45 |
47 SkRect srcRect; | 46 SkRect srcRect; |
48 ctx.ctm().mapRect(&srcRect, fSrcRect); | 47 ctx.ctm().mapRect(&srcRect, fSrcRect); |
49 SkIRect srcIRect; | 48 SkIRect srcIRect; |
50 srcRect.roundOut(&srcIRect); | 49 srcRect.roundOut(&srcIRect); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 buffer.readRect(&src); | 108 buffer.readRect(&src); |
110 buffer.readRect(&dst); | 109 buffer.readRect(&dst); |
111 return Create(src, dst, common.getInput(0), common.uniqueID()); | 110 return Create(src, dst, common.getInput(0), common.uniqueID()); |
112 } | 111 } |
113 | 112 |
114 void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const { | 113 void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const { |
115 this->INHERITED::flatten(buffer); | 114 this->INHERITED::flatten(buffer); |
116 buffer.writeRect(fSrcRect); | 115 buffer.writeRect(fSrcRect); |
117 buffer.writeRect(fDstRect); | 116 buffer.writeRect(fDstRect); |
118 } | 117 } |
OLD | NEW |