| 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 | |
| 13 | #include "GrNoncopyable.h" |
| reed@google.com | 7744c20 | 2011-05-06 19:26:26 +0000 | [diff] [blame] | 14 | #include "GrPoint.h" |
| reed@google.com | 07f3ee1 | 2011-05-16 17:21:57 +0000 | [diff] [blame] | 15 | #include "GrPath.h" |
| senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 16 | |
| 17 | /** |
| 18 | * Utilities for evaluating paths. |
| 19 | */ |
| 20 | class GrPathUtils : public GrNoncopyable { |
| 21 | public: |
| tomhudson@google.com | c10a888 | 2011-06-28 15:19:32 +0000 | [diff] [blame] | 22 | /// Since we divide by tol if we're computing exact worst-case bounds, |
| 23 | /// very small tolerances will be increased to gMinCurveTol. |
| reed@google.com | 07f3ee1 | 2011-05-16 17:21:57 +0000 | [diff] [blame] | 24 | static int worstCasePointCount(const GrPath&, |
| senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 25 | int* subpaths, |
| 26 | GrScalar tol); |
| tomhudson@google.com | c10a888 | 2011-06-28 15:19:32 +0000 | [diff] [blame] | 27 | /// Since we divide by tol if we're computing exact worst-case bounds, |
| 28 | /// very small tolerances will be increased to gMinCurveTol. |
| senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 29 | static uint32_t quadraticPointCount(const GrPoint points[], GrScalar tol); |
| 30 | static uint32_t generateQuadraticPoints(const GrPoint& p0, |
| 31 | const GrPoint& p1, |
| 32 | const GrPoint& p2, |
| 33 | GrScalar tolSqd, |
| 34 | GrPoint** points, |
| 35 | uint32_t pointsLeft); |
| tomhudson@google.com | c10a888 | 2011-06-28 15:19:32 +0000 | [diff] [blame] | 36 | /// Since we divide by tol if we're computing exact worst-case bounds, |
| 37 | /// very small tolerances will be increased to gMinCurveTol. |
| senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 38 | static uint32_t cubicPointCount(const GrPoint points[], GrScalar tol); |
| 39 | static uint32_t generateCubicPoints(const GrPoint& p0, |
| 40 | const GrPoint& p1, |
| 41 | const GrPoint& p2, |
| 42 | const GrPoint& p3, |
| 43 | GrScalar tolSqd, |
| 44 | GrPoint** points, |
| 45 | uint32_t pointsLeft); |
| tomhudson@google.com | c10a888 | 2011-06-28 15:19:32 +0000 | [diff] [blame] | 46 | |
| 47 | private: |
| 48 | static const GrScalar gMinCurveTol; |
| senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 49 | }; |
| 50 | #endif |