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

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

Issue 1633143002: move more geometry to simd (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: confirmed that only gm tests that call cubic eval change Created 4 years, 11 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/SkGeometry.cpp ('k') | src/utils/SkPatchUtils.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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return idx + (idy >> 1); 211 return idx + (idy >> 1);
212 } else { 212 } else {
213 return idy + (idx >> 1); 213 return idy + (idx >> 1);
214 } 214 }
215 } 215 }
216 216
217 static void hairquad(const SkPoint pts[3], const SkRegion* clip, 217 static void hairquad(const SkPoint pts[3], const SkRegion* clip,
218 SkBlitter* blitter, int level, SkScan::HairRgnProc lineproc ) { 218 SkBlitter* blitter, int level, SkScan::HairRgnProc lineproc ) {
219 SkASSERT(level <= kMaxQuadSubdivideLevel); 219 SkASSERT(level <= kMaxQuadSubdivideLevel);
220 220
221 SkPoint coeff[3]; 221 SkQuadCoeff coeff(pts);
222 SkQuadToCoeff(pts, coeff);
223 222
224 const int lines = 1 << level; 223 const int lines = 1 << level;
225 Sk2s t(0); 224 Sk2s t(0);
226 Sk2s dt(SK_Scalar1 / lines); 225 Sk2s dt(SK_Scalar1 / lines);
227 226
228 SkPoint tmp[(1 << kMaxQuadSubdivideLevel) + 1]; 227 SkPoint tmp[(1 << kMaxQuadSubdivideLevel) + 1];
229 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp)); 228 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp));
230 229
231 tmp[0] = pts[0]; 230 tmp[0] = pts[0];
232 Sk2s A = Sk2s::Load(&coeff[0].fX); 231 Sk2s A = coeff.fA;
233 Sk2s B = Sk2s::Load(&coeff[1].fX); 232 Sk2s B = coeff.fB;
234 Sk2s C = Sk2s::Load(&coeff[2].fX); 233 Sk2s C = coeff.fC;
235 for (int i = 1; i < lines; ++i) { 234 for (int i = 1; i < lines; ++i) {
236 t = t + dt; 235 t = t + dt;
237 ((A * t + B) * t + C).store(&tmp[i].fX); 236 ((A * t + B) * t + C).store(&tmp[i].fX);
238 } 237 }
239 tmp[lines] = pts[2]; 238 tmp[lines] = pts[2];
240 lineproc(tmp, lines + 1, clip, blitter); 239 lineproc(tmp, lines + 1, clip, blitter);
241 } 240 }
242 241
243 static inline Sk2s abs(const Sk2s& value) { 242 static inline Sk2s abs(const Sk2s& value) {
244 return Sk2s::Max(value, Sk2s(0)-value); 243 return Sk2s::Max(value, Sk2s(0)-value);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 static void hair_cubic(const SkPoint pts[4], const SkRegion* clip, SkBlitter* bl itter, 288 static void hair_cubic(const SkPoint pts[4], const SkRegion* clip, SkBlitter* bl itter,
290 SkScan::HairRgnProc lineproc) { 289 SkScan::HairRgnProc lineproc) {
291 const int lines = compute_cubic_segs(pts); 290 const int lines = compute_cubic_segs(pts);
292 SkASSERT(lines > 0); 291 SkASSERT(lines > 0);
293 if (1 == lines) { 292 if (1 == lines) {
294 SkPoint tmp[2] = { pts[0], pts[3] }; 293 SkPoint tmp[2] = { pts[0], pts[3] };
295 lineproc(tmp, 2, clip, blitter); 294 lineproc(tmp, 2, clip, blitter);
296 return; 295 return;
297 } 296 }
298 297
299 SkPoint coeff[4]; 298 SkCubicCoeff coeff(pts);
300 SkCubicToCoeff(pts, coeff);
301 299
302 const Sk2s dt(SK_Scalar1 / lines); 300 const Sk2s dt(SK_Scalar1 / lines);
303 Sk2s t(0); 301 Sk2s t(0);
304 302
305 SkPoint tmp[(1 << kMaxCubicSubdivideLevel) + 1]; 303 SkPoint tmp[(1 << kMaxCubicSubdivideLevel) + 1];
306 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp)); 304 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp));
307 305
308 tmp[0] = pts[0]; 306 tmp[0] = pts[0];
309 Sk2s A = Sk2s::Load(&coeff[0].fX); 307 Sk2s A = coeff.fA;
310 Sk2s B = Sk2s::Load(&coeff[1].fX); 308 Sk2s B = coeff.fB;
311 Sk2s C = Sk2s::Load(&coeff[2].fX); 309 Sk2s C = coeff.fC;
312 Sk2s D = Sk2s::Load(&coeff[3].fX); 310 Sk2s D = coeff.fD;
313 for (int i = 1; i < lines; ++i) { 311 for (int i = 1; i < lines; ++i) {
314 t = t + dt; 312 t = t + dt;
315 (((A * t + B) * t + C) * t + D).store(&tmp[i].fX); 313 (((A * t + B) * t + C) * t + D).store(&tmp[i].fX);
316 } 314 }
317 tmp[lines] = pts[3]; 315 tmp[lines] = pts[3];
318 lineproc(tmp, lines + 1, clip, blitter); 316 lineproc(tmp, lines + 1, clip, blitter);
319 } 317 }
320 318
321 static SkRect compute_nocheck_cubic_bounds(const SkPoint pts[4]) { 319 static SkRect compute_nocheck_cubic_bounds(const SkPoint pts[4]) {
322 SkASSERT(SkScalarsAreFinite(&pts[0].fX, 8)); 320 SkASSERT(SkScalarsAreFinite(&pts[0].fX, 8));
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 679
682 SkAAClipBlitterWrapper wrap; 680 SkAAClipBlitterWrapper wrap;
683 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { 681 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) {
684 wrap.init(clip, blitter); 682 wrap.init(clip, blitter);
685 blitter = wrap.getBlitter(); 683 blitter = wrap.getBlitter();
686 clipRgn = &wrap.getRgn(); 684 clipRgn = &wrap.getRgn();
687 } 685 }
688 AntiHairLineRgn(pts, count, clipRgn, blitter); 686 AntiHairLineRgn(pts, count, clipRgn, blitter);
689 } 687 }
690 } 688 }
OLDNEW
« no previous file with comments | « src/core/SkGeometry.cpp ('k') | src/utils/SkPatchUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698