| OLD | NEW |
| 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 "SkBlitMask.h" | 9 #include "SkBlitMask.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 S32A_Opaque_BlitRow32, | 117 S32A_Opaque_BlitRow32, |
| 118 S32A_Blend_BlitRow32 | 118 S32A_Blend_BlitRow32 |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 SkBlitRow::Proc32 SkBlitRow::Factory32(unsigned flags) { | 121 SkBlitRow::Proc32 SkBlitRow::Factory32(unsigned flags) { |
| 122 SkASSERT(flags < SK_ARRAY_COUNT(gDefault_Procs32)); | 122 SkASSERT(flags < SK_ARRAY_COUNT(gDefault_Procs32)); |
| 123 // just so we don't crash | 123 // just so we don't crash |
| 124 flags &= kFlags32_Mask; | 124 flags &= kFlags32_Mask; |
| 125 | 125 |
| 126 SkBlitRow::Proc32 proc = PlatformProcs32(flags); | 126 SkBlitRow::Proc32 proc = PlatformProcs32(flags); |
| 127 if (NULL == proc) { | 127 if (nullptr == proc) { |
| 128 proc = gDefault_Procs32[flags]; | 128 proc = gDefault_Procs32[flags]; |
| 129 } | 129 } |
| 130 SkASSERT(proc); | 130 SkASSERT(proc); |
| 131 return proc; | 131 return proc; |
| 132 } | 132 } |
| 133 | 133 |
| 134 #include "Sk4px.h" | 134 #include "Sk4px.h" |
| 135 | 135 |
| 136 // Color32 uses the blend_256_round_alt algorithm from tests/BlendTest.cpp. | 136 // Color32 uses the blend_256_round_alt algorithm from tests/BlendTest.cpp. |
| 137 // It's not quite perfect, but it's never wrong in the interesting edge cases, | 137 // It's not quite perfect, but it's never wrong in the interesting edge cases, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 153 invA += invA >> 7; | 153 invA += invA >> 7; |
| 154 SkASSERT(invA < 256); // We've already handled alpha == 0 above. | 154 SkASSERT(invA < 256); // We've already handled alpha == 0 above. |
| 155 | 155 |
| 156 Sk16h colorHighAndRound = Sk4px::DupPMColor(color).widenHi() + Sk16h(128); | 156 Sk16h colorHighAndRound = Sk4px::DupPMColor(color).widenHi() + Sk16h(128); |
| 157 Sk16b invA_16x(invA); | 157 Sk16b invA_16x(invA); |
| 158 | 158 |
| 159 Sk4px::MapSrc(count, dst, src, [&](const Sk4px& src4) -> Sk4px { | 159 Sk4px::MapSrc(count, dst, src, [&](const Sk4px& src4) -> Sk4px { |
| 160 return (src4 * invA_16x).addNarrowHi(colorHighAndRound); | 160 return (src4 * invA_16x).addNarrowHi(colorHighAndRound); |
| 161 }); | 161 }); |
| 162 } | 162 } |
| OLD | NEW |