OLD | NEW |
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(kAlpha_8_SkColorType == state.fBitmap->
colorType()); | 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 // SRC == Gray8 |
| 228 |
| 229 #undef FILTER_PROC |
| 230 #define FILTER_PROC(x, y, a, b, c, d, dst) \ |
| 231 do { \ |
| 232 unsigned tmp = Filter_8(x, y, a, b, c, d); \ |
| 233 SkPMColor color = SkPackARGB32(0xFF, tmp, tmp, tmp); \ |
| 234 *(dst) = SkAlphaMulQ(color, alphaScale); \ |
| 235 } while (0) |
| 236 |
| 237 #define MAKENAME(suffix) NAME_WRAP(SG8_alpha_D32 ## suffix) |
| 238 #define DSTSIZE 32 |
| 239 #define SRCTYPE uint8_t |
| 240 #define CHECKSTATE(state) SkASSERT(kGray_8_SkColorType == state.fBitmap->c
olorType()); |
| 241 #define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale |
| 242 #define RETURNDST(src) SkAlphaMulQ(SkPackARGB32(0xFF, src, src, src), a
lphaScale) |
| 243 #define SRC_TO_FILTER(src) src |
| 244 #include "SkBitmapProcState_sample.h" |
| 245 |
227 /***************************************************************************** | 246 /***************************************************************************** |
228 * | 247 * |
229 * D16 functions | 248 * D16 functions |
230 * | 249 * |
231 */ | 250 */ |
232 | 251 |
233 // SRC == 8888 | 252 // SRC == 8888 |
234 | 253 |
235 #undef FILTER_PROC | 254 #undef FILTER_PROC |
236 #define FILTER_PROC(x, y, a, b, c, d, dst) \ | 255 #define FILTER_PROC(x, y, a, b, c, d, dst) \ |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 #define MAKENAME(suffix) NAME_WRAP(Clamp_SI8_opaque_D32 ## suffix) | 353 #define MAKENAME(suffix) NAME_WRAP(Clamp_SI8_opaque_D32 ## suffix) |
335 #define SRCTYPE uint8_t | 354 #define SRCTYPE uint8_t |
336 #define DSTTYPE uint32_t | 355 #define DSTTYPE uint32_t |
337 #define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->
colorType()) | 356 #define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->
colorType()) |
338 #define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitm
ap->getColorTable()->readColors() | 357 #define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitm
ap->getColorTable()->readColors() |
339 #define SRC_TO_FILTER(src) table[src] | 358 #define SRC_TO_FILTER(src) table[src] |
340 #define POSTAMBLE(state) | 359 #define POSTAMBLE(state) |
341 #include "SkBitmapProcState_shaderproc.h" | 360 #include "SkBitmapProcState_shaderproc.h" |
342 | 361 |
343 #undef NAME_WRAP | 362 #undef NAME_WRAP |
OLD | NEW |