| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 #include <emmintrin.h> | 8 #include <emmintrin.h> |
| 9 #include "SkBitmapProcState_opts_SSE2.h" | 9 #include "SkBitmapProcState_opts_SSE2.h" |
| 10 #include "SkBlitRow_opts_SSE2.h" | 10 #include "SkBlitRow_opts_SSE2.h" |
| 11 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
| 12 #include "SkColor_opts_SSE2.h" | 12 #include "SkColor_opts_SSE2.h" |
| 13 #include "SkDither.h" | 13 #include "SkDither.h" |
| 14 #include "SkMSAN.h" |
| 14 #include "SkUtils.h" | 15 #include "SkUtils.h" |
| 15 | 16 |
| 16 /* SSE2 version of S32_Blend_BlitRow32() | 17 /* SSE2 version of S32_Blend_BlitRow32() |
| 17 * portable version is in core/SkBlitRow_D32.cpp | 18 * portable version is in core/SkBlitRow_D32.cpp |
| 18 */ | 19 */ |
| 19 void S32_Blend_BlitRow32_SSE2(SkPMColor* SK_RESTRICT dst, | 20 void S32_Blend_BlitRow32_SSE2(SkPMColor* SK_RESTRICT dst, |
| 20 const SkPMColor* SK_RESTRICT src, | 21 const SkPMColor* SK_RESTRICT src, |
| 21 int count, U8CPU alpha) { | 22 int count, U8CPU alpha) { |
| 22 SkASSERT(alpha <= 255); | 23 SkASSERT(alpha <= 255); |
| 23 if (count <= 0) { | 24 if (count <= 0) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 *dst = SkAlphaMulQ(*src, src_scale) + SkAlphaMulQ(*dst, dst_scale); | 63 *dst = SkAlphaMulQ(*src, src_scale) + SkAlphaMulQ(*dst, dst_scale); |
| 63 src++; | 64 src++; |
| 64 dst++; | 65 dst++; |
| 65 count--; | 66 count--; |
| 66 } | 67 } |
| 67 } | 68 } |
| 68 | 69 |
| 69 void S32A_Opaque_BlitRow32_SSE2(SkPMColor* SK_RESTRICT dst, | 70 void S32A_Opaque_BlitRow32_SSE2(SkPMColor* SK_RESTRICT dst, |
| 70 const SkPMColor* SK_RESTRICT src, | 71 const SkPMColor* SK_RESTRICT src, |
| 71 int count, U8CPU alpha) { | 72 int count, U8CPU alpha) { |
| 73 sk_msan_assert_initialized(src, src+count); |
| 74 |
| 72 SkASSERT(alpha == 255); | 75 SkASSERT(alpha == 255); |
| 73 if (count <= 0) { | 76 if (count <= 0) { |
| 74 return; | 77 return; |
| 75 } | 78 } |
| 76 | 79 |
| 77 #ifdef SK_USE_ACCURATE_BLENDING | 80 #ifdef SK_USE_ACCURATE_BLENDING |
| 78 if (count >= 4) { | 81 if (count >= 4) { |
| 79 SkASSERT(((size_t)dst & 0x03) == 0); | 82 SkASSERT(((size_t)dst & 0x03) == 0); |
| 80 while (((size_t)dst & 0x0F) != 0) { | 83 while (((size_t)dst & 0x0F) != 0) { |
| 81 *dst = SkPMSrcOver(*src, *dst); | 84 *dst = SkPMSrcOver(*src, *dst); |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 uint32_t dst_expanded = SkExpand_rgb_16(*dst); | 1113 uint32_t dst_expanded = SkExpand_rgb_16(*dst); |
| 1111 dst_expanded = dst_expanded * (SkAlpha255To256(255 - a) >> 3); | 1114 dst_expanded = dst_expanded * (SkAlpha255To256(255 - a) >> 3); |
| 1112 // now src and dst expanded are in g:11 r:10 x:1 b:10 | 1115 // now src and dst expanded are in g:11 r:10 x:1 b:10 |
| 1113 *dst = SkCompact_rgb_16((src_expanded + dst_expanded) >> 5); | 1116 *dst = SkCompact_rgb_16((src_expanded + dst_expanded) >> 5); |
| 1114 } | 1117 } |
| 1115 dst += 1; | 1118 dst += 1; |
| 1116 DITHER_INC_X(x); | 1119 DITHER_INC_X(x); |
| 1117 } while (--count != 0); | 1120 } while (--count != 0); |
| 1118 } | 1121 } |
| 1119 } | 1122 } |
| OLD | NEW |