@shopify/react-native-skia 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +10 -0
- package/android/build.gradle +2 -1
- package/apple/SkiaCVPixelBufferUtils.mm +8 -4
- package/cpp/api/JsiSkCanvas.h +10 -8
- package/cpp/api/JsiSkFont.h +14 -18
- package/cpp/api/JsiSkPath.h +4 -2
- package/cpp/api/JsiSkPathEffectFactory.h +2 -2
- package/cpp/api/JsiSkTextBlobFactory.h +5 -3
- package/cpp/api/JsiSkTypeface.h +5 -4
- package/cpp/api/recorder/Drawings.h +26 -20
- package/cpp/api/recorder/PathEffects.h +3 -2
- package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +1 -1
- package/cpp/skia/include/android/SkImageAndroid.h +1 -8
- package/cpp/skia/include/config/SkUserConfig.h +9 -0
- package/cpp/skia/include/core/SkCPUContext.h +31 -0
- package/cpp/skia/include/core/SkCPURecorder.h +69 -0
- package/cpp/skia/include/core/SkCanvas.h +57 -13
- package/cpp/skia/include/core/SkContourMeasure.h +1 -1
- package/cpp/skia/include/core/SkData.h +63 -37
- package/cpp/skia/include/core/SkFont.h +94 -65
- package/cpp/skia/include/core/SkImage.h +10 -9
- package/cpp/skia/include/core/SkImageGenerator.h +3 -0
- package/cpp/skia/include/core/SkMatrix.h +102 -116
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +163 -60
- package/cpp/skia/include/core/SkPathBuilder.h +713 -30
- package/cpp/skia/include/core/SkPathTypes.h +5 -1
- package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
- package/cpp/skia/include/core/SkRecorder.h +35 -0
- package/cpp/skia/include/core/SkRect.h +57 -27
- package/cpp/skia/include/core/SkRegion.h +1 -1
- package/cpp/skia/include/core/SkSurface.h +8 -1
- package/cpp/skia/include/core/SkTextBlob.h +50 -6
- package/cpp/skia/include/core/SkTraceMemoryDump.h +7 -0
- package/cpp/skia/include/core/SkTypeface.h +53 -26
- package/cpp/skia/include/core/SkTypes.h +6 -0
- package/cpp/skia/include/effects/SkDashPathEffect.h +9 -3
- package/cpp/skia/include/effects/SkRuntimeEffect.h +1 -1
- package/cpp/skia/include/encode/SkEncoder.h +1 -1
- package/cpp/skia/include/encode/SkICC.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +23 -0
- package/cpp/skia/include/gpu/ganesh/GrRecordingContext.h +12 -0
- package/cpp/skia/include/gpu/graphite/Context.h +32 -8
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +22 -4
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +21 -4
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +16 -2
- package/cpp/skia/include/gpu/graphite/Recorder.h +30 -10
- package/cpp/skia/include/gpu/graphite/Recording.h +7 -3
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +3 -3
- package/cpp/skia/include/gpu/graphite/precompile/PaintOptions.h +15 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +89 -13
- package/cpp/skia/include/gpu/graphite/vk/precompile/VulkanPrecompileShader.h +39 -0
- package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanPreferredFeatures.h +214 -0
- package/cpp/skia/include/pathops/SkPathOps.h +7 -111
- package/cpp/skia/include/ports/SkFontMgr_fontconfig.h +3 -0
- package/cpp/skia/include/private/SkGainmapShader.h +10 -4
- package/cpp/skia/include/private/SkPathRef.h +6 -2
- package/cpp/skia/include/private/base/SkAlign.h +11 -0
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_icd.h +255 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_layer.h +203 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h +1 -2
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std.h +390 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_decode.h +106 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_encode.h +140 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_encode.h +144 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_encode.h +158 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_beta.h +242 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +10094 -5707
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_directfb.h +55 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_fuchsia.h +288 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ggp.h +59 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_metal.h +238 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_screen.h +110 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_vi.h +47 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_wayland.h +55 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib.h +60 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib_xrandr.h +46 -0
- package/cpp/skia/modules/pathops/include/SkPathOps.h +121 -0
- package/cpp/skia/modules/skcms/src/skcms_internals.h +10 -2
- package/cpp/skia/modules/skcms/src/skcms_public.h +39 -10
- package/lib/commonjs/sksg/Container.d.ts +1 -0
- package/lib/commonjs/sksg/Container.js +3 -0
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/Reconciler.js +1 -0
- package/lib/commonjs/sksg/Reconciler.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +1 -0
- package/lib/module/sksg/Container.js +3 -0
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/Reconciler.js +1 -0
- package/lib/module/sksg/Reconciler.js.map +1 -1
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +2 -1
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +6 -3
- package/lib/typescript/lib/module/sksg/Container.d.ts +2 -1
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +6 -3
- package/lib/typescript/src/sksg/Container.d.ts +1 -0
- package/libs/android/arm64-v8a/libpathops.a +0 -0
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libskparagraph.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libskunicode_icu.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libpathops.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode_icu.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libpathops.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libskparagraph.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libskunicode_icu.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libpathops.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libskparagraph.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libskunicode_icu.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/apple/libpathops.xcframework/Info.plist +94 -0
- package/libs/apple/libpathops.xcframework/ios-arm64_arm64e/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/ios-arm64_arm64e_x86_64-simulator/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/macos-arm64_x86_64/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/tvos-arm64_arm64e/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/tvos-arm64_arm64e_x86_64-simulator/libpathops.a +0 -0
- package/libs/apple/libskia.xcframework/Info.plist +7 -7
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskottie.xcframework/Info.plist +10 -10
- package/libs/apple/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/macos-arm64_x86_64/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskparagraph.xcframework/Info.plist +13 -13
- package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/macos-arm64_x86_64/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libsksg.xcframework/Info.plist +11 -11
- package/libs/apple/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/macos-arm64_x86_64/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libskshaper.xcframework/Info.plist +12 -12
- package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/macos-arm64_x86_64/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/Info.plist +14 -14
- package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/macos-arm64_x86_64/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +13 -13
- package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/macos-arm64_x86_64/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libsvg.xcframework/Info.plist +17 -17
- package/libs/apple/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/macos-arm64_x86_64/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/react-native-skia.podspec +2 -1
- package/src/renderer/__tests__/e2e/BackdropFilters.spec.tsx +23 -0
- package/src/sksg/Container.ts +4 -0
- package/src/sksg/Reconciler.ts +1 -0
@@ -14,6 +14,7 @@
|
|
14
14
|
#include "include/core/SkRect.h"
|
15
15
|
#include "include/core/SkRefCnt.h"
|
16
16
|
#include "include/core/SkScalar.h"
|
17
|
+
#include "include/core/SkSpan.h"
|
17
18
|
#include "include/core/SkTypes.h"
|
18
19
|
#include "include/private/base/SkDebug.h"
|
19
20
|
#include "include/private/base/SkTo.h"
|
@@ -22,9 +23,8 @@
|
|
22
23
|
#include <atomic>
|
23
24
|
#include <cstddef>
|
24
25
|
#include <cstdint>
|
25
|
-
#include <
|
26
|
+
#include <optional>
|
26
27
|
#include <tuple>
|
27
|
-
#include <type_traits>
|
28
28
|
|
29
29
|
struct SkArc;
|
30
30
|
class SkData;
|
@@ -35,7 +35,7 @@ enum class SkPathConvexity;
|
|
35
35
|
enum class SkPathFirstDirection;
|
36
36
|
struct SkPathVerbAnalysis;
|
37
37
|
|
38
|
-
// WIP -- define this locally, and fix call-sites to use SkPathBuilder (skbug.com/
|
38
|
+
// WIP -- define this locally, and fix call-sites to use SkPathBuilder (skbug.com/40040287)
|
39
39
|
//#define SK_HIDE_PATH_EDIT_METHODS
|
40
40
|
|
41
41
|
/** \class SkPath
|
@@ -77,9 +77,9 @@ public:
|
|
77
77
|
* with a Move verb, followed by 0 or more segments: Line, Quad, Conic, Cubic, followed
|
78
78
|
* by an optional Close.
|
79
79
|
*/
|
80
|
-
static SkPath Make(const SkPoint
|
81
|
-
const uint8_t
|
82
|
-
const SkScalar
|
80
|
+
static SkPath Make(SkSpan<const SkPoint> pts,
|
81
|
+
SkSpan<const uint8_t> verbs,
|
82
|
+
SkSpan<const SkScalar> conics,
|
83
83
|
SkPathFillType, bool isVolatile = false);
|
84
84
|
|
85
85
|
static SkPath Rect(const SkRect&, SkPathDirection = SkPathDirection::kCW,
|
@@ -93,15 +93,9 @@ public:
|
|
93
93
|
static SkPath RRect(const SkRect& bounds, SkScalar rx, SkScalar ry,
|
94
94
|
SkPathDirection dir = SkPathDirection::kCW);
|
95
95
|
|
96
|
-
static SkPath Polygon(const SkPoint pts
|
97
|
-
SkPathFillType = SkPathFillType::kWinding,
|
98
|
-
bool isVolatile = false);
|
99
|
-
|
100
|
-
static SkPath Polygon(const std::initializer_list<SkPoint>& list, bool isClosed,
|
96
|
+
static SkPath Polygon(SkSpan<const SkPoint> pts, bool isClosed,
|
101
97
|
SkPathFillType fillType = SkPathFillType::kWinding,
|
102
|
-
bool isVolatile = false)
|
103
|
-
return Polygon(list.begin(), SkToInt(list.size()), isClosed, fillType, isVolatile);
|
104
|
-
}
|
98
|
+
bool isVolatile = false);
|
105
99
|
|
106
100
|
static SkPath Line(const SkPoint a, const SkPoint b) {
|
107
101
|
return Polygon({a, b}, false);
|
@@ -143,12 +137,18 @@ public:
|
|
143
137
|
return *this;
|
144
138
|
}
|
145
139
|
|
140
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
141
|
+
private:
|
142
|
+
#endif
|
146
143
|
/** Returns a copy of this path in the current state, and resets the path to empty. */
|
147
144
|
SkPath detach() {
|
148
145
|
SkPath result = *this;
|
149
146
|
this->reset();
|
150
147
|
return result;
|
151
148
|
}
|
149
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
150
|
+
public:
|
151
|
+
#endif
|
152
152
|
|
153
153
|
/** Constructs a copy of an existing path.
|
154
154
|
SkPath assignment makes two paths identical by value. Internally, assignment
|
@@ -200,6 +200,9 @@ public:
|
|
200
200
|
*/
|
201
201
|
bool isInterpolatable(const SkPath& compare) const;
|
202
202
|
|
203
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
204
|
+
private:
|
205
|
+
#endif
|
203
206
|
/** Interpolates between SkPath with SkPoint array of equal size.
|
204
207
|
Copy verb array and weights to out, and set out SkPoint array to a weighted
|
205
208
|
average of this SkPoint array and ending SkPoint array, using the formula:
|
@@ -222,6 +225,10 @@ public:
|
|
222
225
|
example: https://fiddle.skia.org/c/@Path_interpolate
|
223
226
|
*/
|
224
227
|
bool interpolate(const SkPath& ending, SkScalar weight, SkPath* out) const;
|
228
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
229
|
+
public:
|
230
|
+
#endif
|
231
|
+
SkPath makeInterpolate(const SkPath& ending, SkScalar weight) const;
|
225
232
|
|
226
233
|
/** Returns SkPathFillType, the rule used to fill SkPath.
|
227
234
|
|
@@ -229,26 +236,49 @@ public:
|
|
229
236
|
*/
|
230
237
|
SkPathFillType getFillType() const { return (SkPathFillType)fFillType; }
|
231
238
|
|
232
|
-
|
233
|
-
|
239
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
240
|
+
private:
|
241
|
+
#endif
|
242
|
+
/** Sets SkPathFillType, the rule used to fill SkPath. While there is no
|
243
|
+
check that ft is legal, values outside of SkPathFillType are not supported.
|
234
244
|
*/
|
235
245
|
void setFillType(SkPathFillType ft) {
|
236
246
|
fFillType = SkToU8(ft);
|
237
247
|
}
|
248
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
249
|
+
public:
|
250
|
+
#endif
|
251
|
+
|
252
|
+
/** Creates an SkPath with the same properties and data, and with SkPathFillType
|
253
|
+
set to newFillType.
|
254
|
+
*/
|
255
|
+
SkPath makeFillType(SkPathFillType newFillType) const;
|
238
256
|
|
239
|
-
/** Returns if
|
257
|
+
/** Returns if SkPathFillType describes area outside SkPath geometry. The inverse fill area
|
240
258
|
extends indefinitely.
|
241
259
|
|
242
260
|
@return true if FillType is kInverseWinding or kInverseEvenOdd
|
243
261
|
*/
|
244
262
|
bool isInverseFillType() const { return SkPathFillType_IsInverse(this->getFillType()); }
|
245
263
|
|
246
|
-
|
247
|
-
|
264
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
265
|
+
private:
|
266
|
+
#endif
|
267
|
+
/** Replaces SkPathFillType with its inverse. The inverse of SkPathFillType describes the area
|
268
|
+
unmodified by the original SkPathFillType.
|
248
269
|
*/
|
249
270
|
void toggleInverseFillType() {
|
250
271
|
fFillType ^= 2;
|
251
272
|
}
|
273
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
274
|
+
public:
|
275
|
+
#endif
|
276
|
+
|
277
|
+
/** Creates an SkPath with the same properties and data, and with SkPathFillType
|
278
|
+
replaced with its inverse. The inverse of SkPathFillType describes the area unmodified
|
279
|
+
by the original FillType.
|
280
|
+
*/
|
281
|
+
SkPath makeToggleInverseFillType() const;
|
252
282
|
|
253
283
|
/** Returns true if the path is convex. If necessary, it will first compute the convexity.
|
254
284
|
*/
|
@@ -291,6 +321,9 @@ public:
|
|
291
321
|
*/
|
292
322
|
bool isArc(SkArc* arc) const;
|
293
323
|
|
324
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
325
|
+
private:
|
326
|
+
#endif
|
294
327
|
/** Sets SkPath to its initial state.
|
295
328
|
Removes verb array, SkPoint array, and weights, and sets FillType to kWinding.
|
296
329
|
Internal storage associated with SkPath is released.
|
@@ -313,6 +346,9 @@ public:
|
|
313
346
|
example: https://fiddle.skia.org/c/@Path_rewind
|
314
347
|
*/
|
315
348
|
SkPath& rewind();
|
349
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
350
|
+
public:
|
351
|
+
#endif
|
316
352
|
|
317
353
|
/** Returns if SkPath is empty.
|
318
354
|
Empty SkPath may have FillType but has no SkPoint, SkPath::Verb, or conic weight.
|
@@ -351,6 +387,9 @@ public:
|
|
351
387
|
return SkToBool(fIsVolatile);
|
352
388
|
}
|
353
389
|
|
390
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
391
|
+
private:
|
392
|
+
#endif
|
354
393
|
/** Specifies whether SkPath is volatile; whether it will be altered or discarded
|
355
394
|
by the caller after it is drawn. SkPath by default have volatile set false, allowing
|
356
395
|
Skia to attach a cache of data which speeds repeated drawing.
|
@@ -371,6 +410,10 @@ public:
|
|
371
410
|
fIsVolatile = isVolatile;
|
372
411
|
return *this;
|
373
412
|
}
|
413
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
414
|
+
public:
|
415
|
+
#endif
|
416
|
+
SkPath makeIsVolatile(bool isVolatile) const;
|
374
417
|
|
375
418
|
/** Tests if line between SkPoint pair is degenerate.
|
376
419
|
Line with no length or that moves a very short distance is degenerate; it is
|
@@ -450,17 +493,15 @@ public:
|
|
450
493
|
*/
|
451
494
|
SkPoint getPoint(int index) const;
|
452
495
|
|
453
|
-
/** Returns number of points in SkPath.
|
454
|
-
points
|
455
|
-
If max is greater than number of points, excess points storage is unaltered.
|
496
|
+
/** Returns number of points in SkPath.
|
497
|
+
Copies N points from the path into the span, where N = min(#points, span capacity)
|
456
498
|
|
457
|
-
@param points
|
458
|
-
@
|
459
|
-
@return SkPath SkPoint array length
|
499
|
+
@param points span to receive the points. may be empty
|
500
|
+
@return the number of points in the path
|
460
501
|
|
461
502
|
example: https://fiddle.skia.org/c/@Path_getPoints
|
462
503
|
*/
|
463
|
-
|
504
|
+
size_t getPoints(SkSpan<SkPoint> points) const;
|
464
505
|
|
465
506
|
/** Returns the number of verbs: kMove_Verb, kLine_Verb, kQuad_Verb, kConic_Verb,
|
466
507
|
kCubic_Verb, and kClose_Verb; added to SkPath.
|
@@ -471,16 +512,15 @@ public:
|
|
471
512
|
*/
|
472
513
|
int countVerbs() const;
|
473
514
|
|
474
|
-
/** Returns
|
475
|
-
|
515
|
+
/** Returns number of points in SkPath.
|
516
|
+
Copies N points from the path into the span, where N = min(#points, span capacity)
|
476
517
|
|
477
|
-
@param verbs
|
478
|
-
@
|
479
|
-
@return the actual number of verbs in the path
|
518
|
+
@param verbs span to store the verbs. may be empty.
|
519
|
+
@return the number of verbs in the path
|
480
520
|
|
481
521
|
example: https://fiddle.skia.org/c/@Path_getVerbs
|
482
522
|
*/
|
483
|
-
|
523
|
+
size_t getVerbs(SkSpan<uint8_t> verbs) const;
|
484
524
|
|
485
525
|
/** Returns the approximate byte size of the SkPath in memory.
|
486
526
|
|
@@ -488,6 +528,9 @@ public:
|
|
488
528
|
*/
|
489
529
|
size_t approximateBytesUsed() const;
|
490
530
|
|
531
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
532
|
+
private:
|
533
|
+
#endif
|
491
534
|
/** Exchanges the verb array, SkPoint array, weights, and SkPath::FillType with other.
|
492
535
|
Cached state is also exchanged. swap() internally exchanges pointers, so
|
493
536
|
it is lightweight and does not allocate memory.
|
@@ -501,6 +544,9 @@ public:
|
|
501
544
|
example: https://fiddle.skia.org/c/@Path_swap
|
502
545
|
*/
|
503
546
|
void swap(SkPath& other);
|
547
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
548
|
+
public:
|
549
|
+
#endif
|
504
550
|
|
505
551
|
/** Returns minimum and maximum axes values of SkPoint array.
|
506
552
|
Returns (0, 0, 0, 0) if SkPath contains no points. Returned bounds width and height may
|
@@ -560,6 +606,10 @@ public:
|
|
560
606
|
*/
|
561
607
|
bool conservativelyContainsRect(const SkRect& rect) const;
|
562
608
|
|
609
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
610
|
+
private:
|
611
|
+
#endif
|
612
|
+
|
563
613
|
/** Grows SkPath verb array, SkPoint array, and conics to contain additional space.
|
564
614
|
May improve performance and use less memory by
|
565
615
|
reducing the number and size of allocations when creating SkPath.
|
@@ -572,10 +622,6 @@ public:
|
|
572
622
|
*/
|
573
623
|
void incReserve(int extraPtCount, int extraVerbCount = 0, int extraConicCount = 0);
|
574
624
|
|
575
|
-
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
576
|
-
private:
|
577
|
-
#endif
|
578
|
-
|
579
625
|
/** Adds beginning of contour at SkPoint (x, y).
|
580
626
|
|
581
627
|
@param x x-axis value of contour start
|
@@ -1202,7 +1248,7 @@ private:
|
|
1202
1248
|
@param dir SkPath::Direction to wind SkRRect
|
1203
1249
|
@return reference to SkPath
|
1204
1250
|
*/
|
1205
|
-
SkPath& addRoundRect(const SkRect& rect, const SkScalar radii
|
1251
|
+
SkPath& addRoundRect(const SkRect& rect, SkSpan<const SkScalar> radii,
|
1206
1252
|
SkPathDirection dir = SkPathDirection::kCW);
|
1207
1253
|
|
1208
1254
|
/** Adds rrect to SkPath, creating a new closed contour. If
|
@@ -1248,25 +1294,7 @@ private:
|
|
1248
1294
|
|
1249
1295
|
example: https://fiddle.skia.org/c/@Path_addPoly
|
1250
1296
|
*/
|
1251
|
-
SkPath& addPoly(const SkPoint pts
|
1252
|
-
|
1253
|
-
/** Adds contour created from list. Contour added starts at list[0], then adds a line
|
1254
|
-
for every additional SkPoint in list. If close is true, appends kClose_Verb to SkPath,
|
1255
|
-
connecting last and first SkPoint in list.
|
1256
|
-
|
1257
|
-
If list is empty, append kMove_Verb to path.
|
1258
|
-
|
1259
|
-
@param list array of SkPoint
|
1260
|
-
@param close true to add line connecting contour end and start
|
1261
|
-
@return reference to SkPath
|
1262
|
-
*/
|
1263
|
-
SkPath& addPoly(const std::initializer_list<SkPoint>& list, bool close) {
|
1264
|
-
return this->addPoly(list.begin(), SkToInt(list.size()), close);
|
1265
|
-
}
|
1266
|
-
|
1267
|
-
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
1268
|
-
public:
|
1269
|
-
#endif
|
1297
|
+
SkPath& addPoly(SkSpan<const SkPoint> pts, bool close);
|
1270
1298
|
|
1271
1299
|
/** \enum SkPath::AddPathMode
|
1272
1300
|
AddPathMode chooses how addPath() appends. Adding one SkPath to another can extend
|
@@ -1341,6 +1369,17 @@ public:
|
|
1341
1369
|
*/
|
1342
1370
|
SkPath& reverseAddPath(const SkPath& src);
|
1343
1371
|
|
1372
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
1373
|
+
public:
|
1374
|
+
#endif
|
1375
|
+
SkPath makeOffset(SkScalar dx, SkScalar dy) const {
|
1376
|
+
SkPath dst;
|
1377
|
+
this->offset(dx, dy, &dst);
|
1378
|
+
return dst;
|
1379
|
+
}
|
1380
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
1381
|
+
private:
|
1382
|
+
#endif
|
1344
1383
|
/** Offsets SkPoint array by (dx, dy). Offset SkPath replaces dst.
|
1345
1384
|
If dst is nullptr, SkPath is replaced by offset data.
|
1346
1385
|
|
@@ -1384,10 +1423,13 @@ public:
|
|
1384
1423
|
@param pc whether to apply perspective clipping
|
1385
1424
|
*/
|
1386
1425
|
SkPath& transform(const SkMatrix& matrix,
|
1387
|
-
|
1426
|
+
SkApplyPerspectiveClip pc = SkApplyPerspectiveClip::kYes) {
|
1388
1427
|
this->transform(matrix, this, pc);
|
1389
1428
|
return *this;
|
1390
1429
|
}
|
1430
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
1431
|
+
public:
|
1432
|
+
#endif
|
1391
1433
|
|
1392
1434
|
SkPath makeTransform(const SkMatrix& m,
|
1393
1435
|
SkApplyPerspectiveClip pc = SkApplyPerspectiveClip::kYes) const {
|
@@ -1396,7 +1438,7 @@ public:
|
|
1396
1438
|
return dst;
|
1397
1439
|
}
|
1398
1440
|
|
1399
|
-
SkPath makeScale(SkScalar sx, SkScalar sy) {
|
1441
|
+
SkPath makeScale(SkScalar sx, SkScalar sy) const {
|
1400
1442
|
return this->makeTransform(SkMatrix::Scale(sx, sy), SkApplyPerspectiveClip::kNo);
|
1401
1443
|
}
|
1402
1444
|
|
@@ -1410,6 +1452,9 @@ public:
|
|
1410
1452
|
*/
|
1411
1453
|
bool getLastPt(SkPoint* lastPt) const;
|
1412
1454
|
|
1455
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
1456
|
+
private:
|
1457
|
+
#endif
|
1413
1458
|
/** Sets last point to (x, y). If SkPoint array is empty, append kMove_Verb to
|
1414
1459
|
verb array and append (x, y) to SkPoint array.
|
1415
1460
|
|
@@ -1428,6 +1473,10 @@ public:
|
|
1428
1473
|
void setLastPt(const SkPoint& p) {
|
1429
1474
|
this->setLastPt(p.fX, p.fY);
|
1430
1475
|
}
|
1476
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
1477
|
+
public:
|
1478
|
+
#endif
|
1479
|
+
|
1431
1480
|
|
1432
1481
|
/** \enum SkPath::SegmentMask
|
1433
1482
|
SegmentMask constants correspond to each drawing Verb type in SkPath; for
|
@@ -1561,6 +1610,36 @@ public:
|
|
1561
1610
|
Verb autoClose(SkPoint pts[2]);
|
1562
1611
|
};
|
1563
1612
|
|
1613
|
+
#ifdef SK_SUPPORT_UNSPANNED_APIS
|
1614
|
+
static SkPath Make(const SkPoint points[], int pointCount,
|
1615
|
+
const uint8_t verbs[], int verbCount,
|
1616
|
+
const SkScalar conics[], int conicWeightCount,
|
1617
|
+
SkPathFillType fillType, bool isVolatile = false) {
|
1618
|
+
return Make({points, pointCount},
|
1619
|
+
{verbs, verbCount},
|
1620
|
+
{conics, conicWeightCount},
|
1621
|
+
fillType, isVolatile);
|
1622
|
+
}
|
1623
|
+
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed,
|
1624
|
+
SkPathFillType fillType = SkPathFillType::kWinding,
|
1625
|
+
bool isVolatile = false) {
|
1626
|
+
return Polygon({pts, count}, isClosed, fillType, isVolatile);
|
1627
|
+
}
|
1628
|
+
int getPoints(SkPoint points[], int max) const {
|
1629
|
+
return (int)this->getPoints({points, max});
|
1630
|
+
}
|
1631
|
+
int getVerbs(uint8_t verbs[], int max) const {
|
1632
|
+
return (int)this->getVerbs({verbs, max});
|
1633
|
+
}
|
1634
|
+
SkPath& addRoundRect(const SkRect& rect, const SkScalar radii[],
|
1635
|
+
SkPathDirection dir = SkPathDirection::kCW) {
|
1636
|
+
return this->addRoundRect(rect, {radii, radii ? 8 : 0}, dir);
|
1637
|
+
}
|
1638
|
+
SkPath& addPoly(const SkPoint pts[], int count, bool close) {
|
1639
|
+
return this->addPoly({pts, count}, close);
|
1640
|
+
}
|
1641
|
+
#endif
|
1642
|
+
|
1564
1643
|
private:
|
1565
1644
|
/** \class SkPath::RangeIter
|
1566
1645
|
Iterates through a raw range of path verbs, points, and conics. All values are returned
|
@@ -1760,6 +1839,9 @@ public:
|
|
1760
1839
|
*/
|
1761
1840
|
sk_sp<SkData> serialize() const;
|
1762
1841
|
|
1842
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
1843
|
+
private:
|
1844
|
+
#endif
|
1763
1845
|
/** Initializes SkPath from buffer of size length. Returns zero if the buffer is
|
1764
1846
|
data is inconsistent, or the length is too small.
|
1765
1847
|
|
@@ -1776,8 +1858,29 @@ public:
|
|
1776
1858
|
example: https://fiddle.skia.org/c/@Path_readFromMemory
|
1777
1859
|
*/
|
1778
1860
|
size_t readFromMemory(const void* buffer, size_t length);
|
1861
|
+
#ifdef SK_HIDE_PATH_EDIT_METHODS
|
1862
|
+
public:
|
1863
|
+
#endif
|
1864
|
+
/** Initializes SkPath from buffer of size length. If the buffer data is inconsistent, or the
|
1865
|
+
length is too small, returns a nullopt.
|
1866
|
+
|
1867
|
+
Reads SkPath::FillType, verb array, SkPoint array, conic weight, and
|
1868
|
+
additionally reads computed information like SkPath::Convexity and bounds.
|
1869
|
+
|
1870
|
+
Used only in concert with writeToMemory();
|
1871
|
+
the format used for SkPath in memory is not guaranteed.
|
1872
|
+
|
1873
|
+
@param buffer storage for SkPath
|
1874
|
+
@param length buffer size in bytes; must be multiple of 4
|
1875
|
+
@param bytesRead if not null, the number of bytes read from buffer will be written here
|
1876
|
+
@return the path read, or nullopt on failure
|
1877
|
+
|
1878
|
+
example: https://fiddle.skia.org/c/@Path_readFromMemory
|
1879
|
+
*/
|
1880
|
+
static std::optional<SkPath> ReadFromMemory(const void* buffer, size_t length,
|
1881
|
+
size_t* bytesRead = nullptr);
|
1779
1882
|
|
1780
|
-
/** (See
|
1883
|
+
/** (See skbug.com/40032862)
|
1781
1884
|
Returns a non-zero, globally unique value. A different value is returned
|
1782
1885
|
if verb array, SkPoint array, or conic weight changes.
|
1783
1886
|
|
@@ -1877,7 +1980,7 @@ private:
|
|
1877
1980
|
|
1878
1981
|
// Bottlenecks for working with fConvexity and fFirstDirection.
|
1879
1982
|
// Notice the setters are const... these are mutable atomic fields.
|
1880
|
-
void
|
1983
|
+
void setConvexity(SkPathConvexity) const;
|
1881
1984
|
|
1882
1985
|
void setFirstDirection(SkPathFirstDirection) const;
|
1883
1986
|
SkPathFirstDirection getFirstDirection() const;
|