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

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

Issue 943053004: Remove SK_USE_LEGACY_AA_COVERAGE guarded code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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/SkScan_AntiPath.cpp ('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 "SkScanPriv.h" 8 #include "SkScanPriv.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkEdge.h" 10 #include "SkEdge.h"
11 #include "SkEdgeBuilder.h" 11 #include "SkEdgeBuilder.h"
12 #include "SkGeometry.h" 12 #include "SkGeometry.h"
13 #include "SkPath.h" 13 #include "SkPath.h"
14 #include "SkQuadClipper.h" 14 #include "SkQuadClipper.h"
15 #include "SkRasterClip.h" 15 #include "SkRasterClip.h"
16 #include "SkRegion.h" 16 #include "SkRegion.h"
17 #include "SkTemplates.h" 17 #include "SkTemplates.h"
18 #include "SkTSort.h" 18 #include "SkTSort.h"
19 19
20 #ifdef SK_USE_LEGACY_AA_COVERAGE
21 #define SK_USE_STD_SORT_FOR_EDGES
22 #endif
23
24 #define kEDGE_HEAD_Y SK_MinS32 20 #define kEDGE_HEAD_Y SK_MinS32
25 #define kEDGE_TAIL_Y SK_MaxS32 21 #define kEDGE_TAIL_Y SK_MaxS32
26 22
27 #ifdef SK_DEBUG 23 #ifdef SK_DEBUG
28 static void validate_sort(const SkEdge* edge) { 24 static void validate_sort(const SkEdge* edge) {
29 int y = kEDGE_HEAD_Y; 25 int y = kEDGE_HEAD_Y;
30 26
31 while (edge->fFirstY != SK_MaxS32) { 27 while (edge->fFirstY != SK_MaxS32) {
32 edge->validate(); 28 edge->validate();
33 SkASSERT(y <= edge->fFirstY); 29 SkASSERT(y <= edge->fFirstY);
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 static void PrePostInverseBlitterProc(SkBlitter* blitter, int y, bool isStart) { 357 static void PrePostInverseBlitterProc(SkBlitter* blitter, int y, bool isStart) {
362 ((InverseBlitter*)blitter)->prepost(y, isStart); 358 ((InverseBlitter*)blitter)->prepost(y, isStart);
363 } 359 }
364 360
365 /////////////////////////////////////////////////////////////////////////////// 361 ///////////////////////////////////////////////////////////////////////////////
366 362
367 #if defined _WIN32 && _MSC_VER >= 1300 363 #if defined _WIN32 && _MSC_VER >= 1300
368 #pragma warning ( pop ) 364 #pragma warning ( pop )
369 #endif 365 #endif
370 366
371 #ifdef SK_USE_STD_SORT_FOR_EDGES
372 extern "C" {
373 static int edge_compare(const void* a, const void* b) {
374 const SkEdge* edgea = *(const SkEdge**)a;
375 const SkEdge* edgeb = *(const SkEdge**)b;
376
377 int valuea = edgea->fFirstY;
378 int valueb = edgeb->fFirstY;
379
380 if (valuea == valueb) {
381 valuea = edgea->fX;
382 valueb = edgeb->fX;
383 }
384
385 // this overflows if valuea >>> valueb or vice-versa
386 // return valuea - valueb;
387 // do perform the slower but safe compares
388 return (valuea < valueb) ? -1 : (valuea > valueb);
389 }
390 }
391 #else
392 static bool operator<(const SkEdge& a, const SkEdge& b) { 367 static bool operator<(const SkEdge& a, const SkEdge& b) {
393 int valuea = a.fFirstY; 368 int valuea = a.fFirstY;
394 int valueb = b.fFirstY; 369 int valueb = b.fFirstY;
395 370
396 if (valuea == valueb) { 371 if (valuea == valueb) {
397 valuea = a.fX; 372 valuea = a.fX;
398 valueb = b.fX; 373 valueb = b.fX;
399 } 374 }
400 375
401 return valuea < valueb; 376 return valuea < valueb;
402 } 377 }
403 #endif
404 378
405 static SkEdge* sort_edges(SkEdge* list[], int count, SkEdge** last) { 379 static SkEdge* sort_edges(SkEdge* list[], int count, SkEdge** last) {
406 #ifdef SK_USE_STD_SORT_FOR_EDGES
407 qsort(list, count, sizeof(SkEdge*), edge_compare);
408 #else
409 SkTQSort(list, list + count - 1); 380 SkTQSort(list, list + count - 1);
410 #endif
411 381
412 // now make the edges linked in sorted order 382 // now make the edges linked in sorted order
413 for (int i = 1; i < count; i++) { 383 for (int i = 1; i < count; i++) {
414 list[i - 1]->fNext = list[i]; 384 list[i - 1]->fNext = list[i];
415 list[i]->fPrev = list[i - 1]; 385 list[i]->fPrev = list[i - 1];
416 } 386 }
417 387
418 *last = list[count - 1]; 388 *last = list[count - 1];
419 return list[0]; 389 return list[0];
420 } 390 }
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 clipRgn = &wrap.getRgn(); 700 clipRgn = &wrap.getRgn();
731 blitter = wrap.getBlitter(); 701 blitter = wrap.getBlitter();
732 } 702 }
733 703
734 SkScanClipper clipper(blitter, clipRgn, ir); 704 SkScanClipper clipper(blitter, clipRgn, ir);
735 blitter = clipper.getBlitter(); 705 blitter = clipper.getBlitter();
736 if (blitter) { 706 if (blitter) {
737 sk_fill_triangle(pts, clipper.getClipRect(), blitter, ir); 707 sk_fill_triangle(pts, clipper.getClipRect(), blitter, ir);
738 } 708 }
739 } 709 }
OLDNEW
« no previous file with comments | « src/core/SkScan_AntiPath.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698