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 27 matching lines...) Expand all Loading... |
38 // | 38 // |
39 // Likewise, the range of destination values to compute and the scale factor | 39 // Likewise, the range of destination values to compute and the scale factor |
40 // for the transform is also specified. | 40 // for the transform is also specified. |
41 | 41 |
42 void computeFilters(int srcSize, | 42 void computeFilters(int srcSize, |
43 int destSubsetLo, int destSubsetSize, | 43 int destSubsetLo, int destSubsetSize, |
44 float scale, | 44 float scale, |
45 SkConvolutionFilter1D* output, | 45 SkConvolutionFilter1D* output, |
46 SkConvolutionProcs* convolveProcs); | 46 SkConvolutionProcs* convolveProcs); |
47 | 47 |
48 // Subset of scaled destination bitmap to compute. | |
49 SkIRect fOutBounds; | |
50 | |
51 SkConvolutionFilter1D fXFilter; | 48 SkConvolutionFilter1D fXFilter; |
52 SkConvolutionFilter1D fYFilter; | 49 SkConvolutionFilter1D fYFilter; |
53 }; | 50 }; |
54 | 51 |
55 SkResizeFilter::SkResizeFilter(SkBitmapScaler::ResizeMethod method, | 52 SkResizeFilter::SkResizeFilter(SkBitmapScaler::ResizeMethod method, |
56 int srcFullWidth, int srcFullHeight, | 53 int srcFullWidth, int srcFullHeight, |
57 int destWidth, int destHeight, | 54 int destWidth, int destHeight, |
58 const SkIRect& destSubset, | 55 const SkIRect& destSubset, |
59 SkConvolutionProcs* convolveProcs) | 56 SkConvolutionProcs* convolveProcs) { |
60 : fOutBounds(destSubset) { | |
61 | 57 |
62 // method will only ever refer to an "algorithm method". | 58 // method will only ever refer to an "algorithm method". |
63 SkASSERT((SkBitmapScaler::RESIZE_FIRST_ALGORITHM_METHOD <= method) && | 59 SkASSERT((SkBitmapScaler::RESIZE_FIRST_ALGORITHM_METHOD <= method) && |
64 (method <= SkBitmapScaler::RESIZE_LAST_ALGORITHM_METHOD)); | 60 (method <= SkBitmapScaler::RESIZE_LAST_ALGORITHM_METHOD)); |
65 | 61 |
66 switch(method) { | 62 switch(method) { |
67 case SkBitmapScaler::RESIZE_BOX: | 63 case SkBitmapScaler::RESIZE_BOX: |
68 fBitmapFilter = SkNEW(SkBoxFilter); | 64 fBitmapFilter = SkNEW(SkBoxFilter); |
69 break; | 65 break; |
70 case SkBitmapScaler::RESIZE_TRIANGLE: | 66 case SkBitmapScaler::RESIZE_TRIANGLE: |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // static | 302 // static |
307 SkBitmap SkBitmapScaler::Resize(const SkBitmap& source, | 303 SkBitmap SkBitmapScaler::Resize(const SkBitmap& source, |
308 ResizeMethod method, | 304 ResizeMethod method, |
309 int destWidth, int destHeight, | 305 int destWidth, int destHeight, |
310 SkConvolutionProcs* convolveProcs, | 306 SkConvolutionProcs* convolveProcs, |
311 SkBitmap::Allocator* allocator) { | 307 SkBitmap::Allocator* allocator) { |
312 SkIRect destSubset = { 0, 0, destWidth, destHeight }; | 308 SkIRect destSubset = { 0, 0, destWidth, destHeight }; |
313 return Resize(source, method, destWidth, destHeight, destSubset, | 309 return Resize(source, method, destWidth, destHeight, destSubset, |
314 convolveProcs, allocator); | 310 convolveProcs, allocator); |
315 } | 311 } |
OLD | NEW |