Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkOpEdgeBuilder.h
Go to the documentation of this file.
1/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7#ifndef SkOpEdgeBuilder_DEFINED
8#define SkOpEdgeBuilder_DEFINED
9
16
17#include <cstdint>
18
19class SkPath;
20
22public:
24 SkOpGlobalState* globalState)
25 : fGlobalState(globalState)
26 , fPath(path.nativePath())
27 , fContourBuilder(contours2)
28 , fContoursHead(contours2)
29 , fAllowOpenContours(true) {
30 init();
31 }
32
33 SkOpEdgeBuilder(const SkPath& path, SkOpContourHead* contours2, SkOpGlobalState* globalState)
34 : fGlobalState(globalState)
35 , fPath(&path)
36 , fContourBuilder(contours2)
37 , fContoursHead(contours2)
38 , fAllowOpenContours(false) {
39 init();
40 }
41
42 void addOperand(const SkPath& path);
43
44 void complete() {
45 fContourBuilder.flush();
46 SkOpContour* contour = fContourBuilder.contour();
47 if (contour && contour->count()) {
48 contour->complete();
49 fContourBuilder.setContour(nullptr);
50 }
51 }
52
53 bool finish();
54
55 const SkOpContour* head() const {
56 return fContoursHead;
57 }
58
59 void init();
60 bool unparseable() const { return fUnparseable; }
61 SkPathOpsMask xorMask() const { return fXorMask[fOperand]; }
62
63private:
64 void closeContour(const SkPoint& curveEnd, const SkPoint& curveStart);
65 bool close();
66 int preFetch();
67 bool walk();
68
69 SkOpGlobalState* fGlobalState;
70 const SkPath* fPath;
71 SkTDArray<SkPoint> fPathPts;
72 SkTDArray<SkScalar> fWeights;
73 SkTDArray<uint8_t> fPathVerbs;
74 SkOpContourBuilder fContourBuilder;
75 SkOpContourHead* fContoursHead;
76 SkPathOpsMask fXorMask[2];
77 int fSecondHalf;
78 bool fOperand;
79 bool fAllowOpenContours;
80 bool fUnparseable;
81};
82
83#endif
SkPathOpsMask
void setContour(SkOpContour *contour)
SkOpContour * contour()
SkOpEdgeBuilder(const SkPath &path, SkOpContourHead *contours2, SkOpGlobalState *globalState)
const SkOpContour * head() const
SkPathOpsMask xorMask() const
void addOperand(const SkPath &path)
SkOpEdgeBuilder(const SkPathWriter &path, SkOpContourHead *contours2, SkOpGlobalState *globalState)
bool unparseable() const