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

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

Issue 1654593002: Revert of batch merge new edges (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | 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"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 SkEdge* prev = edge->fPrev; 54 SkEdge* prev = edge->fPrev;
55 while (prev->fX > x) { 55 while (prev->fX > x) {
56 prev = prev->fPrev; 56 prev = prev->fPrev;
57 } 57 }
58 if (prev->fNext != edge) { 58 if (prev->fNext != edge) {
59 remove_edge(edge); 59 remove_edge(edge);
60 insert_edge_after(edge, prev); 60 insert_edge_after(edge, prev);
61 } 61 }
62 } 62 }
63 63
64 #ifndef SK_SUPPORT_LEGACY_INSERT_NEW_EDGES
65 // Start from the right side, searching backwards for the point to begin the new edge list
66 // insertion, marching forwards from here. The implementation could have started from the left
67 // of the prior insertion, and search to the right, or with some additional cach ing, binary
68 // search the starting point. More work could be done to determine optimal new e dge insertion.
69 static SkEdge* backward_insert_start(SkEdge* prev, SkFixed x) {
70 while (prev->fX > x) {
71 prev = prev->fPrev;
72 }
73 return prev;
74 }
75 #endif
76
77 static void insert_new_edges(SkEdge* newEdge, int curr_y) { 64 static void insert_new_edges(SkEdge* newEdge, int curr_y) {
78 #ifdef SK_SUPPORT_LEGACY_INSERT_NEW_EDGES
79 SkASSERT(newEdge->fFirstY >= curr_y); 65 SkASSERT(newEdge->fFirstY >= curr_y);
80 66
81 while (newEdge->fFirstY == curr_y) { 67 while (newEdge->fFirstY == curr_y) {
82 SkEdge* next = newEdge->fNext; 68 SkEdge* next = newEdge->fNext;
83 backward_insert_edge_based_on_x(newEdge SkPARAM(curr_y)); 69 backward_insert_edge_based_on_x(newEdge SkPARAM(curr_y));
84 newEdge = next; 70 newEdge = next;
85 } 71 }
86 } 72 }
87 #else
88 if (newEdge->fFirstY != curr_y) {
89 return;
90 }
91 SkEdge* prev = newEdge->fPrev;
92 if (prev->fX <= newEdge->fX) {
93 return;
94 }
95 // find first x pos to insert
96 SkEdge* start = backward_insert_start(prev, newEdge->fX);
97 // insert the lot, fixing up the links as we go
98 do {
99 SkEdge* next = newEdge->fNext;
100 do {
101 if (start->fNext == newEdge) {
102 goto nextEdge;
103 }
104 SkEdge* after = start->fNext;
105 if (after->fX >= newEdge->fX) {
106 break;
107 }
108 start = after;
109 } while (true);
110 remove_edge(newEdge);
111 insert_edge_after(newEdge, start);
112 nextEdge:
113 start = newEdge;
114 newEdge = next;
115 } while (newEdge->fFirstY == curr_y);
116 #endif
117 }
118 73
119 #ifdef SK_DEBUG 74 #ifdef SK_DEBUG
120 static void validate_edges_for_y(const SkEdge* edge, int curr_y) { 75 static void validate_edges_for_y(const SkEdge* edge, int curr_y) {
121 while (edge->fFirstY <= curr_y) { 76 while (edge->fFirstY <= curr_y) {
122 SkASSERT(edge->fPrev && edge->fNext); 77 SkASSERT(edge->fPrev && edge->fNext);
123 SkASSERT(edge->fPrev->fNext == edge); 78 SkASSERT(edge->fPrev->fNext == edge);
124 SkASSERT(edge->fNext->fPrev == edge); 79 SkASSERT(edge->fNext->fPrev == edge);
125 SkASSERT(edge->fFirstY <= edge->fLastY); 80 SkASSERT(edge->fFirstY <= edge->fLastY);
126 81
127 SkASSERT(edge->fPrev->fX <= edge->fX); 82 SkASSERT(edge->fPrev->fX <= edge->fX);
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 clipRgn = &wrap.getRgn(); 736 clipRgn = &wrap.getRgn();
782 blitter = wrap.getBlitter(); 737 blitter = wrap.getBlitter();
783 } 738 }
784 739
785 SkScanClipper clipper(blitter, clipRgn, ir); 740 SkScanClipper clipper(blitter, clipRgn, ir);
786 blitter = clipper.getBlitter(); 741 blitter = clipper.getBlitter();
787 if (blitter) { 742 if (blitter) {
788 sk_fill_triangle(pts, clipper.getClipRect(), blitter, ir); 743 sk_fill_triangle(pts, clipper.getClipRect(), blitter, ir);
789 } 744 }
790 } 745 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698