OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 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 #include "SkSpriteBlitter.h" | 10 #include "SkSpriteBlitter.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 /////////////////////////////////////////////////////////////////////////////// | 135 /////////////////////////////////////////////////////////////////////////////// |
136 | 136 |
137 #define SkSPRITE_CLASSNAME Sprite_D16_SIndex8A_Opaque | 137 #define SkSPRITE_CLASSNAME Sprite_D16_SIndex8A_Opaque |
138 #define SkSPRITE_ARGS | 138 #define SkSPRITE_ARGS |
139 #define SkSPRITE_FIELDS | 139 #define SkSPRITE_FIELDS |
140 #define SkSPRITE_INIT | 140 #define SkSPRITE_INIT |
141 #define SkSPRITE_DST_TYPE uint16_t | 141 #define SkSPRITE_DST_TYPE uint16_t |
142 #define SkSPRITE_SRC_TYPE uint8_t | 142 #define SkSPRITE_SRC_TYPE uint8_t |
143 #define SkSPRITE_DST_GETADDR getAddr16 | 143 #define SkSPRITE_DST_GETADDR getAddr16 |
144 #define SkSPRITE_SRC_GETADDR getAddr8 | 144 #define SkSPRITE_SRC_GETADDR getAddr8 |
145 #define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getC
olorTable()->lockColors() | 145 #define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getC
olorTable()->readColors() |
146 #define SkSPRITE_BLIT_PIXEL(dst, src) D16_S32A_Opaque_Pixel(dst, ctable[sr
c]) | 146 #define SkSPRITE_BLIT_PIXEL(dst, src) D16_S32A_Opaque_Pixel(dst, ctable[sr
c]) |
147 #define SkSPRITE_NEXT_ROW | 147 #define SkSPRITE_NEXT_ROW |
148 #define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlockColors(
) | 148 #define SkSPRITE_POSTAMBLE(srcBM) |
149 #include "SkSpriteBlitterTemplate.h" | 149 #include "SkSpriteBlitterTemplate.h" |
150 | 150 |
151 #define SkSPRITE_CLASSNAME Sprite_D16_SIndex8A_Blend | 151 #define SkSPRITE_CLASSNAME Sprite_D16_SIndex8A_Blend |
152 #define SkSPRITE_ARGS , uint8_t alpha | 152 #define SkSPRITE_ARGS , uint8_t alpha |
153 #define SkSPRITE_FIELDS uint8_t fSrcAlpha; | 153 #define SkSPRITE_FIELDS uint8_t fSrcAlpha; |
154 #define SkSPRITE_INIT fSrcAlpha = alpha; | 154 #define SkSPRITE_INIT fSrcAlpha = alpha; |
155 #define SkSPRITE_DST_TYPE uint16_t | 155 #define SkSPRITE_DST_TYPE uint16_t |
156 #define SkSPRITE_SRC_TYPE uint8_t | 156 #define SkSPRITE_SRC_TYPE uint8_t |
157 #define SkSPRITE_DST_GETADDR getAddr16 | 157 #define SkSPRITE_DST_GETADDR getAddr16 |
158 #define SkSPRITE_SRC_GETADDR getAddr8 | 158 #define SkSPRITE_SRC_GETADDR getAddr8 |
159 #define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getC
olorTable()->lockColors(); unsigned src_scale = SkAlpha255To256(fSrcAlpha); | 159 #define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getC
olorTable()->readColors(); unsigned src_scale = SkAlpha255To256(fSrcAlpha); |
160 #define SkSPRITE_BLIT_PIXEL(dst, src) D16_S32A_Blend_Pixel(dst, ctable[src
], src_scale) | 160 #define SkSPRITE_BLIT_PIXEL(dst, src) D16_S32A_Blend_Pixel(dst, ctable[src
], src_scale) |
161 #define SkSPRITE_NEXT_ROW | 161 #define SkSPRITE_NEXT_ROW |
162 #define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlockColors(
); | 162 #define SkSPRITE_POSTAMBLE(srcBM) |
163 #include "SkSpriteBlitterTemplate.h" | 163 #include "SkSpriteBlitterTemplate.h" |
164 | 164 |
165 /////////////////////////////////////////////////////////////////////////////// | 165 /////////////////////////////////////////////////////////////////////////////// |
166 | 166 |
167 static intptr_t asint(const void* ptr) { | 167 static intptr_t asint(const void* ptr) { |
168 return reinterpret_cast<const char*>(ptr) - (const char*)0; | 168 return reinterpret_cast<const char*>(ptr) - (const char*)0; |
169 } | 169 } |
170 | 170 |
171 static void blitrow_d16_si8(uint16_t* SK_RESTRICT dst, | 171 static void blitrow_d16_si8(uint16_t* SK_RESTRICT dst, |
172 const uint8_t* SK_RESTRICT src, int count, | 172 const uint8_t* SK_RESTRICT src, int count, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 #define SkSPRITE_ROW_PROC(d, s, n, x, y) blitrow_d16_si8(d, s, n, ctable) | 227 #define SkSPRITE_ROW_PROC(d, s, n, x, y) blitrow_d16_si8(d, s, n, ctable) |
228 | 228 |
229 #define SkSPRITE_CLASSNAME Sprite_D16_SIndex8_Opaque | 229 #define SkSPRITE_CLASSNAME Sprite_D16_SIndex8_Opaque |
230 #define SkSPRITE_ARGS | 230 #define SkSPRITE_ARGS |
231 #define SkSPRITE_FIELDS | 231 #define SkSPRITE_FIELDS |
232 #define SkSPRITE_INIT | 232 #define SkSPRITE_INIT |
233 #define SkSPRITE_DST_TYPE uint16_t | 233 #define SkSPRITE_DST_TYPE uint16_t |
234 #define SkSPRITE_SRC_TYPE uint8_t | 234 #define SkSPRITE_SRC_TYPE uint8_t |
235 #define SkSPRITE_DST_GETADDR getAddr16 | 235 #define SkSPRITE_DST_GETADDR getAddr16 |
236 #define SkSPRITE_SRC_GETADDR getAddr8 | 236 #define SkSPRITE_SRC_GETADDR getAddr8 |
237 #define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getCo
lorTable()->lock16BitCache() | 237 #define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getCo
lorTable()->read16BitCache() |
238 #define SkSPRITE_BLIT_PIXEL(dst, src) *dst = ctable[src] | 238 #define SkSPRITE_BLIT_PIXEL(dst, src) *dst = ctable[src] |
239 #define SkSPRITE_NEXT_ROW | 239 #define SkSPRITE_NEXT_ROW |
240 #define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlock16BitCa
che() | 240 #define SkSPRITE_POSTAMBLE(srcBM) |
241 #include "SkSpriteBlitterTemplate.h" | 241 #include "SkSpriteBlitterTemplate.h" |
242 | 242 |
243 #define SkSPRITE_CLASSNAME Sprite_D16_SIndex8_Blend | 243 #define SkSPRITE_CLASSNAME Sprite_D16_SIndex8_Blend |
244 #define SkSPRITE_ARGS , uint8_t alpha | 244 #define SkSPRITE_ARGS , uint8_t alpha |
245 #define SkSPRITE_FIELDS uint8_t fSrcAlpha; | 245 #define SkSPRITE_FIELDS uint8_t fSrcAlpha; |
246 #define SkSPRITE_INIT fSrcAlpha = alpha; | 246 #define SkSPRITE_INIT fSrcAlpha = alpha; |
247 #define SkSPRITE_DST_TYPE uint16_t | 247 #define SkSPRITE_DST_TYPE uint16_t |
248 #define SkSPRITE_SRC_TYPE uint8_t | 248 #define SkSPRITE_SRC_TYPE uint8_t |
249 #define SkSPRITE_DST_GETADDR getAddr16 | 249 #define SkSPRITE_DST_GETADDR getAddr16 |
250 #define SkSPRITE_SRC_GETADDR getAddr8 | 250 #define SkSPRITE_SRC_GETADDR getAddr8 |
251 #define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getCo
lorTable()->lock16BitCache(); unsigned src_scale = SkAlpha255To256(fSrcAlpha); | 251 #define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getCo
lorTable()->read16BitCache(); unsigned src_scale = SkAlpha255To256(fSrcAlpha); |
252 #define SkSPRITE_BLIT_PIXEL(dst, src) D16_S16_Blend_Pixel(dst, ctable[src]
, src_scale) | 252 #define SkSPRITE_BLIT_PIXEL(dst, src) D16_S16_Blend_Pixel(dst, ctable[src]
, src_scale) |
253 #define SkSPRITE_NEXT_ROW | 253 #define SkSPRITE_NEXT_ROW |
254 #define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlock16BitCa
che(); | 254 #define SkSPRITE_POSTAMBLE(srcBM) |
255 #include "SkSpriteBlitterTemplate.h" | 255 #include "SkSpriteBlitterTemplate.h" |
256 | 256 |
257 /////////////////////////////////////////////////////////////////////////////// | 257 /////////////////////////////////////////////////////////////////////////////// |
258 | 258 |
259 class Sprite_D16_S32_BlitRowProc : public SkSpriteBlitter { | 259 class Sprite_D16_S32_BlitRowProc : public SkSpriteBlitter { |
260 public: | 260 public: |
261 Sprite_D16_S32_BlitRowProc(const SkBitmap& source) | 261 Sprite_D16_S32_BlitRowProc(const SkBitmap& source) |
262 : SkSpriteBlitter(source) {} | 262 : SkSpriteBlitter(source) {} |
263 | 263 |
264 // overrides | 264 // overrides |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } else { | 371 } else { |
372 blitter = allocator->createT<Sprite_D16_SIndex8A_Blend>(sour
ce, alpha); | 372 blitter = allocator->createT<Sprite_D16_SIndex8A_Blend>(sour
ce, alpha); |
373 } | 373 } |
374 } | 374 } |
375 break; | 375 break; |
376 default: | 376 default: |
377 break; | 377 break; |
378 } | 378 } |
379 return blitter; | 379 return blitter; |
380 } | 380 } |
OLD | NEW |