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 "SkMatrix.h" | 15 #include "SkMatrix.h" |
15 | 16 |
16 #define FractionalInt_IS_64BIT | 17 #define FractionalInt_IS_64BIT |
17 | 18 |
18 #ifdef FractionalInt_IS_64BIT | 19 #ifdef FractionalInt_IS_64BIT |
19 typedef SkFixed48 SkFractionalInt; | 20 typedef SkFixed48 SkFractionalInt; |
20 #define SkScalarToFractionalInt(x) SkScalarToFixed48(x) | 21 #define SkScalarToFractionalInt(x) SkScalarToFixed48(x) |
21 #define SkFractionalIntToFixed(x) SkFixed48ToFixed(x) | 22 #define SkFractionalIntToFixed(x) SkFixed48ToFixed(x) |
22 #define SkFixedToFractionalInt(x) SkFixedToFixed48(x) | 23 #define SkFixedToFractionalInt(x) SkFixedToFixed48(x) |
23 #define SkFractionalIntToInt(x) SkFixed48ToInt(x) | 24 #define SkFractionalIntToInt(x) SkFixed48ToInt(x) |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 107 |
107 Only valid to call after chooseProcs (setContext) has been called. It is | 108 Only valid to call after chooseProcs (setContext) has been called. It is |
108 safe to call this inside the shader's shadeSpan() method. | 109 safe to call this inside the shader's shadeSpan() method. |
109 */ | 110 */ |
110 int maxCountForBufferSize(size_t bufferSize) const; | 111 int maxCountForBufferSize(size_t bufferSize) const; |
111 | 112 |
112 // If a shader proc is present, then the corresponding matrix/sample procs | 113 // If a shader proc is present, then the corresponding matrix/sample procs |
113 // are ignored | 114 // are ignored |
114 ShaderProc32 getShaderProc32() const { return fShaderProc32; } | 115 ShaderProc32 getShaderProc32() const { return fShaderProc32; } |
115 ShaderProc16 getShaderProc16() const { return fShaderProc16; } | 116 ShaderProc16 getShaderProc16() const { return fShaderProc16; } |
| 117 |
| 118 SkBitmapFilter* getBitmapFilter() const { return fBitmapFilter; } |
116 | 119 |
117 #ifdef SK_DEBUG | 120 #ifdef SK_DEBUG |
118 MatrixProc getMatrixProc() const; | 121 MatrixProc getMatrixProc() const; |
119 #else | 122 #else |
120 MatrixProc getMatrixProc() const { return fMatrixProc; } | 123 MatrixProc getMatrixProc() const { return fMatrixProc; } |
121 #endif | 124 #endif |
122 SampleProc32 getSampleProc32() const { return fSampleProc32; } | 125 SampleProc32 getSampleProc32() const { return fSampleProc32; } |
123 SampleProc16 getSampleProc16() const { return fSampleProc16; } | 126 SampleProc16 getSampleProc16() const { return fSampleProc16; } |
124 | 127 |
125 private: | 128 private: |
126 friend class SkBitmapProcShader; | 129 friend class SkBitmapProcShader; |
127 | 130 |
128 ShaderProc32 fShaderProc32; // chooseProcs | 131 ShaderProc32 fShaderProc32; // chooseProcs |
129 ShaderProc16 fShaderProc16; // chooseProcs | 132 ShaderProc16 fShaderProc16; // chooseProcs |
130 // These are used if the shaderproc is NULL | 133 // These are used if the shaderproc is NULL |
131 MatrixProc fMatrixProc; // chooseProcs | 134 MatrixProc fMatrixProc; // chooseProcs |
132 SampleProc32 fSampleProc32; // chooseProcs | 135 SampleProc32 fSampleProc32; // chooseProcs |
133 SampleProc16 fSampleProc16; // chooseProcs | 136 SampleProc16 fSampleProc16; // chooseProcs |
134 | 137 |
135 SkMatrix fUnitInvMatrix; // chooseProcs | 138 SkMatrix fUnitInvMatrix; // chooseProcs |
136 SkBitmap fOrigBitmap; // CONSTRUCTOR | 139 SkBitmap fOrigBitmap; // CONSTRUCTOR |
137 SkBitmap fMipBitmap; | 140 SkBitmap fMipBitmap; |
138 | 141 |
139 MatrixProc chooseMatrixProc(bool trivial_matrix); | 142 MatrixProc chooseMatrixProc(bool trivial_matrix); |
140 bool chooseProcs(const SkMatrix& inv, const SkPaint&); | 143 bool chooseProcs(const SkMatrix& inv, const SkPaint&); |
141 ShaderProc32 chooseShaderProc32(); | 144 ShaderProc32 chooseShaderProc32(); |
| 145 |
| 146 void buildFilterCoefficients(SkFixed dst[4], float t) const; |
| 147 SkBitmapFilter *fBitmapFilter; |
142 | 148 |
143 | 149 ShaderProc32 chooseBitmapFilterProc(const SkPaint &paint); |
144 /** test method for choosing a bicubic shading filter | |
145 */ | |
146 | |
147 ShaderProc32 chooseBicubicFilterProc(const SkPaint &paint); | |
148 | 150 |
149 // Return false if we failed to setup for fast translate (e.g. overflow) | 151 // Return false if we failed to setup for fast translate (e.g. overflow) |
150 bool setupForTranslate(); | 152 bool setupForTranslate(); |
151 | 153 |
152 #ifdef SK_DEBUG | 154 #ifdef SK_DEBUG |
153 static void DebugMatrixProc(const SkBitmapProcState&, | 155 static void DebugMatrixProc(const SkBitmapProcState&, |
154 uint32_t[], int count, int x, int y); | 156 uint32_t[], int count, int x, int y); |
155 #endif | 157 #endif |
156 }; | 158 }; |
157 | 159 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 int count, int x, int y); | 195 int count, int x, int y); |
194 void ClampX_ClampY_nofilter_scale(const SkBitmapProcState& s, uint32_t xy[], | 196 void ClampX_ClampY_nofilter_scale(const SkBitmapProcState& s, uint32_t xy[], |
195 int count, int x, int y); | 197 int count, int x, int y); |
196 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s, | 198 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s, |
197 uint32_t xy[], int count, int x, int y); | 199 uint32_t xy[], int count, int x, int y); |
198 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, | 200 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, |
199 uint32_t xy[], int count, int x, int y); | 201 uint32_t xy[], int count, int x, int y); |
200 void S32_D16_filter_DX(const SkBitmapProcState& s, | 202 void S32_D16_filter_DX(const SkBitmapProcState& s, |
201 const uint32_t* xy, int count, uint16_t* colo
rs); | 203 const uint32_t* xy, int count, uint16_t* colo
rs); |
202 | 204 |
| 205 void highQualityFilter_ScaleOnly(const SkBitmapProcState &s, int x, int y, |
| 206 SkPMColor *SK_RESTRICT colors, int count); |
| 207 void highQualityFilter(const SkBitmapProcState &s, int x, int y, |
| 208 SkPMColor *SK_RESTRICT colors, int count); |
| 209 |
| 210 |
203 #endif | 211 #endif |
OLD | NEW |