OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |