xref: /aosp_15_r20/external/skia/modules/svg/include/SkSVGClipPath.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2016 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 SkSVGClipPath_DEFINED
9 #define SkSVGClipPath_DEFINED
10 
11 #include "include/core/SkPath.h"
12 #include "include/core/SkRefCnt.h"
13 #include "include/private/base/SkAPI.h"
14 #include "modules/svg/include/SkSVGHiddenContainer.h"
15 #include "modules/svg/include/SkSVGNode.h"
16 #include "modules/svg/include/SkSVGTypes.h"
17 
18 class SkSVGRenderContext;
19 
20 class SK_API SkSVGClipPath final : public SkSVGHiddenContainer {
21 public:
Make()22     static sk_sp<SkSVGClipPath> Make() {
23         return sk_sp<SkSVGClipPath>(new SkSVGClipPath());
24     }
25 
26     SVG_ATTR(ClipPathUnits, SkSVGObjectBoundingBoxUnits,
27              SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kUserSpaceOnUse))
28 
29 private:
30     friend class SkSVGRenderContext;
31 
32     SkSVGClipPath();
33 
34     bool parseAndSetAttribute(const char*, const char*) override;
35 
36     SkPath resolveClip(const SkSVGRenderContext&) const;
37 
38     using INHERITED = SkSVGHiddenContainer;
39 };
40 
41 #endif // SkSVGClipPath_DEFINED
42