diff -r 000000000000 -r 6474c204b198 gfx/skia/trunk/src/pathops/SkOpEdgeBuilder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gfx/skia/trunk/src/pathops/SkOpEdgeBuilder.h Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright 2012 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef SkOpEdgeBuilder_DEFINED +#define SkOpEdgeBuilder_DEFINED + +#include "SkOpContour.h" +#include "SkPathWriter.h" +#include "SkTArray.h" + +class SkOpEdgeBuilder { +public: + SkOpEdgeBuilder(const SkPathWriter& path, SkTArray& contours) + : fPath(path.nativePath()) + , fContours(contours) + , fAllowOpenContours(true) { + init(); + } + + SkOpEdgeBuilder(const SkPath& path, SkTArray& contours) + : fPath(&path) + , fContours(contours) + , fAllowOpenContours(false) { + init(); + } + + void complete() { + if (fCurrentContour && fCurrentContour->segments().count()) { + fCurrentContour->complete(); + fCurrentContour = NULL; + } + } + + SkPathOpsMask xorMask() const { + return fXorMask[fOperand]; + } + + void addOperand(const SkPath& path); + bool finish(); + void init(); + +private: + void closeContour(const SkPoint& curveEnd, const SkPoint& curveStart); + bool close(); + int preFetch(); + bool walk(); + + const SkPath* fPath; + SkTArray fPathPts; + SkTArray fPathVerbs; + SkOpContour* fCurrentContour; + SkTArray& fContours; + SkPathOpsMask fXorMask[2]; + int fSecondHalf; + bool fOperand; + bool fAllowOpenContours; + bool fUnparseable; +}; + +#endif