GrPathUtils.h revision d38f137e9b813f8193675ebd3dfbfe8bc42639e9
1 2/* 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. 7 */ 8 9 10#ifndef GrPathUtils_DEFINED 11#define GrPathUtils_DEFINED 12 13#include "GrMatrix.h" 14#include "GrPath.h" 15 16/** 17 * Utilities for evaluating paths. 18 */ 19namespace GrPathUtils { 20 GrScalar scaleToleranceToSrc(GrScalar devTol, 21 const GrMatrix& viewM, 22 const GrRect& pathBounds); 23 24 /// 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 49}; 50#endif 51