senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2011 Google Inc. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef GrPathUtils_DEFINED |
| 18 | #define GrPathUtils_DEFINED |
| 19 | |
| 20 | #include "GrNoncopyable.h" |
reed@google.com | 7744c20 | 2011-05-06 19:26:26 +0000 | [diff] [blame] | 21 | #include "GrPoint.h" |
reed@google.com | 07f3ee1 | 2011-05-16 17:21:57 +0000 | [diff] [blame] | 22 | #include "GrPath.h" |
senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Utilities for evaluating paths. |
| 26 | */ |
| 27 | class GrPathUtils : public GrNoncopyable { |
| 28 | public: |
reed@google.com | 07f3ee1 | 2011-05-16 17:21:57 +0000 | [diff] [blame] | 29 | static int worstCasePointCount(const GrPath&, |
senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 30 | int* subpaths, |
| 31 | GrScalar tol); |
| 32 | static uint32_t quadraticPointCount(const GrPoint points[], GrScalar tol); |
| 33 | static uint32_t generateQuadraticPoints(const GrPoint& p0, |
| 34 | const GrPoint& p1, |
| 35 | const GrPoint& p2, |
| 36 | GrScalar tolSqd, |
| 37 | GrPoint** points, |
| 38 | uint32_t pointsLeft); |
| 39 | static uint32_t cubicPointCount(const GrPoint points[], GrScalar tol); |
| 40 | static uint32_t generateCubicPoints(const GrPoint& p0, |
| 41 | const GrPoint& p1, |
| 42 | const GrPoint& p2, |
| 43 | const GrPoint& p3, |
| 44 | GrScalar tolSqd, |
| 45 | GrPoint** points, |
| 46 | uint32_t pointsLeft); |
| 47 | |
| 48 | static const GrScalar gTolerance; |
| 49 | }; |
| 50 | #endif |