| 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 "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkDither.h" | 10 #include "SkDither.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 const SkPMColor* SK_RESTRICT src, int count, | 67 const SkPMColor* SK_RESTRICT src, int count, |
| 68 U8CPU alpha, int /*x*/, int /*y*/) { | 68 U8CPU alpha, int /*x*/, int /*y*/) { |
| 69 SkASSERT(255 > alpha); | 69 SkASSERT(255 > alpha); |
| 70 | 70 |
| 71 if (count > 0) { | 71 if (count > 0) { |
| 72 do { | 72 do { |
| 73 SkPMColor sc = *src++; | 73 SkPMColor sc = *src++; |
| 74 SkPMColorAssert(sc); | 74 SkPMColorAssert(sc); |
| 75 if (sc) { | 75 if (sc) { |
| 76 uint16_t dc = *dst; | 76 uint16_t dc = *dst; |
| 77 unsigned dst_scale = 255 - SkMulDiv255Round(SkGetPackedA32(sc),
alpha); | 77 SkPMColor res = SkBlendARGB32(sc, SkPixel16ToPixel32(dc), alpha)
; |
| 78 unsigned dr = SkMulS16(SkPacked32ToR16(sc), alpha) + SkMulS16(Sk
GetPackedR16(dc), dst_scale); | 78 *dst = SkPixel32ToPixel16(res); |
| 79 unsigned dg = SkMulS16(SkPacked32ToG16(sc), alpha) + SkMulS16(Sk
GetPackedG16(dc), dst_scale); | |
| 80 unsigned db = SkMulS16(SkPacked32ToB16(sc), alpha) + SkMulS16(Sk
GetPackedB16(dc), dst_scale); | |
| 81 *dst = SkPackRGB16(SkDiv255Round(dr), SkDiv255Round(dg), SkDiv25
5Round(db)); | |
| 82 } | 79 } |
| 83 dst += 1; | 80 dst += 1; |
| 84 } while (--count != 0); | 81 } while (--count != 0); |
| 85 } | 82 } |
| 86 } | 83 } |
| 87 | 84 |
| 88 ///////////////////////////////////////////////////////////////////////////// | 85 ///////////////////////////////////////////////////////////////////////////// |
| 89 | 86 |
| 90 static void S32_D565_Opaque_Dither(uint16_t* SK_RESTRICT dst, | 87 static void S32_D565_Opaque_Dither(uint16_t* SK_RESTRICT dst, |
| 91 const SkPMColor* SK_RESTRICT src, | 88 const SkPMColor* SK_RESTRICT src, |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 proc = PlatformProcs565(flags); | 233 proc = PlatformProcs565(flags); |
| 237 if (NULL == proc) { | 234 if (NULL == proc) { |
| 238 proc = gDefault_565_Procs[flags]; | 235 proc = gDefault_565_Procs[flags]; |
| 239 } | 236 } |
| 240 break; | 237 break; |
| 241 default: | 238 default: |
| 242 break; | 239 break; |
| 243 } | 240 } |
| 244 return proc; | 241 return proc; |
| 245 } | 242 } |
| OLD | NEW |