22Merge::Merge(std::vector<Rec>&& recs)
23 : fRecs(
std::move(recs)) {
24 for (
const auto& rec : fRecs) {
25 this->observeInval(rec.fGeo);
30 for (
const auto& rec : fRecs) {
31 this->unobserveInval(rec.fGeo);
35void Merge::onClip(
SkCanvas* canvas,
bool antiAlias)
const {
43bool Merge::onContains(
const SkPoint& p)
const {
44 return fMerged.contains(p.x(), p.y());
53 case Merge::Mode::kUnion:
55 case Merge::Mode::kIntersect:
57 case Merge::Mode::kDifference:
59 case Merge::Mode::kReverseDifference:
61 case Merge::Mode::kXOR:
76 bool in_builder =
false;
80 builder.resolve(&fMerged);
84 if (fMerged.isEmpty()) {
88 fMerged.addPath(path);
92 for (
const auto& rec : fRecs) {
93 rec.fGeo->revalidate(ic, ctm);
95 if (rec.fMode == Mode::kMerge) {
97 append(rec.fGeo->asPath());
106 builder.add(rec.fGeo->asPath(),
mode_to_op(rec.fMode));
110 builder.resolve(&fMerged);
115 return fMerged.computeTightBounds();
@ kReverseDifference_SkPathOp
subtract the first path from the op path
@ kDifference_SkPathOp
subtract the op path from the first path
@ kIntersect_SkPathOp
intersect the two paths
@ kUnion_SkPathOp
union (inclusive-or) the two paths
@ kXOR_SkPathOp
exclusive-or the two paths
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
void drawPath(const SkPath &path, const SkPaint &paint)
static void ShrinkToFit(SkPath *path)
static void append(char **dst, size_t *count, const char *src, size_t n)
static SkPathOp mode_to_op(Merge::Mode mode)