OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "SkCoreBlitters.h" | 9 #include "SkCoreBlitters.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 } | 270 } |
271 } | 271 } |
272 } | 272 } |
273 | 273 |
274 static inline uint8_t aa_blend8(SkPMColor src, U8CPU da, int aa) { | 274 static inline uint8_t aa_blend8(SkPMColor src, U8CPU da, int aa) { |
275 SkASSERT((unsigned)aa <= 255); | 275 SkASSERT((unsigned)aa <= 255); |
276 | 276 |
277 int src_scale = SkAlpha255To256(aa); | 277 int src_scale = SkAlpha255To256(aa); |
278 int sa = SkGetPackedA32(src); | 278 int sa = SkGetPackedA32(src); |
279 int dst_scale = 256 - SkAlphaMul(sa, src_scale); | 279 int dst_scale = SkAlphaMulInv256(sa, src_scale); |
280 | 280 |
281 return SkToU8((sa * src_scale + da * dst_scale) >> 8); | 281 return SkToU8((sa * src_scale + da * dst_scale) >> 8); |
282 } | 282 } |
283 | 283 |
284 void SkA8_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[], | 284 void SkA8_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[], |
285 const int16_t runs[]) { | 285 const int16_t runs[]) { |
286 SkShader::Context* shaderContext = fShaderContext; | 286 SkShader::Context* shaderContext = fShaderContext; |
287 SkXfermode* mode = fXfermode; | 287 SkXfermode* mode = fXfermode; |
288 uint8_t* aaExpand = fAAExpand; | 288 uint8_t* aaExpand = fAAExpand; |
289 SkPMColor* span = fBuffer; | 289 SkPMColor* span = fBuffer; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 while (--height >= 0) { | 424 while (--height >= 0) { |
425 memcpy(dst, src, width); | 425 memcpy(dst, src, width); |
426 dst += dstRB; | 426 dst += dstRB; |
427 src += srcRB; | 427 src += srcRB; |
428 } | 428 } |
429 } | 429 } |
430 | 430 |
431 const SkPixmap* SkA8_Coverage_Blitter::justAnOpaqueColor(uint32_t*) { | 431 const SkPixmap* SkA8_Coverage_Blitter::justAnOpaqueColor(uint32_t*) { |
432 return nullptr; | 432 return nullptr; |
433 } | 433 } |
OLD | NEW |