LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 #include "SkBlitRow.h" | 8 #include "SkBlitRow.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkDither.h" | 10 #include "SkDither.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 U8CPU alpha, int /*x*/, int /*y*/) { | 51 U8CPU alpha, int /*x*/, int /*y*/) { |
52 SkASSERT(255 == alpha); | 52 SkASSERT(255 == alpha); |
53 | 53 |
54 if (count > 0) { | 54 if (count > 0) { |
55 do { | 55 do { |
56 SkPMColor c = *src++; | 56 SkPMColor c = *src++; |
57 SkPMColorAssert(c); | 57 SkPMColorAssert(c); |
58 // if (__builtin_expect(c!=0, 1)) | 58 // if (__builtin_expect(c!=0, 1)) |
59 if (c) | 59 if (c) |
60 { | 60 { |
61 unsigned scale16 = SkAlpha255To256(255 - SkGetPackedA32(c)) >> 4
; | 61 uint32_t src_expand = SkExpand32_4444(c); |
62 uint32_t src_expand = SkExpand_8888(c); | 62 uint32_t dst_expand = SkExpand_4444(*dst); |
63 uint32_t dst_expand = SkExpand_4444(*dst) * scale16; | 63 unsigned dst_scale = 16 - SkGetPackedA4444(src_expand); |
64 *dst = SkCompact_4444((src_expand + dst_expand) >> 4); | 64 *dst = SkCompact_4444(src_expand + (dst_expand * dst_scale >> 4)
); |
65 } | 65 } |
66 dst += 1; | 66 dst += 1; |
67 } while (--count != 0); | 67 } while (--count != 0); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 static void S32A_D4444_Blend(uint16_t* SK_RESTRICT dst, | 71 static void S32A_D4444_Blend(uint16_t* SK_RESTRICT dst, |
72 const SkPMColor* SK_RESTRICT src, int count, | 72 const SkPMColor* SK_RESTRICT src, int count, |
73 U8CPU alpha, int /*x*/, int /*y*/) { | 73 U8CPU alpha, int /*x*/, int /*y*/) { |
74 SkASSERT(255 > alpha); | 74 SkASSERT(255 > alpha); |
75 ···· | 75 ···· |
76 if (count > 0) { | 76 if (count > 0) { |
77 int src_scale = SkAlpha255To256(alpha) >> 4; | 77 int src_scale = SkAlpha255To256(alpha) >> 4; |
78 do { | 78 do { |
79 SkPMColor sc = *src++; | 79 SkPMColor sc = *src++; |
80 SkPMColorAssert(sc); | 80 SkPMColorAssert(sc); |
81 | 81 |
82 if (sc) { | 82 if (sc) { |
83 unsigned dst_scale = 16 - (SkGetPackedA32(sc) * src_scale >> 8); | 83 uint32_t src_expand = SkExpand32_4444(sc); |
84 uint32_t src_expand = SkExpand32_4444(sc) * src_scale; | 84 uint32_t dst_expand = SkExpand_4444(*dst); |
85 uint32_t dst_expand = SkExpand_4444(*dst) * dst_scale; | 85 unsigned dst_scale = 16 - SkAlphaMul4(SkGetPackedA4444(src_expan
d), src_scale); |
86 *dst = SkCompact_4444((src_expand + dst_expand) >> 4); | 86 *dst = SkCompact_4444((src_expand * src_scale >> 4) + (dst_expan
d * dst_scale >> 4)); |
87 } | 87 } |
88 dst += 1; | 88 dst += 1; |
89 } while (--count != 0); | 89 } while (--count != 0); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 ///////////////////////////////////////////////////////////////////////////// | 93 ///////////////////////////////////////////////////////////////////////////// |
94 ······························· | 94 ······························· |
95 static void S32_D4444_Opaque_Dither(uint16_t* SK_RESTRICT dst, | 95 static void S32_D4444_Opaque_Dither(uint16_t* SK_RESTRICT dst, |
96 const SkPMColor* SK_RESTRICT src, | 96 const SkPMColor* SK_RESTRICT src, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 ···· | 212 ···· |
213 SkBlitRow::Proc SkBlitRow_Factory_4444(unsigned flags); | 213 SkBlitRow::Proc SkBlitRow_Factory_4444(unsigned flags); |
214 SkBlitRow::Proc SkBlitRow_Factory_4444(unsigned flags) | 214 SkBlitRow::Proc SkBlitRow_Factory_4444(unsigned flags) |
215 { | 215 { |
216 SkASSERT(flags < SK_ARRAY_COUNT(gProcs4444)); | 216 SkASSERT(flags < SK_ARRAY_COUNT(gProcs4444)); |
217 ···· | 217 ···· |
218 return gProcs4444[flags]; | 218 return gProcs4444[flags]; |
219 } | 219 } |
220 ···· | 220 ···· |
221 ···· | 221 ···· |
LEFT | RIGHT |