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

Side by Side Diff: src/core/SkBlitter_ARGB32.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/SkBlitter_A8.cpp ('k') | src/core/SkSpriteBlitter_RGB16.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 #include "SkCoreBlitters.h" 8 #include "SkCoreBlitters.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkShader.h" 10 #include "SkShader.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 return; 230 return;
231 } 231 }
232 232
233 uint32_t* device = fDevice.writable_addr32(x, y); 233 uint32_t* device = fDevice.writable_addr32(x, y);
234 uint32_t color = fPMColor; 234 uint32_t color = fPMColor;
235 235
236 if (alpha != 255) { 236 if (alpha != 255) {
237 color = SkAlphaMulQ(color, SkAlpha255To256(alpha)); 237 color = SkAlphaMulQ(color, SkAlpha255To256(alpha));
238 } 238 }
239 239
240 #ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
240 unsigned dst_scale = 255 - SkGetPackedA32(color); 241 unsigned dst_scale = 255 - SkGetPackedA32(color);
242 #else
243 unsigned dst_scale = SkAlpha255To256(255 - SkGetPackedA32(color));
244 #endif
241 size_t rowBytes = fDevice.rowBytes(); 245 size_t rowBytes = fDevice.rowBytes();
242 while (--height >= 0) { 246 while (--height >= 0) {
243 device[0] = color + SkAlphaMulQ(device[0], dst_scale); 247 device[0] = color + SkAlphaMulQ(device[0], dst_scale);
244 device = (uint32_t*)((char*)device + rowBytes); 248 device = (uint32_t*)((char*)device + rowBytes);
245 } 249 }
246 } 250 }
247 251
248 void SkARGB32_Blitter::blitRect(int x, int y, int width, int height) { 252 void SkARGB32_Blitter::blitRect(int x, int y, int width, int height) {
249 SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width() && y + height <= f Device.height()); 253 SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width() && y + height <= f Device.height());
250 254
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; 690 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend;
687 do { 691 do {
688 shaderContext->shadeSpan(x, y, span, 1); 692 shaderContext->shadeSpan(x, y, span, 1);
689 proc(device, span, 1, alpha); 693 proc(device, span, 1, alpha);
690 y += 1; 694 y += 1;
691 device = (uint32_t*)((char*)device + deviceRB); 695 device = (uint32_t*)((char*)device + deviceRB);
692 } while (--height > 0); 696 } while (--height > 0);
693 } 697 }
694 } 698 }
695 } 699 }
OLDNEW
« no previous file with comments | « src/core/SkBlitter_A8.cpp ('k') | src/core/SkSpriteBlitter_RGB16.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698