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 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 typedef void (*SampleProc16)(const SkBitmapProcState&, | 58 typedef void (*SampleProc16)(const SkBitmapProcState&, |
59 const uint32_t[], | 59 const uint32_t[], |
60 int count, | 60 int count, |
61 uint16_t colors[]); | 61 uint16_t colors[]); |
62 | 62 |
63 typedef U16CPU (*FixedTileProc)(SkFixed); // returns 0..0xFFFF | 63 typedef U16CPU (*FixedTileProc)(SkFixed); // returns 0..0xFFFF |
64 typedef U16CPU (*FixedTileLowBitsProc)(SkFixed, int); // returns 0..0xF | 64 typedef U16CPU (*FixedTileLowBitsProc)(SkFixed, int); // returns 0..0xF |
65 typedef U16CPU (*IntTileProc)(int value, int count); // returns 0..count-1 | 65 typedef U16CPU (*IntTileProc)(int value, int count); // returns 0..count-1 |
66 | 66 |
67 const SkBitmap* fBitmap; // chooseProcs - orig or mip | 67 const SkBitmap* fBitmap; // chooseProcs - orig or scaled |
68 const SkMatrix* fInvMatrix; // chooseProcs | 68 SkMatrix fInvMatrix; // chooseProcs |
69 SkMatrix::MapXYProc fInvProc; // chooseProcs | 69 SkMatrix::MapXYProc fInvProc; // chooseProcs |
70 | 70 |
71 SkFractionalInt fInvSxFractionalInt; | 71 SkFractionalInt fInvSxFractionalInt; |
72 SkFractionalInt fInvKyFractionalInt; | 72 SkFractionalInt fInvKyFractionalInt; |
73 | 73 |
74 FixedTileProc fTileProcX; // chooseProcs | 74 FixedTileProc fTileProcX; // chooseProcs |
75 FixedTileProc fTileProcY; // chooseProcs | 75 FixedTileProc fTileProcY; // chooseProcs |
76 FixedTileLowBitsProc fTileLowBitsProcX; // chooseProcs | 76 FixedTileLowBitsProc fTileLowBitsProcX; // chooseProcs |
77 FixedTileLowBitsProc fTileLowBitsProcY; // chooseProcs | 77 FixedTileLowBitsProc fTileLowBitsProcY; // chooseProcs |
78 IntTileProc fIntTileProcY; // chooseProcs | 78 IntTileProc fIntTileProcY; // chooseProcs |
79 SkFixed fFilterOneX; | 79 SkFixed fFilterOneX; |
80 SkFixed fFilterOneY; | 80 SkFixed fFilterOneY; |
81 | 81 |
82 SkPMColor fPaintPMColor; // chooseProcs - A8 config | 82 SkPMColor fPaintPMColor; // chooseProcs - A8 config |
83 SkFixed fInvSx; // chooseProcs | 83 SkFixed fInvSx; // chooseProcs |
84 SkFixed fInvKy; // chooseProcs | 84 SkFixed fInvKy; // chooseProcs |
85 uint16_t fAlphaScale; // chooseProcs | 85 uint16_t fAlphaScale; // chooseProcs |
86 uint8_t fInvType; // chooseProcs | 86 uint8_t fInvType; // chooseProcs |
87 uint8_t fTileModeX; // CONSTRUCTOR | 87 uint8_t fTileModeX; // CONSTRUCTOR |
88 uint8_t fTileModeY; // CONSTRUCTOR | 88 uint8_t fTileModeY; // CONSTRUCTOR |
89 SkBool8 fDoFilter; // chooseProcs | 89 |
| 90 enum { |
| 91 kNone_BitmapFilter, |
| 92 kBilerp_BitmapFilter, |
| 93 kHQ_BitmapFilter |
| 94 } fFilterQuality; // chooseProcs |
| 95 |
| 96 /** The shader will let us know when we can release some of our resources |
| 97 * like scaled bitmaps. |
| 98 */ |
| 99 |
| 100 void endContext(); |
90 | 101 |
91 /** Platforms implement this, and can optionally overwrite only the | 102 /** Platforms implement this, and can optionally overwrite only the |
92 following fields: | 103 following fields: |
93 | 104 |
94 fShaderProc32 | 105 fShaderProc32 |
95 fShaderProc16 | 106 fShaderProc16 |
96 fMatrixProc | 107 fMatrixProc |
97 fSampleProc32 | 108 fSampleProc32 |
98 fSampleProc32 | 109 fSampleProc32 |
99 | 110 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 private: | 144 private: |
134 friend class SkBitmapProcShader; | 145 friend class SkBitmapProcShader; |
135 | 146 |
136 ShaderProc32 fShaderProc32; // chooseProcs | 147 ShaderProc32 fShaderProc32; // chooseProcs |
137 ShaderProc16 fShaderProc16; // chooseProcs | 148 ShaderProc16 fShaderProc16; // chooseProcs |
138 // These are used if the shaderproc is NULL | 149 // These are used if the shaderproc is NULL |
139 MatrixProc fMatrixProc; // chooseProcs | 150 MatrixProc fMatrixProc; // chooseProcs |
140 SampleProc32 fSampleProc32; // chooseProcs | 151 SampleProc32 fSampleProc32; // chooseProcs |
141 SampleProc16 fSampleProc16; // chooseProcs | 152 SampleProc16 fSampleProc16; // chooseProcs |
142 | 153 |
143 SkMatrix fUnitInvMatrix; // chooseProcs | |
144 SkBitmap fOrigBitmap; // CONSTRUCTOR | 154 SkBitmap fOrigBitmap; // CONSTRUCTOR |
145 SkBitmap fMipBitmap; | 155 SkBitmap fScaledBitmap; // chooseProcs |
146 | 156 |
147 MatrixProc chooseMatrixProc(bool trivial_matrix); | 157 MatrixProc chooseMatrixProc(bool trivial_matrix); |
148 bool chooseProcs(const SkMatrix& inv, const SkPaint&); | 158 bool chooseProcs(const SkMatrix& inv, const SkPaint&); |
149 ShaderProc32 chooseShaderProc32(); | 159 ShaderProc32 chooseShaderProc32(); |
150 | 160 |
151 void buildFilterCoefficients(SkFixed dst[4], float t) const; | 161 void possiblyScaleImage(); |
| 162 |
152 SkBitmapFilter *fBitmapFilter; | 163 SkBitmapFilter *fBitmapFilter; |
153 | 164 |
154 ShaderProc32 chooseBitmapFilterProc(const SkPaint &paint); | 165 ShaderProc32 chooseBitmapFilterProc(); |
155 | 166 |
156 // Return false if we failed to setup for fast translate (e.g. overflow) | 167 // Return false if we failed to setup for fast translate (e.g. overflow) |
157 bool setupForTranslate(); | 168 bool setupForTranslate(); |
158 | 169 |
159 #ifdef SK_DEBUG | 170 #ifdef SK_DEBUG |
160 static void DebugMatrixProc(const SkBitmapProcState&, | 171 static void DebugMatrixProc(const SkBitmapProcState&, |
161 uint32_t[], int count, int x, int y); | 172 uint32_t[], int count, int x, int y); |
162 #endif | 173 #endif |
163 }; | 174 }; |
164 | 175 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 void S32_D16_filter_DX(const SkBitmapProcState& s, | 218 void S32_D16_filter_DX(const SkBitmapProcState& s, |
208 const uint32_t* xy, int count, uint16_t* colo
rs); | 219 const uint32_t* xy, int count, uint16_t* colo
rs); |
209 | 220 |
210 void highQualityFilter_ScaleOnly(const SkBitmapProcState &s, int x, int y, | 221 void highQualityFilter_ScaleOnly(const SkBitmapProcState &s, int x, int y, |
211 SkPMColor *SK_RESTRICT colors, int count); | 222 SkPMColor *SK_RESTRICT colors, int count); |
212 void highQualityFilter(const SkBitmapProcState &s, int x, int y, | 223 void highQualityFilter(const SkBitmapProcState &s, int x, int y, |
213 SkPMColor *SK_RESTRICT colors, int count); | 224 SkPMColor *SK_RESTRICT colors, int count); |
214 | 225 |
215 | 226 |
216 #endif | 227 #endif |
OLD | NEW |