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 "SkScaledImageCache.h" |
16 | 17 |
17 #define FractionalInt_IS_64BIT | 18 #define FractionalInt_IS_64BIT |
18 | 19 |
19 #ifdef FractionalInt_IS_64BIT | 20 #ifdef FractionalInt_IS_64BIT |
20 typedef SkFixed48 SkFractionalInt; | 21 typedef SkFixed48 SkFractionalInt; |
21 #define SkScalarToFractionalInt(x) SkScalarToFixed48(x) | 22 #define SkScalarToFractionalInt(x) SkScalarToFixed48(x) |
22 #define SkFractionalIntToFixed(x) SkFixed48ToFixed(x) | 23 #define SkFractionalIntToFixed(x) SkFixed48ToFixed(x) |
23 #define SkFixedToFractionalInt(x) SkFixedToFixed48(x) | 24 #define SkFixedToFractionalInt(x) SkFixedToFixed48(x) |
24 #define SkFractionalIntToInt(x) SkFixed48ToInt(x) | 25 #define SkFractionalIntToInt(x) SkFixed48ToInt(x) |
25 #else | 26 #else |
26 typedef SkFixed SkFractionalInt; | 27 typedef SkFixed SkFractionalInt; |
27 #define SkScalarToFractionalInt(x) SkScalarToFixed(x) | 28 #define SkScalarToFractionalInt(x) SkScalarToFixed(x) |
28 #define SkFractionalIntToFixed(x) (x) | 29 #define SkFractionalIntToFixed(x) (x) |
29 #define SkFixedToFractionalInt(x) (x) | 30 #define SkFixedToFractionalInt(x) (x) |
30 #define SkFractionalIntToInt(x) ((x) >> 16) | 31 #define SkFractionalIntToInt(x) ((x) >> 16) |
31 #endif | 32 #endif |
32 | 33 |
33 class SkPaint; | 34 class SkPaint; |
34 struct SkConvolutionProcs; | 35 struct SkConvolutionProcs; |
35 | 36 |
36 struct SkBitmapProcState { | 37 struct SkBitmapProcState { |
37 | 38 |
38 SkBitmapProcState(): fBitmapFilter(NULL) {} | 39 SkBitmapProcState(): fScaledCacheID(NULL), fBitmapFilter(NULL) {} |
39 ~SkBitmapProcState() { | 40 ~SkBitmapProcState() { |
| 41 SkASSERT(NULL == fScaledCacheID); |
40 SkDELETE(fBitmapFilter); | 42 SkDELETE(fBitmapFilter); |
41 } | 43 } |
42 | 44 |
43 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, | 45 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, |
44 SkPMColor[], int count); | 46 SkPMColor[], int count); |
45 | 47 |
46 typedef void (*ShaderProc16)(const SkBitmapProcState&, int x, int y, | 48 typedef void (*ShaderProc16)(const SkBitmapProcState&, int x, int y, |
47 uint16_t[], int count); | 49 uint16_t[], int count); |
48 | 50 |
49 typedef void (*MatrixProc)(const SkBitmapProcState&, | 51 typedef void (*MatrixProc)(const SkBitmapProcState&, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 ShaderProc32 fShaderProc32; // chooseProcs | 152 ShaderProc32 fShaderProc32; // chooseProcs |
151 ShaderProc16 fShaderProc16; // chooseProcs | 153 ShaderProc16 fShaderProc16; // chooseProcs |
152 // These are used if the shaderproc is NULL | 154 // These are used if the shaderproc is NULL |
153 MatrixProc fMatrixProc; // chooseProcs | 155 MatrixProc fMatrixProc; // chooseProcs |
154 SampleProc32 fSampleProc32; // chooseProcs | 156 SampleProc32 fSampleProc32; // chooseProcs |
155 SampleProc16 fSampleProc16; // chooseProcs | 157 SampleProc16 fSampleProc16; // chooseProcs |
156 | 158 |
157 SkBitmap fOrigBitmap; // CONSTRUCTOR | 159 SkBitmap fOrigBitmap; // CONSTRUCTOR |
158 SkBitmap fScaledBitmap; // chooseProcs | 160 SkBitmap fScaledBitmap; // chooseProcs |
159 | 161 |
| 162 SkScaledImageCache::ID* fScaledCacheID; |
| 163 |
160 MatrixProc chooseMatrixProc(bool trivial_matrix); | 164 MatrixProc chooseMatrixProc(bool trivial_matrix); |
161 bool chooseProcs(const SkMatrix& inv, const SkPaint&); | 165 bool chooseProcs(const SkMatrix& inv, const SkPaint&); |
162 ShaderProc32 chooseShaderProc32(); | 166 ShaderProc32 chooseShaderProc32(); |
163 | 167 |
164 void possiblyScaleImage(); | 168 void possiblyScaleImage(); |
165 | 169 |
166 SkBitmapFilter* fBitmapFilter; | 170 SkBitmapFilter* fBitmapFilter; |
167 | 171 |
168 ShaderProc32 chooseBitmapFilterProc(); | 172 ShaderProc32 chooseBitmapFilterProc(); |
169 | 173 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, | 223 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, |
220 uint32_t xy[], int count, int x, int y); | 224 uint32_t xy[], int count, int x, int y); |
221 void S32_D16_filter_DX(const SkBitmapProcState& s, | 225 void S32_D16_filter_DX(const SkBitmapProcState& s, |
222 const uint32_t* xy, int count, uint16_t* colo
rs); | 226 const uint32_t* xy, int count, uint16_t* colo
rs); |
223 | 227 |
224 void highQualityFilter(const SkBitmapProcState &s, int x, int y, | 228 void highQualityFilter(const SkBitmapProcState &s, int x, int y, |
225 SkPMColor *SK_RESTRICT colors, int count); | 229 SkPMColor *SK_RESTRICT colors, int count); |
226 | 230 |
227 | 231 |
228 #endif | 232 #endif |
OLD | NEW |