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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(kIndex_8_SkColorType == state.fBitmap->
colorType()); \ | 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()->readColors() |
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) |
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(kIndex_8_SkColorType == state.fBitmap->
colorType()); \ | 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()->readColors() |
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) |
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 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(kIndex_8_SkColorType == state.fBitmap->
colorType()); \ | 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()->read16BitCache() |
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) |
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) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(kIndex_8_SkColorType == state.fBitmap->
colorType()) | 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()->readColors() |
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) |
341 #include "SkBitmapProcState_shaderproc.h" | 341 #include "SkBitmapProcState_shaderproc.h" |
342 | 342 |
343 #undef NAME_WRAP | 343 #undef NAME_WRAP |
OLD | NEW |