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

Side by Side Diff: src/core/SkBlitter_A8.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 | « src/core/SkBlitRow_D32.cpp ('k') | src/core/SkBlitter_ARGB32.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 2006 The Android Open Source Project 2 * Copyright 2006 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 8
9 #include "SkCoreBlitters.h" 9 #include "SkCoreBlitters.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 269 }
270 } 270 }
271 } 271 }
272 } 272 }
273 273
274 static inline uint8_t aa_blend8(SkPMColor src, U8CPU da, int aa) { 274 static inline uint8_t aa_blend8(SkPMColor src, U8CPU da, int aa) {
275 SkASSERT((unsigned)aa <= 255); 275 SkASSERT((unsigned)aa <= 255);
276 276
277 int src_scale = SkAlpha255To256(aa); 277 int src_scale = SkAlpha255To256(aa);
278 int sa = SkGetPackedA32(src); 278 int sa = SkGetPackedA32(src);
279 int dst_scale = 256 - SkAlphaMul(sa, src_scale); 279 int dst_scale = SkAlphaMulInv256(sa, src_scale);
280 280
281 return SkToU8((sa * src_scale + da * dst_scale) >> 8); 281 return SkToU8((sa * src_scale + da * dst_scale) >> 8);
282 } 282 }
283 283
284 void SkA8_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[], 284 void SkA8_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
285 const int16_t runs[]) { 285 const int16_t runs[]) {
286 SkShader::Context* shaderContext = fShaderContext; 286 SkShader::Context* shaderContext = fShaderContext;
287 SkXfermode* mode = fXfermode; 287 SkXfermode* mode = fXfermode;
288 uint8_t* aaExpand = fAAExpand; 288 uint8_t* aaExpand = fAAExpand;
289 SkPMColor* span = fBuffer; 289 SkPMColor* span = fBuffer;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 while (--height >= 0) { 424 while (--height >= 0) {
425 memcpy(dst, src, width); 425 memcpy(dst, src, width);
426 dst += dstRB; 426 dst += dstRB;
427 src += srcRB; 427 src += srcRB;
428 } 428 }
429 } 429 }
430 430
431 const SkPixmap* SkA8_Coverage_Blitter::justAnOpaqueColor(uint32_t*) { 431 const SkPixmap* SkA8_Coverage_Blitter::justAnOpaqueColor(uint32_t*) {
432 return nullptr; 432 return nullptr;
433 } 433 }
OLDNEW
« no previous file with comments | « src/core/SkBlitRow_D32.cpp ('k') | src/core/SkBlitter_ARGB32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698