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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 SkIRect SkTileImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix&, M
apDirection) const { | 117 SkIRect SkTileImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix&, M
apDirection) const { |
118 // Don't recurse into inputs. | 118 // Don't recurse into inputs. |
119 return src; | 119 return src; |
120 } | 120 } |
121 | 121 |
122 SkRect SkTileImageFilter::computeFastBounds(const SkRect& src) const { | 122 SkRect SkTileImageFilter::computeFastBounds(const SkRect& src) const { |
123 return fDstRect; | 123 return fDstRect; |
124 } | 124 } |
125 | 125 |
126 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) { | 126 sk_sp<SkFlattenable> SkTileImageFilter::CreateProc(SkReadBuffer& buffer) { |
127 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 127 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
128 SkRect src, dst; | 128 SkRect src, dst; |
129 buffer.readRect(&src); | 129 buffer.readRect(&src); |
130 buffer.readRect(&dst); | 130 buffer.readRect(&dst); |
131 return Create(src, dst, common.getInput(0).get()); | 131 return sk_sp<SkFlattenable>(Create(src, dst, common.getInput(0).get())); |
132 } | 132 } |
133 | 133 |
134 void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const { | 134 void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const { |
135 this->INHERITED::flatten(buffer); | 135 this->INHERITED::flatten(buffer); |
136 buffer.writeRect(fSrcRect); | 136 buffer.writeRect(fSrcRect); |
137 buffer.writeRect(fDstRect); | 137 buffer.writeRect(fDstRect); |
138 } | 138 } |
139 | 139 |
140 #ifndef SK_IGNORE_TO_STRING | 140 #ifndef SK_IGNORE_TO_STRING |
141 void SkTileImageFilter::toString(SkString* str) const { | 141 void SkTileImageFilter::toString(SkString* str) const { |
142 str->appendf("SkTileImageFilter: ("); | 142 str->appendf("SkTileImageFilter: ("); |
143 str->appendf("src: %.2f %.2f %.2f %.2f", | 143 str->appendf("src: %.2f %.2f %.2f %.2f", |
144 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); | 144 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); |
145 str->appendf(" dst: %.2f %.2f %.2f %.2f", | 145 str->appendf(" dst: %.2f %.2f %.2f %.2f", |
146 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); | 146 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); |
147 if (this->getInput(0)) { | 147 if (this->getInput(0)) { |
148 str->appendf("input: ("); | 148 str->appendf("input: ("); |
149 this->getInput(0)->toString(str); | 149 this->getInput(0)->toString(str); |
150 str->appendf(")"); | 150 str->appendf(")"); |
151 } | 151 } |
152 str->append(")"); | 152 str->append(")"); |
153 } | 153 } |
154 #endif | 154 #endif |
OLD | NEW |