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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 uint32_t sc = SkAlphaMulQ(color, SkAlpha255To256(aa)); | 99 uint32_t sc = SkAlphaMulQ(color, SkAlpha255To256(aa)); |
100 fColor32Proc(device, device, count, sc); | 100 fColor32Proc(device, device, count, sc); |
101 } | 101 } |
102 } | 102 } |
103 runs += count; | 103 runs += count; |
104 antialias += count; | 104 antialias += count; |
105 device += count; | 105 device += count; |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 #ifndef SK_SUPPORT_LEGACY_BLITANTIH2V2 | |
110 void SkARGB32_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { | 109 void SkARGB32_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { |
111 uint32_t* device = fDevice.getAddr32(x, y); | 110 uint32_t* device = fDevice.getAddr32(x, y); |
112 SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);) | 111 SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);) |
113 | 112 |
114 device[0] = SkBlendARGB32(fPMColor, device[0], a0); | 113 device[0] = SkBlendARGB32(fPMColor, device[0], a0); |
115 device[1] = SkBlendARGB32(fPMColor, device[1], a1); | 114 device[1] = SkBlendARGB32(fPMColor, device[1], a1); |
116 } | 115 } |
117 | 116 |
118 void SkARGB32_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) { | 117 void SkARGB32_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) { |
119 uint32_t* device = fDevice.getAddr32(x, y); | 118 uint32_t* device = fDevice.getAddr32(x, y); |
120 SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);) | 119 SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);) |
121 | 120 |
122 device[0] = SkBlendARGB32(fPMColor, device[0], a0); | 121 device[0] = SkBlendARGB32(fPMColor, device[0], a0); |
123 device = (uint32_t*)((char*)device + fDevice.rowBytes()); | 122 device = (uint32_t*)((char*)device + fDevice.rowBytes()); |
124 device[0] = SkBlendARGB32(fPMColor, device[0], a1); | 123 device[0] = SkBlendARGB32(fPMColor, device[0], a1); |
125 } | 124 } |
126 #endif | |
127 | 125 |
128 ////////////////////////////////////////////////////////////////////////////////
////// | 126 ////////////////////////////////////////////////////////////////////////////////
////// |
129 | 127 |
130 #define solid_8_pixels(mask, dst, color) \ | 128 #define solid_8_pixels(mask, dst, color) \ |
131 do { \ | 129 do { \ |
132 if (mask & 0x80) dst[0] = color; \ | 130 if (mask & 0x80) dst[0] = color; \ |
133 if (mask & 0x40) dst[1] = color; \ | 131 if (mask & 0x40) dst[1] = color; \ |
134 if (mask & 0x20) dst[2] = color; \ | 132 if (mask & 0x20) dst[2] = color; \ |
135 if (mask & 0x10) dst[3] = color; \ | 133 if (mask & 0x10) dst[3] = color; \ |
136 if (mask & 0x08) dst[4] = color; \ | 134 if (mask & 0x08) dst[4] = color; \ |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 return; | 190 return; |
193 } | 191 } |
194 | 192 |
195 if (mask.fFormat == SkMask::kBW_Format) { | 193 if (mask.fFormat == SkMask::kBW_Format) { |
196 SkARGB32_BlitBW(fDevice, mask, clip, fPMColor); | 194 SkARGB32_BlitBW(fDevice, mask, clip, fPMColor); |
197 } else if (SkMask::kARGB32_Format == mask.fFormat) { | 195 } else if (SkMask::kARGB32_Format == mask.fFormat) { |
198 SkARGB32_Blit32(fDevice, mask, clip, fPMColor); | 196 SkARGB32_Blit32(fDevice, mask, clip, fPMColor); |
199 } | 197 } |
200 } | 198 } |
201 | 199 |
202 #ifndef SK_SUPPORT_LEGACY_BLITANTIH2V2 | |
203 void SkARGB32_Opaque_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { | 200 void SkARGB32_Opaque_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { |
204 uint32_t* device = fDevice.getAddr32(x, y); | 201 uint32_t* device = fDevice.getAddr32(x, y); |
205 SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);) | 202 SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);) |
206 | 203 |
207 device[0] = SkFastFourByteInterp(fPMColor, device[0], a0); | 204 device[0] = SkFastFourByteInterp(fPMColor, device[0], a0); |
208 device[1] = SkFastFourByteInterp(fPMColor, device[1], a1); | 205 device[1] = SkFastFourByteInterp(fPMColor, device[1], a1); |
209 } | 206 } |
210 | 207 |
211 void SkARGB32_Opaque_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) { | 208 void SkARGB32_Opaque_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) { |
212 uint32_t* device = fDevice.getAddr32(x, y); | 209 uint32_t* device = fDevice.getAddr32(x, y); |
213 SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);) | 210 SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);) |
214 | 211 |
215 device[0] = SkFastFourByteInterp(fPMColor, device[0], a0); | 212 device[0] = SkFastFourByteInterp(fPMColor, device[0], a0); |
216 device = (uint32_t*)((char*)device + fDevice.rowBytes()); | 213 device = (uint32_t*)((char*)device + fDevice.rowBytes()); |
217 device[0] = SkFastFourByteInterp(fPMColor, device[0], a1); | 214 device[0] = SkFastFourByteInterp(fPMColor, device[0], a1); |
218 } | 215 } |
219 #endif | |
220 | 216 |
221 /////////////////////////////////////////////////////////////////////////////// | 217 /////////////////////////////////////////////////////////////////////////////// |
222 | 218 |
223 void SkARGB32_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { | 219 void SkARGB32_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { |
224 if (alpha == 0 || fSrcA == 0) { | 220 if (alpha == 0 || fSrcA == 0) { |
225 return; | 221 return; |
226 } | 222 } |
227 | 223 |
228 uint32_t* device = fDevice.getAddr32(x, y); | 224 uint32_t* device = fDevice.getAddr32(x, y); |
229 uint32_t color = fPMColor; | 225 uint32_t color = fPMColor; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 device[n] = src + SkAlphaMulQ(device[n], dst_scale); | 283 device[n] = src + SkAlphaMulQ(device[n], dst_scale); |
288 } while (n > 0); | 284 } while (n > 0); |
289 } | 285 } |
290 } | 286 } |
291 runs += count; | 287 runs += count; |
292 antialias += count; | 288 antialias += count; |
293 device += count; | 289 device += count; |
294 } | 290 } |
295 } | 291 } |
296 | 292 |
297 #ifndef SK_SUPPORT_LEGACY_BLITANTIH2V2 | |
298 void SkARGB32_Black_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { | 293 void SkARGB32_Black_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { |
299 uint32_t* device = fDevice.getAddr32(x, y); | 294 uint32_t* device = fDevice.getAddr32(x, y); |
300 SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);) | 295 SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);) |
301 | 296 |
302 device[0] = (a0 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a0); | 297 device[0] = (a0 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a0); |
303 device[1] = (a1 << SK_A32_SHIFT) + SkAlphaMulQ(device[1], 256 - a1); | 298 device[1] = (a1 << SK_A32_SHIFT) + SkAlphaMulQ(device[1], 256 - a1); |
304 } | 299 } |
305 | 300 |
306 void SkARGB32_Black_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) { | 301 void SkARGB32_Black_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) { |
307 uint32_t* device = fDevice.getAddr32(x, y); | 302 uint32_t* device = fDevice.getAddr32(x, y); |
308 SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);) | 303 SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);) |
309 | 304 |
310 device[0] = (a0 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a0); | 305 device[0] = (a0 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a0); |
311 device = (uint32_t*)((char*)device + fDevice.rowBytes()); | 306 device = (uint32_t*)((char*)device + fDevice.rowBytes()); |
312 device[0] = (a1 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a1); | 307 device[0] = (a1 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a1); |
313 } | 308 } |
314 #endif | |
315 | 309 |
316 /////////////////////////////////////////////////////////////////////////////// | 310 /////////////////////////////////////////////////////////////////////////////// |
317 | 311 |
318 // Special version of SkBlitRow::Factory32 that knows we're in kSrc_Mode, | 312 // Special version of SkBlitRow::Factory32 that knows we're in kSrc_Mode, |
319 // instead of kSrcOver_Mode | 313 // instead of kSrcOver_Mode |
320 static void blend_srcmode(SkPMColor* SK_RESTRICT device, | 314 static void blend_srcmode(SkPMColor* SK_RESTRICT device, |
321 const SkPMColor* SK_RESTRICT span, | 315 const SkPMColor* SK_RESTRICT span, |
322 int count, U8CPU aa) { | 316 int count, U8CPU aa) { |
323 int aa256 = SkAlpha255To256(aa); | 317 int aa256 = SkAlpha255To256(aa); |
324 for (int i = 0; i < count; ++i) { | 318 for (int i = 0; i < count; ++i) { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; | 677 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; |
684 do { | 678 do { |
685 shaderContext->shadeSpan(x, y, span, 1); | 679 shaderContext->shadeSpan(x, y, span, 1); |
686 proc(device, span, 1, alpha); | 680 proc(device, span, 1, alpha); |
687 y += 1; | 681 y += 1; |
688 device = (uint32_t*)((char*)device + deviceRB); | 682 device = (uint32_t*)((char*)device + deviceRB); |
689 } while (--height > 0); | 683 } while (--height > 0); |
690 } | 684 } |
691 } | 685 } |
692 } | 686 } |
OLD | NEW |