blob: 5dc06aaf414241b3cd3fe94d3f095acd8ebdbd38 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
senorblanco@chromium.org9d18b782011-03-28 20:47:09 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * 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.org9d18b782011-03-28 20:47:09 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
senorblanco@chromium.org9d18b782011-03-28 20:47:09 +000010#ifndef GrPathUtils_DEFINED
11#define GrPathUtils_DEFINED
12
bsalomon@google.com181e9bd2011-09-07 18:42:30 +000013#include "GrMatrix.h"
reed@google.com07f3ee12011-05-16 17:21:57 +000014#include "GrPath.h"
senorblanco@chromium.org9d18b782011-03-28 20:47:09 +000015
16/**
17 * Utilities for evaluating paths.
18 */
bsalomon@google.com181e9bd2011-09-07 18:42:30 +000019namespace GrPathUtils {
20 GrScalar scaleToleranceToSrc(GrScalar devTol,
bsalomon@google.com38396322011-09-09 19:32:04 +000021 const GrMatrix& viewM,
22 const GrRect& pathBounds);
tomhudson@google.comc10a8882011-06-28 15:19:32 +000023
bsalomon@google.com181e9bd2011-09-07 18:42:30 +000024 /// Since we divide by tol if we're computing exact worst-case bounds,
25 /// very small tolerances will be increased to gMinCurveTol.
26 int worstCasePointCount(const GrPath&,
27 int* subpaths,
28 GrScalar tol);
29 /// Since we divide by tol if we're computing exact worst-case bounds,
30 /// very small tolerances will be increased to gMinCurveTol.
31 uint32_t quadraticPointCount(const GrPoint points[], GrScalar tol);
32 uint32_t generateQuadraticPoints(const GrPoint& p0,
33 const GrPoint& p1,
34 const GrPoint& p2,
35 GrScalar tolSqd,
36 GrPoint** points,
37 uint32_t pointsLeft);
38 /// Since we divide by tol if we're computing exact worst-case bounds,
39 /// very small tolerances will be increased to gMinCurveTol.
40 uint32_t cubicPointCount(const GrPoint points[], GrScalar tol);
41 uint32_t generateCubicPoints(const GrPoint& p0,
42 const GrPoint& p1,
43 const GrPoint& p2,
44 const GrPoint& p3,
45 GrScalar tolSqd,
46 GrPoint** points,
47 uint32_t pointsLeft);
48
senorblanco@chromium.org9d18b782011-03-28 20:47:09 +000049};
50#endif