| OLD | NEW |
| 1 #include "SkBitmapScaler.h" | 1 #include "SkBitmapScaler.h" |
| 2 #include "SkBitmapFilter.h" | 2 #include "SkBitmapFilter.h" |
| 3 #include "SkRect.h" | 3 #include "SkRect.h" |
| 4 #include "SkTArray.h" | 4 #include "SkTArray.h" |
| 5 #include "SkErrorInternals.h" | 5 #include "SkErrorInternals.h" |
| 6 #include "SkConvolver.h" | 6 #include "SkConvolver.h" |
| 7 | 7 |
| 8 // SkResizeFilter --------------------------------------------------------------
-- | 8 // SkResizeFilter --------------------------------------------------------------
-- |
| 9 | 9 |
| 10 // Encapsulates computation and storage of the filters required for one complete | 10 // Encapsulates computation and storage of the filters required for one complete |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 275 } |
| 276 | 276 |
| 277 method = ResizeMethodToAlgorithmMethod(method); | 277 method = ResizeMethodToAlgorithmMethod(method); |
| 278 | 278 |
| 279 // Check that we deal with an "algorithm methods" from this point onward. | 279 // Check that we deal with an "algorithm methods" from this point onward. |
| 280 SkASSERT((SkBitmapScaler::RESIZE_FIRST_ALGORITHM_METHOD <= method) && | 280 SkASSERT((SkBitmapScaler::RESIZE_FIRST_ALGORITHM_METHOD <= method) && |
| 281 (method <= SkBitmapScaler::RESIZE_LAST_ALGORITHM_METHOD)); | 281 (method <= SkBitmapScaler::RESIZE_LAST_ALGORITHM_METHOD)); |
| 282 | 282 |
| 283 SkAutoLockPixels locker(source); | 283 SkAutoLockPixels locker(source); |
| 284 if (!source.readyToDraw() || | 284 if (!source.readyToDraw() || |
| 285 source.colorType() != kN32_SkColorType) { | 285 source.colorType() != kPMColor_SkColorType) { |
| 286 return false; | 286 return false; |
| 287 } | 287 } |
| 288 | 288 |
| 289 SkResizeFilter filter(method, source.width(), source.height(), | 289 SkResizeFilter filter(method, source.width(), source.height(), |
| 290 destWidth, destHeight, destSubset, convolveProcs); | 290 destWidth, destHeight, destSubset, convolveProcs); |
| 291 | 291 |
| 292 // Get a source bitmap encompassing this touched area. We construct the | 292 // Get a source bitmap encompassing this touched area. We construct the |
| 293 // offsets and row strides such that it looks like a new bitmap, while | 293 // offsets and row strides such that it looks like a new bitmap, while |
| 294 // referring to the old data. | 294 // referring to the old data. |
| 295 const unsigned char* sourceSubset = | 295 const unsigned char* sourceSubset = |
| (...skipping 25 matching lines...) Expand all Loading... |
| 321 bool SkBitmapScaler::Resize(SkBitmap* resultPtr, | 321 bool SkBitmapScaler::Resize(SkBitmap* resultPtr, |
| 322 const SkBitmap& source, | 322 const SkBitmap& source, |
| 323 ResizeMethod method, | 323 ResizeMethod method, |
| 324 int destWidth, int destHeight, | 324 int destWidth, int destHeight, |
| 325 const SkConvolutionProcs& convolveProcs, | 325 const SkConvolutionProcs& convolveProcs, |
| 326 SkBitmap::Allocator* allocator) { | 326 SkBitmap::Allocator* allocator) { |
| 327 SkIRect destSubset = { 0, 0, destWidth, destHeight }; | 327 SkIRect destSubset = { 0, 0, destWidth, destHeight }; |
| 328 return Resize(resultPtr, source, method, destWidth, destHeight, destSubset, | 328 return Resize(resultPtr, source, method, destWidth, destHeight, destSubset, |
| 329 convolveProcs, allocator); | 329 convolveProcs, allocator); |
| 330 } | 330 } |
| OLD | NEW |