1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/core/SkEdgeBuilder.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2011 Google Inc. 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 +#ifndef SkEdgeBuilder_DEFINED 1.12 +#define SkEdgeBuilder_DEFINED 1.13 + 1.14 +#include "SkChunkAlloc.h" 1.15 +#include "SkRect.h" 1.16 +#include "SkTDArray.h" 1.17 + 1.18 +struct SkEdge; 1.19 +class SkEdgeClipper; 1.20 +class SkPath; 1.21 + 1.22 +class SkEdgeBuilder { 1.23 +public: 1.24 + SkEdgeBuilder(); 1.25 + 1.26 + // returns the number of built edges. The array of those edge pointers 1.27 + // is returned from edgeList(). 1.28 + int build(const SkPath& path, const SkIRect* clip, int shiftUp); 1.29 + 1.30 + SkEdge** edgeList() { return fEdgeList; } 1.31 + 1.32 +private: 1.33 + SkChunkAlloc fAlloc; 1.34 + SkTDArray<SkEdge*> fList; 1.35 + 1.36 + /* 1.37 + * If we're in general mode, we allcoate the pointers in fList, and this 1.38 + * will point at fList.begin(). If we're in polygon mode, fList will be 1.39 + * empty, as we will have preallocated room for the pointers in fAlloc's 1.40 + * block, and fEdgeList will point into that. 1.41 + */ 1.42 + SkEdge** fEdgeList; 1.43 + 1.44 + int fShiftUp; 1.45 + 1.46 +public: 1.47 + void addLine(const SkPoint pts[]); 1.48 + void addQuad(const SkPoint pts[]); 1.49 + void addCubic(const SkPoint pts[]); 1.50 + void addClipper(SkEdgeClipper*); 1.51 + 1.52 + int buildPoly(const SkPath& path, const SkIRect* clip, int shiftUp); 1.53 +}; 1.54 + 1.55 +#endif