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

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

Issue 1078413003: Speeup hairline curves (quads and cubics) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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.h ('k') | src/core/SkCoreBlitters.h » ('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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
111 uint32_t* device = fDevice.getAddr32(x, y);
112 SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);)
113
114 device[0] = SkBlendARGB32(fPMColor, device[0], a0);
115 device[1] = SkBlendARGB32(fPMColor, device[1], a1);
116 }
117
118 void SkARGB32_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) {
119 uint32_t* device = fDevice.getAddr32(x, y);
120 SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);)
121
122 device[0] = SkBlendARGB32(fPMColor, device[0], a0);
123 device = (uint32_t*)((char*)device + fDevice.rowBytes());
124 device[0] = SkBlendARGB32(fPMColor, device[0], a1);
125 }
126 #endif
127
109 //////////////////////////////////////////////////////////////////////////////// ////// 128 //////////////////////////////////////////////////////////////////////////////// //////
110 129
111 #define solid_8_pixels(mask, dst, color) \ 130 #define solid_8_pixels(mask, dst, color) \
112 do { \ 131 do { \
113 if (mask & 0x80) dst[0] = color; \ 132 if (mask & 0x80) dst[0] = color; \
114 if (mask & 0x40) dst[1] = color; \ 133 if (mask & 0x40) dst[1] = color; \
115 if (mask & 0x20) dst[2] = color; \ 134 if (mask & 0x20) dst[2] = color; \
116 if (mask & 0x10) dst[3] = color; \ 135 if (mask & 0x10) dst[3] = color; \
117 if (mask & 0x08) dst[4] = color; \ 136 if (mask & 0x08) dst[4] = color; \
118 if (mask & 0x04) dst[5] = color; \ 137 if (mask & 0x04) dst[5] = color; \
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return; 192 return;
174 } 193 }
175 194
176 if (mask.fFormat == SkMask::kBW_Format) { 195 if (mask.fFormat == SkMask::kBW_Format) {
177 SkARGB32_BlitBW(fDevice, mask, clip, fPMColor); 196 SkARGB32_BlitBW(fDevice, mask, clip, fPMColor);
178 } else if (SkMask::kARGB32_Format == mask.fFormat) { 197 } else if (SkMask::kARGB32_Format == mask.fFormat) {
179 SkARGB32_Blit32(fDevice, mask, clip, fPMColor); 198 SkARGB32_Blit32(fDevice, mask, clip, fPMColor);
180 } 199 }
181 } 200 }
182 201
202 #ifndef SK_SUPPORT_LEGACY_BLITANTIH2V2
203 void SkARGB32_Opaque_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) {
204 uint32_t* device = fDevice.getAddr32(x, y);
205 SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);)
206
207 device[0] = SkFastFourByteInterp(fPMColor, device[0], a0);
208 device[1] = SkFastFourByteInterp(fPMColor, device[1], a1);
209 }
210
211 void SkARGB32_Opaque_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) {
212 uint32_t* device = fDevice.getAddr32(x, y);
213 SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);)
214
215 device[0] = SkFastFourByteInterp(fPMColor, device[0], a0);
216 device = (uint32_t*)((char*)device + fDevice.rowBytes());
217 device[0] = SkFastFourByteInterp(fPMColor, device[0], a1);
218 }
219 #endif
220
183 /////////////////////////////////////////////////////////////////////////////// 221 ///////////////////////////////////////////////////////////////////////////////
184 222
185 void SkARGB32_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { 223 void SkARGB32_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
186 if (alpha == 0 || fSrcA == 0) { 224 if (alpha == 0 || fSrcA == 0) {
187 return; 225 return;
188 } 226 }
189 227
190 uint32_t* device = fDevice.getAddr32(x, y); 228 uint32_t* device = fDevice.getAddr32(x, y);
191 uint32_t color = fPMColor; 229 uint32_t color = fPMColor;
192 230
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 device[n] = src + SkAlphaMulQ(device[n], dst_scale); 287 device[n] = src + SkAlphaMulQ(device[n], dst_scale);
250 } while (n > 0); 288 } while (n > 0);
251 } 289 }
252 } 290 }
253 runs += count; 291 runs += count;
254 antialias += count; 292 antialias += count;
255 device += count; 293 device += count;
256 } 294 }
257 } 295 }
258 296
297 #ifndef SK_SUPPORT_LEGACY_BLITANTIH2V2
298 void SkARGB32_Black_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) {
299 uint32_t* device = fDevice.getAddr32(x, y);
300 SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);)
301
302 device[0] = (a0 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a0);
303 device[1] = (a1 << SK_A32_SHIFT) + SkAlphaMulQ(device[1], 256 - a1);
304 }
305
306 void SkARGB32_Black_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) {
307 uint32_t* device = fDevice.getAddr32(x, y);
308 SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);)
309
310 device[0] = (a0 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a0);
311 device = (uint32_t*)((char*)device + fDevice.rowBytes());
312 device[0] = (a1 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a1);
313 }
314 #endif
315
259 /////////////////////////////////////////////////////////////////////////////// 316 ///////////////////////////////////////////////////////////////////////////////
260 317
261 // Special version of SkBlitRow::Factory32 that knows we're in kSrc_Mode, 318 // Special version of SkBlitRow::Factory32 that knows we're in kSrc_Mode,
262 // instead of kSrcOver_Mode 319 // instead of kSrcOver_Mode
263 static void blend_srcmode(SkPMColor* SK_RESTRICT device, 320 static void blend_srcmode(SkPMColor* SK_RESTRICT device,
264 const SkPMColor* SK_RESTRICT span, 321 const SkPMColor* SK_RESTRICT span,
265 int count, U8CPU aa) { 322 int count, U8CPU aa) {
266 int aa256 = SkAlpha255To256(aa); 323 int aa256 = SkAlpha255To256(aa);
267 for (int i = 0; i < count; ++i) { 324 for (int i = 0; i < count; ++i) {
268 device[i] = SkFourByteInterp256(span[i], device[i], aa256); 325 device[i] = SkFourByteInterp256(span[i], device[i], aa256);
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; 683 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend;
627 do { 684 do {
628 shaderContext->shadeSpan(x, y, span, 1); 685 shaderContext->shadeSpan(x, y, span, 1);
629 proc(device, span, 1, alpha); 686 proc(device, span, 1, alpha);
630 y += 1; 687 y += 1;
631 device = (uint32_t*)((char*)device + deviceRB); 688 device = (uint32_t*)((char*)device + deviceRB);
632 } while (--height > 0); 689 } while (--height > 0);
633 } 690 }
634 } 691 }
635 } 692 }
OLDNEW
« no previous file with comments | « src/core/SkBlitter.h ('k') | src/core/SkCoreBlitters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698