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

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

Issue 1085013003: Revert of add new blit2 methods in support of antialiased hairlines guard flag SK_SUPPORT_LEGACY_BLITANTIH2V2 (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
128 //////////////////////////////////////////////////////////////////////////////// ////// 109 //////////////////////////////////////////////////////////////////////////////// //////
129 110
130 #define solid_8_pixels(mask, dst, color) \ 111 #define solid_8_pixels(mask, dst, color) \
131 do { \ 112 do { \
132 if (mask & 0x80) dst[0] = color; \ 113 if (mask & 0x80) dst[0] = color; \
133 if (mask & 0x40) dst[1] = color; \ 114 if (mask & 0x40) dst[1] = color; \
134 if (mask & 0x20) dst[2] = color; \ 115 if (mask & 0x20) dst[2] = color; \
135 if (mask & 0x10) dst[3] = color; \ 116 if (mask & 0x10) dst[3] = color; \
136 if (mask & 0x08) dst[4] = color; \ 117 if (mask & 0x08) dst[4] = color; \
137 if (mask & 0x04) dst[5] = color; \ 118 if (mask & 0x04) dst[5] = color; \
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 return; 173 return;
193 } 174 }
194 175
195 if (mask.fFormat == SkMask::kBW_Format) { 176 if (mask.fFormat == SkMask::kBW_Format) {
196 SkARGB32_BlitBW(fDevice, mask, clip, fPMColor); 177 SkARGB32_BlitBW(fDevice, mask, clip, fPMColor);
197 } else if (SkMask::kARGB32_Format == mask.fFormat) { 178 } else if (SkMask::kARGB32_Format == mask.fFormat) {
198 SkARGB32_Blit32(fDevice, mask, clip, fPMColor); 179 SkARGB32_Blit32(fDevice, mask, clip, fPMColor);
199 } 180 }
200 } 181 }
201 182
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
221 /////////////////////////////////////////////////////////////////////////////// 183 ///////////////////////////////////////////////////////////////////////////////
222 184
223 void SkARGB32_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { 185 void SkARGB32_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
224 if (alpha == 0 || fSrcA == 0) { 186 if (alpha == 0 || fSrcA == 0) {
225 return; 187 return;
226 } 188 }
227 189
228 uint32_t* device = fDevice.getAddr32(x, y); 190 uint32_t* device = fDevice.getAddr32(x, y);
229 uint32_t color = fPMColor; 191 uint32_t color = fPMColor;
230 192
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 device[n] = src + SkAlphaMulQ(device[n], dst_scale); 249 device[n] = src + SkAlphaMulQ(device[n], dst_scale);
288 } while (n > 0); 250 } while (n > 0);
289 } 251 }
290 } 252 }
291 runs += count; 253 runs += count;
292 antialias += count; 254 antialias += count;
293 device += count; 255 device += count;
294 } 256 }
295 } 257 }
296 258
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
316 /////////////////////////////////////////////////////////////////////////////// 259 ///////////////////////////////////////////////////////////////////////////////
317 260
318 // Special version of SkBlitRow::Factory32 that knows we're in kSrc_Mode, 261 // Special version of SkBlitRow::Factory32 that knows we're in kSrc_Mode,
319 // instead of kSrcOver_Mode 262 // instead of kSrcOver_Mode
320 static void blend_srcmode(SkPMColor* SK_RESTRICT device, 263 static void blend_srcmode(SkPMColor* SK_RESTRICT device,
321 const SkPMColor* SK_RESTRICT span, 264 const SkPMColor* SK_RESTRICT span,
322 int count, U8CPU aa) { 265 int count, U8CPU aa) {
323 int aa256 = SkAlpha255To256(aa); 266 int aa256 = SkAlpha255To256(aa);
324 for (int i = 0; i < count; ++i) { 267 for (int i = 0; i < count; ++i) {
325 device[i] = SkFourByteInterp256(span[i], device[i], aa256); 268 device[i] = SkFourByteInterp256(span[i], device[i], aa256);
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; 626 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend;
684 do { 627 do {
685 shaderContext->shadeSpan(x, y, span, 1); 628 shaderContext->shadeSpan(x, y, span, 1);
686 proc(device, span, 1, alpha); 629 proc(device, span, 1, alpha);
687 y += 1; 630 y += 1;
688 device = (uint32_t*)((char*)device + deviceRB); 631 device = (uint32_t*)((char*)device + deviceRB);
689 } while (--height > 0); 632 } while (--height > 0);
690 } 633 }
691 } 634 }
692 } 635 }
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