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

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

Issue 1050953003: remove dead code from 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/SkCoreBlitters.h ('k') | no next file » | 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 #ifdef SK_SUPPORT_LEGACY_BLITANTIH2V2
222 if (level > 0) {
223 SkPoint tmp[5];
224
225 SkChopQuadAtHalf(pts, tmp);
226 hairquad(tmp, clip, blitter, level - 1, lineproc);
227 hairquad(&tmp[2], clip, blitter, level - 1, lineproc);
228 } else {
229 SkPoint tmp[] = { pts[0], pts[2] };
230 lineproc(tmp, 2, clip, blitter);
231 }
232 #else
233 SkPoint coeff[3]; 221 SkPoint coeff[3];
234 SkQuadToCoeff(pts, coeff); 222 SkQuadToCoeff(pts, coeff);
235 223
236 const int lines = 1 << level; 224 const int lines = 1 << level;
237 Sk2s t(0); 225 Sk2s t(0);
238 Sk2s dt(SK_Scalar1 / lines); 226 Sk2s dt(SK_Scalar1 / lines);
239 227
240 SkPoint tmp[(1 << kMaxQuadSubdivideLevel) + 1]; 228 SkPoint tmp[(1 << kMaxQuadSubdivideLevel) + 1];
241 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp)); 229 SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp));
242 230
243 tmp[0] = pts[0]; 231 tmp[0] = pts[0];
244 Sk2s A = Sk2s::Load(&coeff[0].fX); 232 Sk2s A = Sk2s::Load(&coeff[0].fX);
245 Sk2s B = Sk2s::Load(&coeff[1].fX); 233 Sk2s B = Sk2s::Load(&coeff[1].fX);
246 Sk2s C = Sk2s::Load(&coeff[2].fX); 234 Sk2s C = Sk2s::Load(&coeff[2].fX);
247 for (int i = 1; i < lines; ++i) { 235 for (int i = 1; i < lines; ++i) {
248 t += dt; 236 t += dt;
249 ((A * t + B) * t + C).store(&tmp[i].fX); 237 ((A * t + B) * t + C).store(&tmp[i].fX);
250 } 238 }
251 tmp[lines] = pts[2]; 239 tmp[lines] = pts[2];
252 lineproc(tmp, lines + 1, clip, blitter); 240 lineproc(tmp, lines + 1, clip, blitter);
253 #endif
254 } 241 }
255 242
256 #ifndef SK_SUPPORT_LEGACY_BLITANTIH2V2
257 static inline Sk2s abs(const Sk2s& value) { 243 static inline Sk2s abs(const Sk2s& value) {
258 return Sk2s::Max(value, -value); 244 return Sk2s::Max(value, -value);
259 } 245 }
260 246
261 static inline SkScalar max_component(const Sk2s& value) { 247 static inline SkScalar max_component(const Sk2s& value) {
262 SkScalar components[2]; 248 SkScalar components[2];
263 value.store(components); 249 value.store(components);
264 return SkTMax(components[0], components[1]); 250 return SkTMax(components[0], components[1]);
265 } 251 }
266 252
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 Sk2s B = Sk2s::Load(&coeff[1].fX); 310 Sk2s B = Sk2s::Load(&coeff[1].fX);
325 Sk2s C = Sk2s::Load(&coeff[2].fX); 311 Sk2s C = Sk2s::Load(&coeff[2].fX);
326 Sk2s D = Sk2s::Load(&coeff[3].fX); 312 Sk2s D = Sk2s::Load(&coeff[3].fX);
327 for (int i = 1; i < lines; ++i) { 313 for (int i = 1; i < lines; ++i) {
328 t += dt; 314 t += dt;
329 (((A * t + B) * t + C) * t + D).store(&tmp[i].fX); 315 (((A * t + B) * t + C) * t + D).store(&tmp[i].fX);
330 } 316 }
331 tmp[lines] = pts[3]; 317 tmp[lines] = pts[3];
332 lineproc(tmp, lines + 1, clip, blitter); 318 lineproc(tmp, lines + 1, clip, blitter);
333 } 319 }
334 #endif
335 320
336 static inline void haircubic(const SkPoint pts[4], const SkRegion* clip, 321 static inline void haircubic(const SkPoint pts[4], const SkRegion* clip,
337 SkBlitter* blitter, int level, SkScan::HairRgnProc linepro c) { 322 SkBlitter* blitter, int level, SkScan::HairRgnProc linepro c) {
338 #ifdef SK_SUPPORT_LEGACY_BLITANTIH2V2
339 if (level > 0) {
340 SkPoint tmp[7];
341
342 SkChopCubicAt(pts, tmp, SK_Scalar1/2);
343 haircubic(tmp, clip, blitter, level - 1, lineproc);
344 haircubic(&tmp[3], clip, blitter, level - 1, lineproc);
345 } else {
346 SkPoint tmp[] = { pts[0], pts[3] };
347 lineproc(tmp, 2, clip, blitter);
348 }
349 #else
350 if (quick_cubic_niceness_check(pts)) { 323 if (quick_cubic_niceness_check(pts)) {
351 hair_cubic(pts, clip, blitter, lineproc); 324 hair_cubic(pts, clip, blitter, lineproc);
352 } else { 325 } else {
353 SkPoint tmp[13]; 326 SkPoint tmp[13];
354 SkScalar tValues[3]; 327 SkScalar tValues[3];
355 328
356 int count = SkChopCubicAtMaxCurvature(pts, tmp, tValues); 329 int count = SkChopCubicAtMaxCurvature(pts, tmp, tValues);
357 for (int i = 0; i < count; i++) { 330 for (int i = 0; i < count; i++) {
358 hair_cubic(&tmp[i * 3], clip, blitter, lineproc); 331 hair_cubic(&tmp[i * 3], clip, blitter, lineproc);
359 } 332 }
360 } 333 }
361 #endif
362 } 334 }
363 335
364 static int compute_quad_level(const SkPoint pts[3]) { 336 static int compute_quad_level(const SkPoint pts[3]) {
365 int d = compute_int_quad_dist(pts); 337 int d = compute_int_quad_dist(pts);
366 /* quadratics approach the line connecting their start and end points 338 /* quadratics approach the line connecting their start and end points
367 4x closer with each subdivision, so we compute the number of 339 4x closer with each subdivision, so we compute the number of
368 subdivisions to be the minimum need to get that distance to be less 340 subdivisions to be the minimum need to get that distance to be less
369 than a pixel. 341 than a pixel.
370 */ 342 */
371 int level = (33 - SkCLZ(d)) >> 1; 343 int level = (33 - SkCLZ(d)) >> 1;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 490
519 SkAAClipBlitterWrapper wrap; 491 SkAAClipBlitterWrapper wrap;
520 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { 492 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) {
521 wrap.init(clip, blitter); 493 wrap.init(clip, blitter);
522 blitter = wrap.getBlitter(); 494 blitter = wrap.getBlitter();
523 clipRgn = &wrap.getRgn(); 495 clipRgn = &wrap.getRgn();
524 } 496 }
525 AntiHairLineRgn(pts, count, clipRgn, blitter); 497 AntiHairLineRgn(pts, count, clipRgn, blitter);
526 } 498 }
527 } 499 }
OLDNEW
« no previous file with comments | « src/core/SkCoreBlitters.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698