blob: df0795b0c85827176c36a23c56d977c0902ff674 [file] [log] [blame]
* 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 {
SkOpEdgeBuilder(const SkPathWriter& path, SkTArray<SkOpContour>& contours)
: fPath(path.nativePath())
, fContours(contours)
, fAllowOpenContours(true) {
SkOpEdgeBuilder(const SkPath& path, SkTArray<SkOpContour>& contours)
: fPath(&path)
, fContours(contours)
, fAllowOpenContours(false) {
void complete() {
if (fCurrentContour && fCurrentContour->segments().count()) {
fCurrentContour = NULL;
SkPathOpsMask xorMask() const {
return fXorMask[fOperand];
void addOperand(const SkPath& path);
bool finish();
void init();
void closeContour(const SkPoint& curveEnd, const SkPoint& curveStart);
bool close();
int preFetch();
bool walk();
const SkPath* fPath;
SkTArray<SkPoint, true> fPathPts;
SkTArray<uint8_t, true> fPathVerbs;
SkOpContour* fCurrentContour;
SkTArray<SkOpContour>& fContours;
SkPathOpsMask fXorMask[2];
int fSecondHalf;
bool fOperand;
bool fAllowOpenContours;
bool fUnparseable;