Flutter Engine
The Flutter Engine
SkSGMerge.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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
8#ifndef SkSGMerge_DEFINED
9#define SkSGMerge_DEFINED
10
11#include "include/core/SkPath.h"
12#include "include/core/SkRect.h"
15
16#include <utility>
17#include <vector>
18
19class SkCanvas;
20class SkMatrix;
21class SkPaint;
22struct SkPoint;
23
24namespace sksg {
25class InvalidationController;
26
27/**
28 * Concrete Geometry node, combining other geometries based on Mode.
29 */
30class Merge final : public GeometryNode {
31public:
32 enum class Mode {
33 // Append path mode.
34 kMerge,
35
36 // SkPathOp ops.
37 kUnion,
39 kDifference,
41 kXOR,
42 };
43
44 struct Rec {
47 };
48
49 static sk_sp<Merge> Make(std::vector<Rec>&& recs) {
50 return sk_sp<Merge>(new Merge(std::move(recs)));
51 }
52
53 ~Merge() override;
54
55protected:
56 void onClip(SkCanvas*, bool antiAlias) const override;
57 void onDraw(SkCanvas*, const SkPaint&) const override;
58 bool onContains(const SkPoint&) const override;
59
61 SkPath onAsPath() const override;
62
63private:
64 Merge(std::vector<Rec>&& recs);
65
66 const std::vector<Rec> fRecs;
67 SkPath fMerged;
68
69 using INHERITED = GeometryNode;
70};
71
72} // namespace sksg
73
74#endif // SkSGMerge_DEFINED
Definition: SkPath.h:59
void onClip(SkCanvas *, bool antiAlias) const override
Definition: SkSGMerge.cpp:35
bool onContains(const SkPoint &) const override
Definition: SkSGMerge.cpp:43
SkRect onRevalidate(InvalidationController *, const SkMatrix &) override
Definition: SkSGMerge.cpp:70
~Merge() override
Definition: SkSGMerge.cpp:29
SkPath onAsPath() const override
Definition: SkSGMerge.cpp:47
static sk_sp< Merge > Make(std::vector< Rec > &&recs)
Definition: SkSGMerge.h:49
void onDraw(SkCanvas *, const SkPaint &) const override
Definition: SkSGMerge.cpp:39
Definition: Skottie.h:32
sk_sp< GeometryNode > fGeo
Definition: SkSGMerge.h:45