| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 !source.isOpaque(), filter.xFilter(), filter.yFilter(), | 310 !source.isOpaque(), filter.xFilter(), filter.yFilter(), |
| 311 static_cast<int>(result.rowBytes()), | 311 static_cast<int>(result.rowBytes()), |
| 312 static_cast<unsigned char*>(result.getPixels()), | 312 static_cast<unsigned char*>(result.getPixels()), |
| 313 convolveProcs, true); | 313 convolveProcs, true); |
| 314 | 314 |
| 315 *resultPtr = result; | 315 *resultPtr = result; |
| 316 resultPtr->lockPixels(); | 316 resultPtr->lockPixels(); |
| 317 SkASSERT(NULL != resultPtr->getPixels()); | 317 SkASSERT(NULL != resultPtr->getPixels()); |
| 318 return true; | 318 return true; |
| 319 } | 319 } |
| 320 |
| 321 // static -- simpler interface to the resizer; returns a default bitmap if scali
ng |
| 322 // fails for any reason. This is the interface that Chrome expects. |
| 323 SkBitmap SkBitmapScaler::Resize(const SkBitmap& source, |
| 324 ResizeMethod method, |
| 325 float destWidth, float destHeight, |
| 326 SkBitmap::Allocator* allocator) { |
| 327 SkBitmap result; |
| 328 if (!Resize(&result, source, method, destWidth, destHeight, allocator)) { |
| 329 return SkBitmap(); |
| 330 } |
| 331 return result; |
| 332 } |
| OLD | NEW |