Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/core/SkBlitRow_D16.cpp

Issue 2097883002: revise row blits to keep intermediate precision so that color is preserved when blended against its… (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: guard more changes with SK_SUPPORT_LEGACY_BROKEN_LERP Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkColorPriv.h ('k') | src/core/SkBlitRow_D32.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « include/core/SkColorPriv.h ('k') | src/core/SkBlitRow_D32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698