| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkBitmapProcState_DEFINED | 10 #ifndef SkBitmapProcState_DEFINED |
| 11 #define SkBitmapProcState_DEFINED | 11 #define SkBitmapProcState_DEFINED |
| 12 | 12 |
| 13 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
| 14 #include "SkBitmapFilter.h" | 14 #include "SkBitmapFilter.h" |
| 15 #include "SkMatrix.h" | 15 #include "SkMatrix.h" |
| 16 #include "SkMipMap.h" |
| 16 #include "SkPaint.h" | 17 #include "SkPaint.h" |
| 17 #include "SkScaledImageCache.h" | 18 #include "SkScaledImageCache.h" |
| 18 | 19 |
| 19 #define FractionalInt_IS_64BIT | 20 #define FractionalInt_IS_64BIT |
| 20 | 21 |
| 21 #ifdef FractionalInt_IS_64BIT | 22 #ifdef FractionalInt_IS_64BIT |
| 22 typedef SkFixed48 SkFractionalInt; | 23 typedef SkFixed48 SkFractionalInt; |
| 23 #define SkScalarToFractionalInt(x) SkScalarToFixed48(x) | 24 #define SkScalarToFractionalInt(x) SkScalarToFixed48(x) |
| 24 #define SkFractionalIntToFixed(x) SkFixed48ToFixed(x) | 25 #define SkFractionalIntToFixed(x) SkFixed48ToFixed(x) |
| 25 #define SkFixedToFractionalInt(x) SkFixedToFixed48(x) | 26 #define SkFixedToFractionalInt(x) SkFixedToFixed48(x) |
| 26 #define SkFractionalIntToInt(x) SkFixed48ToInt(x) | 27 #define SkFractionalIntToInt(x) SkFixed48ToInt(x) |
| 27 #else | 28 #else |
| 28 typedef SkFixed SkFractionalInt; | 29 typedef SkFixed SkFractionalInt; |
| 29 #define SkScalarToFractionalInt(x) SkScalarToFixed(x) | 30 #define SkScalarToFractionalInt(x) SkScalarToFixed(x) |
| 30 #define SkFractionalIntToFixed(x) (x) | 31 #define SkFractionalIntToFixed(x) (x) |
| 31 #define SkFixedToFractionalInt(x) (x) | 32 #define SkFixedToFractionalInt(x) (x) |
| 32 #define SkFractionalIntToInt(x) ((x) >> 16) | 33 #define SkFractionalIntToInt(x) ((x) >> 16) |
| 33 #endif | 34 #endif |
| 34 | 35 |
| 35 class SkPaint; | 36 class SkPaint; |
| 36 | 37 |
| 37 struct SkBitmapProcState { | 38 struct SkBitmapProcState { |
| 38 | 39 |
| 39 SkBitmapProcState(): fScaledCacheID(NULL), fBitmapFilter(NULL) {} | 40 SkBitmapProcState() : fBitmapFilter(NULL) {} |
| 40 ~SkBitmapProcState(); | 41 ~SkBitmapProcState(); |
| 41 | 42 |
| 42 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, | 43 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, |
| 43 SkPMColor[], int count); | 44 SkPMColor[], int count); |
| 44 | 45 |
| 45 typedef void (*ShaderProc16)(const SkBitmapProcState&, int x, int y, | 46 typedef void (*ShaderProc16)(const SkBitmapProcState&, int x, int y, |
| 46 uint16_t[], int count); | 47 uint16_t[], int count); |
| 47 | 48 |
| 48 typedef void (*MatrixProc)(const SkBitmapProcState&, | 49 typedef void (*MatrixProc)(const SkBitmapProcState&, |
| 49 uint32_t bitmapXY[], | 50 uint32_t bitmapXY[], |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 ShaderProc32 fShaderProc32; // chooseProcs | 136 ShaderProc32 fShaderProc32; // chooseProcs |
| 136 ShaderProc16 fShaderProc16; // chooseProcs | 137 ShaderProc16 fShaderProc16; // chooseProcs |
| 137 // These are used if the shaderproc is NULL | 138 // These are used if the shaderproc is NULL |
| 138 MatrixProc fMatrixProc; // chooseProcs | 139 MatrixProc fMatrixProc; // chooseProcs |
| 139 SampleProc32 fSampleProc32; // chooseProcs | 140 SampleProc32 fSampleProc32; // chooseProcs |
| 140 SampleProc16 fSampleProc16; // chooseProcs | 141 SampleProc16 fSampleProc16; // chooseProcs |
| 141 | 142 |
| 142 SkBitmap fOrigBitmap; // CONSTRUCTOR | 143 SkBitmap fOrigBitmap; // CONSTRUCTOR |
| 143 SkBitmap fScaledBitmap; // chooseProcs | 144 SkBitmap fScaledBitmap; // chooseProcs |
| 144 | 145 |
| 145 SkScaledImageCache::ID* fScaledCacheID; | 146 SkAutoTUnref<const SkMipMap> fCurrMip; |
| 147 // SkScaledImageCache::ID fScaledCacheID; |
| 146 | 148 |
| 147 MatrixProc chooseMatrixProc(bool trivial_matrix); | 149 MatrixProc chooseMatrixProc(bool trivial_matrix); |
| 148 bool chooseProcs(const SkMatrix& inv, const SkPaint&); | 150 bool chooseProcs(const SkMatrix& inv, const SkPaint&); |
| 149 ShaderProc32 chooseShaderProc32(); | 151 ShaderProc32 chooseShaderProc32(); |
| 150 | 152 |
| 151 // returns false if we did not try to scale the image. In that case, we | 153 // returns false if we did not try to scale the image. In that case, we |
| 152 // will need to "lock" its pixels some other way. | 154 // will need to "lock" its pixels some other way. |
| 153 bool possiblyScaleImage(); | 155 bool possiblyScaleImage(); |
| 154 | 156 |
| 155 // returns false if we failed to "lock" the pixels at all. Typically this | 157 // returns false if we failed to "lock" the pixels at all. Typically this |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 void S32_D16_filter_DX(const SkBitmapProcState& s, | 218 void S32_D16_filter_DX(const SkBitmapProcState& s, |
| 217 const uint32_t* xy, int count, uint16_t* colors); | 219 const uint32_t* xy, int count, uint16_t* colors); |
| 218 | 220 |
| 219 void highQualityFilter32(const SkBitmapProcState &s, int x, int y, | 221 void highQualityFilter32(const SkBitmapProcState &s, int x, int y, |
| 220 SkPMColor *SK_RESTRICT colors, int count); | 222 SkPMColor *SK_RESTRICT colors, int count); |
| 221 void highQualityFilter16(const SkBitmapProcState &s, int x, int y, | 223 void highQualityFilter16(const SkBitmapProcState &s, int x, int y, |
| 222 uint16_t *SK_RESTRICT colors, int count); | 224 uint16_t *SK_RESTRICT colors, int count); |
| 223 | 225 |
| 224 | 226 |
| 225 #endif | 227 #endif |
| OLD | NEW |