blob: 2cd00cbb8446da7176bb54ec18f99dfc1b59efab [file] [log] [blame]
senorblanco@chromium.org9d18b782011-03-28 20:47:09 +00001/*
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.com7744c202011-05-06 19:26:26 +000021#include "GrPoint.h"
reed@google.com07f3ee12011-05-16 17:21:57 +000022#include "GrPath.h"
senorblanco@chromium.org9d18b782011-03-28 20:47:09 +000023
24/**
25 * Utilities for evaluating paths.
26 */
27class GrPathUtils : public GrNoncopyable {
28public:
reed@google.com07f3ee12011-05-16 17:21:57 +000029 static int worstCasePointCount(const GrPath&,
senorblanco@chromium.org9d18b782011-03-28 20:47:09 +000030 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