Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/core/SkBitmapProcState_procs.h

Issue 303543009: replace config() with colorType() (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 // Define NAME_WRAP(x) before including this header to perform name-wrapping 9 // Define NAME_WRAP(x) before including this header to perform name-wrapping
10 // E.g. for ARM NEON, defined it as 'x ## _neon' to ensure all important 10 // E.g. for ARM NEON, defined it as 'x ## _neon' to ensure all important
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 * 83 *
84 */ 84 */
85 85
86 // SRC == 8888 86 // SRC == 8888
87 87
88 #define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_opaque)(x, y, a , b, c, d, dst) 88 #define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_opaque)(x, y, a , b, c, d, dst)
89 89
90 #define MAKENAME(suffix) NAME_WRAP(S32_opaque_D32 ## suffix) 90 #define MAKENAME(suffix) NAME_WRAP(S32_opaque_D32 ## suffix)
91 #define DSTSIZE 32 91 #define DSTSIZE 32
92 #define SRCTYPE SkPMColor 92 #define SRCTYPE SkPMColor
93 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kA RGB_8888_Config); \ 93 #define CHECKSTATE(state) SkASSERT(4 == state.fBitmap->bytesPerPixel()); \
94 SkASSERT(state.fAlphaScale == 256) 94 SkASSERT(state.fAlphaScale == 256)
95 #define RETURNDST(src) src 95 #define RETURNDST(src) src
96 #define SRC_TO_FILTER(src) src 96 #define SRC_TO_FILTER(src) src
97 #include "SkBitmapProcState_sample.h" 97 #include "SkBitmapProcState_sample.h"
98 98
99 #undef FILTER_PROC 99 #undef FILTER_PROC
100 #define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_alpha)(x, y, a, b, c, d, dst, alphaScale) 100 #define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_alpha)(x, y, a, b, c, d, dst, alphaScale)
101 101
102 #define MAKENAME(suffix) NAME_WRAP(S32_alpha_D32 ## suffix) 102 #define MAKENAME(suffix) NAME_WRAP(S32_alpha_D32 ## suffix)
103 #define DSTSIZE 32 103 #define DSTSIZE 32
104 #define SRCTYPE SkPMColor 104 #define SRCTYPE SkPMColor
105 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kA RGB_8888_Config); \ 105 #define CHECKSTATE(state) SkASSERT(4 == state.fBitmap->bytesPerPixel()); \
106 SkASSERT(state.fAlphaScale < 256) 106 SkASSERT(state.fAlphaScale < 256)
107 #define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale 107 #define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale
108 #define RETURNDST(src) SkAlphaMulQ(src, alphaScale) 108 #define RETURNDST(src) SkAlphaMulQ(src, alphaScale)
109 #define SRC_TO_FILTER(src) src 109 #define SRC_TO_FILTER(src) src
110 #include "SkBitmapProcState_sample.h" 110 #include "SkBitmapProcState_sample.h"
111 111
112 // SRC == 565 112 // SRC == 565
113 113
114 #undef FILTER_PROC 114 #undef FILTER_PROC
115 #define FILTER_PROC(x, y, a, b, c, d, dst) \ 115 #define FILTER_PROC(x, y, a, b, c, d, dst) \
116 do { \ 116 do { \
117 uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \ 117 uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \
118 *(dst) = SkExpanded_565_To_PMColor(tmp); \ 118 *(dst) = SkExpanded_565_To_PMColor(tmp); \
119 } while (0) 119 } while (0)
120 120
121 #define MAKENAME(suffix) NAME_WRAP(S16_opaque_D32 ## suffix) 121 #define MAKENAME(suffix) NAME_WRAP(S16_opaque_D32 ## suffix)
122 #define DSTSIZE 32 122 #define DSTSIZE 32
123 #define SRCTYPE uint16_t 123 #define SRCTYPE uint16_t
124 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kR GB_565_Config); \ 124 #define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fBitmap-> colorType()); \
125 SkASSERT(state.fAlphaScale == 256) 125 SkASSERT(state.fAlphaScale == 256)
126 #define RETURNDST(src) SkPixel16ToPixel32(src) 126 #define RETURNDST(src) SkPixel16ToPixel32(src)
127 #define SRC_TO_FILTER(src) src 127 #define SRC_TO_FILTER(src) src
128 #include "SkBitmapProcState_sample.h" 128 #include "SkBitmapProcState_sample.h"
129 129
130 #undef FILTER_PROC 130 #undef FILTER_PROC
131 #define FILTER_PROC(x, y, a, b, c, d, dst) \ 131 #define FILTER_PROC(x, y, a, b, c, d, dst) \
132 do { \ 132 do { \
133 uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \ 133 uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \
134 *(dst) = SkAlphaMulQ(SkExpanded_565_To_PMColor(tmp), alphaScale); \ 134 *(dst) = SkAlphaMulQ(SkExpanded_565_To_PMColor(tmp), alphaScale); \
135 } while (0) 135 } while (0)
136 136
137 #define MAKENAME(suffix) NAME_WRAP(S16_alpha_D32 ## suffix) 137 #define MAKENAME(suffix) NAME_WRAP(S16_alpha_D32 ## suffix)
138 #define DSTSIZE 32 138 #define DSTSIZE 32
139 #define SRCTYPE uint16_t 139 #define SRCTYPE uint16_t
140 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kR GB_565_Config); \ 140 #define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fBitmap-> colorType()); \
141 SkASSERT(state.fAlphaScale < 256) 141 SkASSERT(state.fAlphaScale < 256)
142 #define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale 142 #define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale
143 #define RETURNDST(src) SkAlphaMulQ(SkPixel16ToPixel32(src), alphaScale) 143 #define RETURNDST(src) SkAlphaMulQ(SkPixel16ToPixel32(src), alphaScale)
144 #define SRC_TO_FILTER(src) src 144 #define SRC_TO_FILTER(src) src
145 #include "SkBitmapProcState_sample.h" 145 #include "SkBitmapProcState_sample.h"
146 146
147 // SRC == Index8 147 // SRC == Index8
148 148
149 #undef FILTER_PROC 149 #undef FILTER_PROC
150 #define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_opaque)(x, y, a , b, c, d, dst) 150 #define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_opaque)(x, y, a , b, c, d, dst)
151 151
152 #define MAKENAME(suffix) NAME_WRAP(SI8_opaque_D32 ## suffix) 152 #define MAKENAME(suffix) NAME_WRAP(SI8_opaque_D32 ## suffix)
153 #define DSTSIZE 32 153 #define DSTSIZE 32
154 #define SRCTYPE uint8_t 154 #define SRCTYPE uint8_t
155 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kI ndex8_Config); \ 155 #define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap-> colorType()); \
156 SkASSERT(state.fAlphaScale == 256) 156 SkASSERT(state.fAlphaScale == 256)
157 #define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitm ap->getColorTable()->lockColors() 157 #define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitm ap->getColorTable()->lockColors()
158 #define RETURNDST(src) table[src] 158 #define RETURNDST(src) table[src]
159 #define SRC_TO_FILTER(src) table[src] 159 #define SRC_TO_FILTER(src) table[src]
160 #define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors() 160 #define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors()
161 #include "SkBitmapProcState_sample.h" 161 #include "SkBitmapProcState_sample.h"
162 162
163 #undef FILTER_PROC 163 #undef FILTER_PROC
164 #define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_alpha)(x, y, a, b, c, d, dst, alphaScale) 164 #define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_alpha)(x, y, a, b, c, d, dst, alphaScale)
165 165
166 #define MAKENAME(suffix) NAME_WRAP(SI8_alpha_D32 ## suffix) 166 #define MAKENAME(suffix) NAME_WRAP(SI8_alpha_D32 ## suffix)
167 #define DSTSIZE 32 167 #define DSTSIZE 32
168 #define SRCTYPE uint8_t 168 #define SRCTYPE uint8_t
169 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kI ndex8_Config); \ 169 #define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap-> colorType()); \
170 SkASSERT(state.fAlphaScale < 256) 170 SkASSERT(state.fAlphaScale < 256)
171 #define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale; \ 171 #define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale; \
172 const SkPMColor* SK_RESTRICT table = state.fBitm ap->getColorTable()->lockColors() 172 const SkPMColor* SK_RESTRICT table = state.fBitm ap->getColorTable()->lockColors()
173 #define RETURNDST(src) SkAlphaMulQ(table[src], alphaScale) 173 #define RETURNDST(src) SkAlphaMulQ(table[src], alphaScale)
174 #define SRC_TO_FILTER(src) table[src] 174 #define SRC_TO_FILTER(src) table[src]
175 #define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors() 175 #define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors()
176 #include "SkBitmapProcState_sample.h" 176 #include "SkBitmapProcState_sample.h"
177 177
178 // SRC == 4444 178 // SRC == 4444
179 179
180 #undef FILTER_PROC 180 #undef FILTER_PROC
181 #define FILTER_PROC(x, y, a, b, c, d, dst) *(dst) = Filter_4444_D32(x, y, a, b, c, d) 181 #define FILTER_PROC(x, y, a, b, c, d, dst) *(dst) = Filter_4444_D32(x, y, a, b, c, d)
182 182
183 #define MAKENAME(suffix) NAME_WRAP(S4444_opaque_D32 ## suffix) 183 #define MAKENAME(suffix) NAME_WRAP(S4444_opaque_D32 ## suffix)
184 #define DSTSIZE 32 184 #define DSTSIZE 32
185 #define SRCTYPE SkPMColor16 185 #define SRCTYPE SkPMColor16
186 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kA RGB_4444_Config); \ 186 #define CHECKSTATE(state) SkASSERT(kARGB_4444_SkColorType == state.fBitmap ->colorType()); \
187 SkASSERT(state.fAlphaScale == 256) 187 SkASSERT(state.fAlphaScale == 256)
188 #define RETURNDST(src) SkPixel4444ToPixel32(src) 188 #define RETURNDST(src) SkPixel4444ToPixel32(src)
189 #define SRC_TO_FILTER(src) src 189 #define SRC_TO_FILTER(src) src
190 #include "SkBitmapProcState_sample.h" 190 #include "SkBitmapProcState_sample.h"
191 191
192 #undef FILTER_PROC 192 #undef FILTER_PROC
193 #define FILTER_PROC(x, y, a, b, c, d, dst) \ 193 #define FILTER_PROC(x, y, a, b, c, d, dst) \
194 do { \ 194 do { \
195 uint32_t tmp = Filter_4444_D32(x, y, a, b, c, d); \ 195 uint32_t tmp = Filter_4444_D32(x, y, a, b, c, d); \
196 *(dst) = SkAlphaMulQ(tmp, alphaScale); \ 196 *(dst) = SkAlphaMulQ(tmp, alphaScale); \
197 } while (0) 197 } while (0)
198 198
199 #define MAKENAME(suffix) NAME_WRAP(S4444_alpha_D32 ## suffix) 199 #define MAKENAME(suffix) NAME_WRAP(S4444_alpha_D32 ## suffix)
200 #define DSTSIZE 32 200 #define DSTSIZE 32
201 #define SRCTYPE SkPMColor16 201 #define SRCTYPE SkPMColor16
202 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kA RGB_4444_Config); \ 202 #define CHECKSTATE(state) SkASSERT(kARGB_4444_SkColorType == state.fBitmap ->colorType()); \
203 SkASSERT(state.fAlphaScale < 256) 203 SkASSERT(state.fAlphaScale < 256)
204 #define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale 204 #define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale
205 #define RETURNDST(src) SkAlphaMulQ(SkPixel4444ToPixel32(src), alphaScal e) 205 #define RETURNDST(src) SkAlphaMulQ(SkPixel4444ToPixel32(src), alphaScal e)
206 #define SRC_TO_FILTER(src) src 206 #define SRC_TO_FILTER(src) src
207 #include "SkBitmapProcState_sample.h" 207 #include "SkBitmapProcState_sample.h"
208 208
209 // SRC == A8 209 // SRC == A8
210 210
211 #undef FILTER_PROC 211 #undef FILTER_PROC
212 #define FILTER_PROC(x, y, a, b, c, d, dst) \ 212 #define FILTER_PROC(x, y, a, b, c, d, dst) \
213 do { \ 213 do { \
214 unsigned tmp = Filter_8(x, y, a, b, c, d); \ 214 unsigned tmp = Filter_8(x, y, a, b, c, d); \
215 *(dst) = SkAlphaMulQ(pmColor, SkAlpha255To256(tmp)); \ 215 *(dst) = SkAlphaMulQ(pmColor, SkAlpha255To256(tmp)); \
216 } while (0) 216 } while (0)
217 217
218 #define MAKENAME(suffix) NAME_WRAP(SA8_alpha_D32 ## suffix) 218 #define MAKENAME(suffix) NAME_WRAP(SA8_alpha_D32 ## suffix)
219 #define DSTSIZE 32 219 #define DSTSIZE 32
220 #define SRCTYPE uint8_t 220 #define SRCTYPE uint8_t
221 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kA 8_Config); 221 #define CHECKSTATE(state) SkASSERT(kAlpha_8_SkColorType == state.fBitmap-> colorType());
222 #define PREAMBLE(state) const SkPMColor pmColor = state.fPaintPMColor; 222 #define PREAMBLE(state) const SkPMColor pmColor = state.fPaintPMColor;
223 #define RETURNDST(src) SkAlphaMulQ(pmColor, SkAlpha255To256(src)) 223 #define RETURNDST(src) SkAlphaMulQ(pmColor, SkAlpha255To256(src))
224 #define SRC_TO_FILTER(src) src 224 #define SRC_TO_FILTER(src) src
225 #include "SkBitmapProcState_sample.h" 225 #include "SkBitmapProcState_sample.h"
226 226
227 /***************************************************************************** 227 /*****************************************************************************
228 * 228 *
229 * D16 functions 229 * D16 functions
230 * 230 *
231 */ 231 */
232 232
233 // SRC == 8888 233 // SRC == 8888
234 234
235 #undef FILTER_PROC 235 #undef FILTER_PROC
236 #define FILTER_PROC(x, y, a, b, c, d, dst) \ 236 #define FILTER_PROC(x, y, a, b, c, d, dst) \
237 do { \ 237 do { \
238 SkPMColor dstColor; \ 238 SkPMColor dstColor; \
239 NAME_WRAP(Filter_32_opaque)(x, y, a, b, c, d, &dstColor); \ 239 NAME_WRAP(Filter_32_opaque)(x, y, a, b, c, d, &dstColor); \
240 (*dst) = SkPixel32ToPixel16(dstColor); \ 240 (*dst) = SkPixel32ToPixel16(dstColor); \
241 } while (0) 241 } while (0)
242 242
243 #define MAKENAME(suffix) NAME_WRAP(S32_D16 ## suffix) 243 #define MAKENAME(suffix) NAME_WRAP(S32_D16 ## suffix)
244 #define DSTSIZE 16 244 #define DSTSIZE 16
245 #define SRCTYPE SkPMColor 245 #define SRCTYPE SkPMColor
246 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kA RGB_8888_Config); \ 246 #define CHECKSTATE(state) SkASSERT(4 == state.fBitmap->bytesPerPixel()); \
247 SkASSERT(state.fBitmap->isOpaque()) 247 SkASSERT(state.fBitmap->isOpaque())
248 #define RETURNDST(src) SkPixel32ToPixel16(src) 248 #define RETURNDST(src) SkPixel32ToPixel16(src)
249 #define SRC_TO_FILTER(src) src 249 #define SRC_TO_FILTER(src) src
250 #include "SkBitmapProcState_sample.h" 250 #include "SkBitmapProcState_sample.h"
251 251
252 // SRC == 565 252 // SRC == 565
253 253
254 #undef FILTER_PROC 254 #undef FILTER_PROC
255 #define FILTER_PROC(x, y, a, b, c, d, dst) \ 255 #define FILTER_PROC(x, y, a, b, c, d, dst) \
256 do { \ 256 do { \
257 uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \ 257 uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \
258 *(dst) = SkCompact_rgb_16((tmp) >> 5); \ 258 *(dst) = SkCompact_rgb_16((tmp) >> 5); \
259 } while (0) 259 } while (0)
260 260
261 #define MAKENAME(suffix) NAME_WRAP(S16_D16 ## suffix) 261 #define MAKENAME(suffix) NAME_WRAP(S16_D16 ## suffix)
262 #define DSTSIZE 16 262 #define DSTSIZE 16
263 #define SRCTYPE uint16_t 263 #define SRCTYPE uint16_t
264 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kR GB_565_Config) 264 #define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fBitmap-> colorType())
265 #define RETURNDST(src) src 265 #define RETURNDST(src) src
266 #define SRC_TO_FILTER(src) src 266 #define SRC_TO_FILTER(src) src
267 #include "SkBitmapProcState_sample.h" 267 #include "SkBitmapProcState_sample.h"
268 268
269 // SRC == Index8 269 // SRC == Index8
270 270
271 #undef FILTER_PROC 271 #undef FILTER_PROC
272 #define FILTER_PROC(x, y, a, b, c, d, dst) \ 272 #define FILTER_PROC(x, y, a, b, c, d, dst) \
273 do { \ 273 do { \
274 uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \ 274 uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \
275 *(dst) = SkCompact_rgb_16((tmp) >> 5); \ 275 *(dst) = SkCompact_rgb_16((tmp) >> 5); \
276 } while (0) 276 } while (0)
277 277
278 #define MAKENAME(suffix) NAME_WRAP(SI8_D16 ## suffix) 278 #define MAKENAME(suffix) NAME_WRAP(SI8_D16 ## suffix)
279 #define DSTSIZE 16 279 #define DSTSIZE 16
280 #define SRCTYPE uint8_t 280 #define SRCTYPE uint8_t
281 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kI ndex8_Config); \ 281 #define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap-> colorType()); \
282 SkASSERT(state.fBitmap->isOpaque()) 282 SkASSERT(state.fBitmap->isOpaque())
283 #define PREAMBLE(state) const uint16_t* SK_RESTRICT table = state.fBitma p->getColorTable()->lock16BitCache() 283 #define PREAMBLE(state) const uint16_t* SK_RESTRICT table = state.fBitma p->getColorTable()->lock16BitCache()
284 #define RETURNDST(src) table[src] 284 #define RETURNDST(src) table[src]
285 #define SRC_TO_FILTER(src) table[src] 285 #define SRC_TO_FILTER(src) table[src]
286 #define POSTAMBLE(state) state.fBitmap->getColorTable()->unlock16BitCache () 286 #define POSTAMBLE(state) state.fBitmap->getColorTable()->unlock16BitCache ()
287 #include "SkBitmapProcState_sample.h" 287 #include "SkBitmapProcState_sample.h"
288 288
289 /////////////////////////////////////////////////////////////////////////////// 289 ///////////////////////////////////////////////////////////////////////////////
290 290
291 #undef FILTER_PROC 291 #undef FILTER_PROC
292 #define FILTER_PROC(x, y, a, b, c, d, dst) \ 292 #define FILTER_PROC(x, y, a, b, c, d, dst) \
293 do { \ 293 do { \
294 uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \ 294 uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \
295 *(dst) = SkCompact_rgb_16((tmp) >> 5); \ 295 *(dst) = SkCompact_rgb_16((tmp) >> 5); \
296 } while (0) 296 } while (0)
297 297
298 298
299 // clamp 299 // clamp
300 300
301 #define TILEX_PROCF(fx, max) SkClampMax((fx) >> 16, max) 301 #define TILEX_PROCF(fx, max) SkClampMax((fx) >> 16, max)
302 #define TILEY_PROCF(fy, max) SkClampMax((fy) >> 16, max) 302 #define TILEY_PROCF(fy, max) SkClampMax((fy) >> 16, max)
303 #define TILEX_LOW_BITS(fx, max) (((fx) >> 12) & 0xF) 303 #define TILEX_LOW_BITS(fx, max) (((fx) >> 12) & 0xF)
304 #define TILEY_LOW_BITS(fy, max) (((fy) >> 12) & 0xF) 304 #define TILEY_LOW_BITS(fy, max) (((fy) >> 12) & 0xF)
305 305
306 #define MAKENAME(suffix) NAME_WRAP(Clamp_S16_D16 ## suffix) 306 #define MAKENAME(suffix) NAME_WRAP(Clamp_S16_D16 ## suffix)
307 #define SRCTYPE uint16_t 307 #define SRCTYPE uint16_t
308 #define DSTTYPE uint16_t 308 #define DSTTYPE uint16_t
309 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kR GB_565_Config) 309 #define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fBitmap-> colorType())
310 #define SRC_TO_FILTER(src) src 310 #define SRC_TO_FILTER(src) src
311 #include "SkBitmapProcState_shaderproc.h" 311 #include "SkBitmapProcState_shaderproc.h"
312 312
313 313
314 #define TILEX_PROCF(fx, max) (((fx) & 0xFFFF) * ((max) + 1) >> 16) 314 #define TILEX_PROCF(fx, max) (((fx) & 0xFFFF) * ((max) + 1) >> 16)
315 #define TILEY_PROCF(fy, max) (((fy) & 0xFFFF) * ((max) + 1) >> 16) 315 #define TILEY_PROCF(fy, max) (((fy) & 0xFFFF) * ((max) + 1) >> 16)
316 #define TILEX_LOW_BITS(fx, max) ((((fx) & 0xFFFF) * ((max) + 1) >> 12) & 0xF) 316 #define TILEX_LOW_BITS(fx, max) ((((fx) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
317 #define TILEY_LOW_BITS(fy, max) ((((fy) & 0xFFFF) * ((max) + 1) >> 12) & 0xF) 317 #define TILEY_LOW_BITS(fy, max) ((((fy) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
318 318
319 #define MAKENAME(suffix) NAME_WRAP(Repeat_S16_D16 ## suffix) 319 #define MAKENAME(suffix) NAME_WRAP(Repeat_S16_D16 ## suffix)
320 #define SRCTYPE uint16_t 320 #define SRCTYPE uint16_t
321 #define DSTTYPE uint16_t 321 #define DSTTYPE uint16_t
322 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kR GB_565_Config) 322 #define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fBitmap-> colorType())
323 #define SRC_TO_FILTER(src) src 323 #define SRC_TO_FILTER(src) src
324 #include "SkBitmapProcState_shaderproc.h" 324 #include "SkBitmapProcState_shaderproc.h"
325 325
326 326
327 #define TILEX_PROCF(fx, max) SkClampMax((fx) >> 16, max) 327 #define TILEX_PROCF(fx, max) SkClampMax((fx) >> 16, max)
328 #define TILEY_PROCF(fy, max) SkClampMax((fy) >> 16, max) 328 #define TILEY_PROCF(fy, max) SkClampMax((fy) >> 16, max)
329 #define TILEX_LOW_BITS(fx, max) (((fx) >> 12) & 0xF) 329 #define TILEX_LOW_BITS(fx, max) (((fx) >> 12) & 0xF)
330 #define TILEY_LOW_BITS(fy, max) (((fy) >> 12) & 0xF) 330 #define TILEY_LOW_BITS(fy, max) (((fy) >> 12) & 0xF)
331 331
332 #undef FILTER_PROC 332 #undef FILTER_PROC
333 #define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_opaque)(x, y, a , b, c, d, dst) 333 #define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_opaque)(x, y, a , b, c, d, dst)
334 #define MAKENAME(suffix) NAME_WRAP(Clamp_SI8_opaque_D32 ## suffix) 334 #define MAKENAME(suffix) NAME_WRAP(Clamp_SI8_opaque_D32 ## suffix)
335 #define SRCTYPE uint8_t 335 #define SRCTYPE uint8_t
336 #define DSTTYPE uint32_t 336 #define DSTTYPE uint32_t
337 #define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kI ndex8_Config) 337 #define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap-> colorType())
338 #define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitm ap->getColorTable()->lockColors() 338 #define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitm ap->getColorTable()->lockColors()
339 #define SRC_TO_FILTER(src) table[src] 339 #define SRC_TO_FILTER(src) table[src]
340 #define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors() 340 #define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors()
341 #include "SkBitmapProcState_shaderproc.h" 341 #include "SkBitmapProcState_shaderproc.h"
342 342
343 #undef NAME_WRAP 343 #undef NAME_WRAP
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698