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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 buffer.readRect(&src); | 287 buffer.readRect(&src); |
288 return Create(src, buffer.readScalar(), common.getInput(0)); | 288 return Create(src, buffer.readScalar(), common.getInput(0)); |
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::onFilterImage(Proxy* proxy, const SkBitmap& src, | 297 bool SkMagnifierImageFilter::onFilterImageDeprecated(Proxy* proxy, const SkBitma
p& src, |
298 const Context&, SkBitmap* dst, | 298 const Context&, SkBitmap* d
st, |
299 SkIPoint* offset) const { | 299 SkIPoint* offset) const { |
300 if ((src.colorType() != kN32_SkColorType) || | 300 if ((src.colorType() != kN32_SkColorType) || |
301 (fSrcRect.width() >= src.width()) || | 301 (fSrcRect.width() >= src.width()) || |
302 (fSrcRect.height() >= src.height())) { | 302 (fSrcRect.height() >= src.height())) { |
303 return false; | 303 return false; |
304 } | 304 } |
305 | 305 |
306 SkAutoLockPixels alp(src); | 306 SkAutoLockPixels alp(src); |
307 SkASSERT(src.getPixels()); | 307 SkASSERT(src.getPixels()); |
308 if (!src.getPixels() || src.width() <= 0 || src.height() <= 0) { | 308 if (!src.getPixels() || src.width() <= 0 || src.height() <= 0) { |
309 return false; | 309 return false; |
(...skipping 55 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 |