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" |
11 #include "SkDevice.h" | 11 #include "SkDevice.h" |
12 #include "SkReadBuffer.h" | 12 #include "SkReadBuffer.h" |
13 #include "SkWriteBuffer.h" | 13 #include "SkWriteBuffer.h" |
14 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
15 #include "SkPaint.h" | 15 #include "SkPaint.h" |
16 #include "SkShader.h" | 16 #include "SkShader.h" |
17 #include "SkValidationUtils.h" | 17 #include "SkValidationUtils.h" |
18 | 18 |
19 SkTileImageFilter* SkTileImageFilter::Create(const SkRect& srcRect, const SkRect
& dstRect, | 19 SkTileImageFilter* SkTileImageFilter::Create(const SkRect& srcRect, const SkRect
& dstRect, |
20 SkImageFilter* input) { | 20 SkImageFilter* input, uint32_t uniq
ueID) { |
21 if (!SkIsValidRect(srcRect) || !SkIsValidRect(dstRect)) { | 21 if (!SkIsValidRect(srcRect) || !SkIsValidRect(dstRect)) { |
22 return NULL; | 22 return NULL; |
23 } | 23 } |
24 return SkNEW_ARGS(SkTileImageFilter, (srcRect, dstRect, input)); | 24 return SkNEW_ARGS(SkTileImageFilter, (srcRect, dstRect, input, uniqueID)); |
25 } | 25 } |
26 | 26 |
27 bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, | 27 bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, |
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 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; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 buffer.readRect(&fDstRect); | 101 buffer.readRect(&fDstRect); |
102 buffer.validate(buffer.isValid() && SkIsValidRect(fSrcRect) && SkIsValidRect
(fDstRect)); | 102 buffer.validate(buffer.isValid() && SkIsValidRect(fSrcRect) && SkIsValidRect
(fDstRect)); |
103 } | 103 } |
104 #endif | 104 #endif |
105 | 105 |
106 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) { | 106 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) { |
107 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 107 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
108 SkRect src, dst; | 108 SkRect src, dst; |
109 buffer.readRect(&src); | 109 buffer.readRect(&src); |
110 buffer.readRect(&dst); | 110 buffer.readRect(&dst); |
111 return Create(src, dst, common.getInput(0)); | 111 return Create(src, dst, common.getInput(0), common.uniqueID()); |
112 } | 112 } |
113 | 113 |
114 void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const { | 114 void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const { |
115 this->INHERITED::flatten(buffer); | 115 this->INHERITED::flatten(buffer); |
116 buffer.writeRect(fSrcRect); | 116 buffer.writeRect(fSrcRect); |
117 buffer.writeRect(fDstRect); | 117 buffer.writeRect(fDstRect); |
118 } | 118 } |
OLD | NEW |