| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 void SkMagnifierImageFilter::flatten(SkWriteBuffer& buffer) const { | 285 void SkMagnifierImageFilter::flatten(SkWriteBuffer& buffer) const { |
| 286 this->INHERITED::flatten(buffer); | 286 this->INHERITED::flatten(buffer); |
| 287 buffer.writeRect(fSrcRect); | 287 buffer.writeRect(fSrcRect); |
| 288 buffer.writeScalar(fInset); | 288 buffer.writeScalar(fInset); |
| 289 } | 289 } |
| 290 | 290 |
| 291 bool SkMagnifierImageFilter::onFilterImage(Proxy*, const SkBitmap& src, | 291 bool SkMagnifierImageFilter::onFilterImage(Proxy*, const SkBitmap& src, |
| 292 const Context&, SkBitmap* dst, | 292 const Context&, SkBitmap* dst, |
| 293 SkIPoint* offset) const { | 293 SkIPoint* offset) const { |
| 294 SkASSERT(src.colorType() == kN32_SkColorType); | |
| 295 SkASSERT(fSrcRect.width() < src.width()); | |
| 296 SkASSERT(fSrcRect.height() < src.height()); | |
| 297 | |
| 298 if ((src.colorType() != kN32_SkColorType) || | 294 if ((src.colorType() != kN32_SkColorType) || |
| 299 (fSrcRect.width() >= src.width()) || | 295 (fSrcRect.width() >= src.width()) || |
| 300 (fSrcRect.height() >= src.height())) { | 296 (fSrcRect.height() >= src.height())) { |
| 301 return false; | 297 return false; |
| 302 } | 298 } |
| 303 | 299 |
| 304 SkAutoLockPixels alp(src); | 300 SkAutoLockPixels alp(src); |
| 305 SkASSERT(src.getPixels()); | 301 SkASSERT(src.getPixels()); |
| 306 if (!src.getPixels() || src.width() <= 0 || src.height() <= 0) { | 302 if (!src.getPixels() || src.width() <= 0 || src.height() <= 0) { |
| 307 return false; | 303 return false; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 356 |
| 361 #ifndef SK_IGNORE_TO_STRING | 357 #ifndef SK_IGNORE_TO_STRING |
| 362 void SkMagnifierImageFilter::toString(SkString* str) const { | 358 void SkMagnifierImageFilter::toString(SkString* str) const { |
| 363 str->appendf("SkMagnifierImageFilter: ("); | 359 str->appendf("SkMagnifierImageFilter: ("); |
| 364 str->appendf("src: (%f,%f,%f,%f) ", | 360 str->appendf("src: (%f,%f,%f,%f) ", |
| 365 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); | 361 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); |
| 366 str->appendf("inset: %f", fInset); | 362 str->appendf("inset: %f", fInset); |
| 367 str->append(")"); | 363 str->append(")"); |
| 368 } | 364 } |
| 369 #endif | 365 #endif |
| OLD | NEW |