| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 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 #ifndef SkScaledCodec_DEFINED | 7 #ifndef SkScaledCodec_DEFINED |
| 8 #define SkScaledCodec_DEFINED | 8 #define SkScaledCodec_DEFINED |
| 9 | 9 |
| 10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 return false; | 34 return false; |
| 35 } | 35 } |
| 36 // only support down sampling, dstWidth cannot be larger that srcWidth | 36 // only support down sampling, dstWidth cannot be larger that srcWidth |
| 37 if(dstInfo.width() > srcInfo.width()) { | 37 if(dstInfo.width() > srcInfo.width()) { |
| 38 return false; | 38 return false; |
| 39 } | 39 } |
| 40 return true; | 40 return true; |
| 41 } | 41 } |
| 42 | 42 |
| 43 /* | 43 /* |
| 44 * Converts the original dimension to a scaled output dimension using the |
| 45 * sample factor. |
| 46 */ |
| 47 static inline int GetScaledDimension(int srcDim, int sampleFactor); |
| 48 |
| 49 /* |
| 44 * Returns the first coordinate that we will keep during sampling. | 50 * Returns the first coordinate that we will keep during sampling. |
| 45 * The output can be interpreted as an x-coordinate or a y-coordinate. | 51 * The output can be interpreted as an x-coordinate or a y-coordinate. |
| 46 */ | 52 */ |
| 47 static inline int GetStartCoord(int sampleFactor); | 53 static inline int GetStartCoord(int sampleFactor); |
| 48 | 54 |
| 49 /* | 55 /* |
| 50 * Given a coordinate in the original image, this returns the corresponding | 56 * Given a coordinate in the original image, this returns the corresponding |
| 51 * coordinate in the scaled image. This function is meaningless if | 57 * coordinate in the scaled image. This function is meaningless if |
| 52 * IsCoordNecessary returns false. | 58 * IsCoordNecessary returns false. |
| 53 * The output can be interpreted as an x-coordinate or a y-coordinate. | 59 * The output can be interpreted as an x-coordinate or a y-coordinate. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 83 | 89 |
| 84 private: | 90 private: |
| 85 | 91 |
| 86 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; | 92 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; |
| 87 | 93 |
| 88 explicit SkScaledCodec(SkScanlineDecoder*); | 94 explicit SkScaledCodec(SkScanlineDecoder*); |
| 89 | 95 |
| 90 typedef SkCodec INHERITED; | 96 typedef SkCodec INHERITED; |
| 91 }; | 97 }; |
| 92 #endif // SkScaledCodec_DEFINED | 98 #endif // SkScaledCodec_DEFINED |
| OLD | NEW |