OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAAConvexPathRenderer.h" | 9 #include "GrAAConvexPathRenderer.h" |
10 | 10 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 static inline void add_line_to_segment(const SkPoint& pt, | 224 static inline void add_line_to_segment(const SkPoint& pt, |
225 SegmentArray* segments, | 225 SegmentArray* segments, |
226 SkRect* devBounds) { | 226 SkRect* devBounds) { |
227 segments->push_back(); | 227 segments->push_back(); |
228 segments->back().fType = Segment::kLine; | 228 segments->back().fType = Segment::kLine; |
229 segments->back().fPts[0] = pt; | 229 segments->back().fPts[0] = pt; |
230 devBounds->growToInclude(pt.fX, pt.fY); | 230 devBounds->growToInclude(pt.fX, pt.fY); |
231 } | 231 } |
232 | 232 |
| 233 #ifdef SK_DEBUG |
233 static inline bool contains_inclusive(const SkRect& rect, const SkPoint& p) { | 234 static inline bool contains_inclusive(const SkRect& rect, const SkPoint& p) { |
234 return p.fX >= rect.fLeft && p.fX <= rect.fRight && p.fY >= rect.fTop && p.f
Y <= rect.fBottom; | 235 return p.fX >= rect.fLeft && p.fX <= rect.fRight && p.fY >= rect.fTop && p.f
Y <= rect.fBottom; |
235 } | 236 } |
| 237 #endif |
| 238 |
236 static inline void add_quad_segment(const SkPoint pts[3], | 239 static inline void add_quad_segment(const SkPoint pts[3], |
237 SegmentArray* segments, | 240 SegmentArray* segments, |
238 SkRect* devBounds) { | 241 SkRect* devBounds) { |
239 if (pts[0].distanceToSqd(pts[1]) < kCloseSqd || pts[1].distanceToSqd(pts[2])
< kCloseSqd) { | 242 if (pts[0].distanceToSqd(pts[1]) < kCloseSqd || pts[1].distanceToSqd(pts[2])
< kCloseSqd) { |
240 if (pts[0] != pts[2]) { | 243 if (pts[0] != pts[2]) { |
241 add_line_to_segment(pts[2], segments, devBounds); | 244 add_line_to_segment(pts[2], segments, devBounds); |
242 } | 245 } |
243 } else { | 246 } else { |
244 segments->push_back(); | 247 segments->push_back(); |
245 segments->back().fType = Segment::kQuad; | 248 segments->back().fType = Segment::kQuad; |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 vOffset, // start vertex | 708 vOffset, // start vertex |
706 0, // start index | 709 0, // start index |
707 draw.fVertexCnt, | 710 draw.fVertexCnt, |
708 draw.fIndexCnt, | 711 draw.fIndexCnt, |
709 &devBounds); | 712 &devBounds); |
710 vOffset += draw.fVertexCnt; | 713 vOffset += draw.fVertexCnt; |
711 } | 714 } |
712 | 715 |
713 return true; | 716 return true; |
714 } | 717 } |
OLD | NEW |