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

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

Issue 1167153002: Remove overly-promiscuous SkNx syntax sugar. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: update test Created 5 years, 6 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/SkRect.cpp ('k') | src/effects/gradients/SkRadialGradient.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 "SkScan.h" 8 #include "SkScan.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkRasterClip.h" 10 #include "SkRasterClip.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 Sk2s dt(SK_Scalar1 / lines); 226 Sk2s dt(SK_Scalar1 / lines);
227 227
228 SkPoint tmp[(1 << kMaxQuadSubdivideLevel) + 1]; 228 SkPoint tmp[(1 << kMaxQuadSubdivideLevel) + 1];
229 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp)); 229 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp));
230 230
231 tmp[0] = pts[0]; 231 tmp[0] = pts[0];
232 Sk2s A = Sk2s::Load(&coeff[0].fX); 232 Sk2s A = Sk2s::Load(&coeff[0].fX);
233 Sk2s B = Sk2s::Load(&coeff[1].fX); 233 Sk2s B = Sk2s::Load(&coeff[1].fX);
234 Sk2s C = Sk2s::Load(&coeff[2].fX); 234 Sk2s C = Sk2s::Load(&coeff[2].fX);
235 for (int i = 1; i < lines; ++i) { 235 for (int i = 1; i < lines; ++i) {
236 t += dt; 236 t = t + dt;
237 ((A * t + B) * t + C).store(&tmp[i].fX); 237 ((A * t + B) * t + C).store(&tmp[i].fX);
238 } 238 }
239 tmp[lines] = pts[2]; 239 tmp[lines] = pts[2];
240 lineproc(tmp, lines + 1, clip, blitter); 240 lineproc(tmp, lines + 1, clip, blitter);
241 } 241 }
242 242
243 static inline Sk2s abs(const Sk2s& value) { 243 static inline Sk2s abs(const Sk2s& value) {
244 return Sk2s::Max(value, -value); 244 return Sk2s::Max(value, Sk2s(0)-value);
245 } 245 }
246 246
247 static inline SkScalar max_component(const Sk2s& value) { 247 static inline SkScalar max_component(const Sk2s& value) {
248 SkScalar components[2]; 248 SkScalar components[2];
249 value.store(components); 249 value.store(components);
250 return SkTMax(components[0], components[1]); 250 return SkTMax(components[0], components[1]);
251 } 251 }
252 252
253 static inline int compute_cubic_segs(const SkPoint pts[4]) { 253 static inline int compute_cubic_segs(const SkPoint pts[4]) {
254 Sk2s p0 = from_point(pts[0]); 254 Sk2s p0 = from_point(pts[0]);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 const int lines = compute_cubic_segs(pts); 291 const int lines = compute_cubic_segs(pts);
292 SkASSERT(lines > 0); 292 SkASSERT(lines > 0);
293 if (1 == lines) { 293 if (1 == lines) {
294 SkPoint tmp[2] = { pts[0], pts[3] }; 294 SkPoint tmp[2] = { pts[0], pts[3] };
295 lineproc(tmp, 2, clip, blitter); 295 lineproc(tmp, 2, clip, blitter);
296 return; 296 return;
297 } 297 }
298 298
299 SkPoint coeff[4]; 299 SkPoint coeff[4];
300 SkCubicToCoeff(pts, coeff); 300 SkCubicToCoeff(pts, coeff);
301 301
302 const Sk2s dt(SK_Scalar1 / lines); 302 const Sk2s dt(SK_Scalar1 / lines);
303 Sk2s t(0); 303 Sk2s t(0);
304 304
305 SkPoint tmp[(1 << kMaxCubicSubdivideLevel) + 1]; 305 SkPoint tmp[(1 << kMaxCubicSubdivideLevel) + 1];
306 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp)); 306 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp));
307 307
308 tmp[0] = pts[0]; 308 tmp[0] = pts[0];
309 Sk2s A = Sk2s::Load(&coeff[0].fX); 309 Sk2s A = Sk2s::Load(&coeff[0].fX);
310 Sk2s B = Sk2s::Load(&coeff[1].fX); 310 Sk2s B = Sk2s::Load(&coeff[1].fX);
311 Sk2s C = Sk2s::Load(&coeff[2].fX); 311 Sk2s C = Sk2s::Load(&coeff[2].fX);
312 Sk2s D = Sk2s::Load(&coeff[3].fX); 312 Sk2s D = Sk2s::Load(&coeff[3].fX);
313 for (int i = 1; i < lines; ++i) { 313 for (int i = 1; i < lines; ++i) {
314 t += dt; 314 t = t + dt;
315 (((A * t + B) * t + C) * t + D).store(&tmp[i].fX); 315 (((A * t + B) * t + C) * t + D).store(&tmp[i].fX);
316 } 316 }
317 tmp[lines] = pts[3]; 317 tmp[lines] = pts[3];
318 lineproc(tmp, lines + 1, clip, blitter); 318 lineproc(tmp, lines + 1, clip, blitter);
319 } 319 }
320 320
321 static inline void haircubic(const SkPoint pts[4], const SkRegion* clip, 321 static inline void haircubic(const SkPoint pts[4], const SkRegion* clip,
322 SkBlitter* blitter, int level, SkScan::HairRgnProc linepro c) { 322 SkBlitter* blitter, int level, SkScan::HairRgnProc linepro c) {
323 if (quick_cubic_niceness_check(pts)) { 323 if (quick_cubic_niceness_check(pts)) {
324 hair_cubic(pts, clip, blitter, lineproc); 324 hair_cubic(pts, clip, blitter, lineproc);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 490
491 SkAAClipBlitterWrapper wrap; 491 SkAAClipBlitterWrapper wrap;
492 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { 492 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) {
493 wrap.init(clip, blitter); 493 wrap.init(clip, blitter);
494 blitter = wrap.getBlitter(); 494 blitter = wrap.getBlitter();
495 clipRgn = &wrap.getRgn(); 495 clipRgn = &wrap.getRgn();
496 } 496 }
497 AntiHairLineRgn(pts, count, clipRgn, blitter); 497 AntiHairLineRgn(pts, count, clipRgn, blitter);
498 } 498 }
499 } 499 }
OLDNEW
« no previous file with comments | « src/core/SkRect.cpp ('k') | src/effects/gradients/SkRadialGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698