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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 return SkBitmapScaler::RESIZE_TRIANGLE; | 221 return SkBitmapScaler::RESIZE_TRIANGLE; |
222 // Users of RESIZE_BETTER are willing to trade some quality in order | 222 // Users of RESIZE_BETTER are willing to trade some quality in order |
223 // to improve performance, but are guaranteed not to devolve to a linear | 223 // to improve performance, but are guaranteed not to devolve to a linear |
224 // resampling. In visual tests we see that Hamming-1 is not as good as | 224 // resampling. In visual tests we see that Hamming-1 is not as good as |
225 // Lanczos-2, however it is about 40% faster and Lanczos-2 itself is | 225 // Lanczos-2, however it is about 40% faster and Lanczos-2 itself is |
226 // about 30% faster than Lanczos-3. The use of Hamming-1 has been deemed | 226 // about 30% faster than Lanczos-3. The use of Hamming-1 has been deemed |
227 // an acceptable trade-off between quality and speed. | 227 // an acceptable trade-off between quality and speed. |
228 case SkBitmapScaler::RESIZE_BETTER: | 228 case SkBitmapScaler::RESIZE_BETTER: |
229 return SkBitmapScaler::RESIZE_HAMMING; | 229 return SkBitmapScaler::RESIZE_HAMMING; |
230 default: | 230 default: |
| 231 #ifdef SK_HIGH_QUALITY_IS_LANCZOS |
| 232 return SkBitmapScaler::RESIZE_LANCZOS3; |
| 233 #else |
231 return SkBitmapScaler::RESIZE_MITCHELL; | 234 return SkBitmapScaler::RESIZE_MITCHELL; |
| 235 #endif |
232 } | 236 } |
233 } | 237 } |
234 | 238 |
235 // static | 239 // static |
236 bool SkBitmapScaler::Resize(SkBitmap* resultPtr, | 240 bool SkBitmapScaler::Resize(SkBitmap* resultPtr, |
237 const SkBitmap& source, | 241 const SkBitmap& source, |
238 ResizeMethod method, | 242 ResizeMethod method, |
239 int destWidth, int destHeight, | 243 int destWidth, int destHeight, |
240 const SkIRect& destSubset, | 244 const SkIRect& destSubset, |
241 const SkConvolutionProcs& convolveProcs, | 245 const SkConvolutionProcs& convolveProcs, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 bool SkBitmapScaler::Resize(SkBitmap* resultPtr, | 314 bool SkBitmapScaler::Resize(SkBitmap* resultPtr, |
311 const SkBitmap& source, | 315 const SkBitmap& source, |
312 ResizeMethod method, | 316 ResizeMethod method, |
313 int destWidth, int destHeight, | 317 int destWidth, int destHeight, |
314 const SkConvolutionProcs& convolveProcs, | 318 const SkConvolutionProcs& convolveProcs, |
315 SkBitmap::Allocator* allocator) { | 319 SkBitmap::Allocator* allocator) { |
316 SkIRect destSubset = { 0, 0, destWidth, destHeight }; | 320 SkIRect destSubset = { 0, 0, destWidth, destHeight }; |
317 return Resize(resultPtr, source, method, destWidth, destHeight, destSubset, | 321 return Resize(resultPtr, source, method, destWidth, destHeight, destSubset, |
318 convolveProcs, allocator); | 322 convolveProcs, allocator); |
319 } | 323 } |
OLD | NEW |