OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
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 | 7 |
8 #ifndef SkBitmapProcState_DEFINED | 8 #ifndef SkBitmapProcState_DEFINED |
9 #define SkBitmapProcState_DEFINED | 9 #define SkBitmapProcState_DEFINED |
10 | 10 |
11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
12 #include "SkBitmapController.h" | 12 #include "SkBitmapController.h" |
13 #include "SkBitmapFilter.h" | 13 #include "SkBitmapFilter.h" |
14 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
15 #include "SkMipMap.h" | 15 #include "SkMipMap.h" |
16 #include "SkPaint.h" | 16 #include "SkPaint.h" |
17 #include "SkTemplates.h" | 17 #include "SkTemplates.h" |
18 | 18 |
19 typedef SkFixed3232 SkFractionalInt; | 19 typedef SkFixed3232 SkFractionalInt; |
20 #define SkScalarToFractionalInt(x) SkScalarToFixed3232(x) | 20 #define SkScalarToFractionalInt(x) SkScalarToFixed3232(x) |
21 #define SkFractionalIntToFixed(x) SkFixed3232ToFixed(x) | 21 #define SkFractionalIntToFixed(x) SkFixed3232ToFixed(x) |
22 #define SkFixedToFractionalInt(x) SkFixedToFixed3232(x) | 22 #define SkFixedToFractionalInt(x) SkFixedToFixed3232(x) |
23 #define SkFractionalIntToInt(x) SkFixed3232ToInt(x) | 23 #define SkFractionalIntToInt(x) SkFixed3232ToInt(x) |
24 | 24 |
25 class SkPaint; | 25 class SkPaint; |
26 | 26 |
27 struct SkBitmapProcState { | 27 struct SkBitmapProcState { |
28 SkBitmapProcState(); | 28 SkBitmapProcState(const SkBitmapProvider&, SkShader::TileMode tmx, SkShader:
:TileMode tmy); |
| 29 SkBitmapProcState(const SkBitmap&, SkShader::TileMode tmx, SkShader::TileMod
e tmy); |
29 ~SkBitmapProcState(); | 30 ~SkBitmapProcState(); |
30 | 31 |
31 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, | 32 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, |
32 SkPMColor[], int count); | 33 SkPMColor[], int count); |
33 | 34 |
34 typedef void (*ShaderProc16)(const SkBitmapProcState&, int x, int y, | 35 typedef void (*ShaderProc16)(const SkBitmapProcState&, int x, int y, |
35 uint16_t[], int count); | 36 uint16_t[], int count); |
36 | 37 |
37 typedef void (*MatrixProc)(const SkBitmapProcState&, | 38 typedef void (*MatrixProc)(const SkBitmapProcState&, |
38 uint32_t bitmapXY[], | 39 uint32_t bitmapXY[], |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 friend class SkBitmapProcShader; | 122 friend class SkBitmapProcShader; |
122 friend class SkLightingShaderImpl; | 123 friend class SkLightingShaderImpl; |
123 | 124 |
124 ShaderProc32 fShaderProc32; // chooseProcs | 125 ShaderProc32 fShaderProc32; // chooseProcs |
125 ShaderProc16 fShaderProc16; // chooseProcs | 126 ShaderProc16 fShaderProc16; // chooseProcs |
126 // These are used if the shaderproc is nullptr | 127 // These are used if the shaderproc is nullptr |
127 MatrixProc fMatrixProc; // chooseProcs | 128 MatrixProc fMatrixProc; // chooseProcs |
128 SampleProc32 fSampleProc32; // chooseProcs | 129 SampleProc32 fSampleProc32; // chooseProcs |
129 SampleProc16 fSampleProc16; // chooseProcs | 130 SampleProc16 fSampleProc16; // chooseProcs |
130 | 131 |
131 SkBitmap fOrigBitmap; // CONSTRUCTOR | 132 const SkBitmapProvider fProvider; |
132 | 133 |
133 enum { | 134 enum { |
134 kBMStateSize = 136 // found by inspection. if too small, we will call n
ew/delete | 135 kBMStateSize = 136 // found by inspection. if too small, we will call n
ew/delete |
135 }; | 136 }; |
136 SkAlignedSStorage<kBMStateSize> fBMStateStorage; | 137 SkAlignedSStorage<kBMStateSize> fBMStateStorage; |
137 SkBitmapController::State* fBMState; | 138 SkBitmapController::State* fBMState; |
138 | 139 |
139 MatrixProc chooseMatrixProc(bool trivial_matrix); | 140 MatrixProc chooseMatrixProc(bool trivial_matrix); |
140 bool chooseProcs(const SkMatrix& inv, const SkPaint&); | 141 bool chooseProcs(const SkMatrix& inv, const SkPaint&); |
141 bool chooseScanlineProcs(bool trivialMatrix, bool clampClamp, const SkPaint&
paint); | 142 bool chooseScanlineProcs(bool trivialMatrix, bool clampClamp, const SkPaint&
paint); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s, | 192 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s, |
192 uint32_t xy[], int count, int x, int y); | 193 uint32_t xy[], int count, int x, int y); |
193 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, | 194 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, |
194 uint32_t xy[], int count, int x, int y); | 195 uint32_t xy[], int count, int x, int y); |
195 void S32_D16_filter_DX(const SkBitmapProcState& s, | 196 void S32_D16_filter_DX(const SkBitmapProcState& s, |
196 const uint32_t* xy, int count, uint16_t* colors); | 197 const uint32_t* xy, int count, uint16_t* colors); |
197 void S32_D16_filter_DXDY(const SkBitmapProcState& s, | 198 void S32_D16_filter_DXDY(const SkBitmapProcState& s, |
198 const uint32_t* xy, int count, uint16_t* colors); | 199 const uint32_t* xy, int count, uint16_t* colors); |
199 | 200 |
200 #endif | 201 #endif |
OLD | NEW |