| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (count > 0) { | 173 if (count > 0) { |
| 174 int src_scale = SkAlpha255To256(alpha); | 174 int src_scale = SkAlpha255To256(alpha); |
| 175 DITHER_565_SCAN(y); | 175 DITHER_565_SCAN(y); |
| 176 do { | 176 do { |
| 177 SkPMColor c = *src++; | 177 SkPMColor c = *src++; |
| 178 SkPMColorAssert(c); | 178 SkPMColorAssert(c); |
| 179 if (c) | 179 if (c) |
| 180 { | 180 { |
| 181 unsigned d = *dst; | 181 unsigned d = *dst; |
| 182 int sa = SkGetPackedA32(c); | 182 int sa = SkGetPackedA32(c); |
| 183 int dst_scale = SkAlpha255To256(255 - SkAlphaMul(sa, src_scale))
; | 183 int dst_scale = SkAlphaMulInv256(sa, src_scale); |
| 184 int dither = DITHER_VALUE(x); | 184 int dither = DITHER_VALUE(x); |
| 185 | 185 |
| 186 int sr = SkGetPackedR32(c); | 186 int sr = SkGetPackedR32(c); |
| 187 int sg = SkGetPackedG32(c); | 187 int sg = SkGetPackedG32(c); |
| 188 int sb = SkGetPackedB32(c); | 188 int sb = SkGetPackedB32(c); |
| 189 sr = SkDITHER_R32To565(sr, dither); | 189 sr = SkDITHER_R32To565(sr, dither); |
| 190 sg = SkDITHER_G32To565(sg, dither); | 190 sg = SkDITHER_G32To565(sg, dither); |
| 191 sb = SkDITHER_B32To565(sb, dither); | 191 sb = SkDITHER_B32To565(sb, dither); |
| 192 | 192 |
| 193 int dr = (sr * src_scale + SkGetPackedR16(d) * dst_scale) >> 8; | 193 int dr = (sr * src_scale + SkGetPackedR16(d) * dst_scale) >> 8; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 flags >>= 2; | 272 flags >>= 2; |
| 273 | 273 |
| 274 SkASSERT(flags < SK_ARRAY_COUNT(gDefault_565_ColorProcs)); | 274 SkASSERT(flags < SK_ARRAY_COUNT(gDefault_565_ColorProcs)); |
| 275 | 275 |
| 276 SkBlitRow::ColorProc16 proc = PlatformColorFactory565(flags); | 276 SkBlitRow::ColorProc16 proc = PlatformColorFactory565(flags); |
| 277 if (nullptr == proc) { | 277 if (nullptr == proc) { |
| 278 proc = gDefault_565_ColorProcs[flags]; | 278 proc = gDefault_565_ColorProcs[flags]; |
| 279 } | 279 } |
| 280 return proc; | 280 return proc; |
| 281 } | 281 } |
| OLD | NEW |