| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 buffer.writeScalar(fSrcRect.x()); | 275 buffer.writeScalar(fSrcRect.x()); |
| 276 buffer.writeScalar(fSrcRect.y()); | 276 buffer.writeScalar(fSrcRect.y()); |
| 277 buffer.writeScalar(fSrcRect.width()); | 277 buffer.writeScalar(fSrcRect.width()); |
| 278 buffer.writeScalar(fSrcRect.height()); | 278 buffer.writeScalar(fSrcRect.height()); |
| 279 buffer.writeScalar(fInset); | 279 buffer.writeScalar(fInset); |
| 280 } | 280 } |
| 281 | 281 |
| 282 bool SkMagnifierImageFilter::onFilterImage(Proxy*, const SkBitmap& src, | 282 bool SkMagnifierImageFilter::onFilterImage(Proxy*, const SkBitmap& src, |
| 283 const Context&, SkBitmap* dst, | 283 const Context&, SkBitmap* dst, |
| 284 SkIPoint* offset) const { | 284 SkIPoint* offset) const { |
| 285 SkASSERT(src.colorType() == kN32_SkColorType); | 285 SkASSERT(src.colorType() == kPMColor_SkColorType); |
| 286 SkASSERT(fSrcRect.width() < src.width()); | 286 SkASSERT(fSrcRect.width() < src.width()); |
| 287 SkASSERT(fSrcRect.height() < src.height()); | 287 SkASSERT(fSrcRect.height() < src.height()); |
| 288 | 288 |
| 289 if ((src.colorType() != kN32_SkColorType) || | 289 if ((src.colorType() != kPMColor_SkColorType) || |
| 290 (fSrcRect.width() >= src.width()) || | 290 (fSrcRect.width() >= src.width()) || |
| 291 (fSrcRect.height() >= src.height())) { | 291 (fSrcRect.height() >= src.height())) { |
| 292 return false; | 292 return false; |
| 293 } | 293 } |
| 294 | 294 |
| 295 SkAutoLockPixels alp(src); | 295 SkAutoLockPixels alp(src); |
| 296 SkASSERT(src.getPixels()); | 296 SkASSERT(src.getPixels()); |
| 297 if (!src.getPixels() || src.width() <= 0 || src.height() <= 0) { | 297 if (!src.getPixels() || src.width() <= 0 || src.height() <= 0) { |
| 298 return false; | 298 return false; |
| 299 } | 299 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 343 |
| 344 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); | 344 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); |
| 345 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); | 345 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); |
| 346 | 346 |
| 347 *dptr = sptr[y_val * width + x_val]; | 347 *dptr = sptr[y_val * width + x_val]; |
| 348 dptr++; | 348 dptr++; |
| 349 } | 349 } |
| 350 } | 350 } |
| 351 return true; | 351 return true; |
| 352 } | 352 } |
| OLD | NEW |