author Lee Salzman <>
Tue, 09 Feb 2016 13:38:06 -0500
changeset 283697 159e0a5a653f2789e0c9b94f41501a4a44f7cb34
child 295394 cf560124d28f3737353c105eec79677a7731d2e8
permissions -rw-r--r--
Bug 1246756 - part 3 - update Skia to m49 branch. r=jrmuizel

 * Copyright 2015 Google Inc.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.

#ifndef GrTessellator_DEFINED
#define GrTessellator_DEFINED

#include "SkPath.h"
#include "GrResourceProvider.h"

 * Provides utility functions for converting paths to a collection of triangles.


namespace GrTessellator {

struct WindingVertex {
    SkPoint fPos;
    int fWinding;

// Triangulates a path to an array of vertices. Each triangle is represented as a set of three
// WindingVertex entries, each of which contains the position and winding count (which is the same
// for all three vertices of a triangle). The 'verts' out parameter is set to point to the resultant
// vertex array. CALLER IS RESPONSIBLE for deleting this buffer to avoid a memory leak!
int PathToVertices(const SkPath& path, SkScalar tolerance, const SkRect& clipBounds, 
                   WindingVertex** verts);

int PathToTriangles(const SkPath& path, SkScalar tolerance, const SkRect& clipBounds, 
                    GrResourceProvider* resourceProvider, 
                    SkAutoTUnref<GrVertexBuffer>& vertexBuffer, bool canMapVB, bool* isLinear);