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

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

Issue 1650653002: SkNx Load/store: take any pointer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify call sites Created 4 years, 10 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/SkColorMatrixFilter.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 226
227 SkPoint tmp[(1 << kMaxQuadSubdivideLevel) + 1]; 227 SkPoint tmp[(1 << kMaxQuadSubdivideLevel) + 1];
228 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp)); 228 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp));
229 229
230 tmp[0] = pts[0]; 230 tmp[0] = pts[0];
231 Sk2s A = coeff.fA; 231 Sk2s A = coeff.fA;
232 Sk2s B = coeff.fB; 232 Sk2s B = coeff.fB;
233 Sk2s C = coeff.fC; 233 Sk2s C = coeff.fC;
234 for (int i = 1; i < lines; ++i) { 234 for (int i = 1; i < lines; ++i) {
235 t = t + dt; 235 t = t + dt;
236 ((A * t + B) * t + C).store(&tmp[i].fX); 236 ((A * t + B) * t + C).store(&tmp[i]);
237 } 237 }
238 tmp[lines] = pts[2]; 238 tmp[lines] = pts[2];
239 lineproc(tmp, lines + 1, clip, blitter); 239 lineproc(tmp, lines + 1, clip, blitter);
240 } 240 }
241 241
242 static inline Sk2s abs(const Sk2s& value) { 242 static inline Sk2s abs(const Sk2s& value) {
243 return Sk2s::Max(value, Sk2s(0)-value); 243 return Sk2s::Max(value, Sk2s(0)-value);
244 } 244 }
245 245
246 static inline SkScalar max_component(const Sk2s& value) { 246 static inline SkScalar max_component(const Sk2s& value) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 SkPoint tmp[(1 << kMaxCubicSubdivideLevel) + 1]; 303 SkPoint tmp[(1 << kMaxCubicSubdivideLevel) + 1];
304 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp)); 304 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp));
305 305
306 tmp[0] = pts[0]; 306 tmp[0] = pts[0];
307 Sk2s A = coeff.fA; 307 Sk2s A = coeff.fA;
308 Sk2s B = coeff.fB; 308 Sk2s B = coeff.fB;
309 Sk2s C = coeff.fC; 309 Sk2s C = coeff.fC;
310 Sk2s D = coeff.fD; 310 Sk2s D = coeff.fD;
311 for (int i = 1; i < lines; ++i) { 311 for (int i = 1; i < lines; ++i) {
312 t = t + dt; 312 t = t + dt;
313 (((A * t + B) * t + C) * t + D).store(&tmp[i].fX); 313 (((A * t + B) * t + C) * t + D).store(&tmp[i]);
314 } 314 }
315 tmp[lines] = pts[3]; 315 tmp[lines] = pts[3];
316 lineproc(tmp, lines + 1, clip, blitter); 316 lineproc(tmp, lines + 1, clip, blitter);
317 } 317 }
318 318
319 static SkRect compute_nocheck_cubic_bounds(const SkPoint pts[4]) { 319 static SkRect compute_nocheck_cubic_bounds(const SkPoint pts[4]) {
320 SkASSERT(SkScalarsAreFinite(&pts[0].fX, 8)); 320 SkASSERT(SkScalarsAreFinite(&pts[0].fX, 8));
321 321
322 Sk2s min = Sk2s::Load(&pts[0].fX); 322 Sk2s min = Sk2s::Load(pts);
323 Sk2s max = min; 323 Sk2s max = min;
324 for (int i = 1; i < 4; ++i) { 324 for (int i = 1; i < 4; ++i) {
325 Sk2s pair = Sk2s::Load(&pts[i].fX); 325 Sk2s pair = Sk2s::Load(pts+i);
326 min = Sk2s::Min(min, pair); 326 min = Sk2s::Min(min, pair);
327 max = Sk2s::Max(max, pair); 327 max = Sk2s::Max(max, pair);
328 } 328 }
329 return { min.kth<0>(), min.kth<1>(), max.kth<0>(), max.kth<1>() }; 329 return { min.kth<0>(), min.kth<1>(), max.kth<0>(), max.kth<1>() };
330 } 330 }
331 331
332 static bool is_inverted(const SkRect& r) { 332 static bool is_inverted(const SkRect& r) {
333 return r.fLeft > r.fRight || r.fTop > r.fBottom; 333 return r.fLeft > r.fRight || r.fTop > r.fBottom;
334 } 334 }
335 335
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 679
680 SkAAClipBlitterWrapper wrap; 680 SkAAClipBlitterWrapper wrap;
681 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { 681 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) {
682 wrap.init(clip, blitter); 682 wrap.init(clip, blitter);
683 blitter = wrap.getBlitter(); 683 blitter = wrap.getBlitter();
684 clipRgn = &wrap.getRgn(); 684 clipRgn = &wrap.getRgn();
685 } 685 }
686 AntiHairLineRgn(pts, count, clipRgn, blitter); 686 AntiHairLineRgn(pts, count, clipRgn, blitter);
687 } 687 }
688 } 688 }
OLDNEW
« no previous file with comments | « src/core/SkRect.cpp ('k') | src/effects/SkColorMatrixFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698