OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return ((clockwise) ? vertexIndex + 1 : vertexIndex - 1 + nVertices) % | 63 return ((clockwise) ? vertexIndex + 1 : vertexIndex - 1 + nVertices) % |
64 nVertices; | 64 nVertices; |
65 } | 65 } |
66 | 66 |
67 static unsigned findNextEdgeVertexIndex(const FloatPolygon& polygon, | 67 static unsigned findNextEdgeVertexIndex(const FloatPolygon& polygon, |
68 unsigned vertexIndex1, | 68 unsigned vertexIndex1, |
69 bool clockwise) { | 69 bool clockwise) { |
70 unsigned nVertices = polygon.numberOfVertices(); | 70 unsigned nVertices = polygon.numberOfVertices(); |
71 unsigned vertexIndex2 = nextVertexIndex(vertexIndex1, nVertices, clockwise); | 71 unsigned vertexIndex2 = nextVertexIndex(vertexIndex1, nVertices, clockwise); |
72 | 72 |
73 while (vertexIndex2 && areCoincidentPoints(polygon.vertexAt(vertexIndex1), | 73 while (vertexIndex2 && |
74 polygon.vertexAt(vertexIndex2))) | 74 areCoincidentPoints(polygon.vertexAt(vertexIndex1), |
| 75 polygon.vertexAt(vertexIndex2))) |
75 vertexIndex2 = nextVertexIndex(vertexIndex2, nVertices, clockwise); | 76 vertexIndex2 = nextVertexIndex(vertexIndex2, nVertices, clockwise); |
76 | 77 |
77 while (vertexIndex2) { | 78 while (vertexIndex2) { |
78 unsigned vertexIndex3 = nextVertexIndex(vertexIndex2, nVertices, clockwise); | 79 unsigned vertexIndex3 = nextVertexIndex(vertexIndex2, nVertices, clockwise); |
79 if (!areCollinearPoints(polygon.vertexAt(vertexIndex1), | 80 if (!areCollinearPoints(polygon.vertexAt(vertexIndex1), |
80 polygon.vertexAt(vertexIndex2), | 81 polygon.vertexAt(vertexIndex2), |
81 polygon.vertexAt(vertexIndex3))) | 82 polygon.vertexAt(vertexIndex3))) |
82 break; | 83 break; |
83 vertexIndex2 = vertexIndex3; | 84 vertexIndex2 = vertexIndex3; |
84 } | 85 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 float uOtherLine = determinant(thisDelta, vertex1Delta) / denominator; | 238 float uOtherLine = determinant(thisDelta, vertex1Delta) / denominator; |
238 | 239 |
239 if (uThisLine < 0 || uOtherLine < 0 || uThisLine > 1 || uOtherLine > 1) | 240 if (uThisLine < 0 || uOtherLine < 0 || uThisLine > 1 || uOtherLine > 1) |
240 return false; | 241 return false; |
241 | 242 |
242 point = vertex1() + uThisLine * thisDelta; | 243 point = vertex1() + uThisLine * thisDelta; |
243 return true; | 244 return true; |
244 } | 245 } |
245 | 246 |
246 } // namespace blink | 247 } // namespace blink |
OLD | NEW |