OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkMagnifierImageFilter.h" | 9 #include "SkMagnifierImageFilter.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 yOffset / texture->height(), | 274 yOffset / texture->height(), |
275 fSrcRect.width() / bounds.width(), | 275 fSrcRect.width() / bounds.width(), |
276 fSrcRect.height() / bounds.height(), | 276 fSrcRect.height() / bounds.height(), |
277 bounds.width() * invInset, | 277 bounds.width() * invInset, |
278 bounds.height() * invInset); | 278 bounds.height() * invInset); |
279 } | 279 } |
280 return true; | 280 return true; |
281 } | 281 } |
282 #endif | 282 #endif |
283 | 283 |
284 SkFlattenable* SkMagnifierImageFilter::CreateProc(SkReadBuffer& buffer) { | 284 sk_sp<SkFlattenable> SkMagnifierImageFilter::CreateProc(SkReadBuffer& buffer) { |
285 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 285 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
286 SkRect src; | 286 SkRect src; |
287 buffer.readRect(&src); | 287 buffer.readRect(&src); |
288 return Create(src, buffer.readScalar(), common.getInput(0).get()); | 288 return sk_sp<SkFlattenable>(Create(src, buffer.readScalar(), common.getInput
(0).get())); |
289 } | 289 } |
290 | 290 |
291 void SkMagnifierImageFilter::flatten(SkWriteBuffer& buffer) const { | 291 void SkMagnifierImageFilter::flatten(SkWriteBuffer& buffer) const { |
292 this->INHERITED::flatten(buffer); | 292 this->INHERITED::flatten(buffer); |
293 buffer.writeRect(fSrcRect); | 293 buffer.writeRect(fSrcRect); |
294 buffer.writeScalar(fInset); | 294 buffer.writeScalar(fInset); |
295 } | 295 } |
296 | 296 |
297 bool SkMagnifierImageFilter::onFilterImageDeprecated(Proxy* proxy, const SkBitma
p& src, | 297 bool SkMagnifierImageFilter::onFilterImageDeprecated(Proxy* proxy, const SkBitma
p& src, |
298 const Context&, SkBitmap* d
st, | 298 const Context&, SkBitmap* d
st, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 365 |
366 #ifndef SK_IGNORE_TO_STRING | 366 #ifndef SK_IGNORE_TO_STRING |
367 void SkMagnifierImageFilter::toString(SkString* str) const { | 367 void SkMagnifierImageFilter::toString(SkString* str) const { |
368 str->appendf("SkMagnifierImageFilter: ("); | 368 str->appendf("SkMagnifierImageFilter: ("); |
369 str->appendf("src: (%f,%f,%f,%f) ", | 369 str->appendf("src: (%f,%f,%f,%f) ", |
370 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); | 370 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); |
371 str->appendf("inset: %f", fInset); | 371 str->appendf("inset: %f", fInset); |
372 str->append(")"); | 372 str->append(")"); |
373 } | 373 } |
374 #endif | 374 #endif |
OLD | NEW |