OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
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 "SkChunkAlloc.h" | 8 #include "SkChunkAlloc.h" |
9 #include "SkPathOpsBounds.h" | 9 #include "SkPathOpsBounds.h" |
10 #include "SkPathOpsRect.h" | 10 #include "SkPathOpsRect.h" |
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 // returns true if the rect is too small to consider | 1900 // returns true if the rect is too small to consider |
1901 template<typename TCurve, typename OppCurve> | 1901 template<typename TCurve, typename OppCurve> |
1902 void SkTSect<TCurve, OppCurve>::BinarySearch(SkTSect<TCurve, OppCurve>* sect1, | 1902 void SkTSect<TCurve, OppCurve>::BinarySearch(SkTSect<TCurve, OppCurve>* sect1, |
1903 SkTSect<OppCurve, TCurve>* sect2, SkIntersections* intersections) { | 1903 SkTSect<OppCurve, TCurve>* sect2, SkIntersections* intersections) { |
1904 #if DEBUG_T_SECT_DUMP > 1 | 1904 #if DEBUG_T_SECT_DUMP > 1 |
1905 gDumpTSectNum = 0; | 1905 gDumpTSectNum = 0; |
1906 #endif | 1906 #endif |
1907 SkDEBUGCODE(sect1->fOppSect = sect2); | 1907 SkDEBUGCODE(sect1->fOppSect = sect2); |
1908 SkDEBUGCODE(sect2->fOppSect = sect1); | 1908 SkDEBUGCODE(sect2->fOppSect = sect1); |
1909 intersections->reset(); | 1909 intersections->reset(); |
1910 intersections->setMax(TCurve::kMaxIntersections * 3); // give extra for slo
p | 1910 intersections->setMax(TCurve::kMaxIntersections + 3); // give extra for slo
p |
1911 SkTSpan<TCurve, OppCurve>* span1 = sect1->fHead; | 1911 SkTSpan<TCurve, OppCurve>* span1 = sect1->fHead; |
1912 SkTSpan<OppCurve, TCurve>* span2 = sect2->fHead; | 1912 SkTSpan<OppCurve, TCurve>* span2 = sect2->fHead; |
1913 int oppSect, sect = sect1->intersects(span1, sect2, span2, &oppSect); | 1913 int oppSect, sect = sect1->intersects(span1, sect2, span2, &oppSect); |
1914 // SkASSERT(between(0, sect, 2)); | 1914 // SkASSERT(between(0, sect, 2)); |
1915 if (!sect) { | 1915 if (!sect) { |
1916 return; | 1916 return; |
1917 } | 1917 } |
1918 if (sect == 2 && oppSect == 2) { | 1918 if (sect == 2 && oppSect == 2) { |
1919 (void) EndsEqual(sect1, sect2, intersections); | 1919 (void) EndsEqual(sect1, sect2, intersections); |
1920 return; | 1920 return; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 } else if (intersections->isCoincident(index + 1)) { | 2086 } else if (intersections->isCoincident(index + 1)) { |
2087 intersections->removeOne(index + 1); | 2087 intersections->removeOne(index + 1); |
2088 --last; | 2088 --last; |
2089 } else { | 2089 } else { |
2090 intersections->setCoincident(index++); | 2090 intersections->setCoincident(index++); |
2091 } | 2091 } |
2092 intersections->setCoincident(index); | 2092 intersections->setCoincident(index); |
2093 } | 2093 } |
2094 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); | 2094 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); |
2095 } | 2095 } |
OLD | NEW |