OLD | NEW |
1 #include "SkBlitMask.h" | 1 #include "SkBlitMask.h" |
2 #include "SkColor.h" | 2 #include "SkColor.h" |
3 #include "SkColorPriv.h" | 3 #include "SkColorPriv.h" |
4 | 4 |
5 static void D32_A8_Color(void* SK_RESTRICT dst, size_t dstRB, | 5 static void D32_A8_Color(void* SK_RESTRICT dst, size_t dstRB, |
6 const void* SK_RESTRICT maskPtr, size_t maskRB, | 6 const void* SK_RESTRICT maskPtr, size_t maskRB, |
7 SkColor color, int width, int height) { | 7 SkColor color, int width, int height) { |
8 SkPMColor pmc = SkPreMultiplyColor(color); | 8 SkPMColor pmc = SkPreMultiplyColor(color); |
9 size_t dstOffset = dstRB - (width << 2); | 9 size_t dstOffset = dstRB - (width << 2); |
10 size_t maskOffset = maskRB - width; | 10 size_t maskOffset = maskRB - width; |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 #endif | 376 #endif |
377 } | 377 } |
378 } | 378 } |
379 } | 379 } |
380 | 380 |
381 static int upscale31To255(int value) { | 381 static int upscale31To255(int value) { |
382 value = (value << 3) | (value >> 2); | 382 value = (value << 3) | (value >> 2); |
383 return value; | 383 return value; |
384 } | 384 } |
385 | 385 |
386 static int mul(int a, int b) { | |
387 return a * b >> 8; | |
388 } | |
389 | |
390 static int src_alpha_blend(int src, int dst, int srcA, int mask) { | 386 static int src_alpha_blend(int src, int dst, int srcA, int mask) { |
391 | 387 |
392 return dst + mul(src - mul(srcA, dst), mask); | 388 return dst + SkAlphaMul(src - SkAlphaMul(srcA, dst), mask); |
393 } | 389 } |
394 | 390 |
395 static void LCD16_RowProc_Blend(SkPMColor* SK_RESTRICT dst, | 391 static void LCD16_RowProc_Blend(SkPMColor* SK_RESTRICT dst, |
396 const uint16_t* SK_RESTRICT mask, | 392 const uint16_t* SK_RESTRICT mask, |
397 const SkPMColor* SK_RESTRICT src, int count) { | 393 const SkPMColor* SK_RESTRICT src, int count) { |
398 for (int i = 0; i < count; ++i) { | 394 for (int i = 0; i < count; ++i) { |
399 uint16_t m = mask[i]; | 395 uint16_t m = mask[i]; |
400 if (0 == m) { | 396 if (0 == m) { |
401 continue; | 397 continue; |
402 } | 398 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 if (flags & kSrcIsOpaque_RowFlag) { | 583 if (flags & kSrcIsOpaque_RowFlag) { |
588 index |= 1; | 584 index |= 1; |
589 } | 585 } |
590 SkASSERT((size_t)index < SK_ARRAY_COUNT(gProcs)); | 586 SkASSERT((size_t)index < SK_ARRAY_COUNT(gProcs)); |
591 return gProcs[index]; | 587 return gProcs[index]; |
592 default: | 588 default: |
593 break; | 589 break; |
594 } | 590 } |
595 return NULL; | 591 return NULL; |
596 } | 592 } |
OLD | NEW |