| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 /////////////////////////////////////////////////////////////////////////////// | 205 /////////////////////////////////////////////////////////////////////////////// |
| 206 | 206 |
| 207 static uint32_t pmcolor_to_expand16(SkPMColor c) { | 207 static uint32_t pmcolor_to_expand16(SkPMColor c) { |
| 208 unsigned r = SkGetPackedR32(c); | 208 unsigned r = SkGetPackedR32(c); |
| 209 unsigned g = SkGetPackedG32(c); | 209 unsigned g = SkGetPackedG32(c); |
| 210 unsigned b = SkGetPackedB32(c); | 210 unsigned b = SkGetPackedB32(c); |
| 211 return (g << 24) | (r << 13) | (b << 2); | 211 return (g << 24) | (r << 13) | (b << 2); |
| 212 } | 212 } |
| 213 | 213 |
| 214 static void Color32A_D565(uint16_t dst[], SkPMColor src, int count, int x, int y
) { | 214 static void Color32A_D565(uint16_t dst[], SkPMColor src[], int count, int x, int
y) { |
| 215 SkASSERT(count > 0); | 215 SkASSERT(count > 0); |
| 216 uint32_t src_expand = pmcolor_to_expand16(src); | 216 uint32_t src_expand = pmcolor_to_expand16(*src); |
| 217 unsigned scale = SkAlpha255To256(0xFF - SkGetPackedA32(src)) >> 3; | 217 unsigned scale = SkAlpha255To256(0xFF - SkGetPackedA32(*src)) >> 3; |
| 218 do { | 218 do { |
| 219 uint32_t dst_expand = SkExpand_rgb_16(*dst) * scale; | 219 uint32_t dst_expand = SkExpand_rgb_16(*dst) * scale; |
| 220 *dst = SkCompact_rgb_16((src_expand + dst_expand) >> 5); | 220 *dst = SkCompact_rgb_16((src_expand + dst_expand) >> 5); |
| 221 dst += 1; | 221 dst += 1; |
| 222 } while (--count != 0); | 222 } while (--count != 0); |
| 223 } | 223 } |
| 224 | 224 |
| 225 /////////////////////////////////////////////////////////////////////////////// | 225 /////////////////////////////////////////////////////////////////////////////// |
| 226 /////////////////////////////////////////////////////////////////////////////// | 226 /////////////////////////////////////////////////////////////////////////////// |
| 227 | 227 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 flags >>= 1; | 276 flags >>= 1; |
| 277 | 277 |
| 278 SkASSERT(flags < SK_ARRAY_COUNT(gDefault_565_ColorProcs)); | 278 SkASSERT(flags < SK_ARRAY_COUNT(gDefault_565_ColorProcs)); |
| 279 | 279 |
| 280 SkBlitRow::ColorProc16 proc = PlatformColorFactory565(flags); | 280 SkBlitRow::ColorProc16 proc = PlatformColorFactory565(flags); |
| 281 if (NULL == proc) { | 281 if (NULL == proc) { |
| 282 proc = gDefault_565_ColorProcs[flags]; | 282 proc = gDefault_565_ColorProcs[flags]; |
| 283 } | 283 } |
| 284 return proc; | 284 return proc; |
| 285 } | 285 } |
| OLD | NEW |