epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 9 | |
senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 10 | #ifndef GrPathUtils_DEFINED |
| 11 | #define GrPathUtils_DEFINED |
| 12 | |
bsalomon@google.com | 181e9bd | 2011-09-07 18:42:30 +0000 | [diff] [blame] | 13 | #include "GrMatrix.h" |
reed@google.com | 07f3ee1 | 2011-05-16 17:21:57 +0000 | [diff] [blame] | 14 | #include "GrPath.h" |
senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 15 | |
bsalomon@google.com | 181e9bd | 2011-09-07 18:42:30 +0000 | [diff] [blame] | 16 | class GrPoint; |
| 17 | |
senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 18 | /** |
| 19 | * Utilities for evaluating paths. |
| 20 | */ |
bsalomon@google.com | 181e9bd | 2011-09-07 18:42:30 +0000 | [diff] [blame] | 21 | namespace GrPathUtils { |
| 22 | GrScalar scaleToleranceToSrc(GrScalar devTol, |
bsalomon@google.com | 3839632 | 2011-09-09 19:32:04 +0000 | [diff] [blame^] | 23 | const GrMatrix& viewM, |
| 24 | const GrRect& pathBounds); |
tomhudson@google.com | c10a888 | 2011-06-28 15:19:32 +0000 | [diff] [blame] | 25 | |
bsalomon@google.com | 181e9bd | 2011-09-07 18:42:30 +0000 | [diff] [blame] | 26 | /// Since we divide by tol if we're computing exact worst-case bounds, |
| 27 | /// very small tolerances will be increased to gMinCurveTol. |
| 28 | int worstCasePointCount(const GrPath&, |
| 29 | int* subpaths, |
| 30 | GrScalar tol); |
| 31 | /// Since we divide by tol if we're computing exact worst-case bounds, |
| 32 | /// very small tolerances will be increased to gMinCurveTol. |
| 33 | uint32_t quadraticPointCount(const GrPoint points[], GrScalar tol); |
| 34 | uint32_t generateQuadraticPoints(const GrPoint& p0, |
| 35 | const GrPoint& p1, |
| 36 | const GrPoint& p2, |
| 37 | GrScalar tolSqd, |
| 38 | GrPoint** points, |
| 39 | uint32_t pointsLeft); |
| 40 | /// Since we divide by tol if we're computing exact worst-case bounds, |
| 41 | /// very small tolerances will be increased to gMinCurveTol. |
| 42 | uint32_t cubicPointCount(const GrPoint points[], GrScalar tol); |
| 43 | uint32_t generateCubicPoints(const GrPoint& p0, |
| 44 | const GrPoint& p1, |
| 45 | const GrPoint& p2, |
| 46 | const GrPoint& p3, |
| 47 | GrScalar tolSqd, |
| 48 | GrPoint** points, |
| 49 | uint32_t pointsLeft); |
| 50 | |
senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 51 | }; |
| 52 | #endif |