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 10 matching lines...) Expand all Loading... |
21 SkImageFilter* input) { | 21 SkImageFilter* input) { |
22 if (!SkIsValidRect(srcRect) || !SkIsValidRect(dstRect)) { | 22 if (!SkIsValidRect(srcRect) || !SkIsValidRect(dstRect)) { |
23 return nullptr; | 23 return nullptr; |
24 } | 24 } |
25 if (srcRect.width() == dstRect.width() && srcRect.height() == dstRect.height
()) { | 25 if (srcRect.width() == dstRect.width() && srcRect.height() == dstRect.height
()) { |
26 SkRect ir = dstRect; | 26 SkRect ir = dstRect; |
27 if (!ir.intersect(srcRect)) { | 27 if (!ir.intersect(srcRect)) { |
28 return SkSafeRef(input); | 28 return SkSafeRef(input); |
29 } | 29 } |
30 CropRect cropRect(ir); | 30 CropRect cropRect(ir); |
31 return SkOffsetImageFilter::Create(dstRect.x() - srcRect.x(), | 31 return SkOffsetImageFilter::Make(dstRect.x() - srcRect.x(), |
32 dstRect.y() - srcRect.y(), | 32 dstRect.y() - srcRect.y(), |
33 input, &cropRect); | 33 sk_ref_sp<SkImageFilter>(input), |
| 34 &cropRect).release(); |
34 } | 35 } |
35 return new SkTileImageFilter(srcRect, dstRect, input); | 36 return new SkTileImageFilter(srcRect, dstRect, input); |
36 } | 37 } |
37 | 38 |
38 bool SkTileImageFilter::onFilterImageDeprecated(Proxy* proxy, const SkBitmap& sr
c, | 39 bool SkTileImageFilter::onFilterImageDeprecated(Proxy* proxy, const SkBitmap& sr
c, |
39 const Context& ctx, | 40 const Context& ctx, |
40 SkBitmap* dst, SkIPoint* offset)
const { | 41 SkBitmap* dst, SkIPoint* offset)
const { |
41 SkBitmap source = src; | 42 SkBitmap source = src; |
42 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 43 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
43 if (!this->filterInputDeprecated(0, proxy, src, ctx, &source, &srcOffset)) { | 44 if (!this->filterInputDeprecated(0, proxy, src, ctx, &source, &srcOffset)) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 str->appendf(" dst: %.2f %.2f %.2f %.2f", | 145 str->appendf(" dst: %.2f %.2f %.2f %.2f", |
145 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); | 146 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); |
146 if (this->getInput(0)) { | 147 if (this->getInput(0)) { |
147 str->appendf("input: ("); | 148 str->appendf("input: ("); |
148 this->getInput(0)->toString(str); | 149 this->getInput(0)->toString(str); |
149 str->appendf(")"); | 150 str->appendf(")"); |
150 } | 151 } |
151 str->append(")"); | 152 str->append(")"); |
152 } | 153 } |
153 #endif | 154 #endif |
OLD | NEW |