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

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

Issue 1647223002: batch merge new edges (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove extra paren 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
64 static void insert_new_edges(SkEdge* newEdge, int curr_y) { 77 static void insert_new_edges(SkEdge* newEdge, int curr_y) {
78 #ifdef SK_SUPPORT_LEGACY_INSERT_NEW_EDGES
65 SkASSERT(newEdge->fFirstY >= curr_y); 79 SkASSERT(newEdge->fFirstY >= curr_y);
66 80
67 while (newEdge->fFirstY == curr_y) { 81 while (newEdge->fFirstY == curr_y) {
68 SkEdge* next = newEdge->fNext; 82 SkEdge* next = newEdge->fNext;
69 backward_insert_edge_based_on_x(newEdge SkPARAM(curr_y)); 83 backward_insert_edge_based_on_x(newEdge SkPARAM(curr_y));
70 newEdge = next; 84 newEdge = next;
71 } 85 }
86 #else
87 if (newEdge->fFirstY != curr_y) {
88 return;
89 }
90 SkEdge* prev = newEdge->fPrev;
91 if (prev->fX <= newEdge->fX) {
92 return;
93 }
94 // find first x pos to insert
95 SkEdge* start = backward_insert_start(prev, newEdge->fX);
96 // insert the lot, fixing up the links as we go
97 do {
98 SkEdge* next = newEdge->fNext;
99 do {
100 if (start->fNext == newEdge) {
101 goto nextEdge;
102 }
103 SkEdge* after = start->fNext;
104 if (after->fX >= newEdge->fX) {
105 break;
106 }
107 start = after;
108 } while (true);
109 remove_edge(newEdge);
110 insert_edge_after(newEdge, start);
111 nextEdge:
112 start = newEdge;
113 newEdge = next;
114 } while (newEdge->fFirstY == curr_y);
115 #endif
72 } 116 }
73 117
74 #ifdef SK_DEBUG 118 #ifdef SK_DEBUG
75 static void validate_edges_for_y(const SkEdge* edge, int curr_y) { 119 static void validate_edges_for_y(const SkEdge* edge, int curr_y) {
76 while (edge->fFirstY <= curr_y) { 120 while (edge->fFirstY <= curr_y) {
77 SkASSERT(edge->fPrev && edge->fNext); 121 SkASSERT(edge->fPrev && edge->fNext);
78 SkASSERT(edge->fPrev->fNext == edge); 122 SkASSERT(edge->fPrev->fNext == edge);
79 SkASSERT(edge->fNext->fPrev == edge); 123 SkASSERT(edge->fNext->fPrev == edge);
80 SkASSERT(edge->fFirstY <= edge->fLastY); 124 SkASSERT(edge->fFirstY <= edge->fLastY);
81 125
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 clipRgn = &wrap.getRgn(); 780 clipRgn = &wrap.getRgn();
737 blitter = wrap.getBlitter(); 781 blitter = wrap.getBlitter();
738 } 782 }
739 783
740 SkScanClipper clipper(blitter, clipRgn, ir); 784 SkScanClipper clipper(blitter, clipRgn, ir);
741 blitter = clipper.getBlitter(); 785 blitter = clipper.getBlitter();
742 if (blitter) { 786 if (blitter) {
743 sk_fill_triangle(pts, clipper.getClipRect(), blitter, ir); 787 sk_fill_triangle(pts, clipper.getClipRect(), blitter, ir);
744 } 788 }
745 } 789 }
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