@shopify/react-native-skia 0.1.129 → 0.1.130

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.
Files changed (167) hide show
  1. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +1 -0
  2. package/cpp/api/JsiSkRuntimeEffect.h +7 -9
  3. package/cpp/api/JsiSkVertices.h +0 -2
  4. package/cpp/rnskia/values/RNSkValue.h +1 -1
  5. package/cpp/skia/include/codec/SkCodec.h +7 -1
  6. package/cpp/skia/include/core/SkAlphaType.h +45 -0
  7. package/cpp/skia/include/core/SkBitmap.h +4 -2
  8. package/cpp/skia/include/core/SkCanvas.h +31 -20
  9. package/cpp/skia/include/core/SkColor.h +1 -1
  10. package/cpp/skia/include/core/SkColorFilter.h +1 -0
  11. package/cpp/skia/include/core/SkColorType.h +66 -0
  12. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +1 -1
  13. package/cpp/skia/include/core/SkDrawable.h +7 -0
  14. package/cpp/skia/include/core/SkEncodedImageFormat.h +1 -0
  15. package/cpp/skia/include/core/SkFont.h +4 -3
  16. package/cpp/skia/include/core/SkFontArguments.h +33 -1
  17. package/cpp/skia/include/core/SkGraphics.h +13 -0
  18. package/cpp/skia/include/core/SkImage.h +67 -22
  19. package/cpp/skia/include/core/SkImageEncoder.h +0 -3
  20. package/cpp/skia/include/core/SkImageGenerator.h +4 -3
  21. package/cpp/skia/include/core/SkImageInfo.h +35 -142
  22. package/cpp/skia/include/core/SkMesh.h +303 -0
  23. package/cpp/skia/include/core/SkMilestone.h +1 -1
  24. package/cpp/skia/include/core/SkOpenTypeSVGDecoder.h +30 -0
  25. package/cpp/skia/include/core/SkPaint.h +4 -19
  26. package/cpp/skia/include/core/SkPath.h +20 -33
  27. package/cpp/skia/include/core/SkPathBuilder.h +1 -6
  28. package/cpp/skia/include/core/SkPixelRef.h +1 -1
  29. package/cpp/skia/include/core/SkPixmap.h +3 -2
  30. package/cpp/skia/include/core/SkRSXform.h +1 -1
  31. package/cpp/skia/include/core/SkSamplingOptions.h +16 -5
  32. package/cpp/skia/include/core/SkSpan.h +5 -5
  33. package/cpp/skia/include/core/SkString.h +5 -8
  34. package/cpp/skia/include/core/SkSurface.h +21 -0
  35. package/cpp/skia/include/core/SkTypeface.h +20 -4
  36. package/cpp/skia/include/core/SkTypes.h +9 -5
  37. package/cpp/skia/include/effects/SkGradientShader.h +9 -18
  38. package/cpp/skia/include/effects/SkRuntimeEffect.h +16 -12
  39. package/cpp/skia/include/gpu/GpuTypes.h +32 -0
  40. package/cpp/skia/include/gpu/GrBackendSemaphore.h +1 -1
  41. package/cpp/skia/include/gpu/GrBackendSurface.h +6 -5
  42. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +1 -1
  43. package/cpp/skia/include/gpu/GrContextOptions.h +11 -20
  44. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +7 -0
  45. package/cpp/skia/include/gpu/GrDirectContext.h +16 -11
  46. package/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h +0 -2
  47. package/cpp/skia/include/gpu/GrRecordingContext.h +14 -7
  48. package/cpp/skia/include/gpu/GrSurfaceInfo.h +6 -6
  49. package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +1 -1
  50. package/cpp/skia/include/gpu/gl/GrGLFunctions.h +3 -1
  51. package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
  52. package/cpp/skia/include/gpu/graphite/BackendTexture.h +64 -0
  53. package/cpp/skia/include/gpu/graphite/Context.h +124 -0
  54. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +71 -0
  55. package/cpp/skia/include/gpu/graphite/Recorder.h +104 -0
  56. package/cpp/skia/include/gpu/graphite/Recording.h +39 -0
  57. package/cpp/skia/include/gpu/graphite/SkStuff.h +47 -0
  58. package/cpp/skia/include/gpu/graphite/TextureInfo.h +91 -0
  59. package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +24 -0
  60. package/cpp/skia/include/gpu/graphite/mtl/MtlTypes.h +68 -0
  61. package/cpp/skia/include/gpu/mock/GrMockTypes.h +1 -2
  62. package/cpp/skia/include/ports/SkCFObject.h +0 -4
  63. package/cpp/skia/include/ports/SkTypeface_win.h +2 -2
  64. package/cpp/skia/include/private/{GrSingleOwner.h → SingleOwner.h} +17 -10
  65. package/cpp/skia/include/private/SkChecksum.h +11 -0
  66. package/cpp/skia/include/private/SkEncodedInfo.h +22 -5
  67. package/cpp/skia/include/private/SkFloatingPoint.h +0 -53
  68. package/cpp/skia/include/private/SkImageInfoPriv.h +8 -2
  69. package/cpp/skia/include/private/SkMacros.h +13 -18
  70. package/cpp/skia/include/private/SkMutex.h +8 -0
  71. package/cpp/skia/include/private/SkPathRef.h +2 -16
  72. package/cpp/skia/include/private/SkSLDefines.h +9 -1
  73. package/cpp/skia/include/private/SkSLIRNode.h +6 -5
  74. package/cpp/skia/include/private/SkSLLayout.h +11 -10
  75. package/cpp/skia/include/private/SkSLModifiers.h +4 -3
  76. package/cpp/skia/include/private/SkSLProgramElement.h +2 -2
  77. package/cpp/skia/include/private/SkSLProgramKind.h +8 -5
  78. package/cpp/skia/include/private/SkSLStatement.h +2 -3
  79. package/cpp/skia/include/private/SkSLString.h +17 -56
  80. package/cpp/skia/include/private/SkSLSymbol.h +4 -4
  81. package/cpp/skia/include/private/SkShadowFlags.h +3 -1
  82. package/cpp/skia/include/private/SkStringView.h +47 -0
  83. package/cpp/skia/include/private/SkTArray.h +4 -3
  84. package/cpp/skia/include/private/SkTHash.h +66 -24
  85. package/cpp/skia/include/private/SkTLogic.h +2 -32
  86. package/cpp/skia/include/private/SkTemplates.h +2 -2
  87. package/cpp/skia/include/private/SkThreadAnnotations.h +4 -4
  88. package/cpp/skia/include/private/SkVx.h +28 -28
  89. package/cpp/skia/include/private/chromium/GrSlug.h +40 -3
  90. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +12 -6
  91. package/cpp/skia/include/private/{GrContext_Base.h → gpu/ganesh/GrContext_Base.h} +7 -0
  92. package/cpp/skia/include/private/{GrD3DTypesMinimal.h → gpu/ganesh/GrD3DTypesMinimal.h} +0 -0
  93. package/cpp/skia/include/private/{GrDawnTypesPriv.h → gpu/ganesh/GrDawnTypesPriv.h} +0 -0
  94. package/cpp/skia/include/private/{GrGLTypesPriv.h → gpu/ganesh/GrGLTypesPriv.h} +1 -0
  95. package/cpp/skia/include/private/{GrImageContext.h → gpu/ganesh/GrImageContext.h} +4 -4
  96. package/cpp/skia/include/private/{GrMockTypesPriv.h → gpu/ganesh/GrMockTypesPriv.h} +0 -0
  97. package/cpp/skia/include/private/{GrMtlTypesPriv.h → gpu/ganesh/GrMtlTypesPriv.h} +0 -0
  98. package/cpp/skia/include/private/{GrTypesPriv.h → gpu/ganesh/GrTypesPriv.h} +25 -367
  99. package/cpp/skia/include/private/{GrVkTypesPriv.h → gpu/ganesh/GrVkTypesPriv.h} +0 -0
  100. package/cpp/skia/include/private/gpu/graphite/MtlTypesPriv.h +74 -0
  101. package/cpp/skia/include/sksl/DSL.h +4 -0
  102. package/cpp/skia/include/sksl/DSLBlock.h +8 -3
  103. package/cpp/skia/include/sksl/DSLCase.h +6 -6
  104. package/cpp/skia/include/sksl/DSLCore.h +89 -78
  105. package/cpp/skia/include/sksl/DSLExpression.h +78 -45
  106. package/cpp/skia/include/sksl/DSLFunction.h +23 -18
  107. package/cpp/skia/include/sksl/DSLLayout.h +14 -16
  108. package/cpp/skia/include/sksl/DSLModifiers.h +7 -5
  109. package/cpp/skia/include/sksl/DSLRuntimeEffects.h +1 -1
  110. package/cpp/skia/include/sksl/DSLStatement.h +16 -10
  111. package/cpp/skia/include/sksl/DSLSymbols.h +7 -7
  112. package/cpp/skia/include/sksl/DSLType.h +27 -23
  113. package/cpp/skia/include/sksl/DSLVar.h +72 -61
  114. package/cpp/skia/include/sksl/SkSLErrorReporter.h +12 -49
  115. package/cpp/skia/include/sksl/SkSLOperator.h +151 -0
  116. package/cpp/skia/include/sksl/SkSLPosition.h +102 -0
  117. package/cpp/skia/include/svg/SkSVGCanvas.h +5 -1
  118. package/cpp/skia/include/utils/SkAnimCodecPlayer.h +7 -0
  119. package/cpp/skia/include/utils/SkCamera.h +2 -0
  120. package/cpp/skia/include/utils/SkCanvasStateUtils.h +4 -1
  121. package/cpp/skia/include/utils/SkCustomTypeface.h +6 -4
  122. package/cpp/skia/include/utils/SkNWayCanvas.h +34 -0
  123. package/cpp/skia/include/utils/SkNullCanvas.h +5 -1
  124. package/cpp/skia/include/utils/SkOrderedFontMgr.h +12 -0
  125. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +30 -1
  126. package/cpp/skia/include/utils/SkParse.h +2 -0
  127. package/cpp/skia/include/utils/SkShadowUtils.h +3 -2
  128. package/cpp/skia/include/utils/SkTextUtils.h +8 -4
  129. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +27 -1
  130. package/cpp/skia/modules/svg/include/SkSVGDOM.h +4 -0
  131. package/cpp/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h +32 -0
  132. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
  133. package/cpp/skia/modules/svg/include/SkSVGSVG.h +2 -0
  134. package/cpp/skia/modules/svg/include/SkSVGTypes.h +48 -9
  135. package/ios/RNSkia-iOS/PlatformContext.h +1 -1
  136. package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +1 -0
  137. package/ios/RNSkia-iOS/SkiaDrawView.mm +1 -1
  138. package/lib/commonjs/renderer/components/shaders/Shader.js +1 -2
  139. package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
  140. package/lib/module/renderer/components/shaders/Shader.js +1 -2
  141. package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
  142. package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +0 -1
  143. package/lib/typescript/src/skia/types/RuntimeEffect/RuntimeEffect.d.ts +2 -4
  144. package/libs/android/arm64-v8a/libskia.a +0 -0
  145. package/libs/android/arm64-v8a/libsvg.a +0 -0
  146. package/libs/android/armeabi-v7a/libskia.a +0 -0
  147. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  148. package/libs/android/x86/libskia.a +0 -0
  149. package/libs/android/x86/libsvg.a +0 -0
  150. package/libs/android/x86_64/libskia.a +0 -0
  151. package/libs/android/x86_64/libsvg.a +0 -0
  152. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  153. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  154. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  155. package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
  156. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  157. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  158. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  159. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  160. package/package.json +2 -2
  161. package/src/renderer/components/shaders/Shader.tsx +1 -3
  162. package/src/skia/types/RuntimeEffect/RuntimeEffect.ts +1 -8
  163. package/cpp/skia/include/core/SkCustomMesh.h +0 -202
  164. package/cpp/skia/include/core/SkStringView.h +0 -185
  165. package/cpp/skia/include/private/SkPaintParamsKey.h +0 -110
  166. package/cpp/skia/include/private/SkShaderCodeDictionary.h +0 -63
  167. package/cpp/skia/include/private/SkTOptional.h +0 -362
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Copyright 2021 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 skgpu_graphite_MtlTypesPriv_DEFINED
9
+ #define skgpu_graphite_MtlTypesPriv_DEFINED
10
+
11
+ #include "include/gpu/graphite/GraphiteTypes.h"
12
+ #include "include/gpu/graphite/mtl/MtlTypes.h"
13
+
14
+ ///////////////////////////////////////////////////////////////////////////////
15
+
16
+ #ifdef __APPLE__
17
+
18
+ #include <TargetConditionals.h>
19
+
20
+ // We're using the MSL version as shorthand for the Metal SDK version here
21
+ #if defined(SK_BUILD_FOR_MAC)
22
+ #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
23
+ #define GR_METAL_SDK_VERSION 230
24
+ #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
25
+ #define GR_METAL_SDK_VERSION 240
26
+ #else
27
+ #error Must use at least 11.00 SDK to build Metal backend for MacOS
28
+ #endif
29
+ #else
30
+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 || __TV_OS_VERSION_MAX_ALLOWED >= 140000
31
+ #define GR_METAL_SDK_VERSION 230
32
+ #elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 || __TV_OS_VERSION_MAX_ALLOWED >= 150000
33
+ #define GR_METAL_SDK_VERSION 240
34
+ #else
35
+ #error Must use at least 14.00 SDK to build Metal backend for iOS
36
+ #endif
37
+ #endif
38
+
39
+ #endif // __APPLE__
40
+
41
+ namespace skgpu::graphite {
42
+
43
+ struct MtlTextureSpec {
44
+ MtlTextureSpec()
45
+ : fFormat(0)
46
+ , fUsage(0)
47
+ , fStorageMode(0)
48
+ , fFramebufferOnly(false) {}
49
+ MtlTextureSpec(const MtlTextureInfo& info)
50
+ : fFormat(info.fFormat)
51
+ , fUsage(info.fUsage)
52
+ , fStorageMode(info.fStorageMode)
53
+ , fFramebufferOnly(info.fFramebufferOnly) {}
54
+
55
+ bool operator==(const MtlTextureSpec& that) const {
56
+ return fFormat == that.fFormat &&
57
+ fUsage == that.fUsage &&
58
+ fStorageMode == that.fStorageMode &&
59
+ fFramebufferOnly == that.fFramebufferOnly;
60
+ }
61
+
62
+ MtlPixelFormat fFormat;
63
+ MtlTextureUsage fUsage;
64
+ MtlStorageMode fStorageMode;
65
+ bool fFramebufferOnly;
66
+ };
67
+
68
+ MtlTextureInfo MtlTextureSpecToTextureInfo(const MtlTextureSpec& mtlSpec,
69
+ uint32_t sampleCount,
70
+ uint32_t levelCount);
71
+
72
+ } // namespace skgpu::graphite
73
+
74
+ #endif // skgpu_graphite_MtlTypesPriv_DEFINED
@@ -8,7 +8,11 @@
8
8
  #ifndef SKSL_DSL
9
9
  #define SKSL_DSL
10
10
 
11
+ #include "include/sksl/DSLBlock.h"
11
12
  #include "include/sksl/DSLCore.h"
13
+ #include "include/sksl/DSLExpression.h"
14
+ #include "include/sksl/DSLFunction.h"
15
+ #include "include/sksl/DSLType.h"
12
16
 
13
17
  namespace SkSL {
14
18
 
@@ -9,10 +9,12 @@
9
9
  #define SKSL_DSL_BLOCK
10
10
 
11
11
  #include "include/private/SkSLDefines.h"
12
- #include "include/sksl/DSLExpression.h"
12
+ #include "include/private/SkTArray.h"
13
13
  #include "include/sksl/DSLStatement.h"
14
+ #include "include/sksl/SkSLPosition.h"
14
15
 
15
16
  #include <memory>
17
+ #include <utility>
16
18
 
17
19
  namespace SkSL {
18
20
 
@@ -37,9 +39,11 @@ public:
37
39
 
38
40
  DSLBlock(DSLBlock&& other) = default;
39
41
 
40
- DSLBlock(SkSL::StatementArray statements, std::shared_ptr<SymbolTable> symbols = nullptr);
42
+ DSLBlock(SkSL::StatementArray statements, std::shared_ptr<SymbolTable> symbols = nullptr,
43
+ Position pos = {});
41
44
 
42
- DSLBlock(SkTArray<DSLStatement> statements, std::shared_ptr<SymbolTable> symbols = nullptr);
45
+ DSLBlock(SkTArray<DSLStatement> statements, std::shared_ptr<SymbolTable> symbols = nullptr,
46
+ Position pos = {});
43
47
 
44
48
  ~DSLBlock();
45
49
 
@@ -55,6 +59,7 @@ public:
55
59
  private:
56
60
  SkSL::StatementArray fStatements;
57
61
  std::shared_ptr<SkSL::SymbolTable> fSymbols;
62
+ Position fPosition;
58
63
 
59
64
  friend class DSLStatement;
60
65
  friend class DSLFunction;
@@ -9,15 +9,15 @@
9
9
  #define SKSL_DSL_CASE
10
10
 
11
11
  #include "include/private/SkSLDefines.h"
12
+ #include "include/private/SkTArray.h"
12
13
  #include "include/sksl/DSLExpression.h"
13
14
  #include "include/sksl/DSLStatement.h"
15
+ #include "include/sksl/SkSLPosition.h"
14
16
 
15
- #include <memory>
17
+ #include <utility>
16
18
 
17
19
  namespace SkSL {
18
20
 
19
- class Statement;
20
-
21
21
  namespace dsl {
22
22
 
23
23
  class DSLCase {
@@ -37,10 +37,10 @@ public:
37
37
  }
38
38
 
39
39
  DSLCase(DSLExpression value, SkTArray<DSLStatement> statements,
40
- PositionInfo info = PositionInfo::Capture());
40
+ Position pos = {});
41
41
 
42
42
  DSLCase(DSLExpression value, SkSL::StatementArray statements,
43
- PositionInfo info = PositionInfo::Capture());
43
+ Position pos = {});
44
44
 
45
45
  DSLCase(DSLCase&&);
46
46
 
@@ -53,7 +53,7 @@ public:
53
53
  private:
54
54
  DSLExpression fValue;
55
55
  SkSL::StatementArray fStatements;
56
- PositionInfo fPosition;
56
+ Position fPosition;
57
57
 
58
58
  friend class DSLCore;
59
59
 
@@ -8,26 +8,33 @@
8
8
  #ifndef SKSL_DSL_CORE
9
9
  #define SKSL_DSL_CORE
10
10
 
11
+ #include "include/private/SkSLDefines.h"
11
12
  #include "include/private/SkSLProgramKind.h"
12
13
  #include "include/private/SkTArray.h"
13
- #include "include/sksl/DSLBlock.h"
14
14
  #include "include/sksl/DSLCase.h"
15
15
  #include "include/sksl/DSLExpression.h"
16
- #include "include/sksl/DSLFunction.h"
17
16
  #include "include/sksl/DSLStatement.h"
18
- #include "include/sksl/DSLType.h"
19
17
  #include "include/sksl/DSLVar.h"
20
- #include "include/sksl/DSLWrapper.h"
21
- #include "include/sksl/SkSLErrorReporter.h"
18
+
19
+ #include <memory>
20
+ #include <string>
21
+ #include <string_view>
22
+ #include <utility>
22
23
 
23
24
  namespace SkSL {
24
25
 
25
26
  class Compiler;
27
+ class ErrorReporter;
28
+ class Position;
29
+ struct ForLoopPositions;
26
30
  struct Program;
27
31
  struct ProgramSettings;
28
32
 
29
33
  namespace dsl {
30
34
 
35
+ class DSLField;
36
+ class DSLModifiers;
37
+
31
38
  // When users import the DSL namespace via `using namespace SkSL::dsl`, we want the SwizzleComponent
32
39
  // Type enum to come into scope as well, so `Swizzle(var, X, Y, ONE)` can work as expected.
33
40
  // `namespace SkSL::SwizzleComponent` contains only an `enum Type`; this `using namespace` directive
@@ -52,9 +59,9 @@ void End();
52
59
  * Returns all global elements (functions and global variables) as a self-contained Program. The
53
60
  * optional source string is retained as the program's source. DSL programs do not normally have
54
61
  * sources, but when a DSL program is produced from parsed program text (as in DSLParser), it may be
55
- * important to retain it so that any skstd::string_views derived from it remain valid.
62
+ * important to retain it so that any std::string_views derived from it remain valid.
56
63
  */
57
- std::unique_ptr<SkSL::Program> ReleaseProgram(std::unique_ptr<SkSL::String> source = nullptr);
64
+ std::unique_ptr<SkSL::Program> ReleaseProgram(std::unique_ptr<std::string> source = nullptr);
58
65
 
59
66
  /**
60
67
  * Returns the ErrorReporter which will be notified of any errors that occur during DSL calls. The
@@ -76,42 +83,42 @@ DSLExpression sk_Position();
76
83
  /**
77
84
  * #extension <name> : enable
78
85
  */
79
- void AddExtension(skstd::string_view name, PositionInfo pos = PositionInfo::Capture());
86
+ void AddExtension(std::string_view name, Position pos = {});
80
87
 
81
88
  /**
82
89
  * break;
83
90
  */
84
- DSLStatement Break(PositionInfo pos = PositionInfo::Capture());
91
+ DSLStatement Break(Position pos = {});
85
92
 
86
93
  /**
87
94
  * continue;
88
95
  */
89
- DSLStatement Continue(PositionInfo pos = PositionInfo::Capture());
96
+ DSLStatement Continue(Position pos = {});
90
97
 
91
98
  /**
92
99
  * Adds a modifiers declaration to the current program.
93
100
  */
94
- void Declare(const DSLModifiers& modifiers, PositionInfo pos = PositionInfo::Capture());
101
+ void Declare(const DSLModifiers& modifiers, Position pos = {});
95
102
 
96
103
  /**
97
104
  * Creates a local variable declaration statement.
98
105
  */
99
- DSLStatement Declare(DSLVar& var, PositionInfo pos = PositionInfo::Capture());
106
+ DSLStatement Declare(DSLVar& var, Position pos = {});
100
107
 
101
108
  /**
102
109
  * Creates a local variable declaration statement containing multiple variables.
103
110
  */
104
- DSLStatement Declare(SkTArray<DSLVar>& vars, PositionInfo pos = PositionInfo::Capture());
111
+ DSLStatement Declare(SkTArray<DSLVar>& vars, Position pos = {});
105
112
 
106
113
  /**
107
114
  * Declares a global variable.
108
115
  */
109
- void Declare(DSLGlobalVar& var, PositionInfo pos = PositionInfo::Capture());
116
+ void Declare(DSLGlobalVar& var, Position pos = {});
110
117
 
111
118
  /**
112
119
  * Declares a set of global variables.
113
120
  */
114
- void Declare(SkTArray<DSLGlobalVar>& vars, PositionInfo pos = PositionInfo::Capture());
121
+ void Declare(SkTArray<DSLGlobalVar>& vars, Position pos = {});
115
122
 
116
123
  /**
117
124
  * default: statements
@@ -124,50 +131,50 @@ DSLCase Default(Statements... statements) {
124
131
  /**
125
132
  * discard;
126
133
  */
127
- DSLStatement Discard(PositionInfo pos = PositionInfo::Capture());
134
+ DSLStatement Discard(Position pos = {});
128
135
 
129
136
  /**
130
137
  * do stmt; while (test);
131
138
  */
132
- DSLStatement Do(DSLStatement stmt, DSLExpression test, PositionInfo pos = PositionInfo::Capture());
139
+ DSLStatement Do(DSLStatement stmt, DSLExpression test, Position pos = {});
133
140
 
134
141
  /**
135
142
  * for (initializer; test; next) stmt;
136
143
  */
137
144
  DSLStatement For(DSLStatement initializer, DSLExpression test, DSLExpression next,
138
- DSLStatement stmt, PositionInfo pos = PositionInfo::Capture());
145
+ DSLStatement stmt, Position pos = {}, ForLoopPositions positions = {});
139
146
 
140
147
  /**
141
148
  * if (test) ifTrue; [else ifFalse;]
142
149
  */
143
150
  DSLStatement If(DSLExpression test, DSLStatement ifTrue, DSLStatement ifFalse = DSLStatement(),
144
- PositionInfo pos = PositionInfo::Capture());
151
+ Position pos = {});
145
152
 
146
- DSLGlobalVar InterfaceBlock(const DSLModifiers& modifiers, skstd::string_view typeName,
147
- SkTArray<DSLField> fields, skstd::string_view varName = "",
148
- int arraySize = 0, PositionInfo pos = PositionInfo::Capture());
153
+ DSLGlobalVar InterfaceBlock(const DSLModifiers& modifiers, std::string_view typeName,
154
+ SkTArray<DSLField> fields, std::string_view varName = "",
155
+ int arraySize = 0, Position pos = {});
149
156
 
150
157
  /**
151
158
  * return [value];
152
159
  */
153
160
  DSLStatement Return(DSLExpression value = DSLExpression(),
154
- PositionInfo pos = PositionInfo::Capture());
161
+ Position pos = {});
155
162
 
156
163
  /**
157
164
  * test ? ifTrue : ifFalse
158
165
  */
159
166
  DSLExpression Select(DSLExpression test, DSLExpression ifTrue, DSLExpression ifFalse,
160
- PositionInfo info = PositionInfo::Capture());
167
+ Position = {});
161
168
 
162
169
  DSLStatement StaticIf(DSLExpression test, DSLStatement ifTrue,
163
170
  DSLStatement ifFalse = DSLStatement(),
164
- PositionInfo pos = PositionInfo::Capture());
171
+ Position pos = {});
165
172
 
166
173
  // Internal use only
167
174
  DSLPossibleStatement PossibleStaticSwitch(DSLExpression value, SkTArray<DSLCase> cases);
168
175
 
169
176
  DSLStatement StaticSwitch(DSLExpression value, SkTArray<DSLCase> cases,
170
- PositionInfo info = PositionInfo::Capture());
177
+ Position pos = {});
171
178
 
172
179
  /**
173
180
  * @switch (value) { cases }
@@ -184,7 +191,7 @@ DSLPossibleStatement StaticSwitch(DSLExpression value, Cases... cases) {
184
191
  DSLPossibleStatement PossibleSwitch(DSLExpression value, SkTArray<DSLCase> cases);
185
192
 
186
193
  DSLStatement Switch(DSLExpression value, SkTArray<DSLCase> cases,
187
- PositionInfo info = PositionInfo::Capture());
194
+ Position pos = {});
188
195
 
189
196
  /**
190
197
  * switch (value) { cases }
@@ -201,187 +208,191 @@ DSLPossibleStatement Switch(DSLExpression value, Cases... cases) {
201
208
  * while (test) stmt;
202
209
  */
203
210
  DSLStatement While(DSLExpression test, DSLStatement stmt,
204
- PositionInfo info = PositionInfo::Capture());
211
+ Position pos = {});
205
212
 
206
213
  /**
207
214
  * expression.xyz1
208
215
  */
209
216
  DSLExpression Swizzle(DSLExpression base,
210
217
  SkSL::SwizzleComponent::Type a,
211
- PositionInfo pos = PositionInfo::Capture());
218
+ Position pos = {},
219
+ Position maskPos = {});
212
220
 
213
221
  DSLExpression Swizzle(DSLExpression base,
214
222
  SkSL::SwizzleComponent::Type a,
215
223
  SkSL::SwizzleComponent::Type b,
216
- PositionInfo pos = PositionInfo::Capture());
224
+ Position pos = {},
225
+ Position maskPos = {});
217
226
 
218
227
  DSLExpression Swizzle(DSLExpression base,
219
228
  SkSL::SwizzleComponent::Type a,
220
229
  SkSL::SwizzleComponent::Type b,
221
230
  SkSL::SwizzleComponent::Type c,
222
- PositionInfo pos = PositionInfo::Capture());
231
+ Position pos = {},
232
+ Position maskPos = {});
223
233
 
224
234
  DSLExpression Swizzle(DSLExpression base,
225
235
  SkSL::SwizzleComponent::Type a,
226
236
  SkSL::SwizzleComponent::Type b,
227
237
  SkSL::SwizzleComponent::Type c,
228
238
  SkSL::SwizzleComponent::Type d,
229
- PositionInfo pos = PositionInfo::Capture());
239
+ Position pos = {},
240
+ Position maskPos = {});
230
241
 
231
242
  /**
232
243
  * Returns the absolute value of x. If x is a vector, operates componentwise.
233
244
  */
234
- DSLExpression Abs(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
245
+ DSLExpression Abs(DSLExpression x, Position pos = {});
235
246
 
236
247
  /**
237
248
  * Returns true if all of the components of boolean vector x are true.
238
249
  */
239
- DSLExpression All(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
250
+ DSLExpression All(DSLExpression x, Position pos = {});
240
251
 
241
252
  /**
242
253
  * Returns true if any of the components of boolean vector x are true.
243
254
  */
244
- DSLExpression Any(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
255
+ DSLExpression Any(DSLExpression x, Position pos = {});
245
256
 
246
257
  /**
247
258
  * Returns the arctangent of y over x. Operates componentwise on vectors.
248
259
  */
249
- DSLExpression Atan(DSLExpression y_over_x, PositionInfo pos = PositionInfo::Capture());
250
- DSLExpression Atan(DSLExpression y, DSLExpression x, PositionInfo pos = PositionInfo::Capture());
260
+ DSLExpression Atan(DSLExpression y_over_x, Position pos = {});
261
+ DSLExpression Atan(DSLExpression y, DSLExpression x, Position pos = {});
251
262
 
252
263
  /**
253
264
  * Returns x rounded towards positive infinity. If x is a vector, operates componentwise.
254
265
  */
255
- DSLExpression Ceil(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
266
+ DSLExpression Ceil(DSLExpression x, Position pos = {});
256
267
 
257
268
  /**
258
269
  * Returns x clamped to between min and max. If x is a vector, operates componentwise.
259
270
  */
260
271
  DSLExpression Clamp(DSLExpression x, DSLExpression min, DSLExpression max,
261
- PositionInfo pos = PositionInfo::Capture());
272
+ Position pos = {});
262
273
 
263
274
  /**
264
275
  * Returns the cosine of x. If x is a vector, operates componentwise.
265
276
  */
266
- DSLExpression Cos(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
277
+ DSLExpression Cos(DSLExpression x, Position pos = {});
267
278
 
268
279
  /**
269
280
  * Returns the cross product of x and y.
270
281
  */
271
- DSLExpression Cross(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo::Capture());
282
+ DSLExpression Cross(DSLExpression x, DSLExpression y, Position pos = {});
272
283
 
273
284
  /**
274
285
  * Returns x converted from radians to degrees. If x is a vector, operates componentwise.
275
286
  */
276
- DSLExpression Degrees(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
287
+ DSLExpression Degrees(DSLExpression x, Position pos = {});
277
288
 
278
289
  /**
279
290
  * Returns the distance between x and y.
280
291
  */
281
292
  DSLExpression Distance(DSLExpression x, DSLExpression y,
282
- PositionInfo pos = PositionInfo::Capture());
293
+ Position pos = {});
283
294
 
284
295
  /**
285
296
  * Returns the dot product of x and y.
286
297
  */
287
- DSLExpression Dot(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo::Capture());
298
+ DSLExpression Dot(DSLExpression x, DSLExpression y, Position pos = {});
288
299
 
289
300
  /**
290
301
  * Returns a boolean vector indicating whether components of x are equal to the corresponding
291
302
  * components of y.
292
303
  */
293
- DSLExpression Equal(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo::Capture());
304
+ DSLExpression Equal(DSLExpression x, DSLExpression y, Position pos = {});
294
305
 
295
306
  /**
296
307
  * Returns e^x. If x is a vector, operates componentwise.
297
308
  */
298
- DSLExpression Exp(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
309
+ DSLExpression Exp(DSLExpression x, Position pos = {});
299
310
 
300
311
  /**
301
312
  * Returns 2^x. If x is a vector, operates componentwise.
302
313
  */
303
- DSLExpression Exp2(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
314
+ DSLExpression Exp2(DSLExpression x, Position pos = {});
304
315
 
305
316
  /**
306
317
  * If dot(i, nref) >= 0, returns n, otherwise returns -n.
307
318
  */
308
319
  DSLExpression Faceforward(DSLExpression n, DSLExpression i, DSLExpression nref,
309
- PositionInfo pos = PositionInfo::Capture());
320
+ Position pos = {});
310
321
 
311
322
  /**
312
323
  * Returns x rounded towards negative infinity. If x is a vector, operates componentwise.
313
324
  */
314
- DSLExpression Floor(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
325
+ DSLExpression Floor(DSLExpression x, Position pos = {});
315
326
 
316
327
  /**
317
328
  * Returns the fractional part of x. If x is a vector, operates componentwise.
318
329
  */
319
- DSLExpression Fract(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
330
+ DSLExpression Fract(DSLExpression x, Position pos = {});
320
331
 
321
332
  /**
322
333
  * Returns a boolean vector indicating whether components of x are greater than the corresponding
323
334
  * components of y.
324
335
  */
325
336
  DSLExpression GreaterThan(DSLExpression x, DSLExpression y,
326
- PositionInfo pos = PositionInfo::Capture());
337
+ Position pos = {});
327
338
 
328
339
  /**
329
340
  * Returns a boolean vector indicating whether components of x are greater than or equal to the
330
341
  * corresponding components of y.
331
342
  */
332
343
  DSLExpression GreaterThanEqual(DSLExpression x, DSLExpression y,
333
- PositionInfo pos = PositionInfo::Capture());
344
+ Position pos = {});
334
345
 
335
346
  /**
336
347
  * Returns the 1/sqrt(x). If x is a vector, operates componentwise.
337
348
  */
338
- DSLExpression Inversesqrt(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
349
+ DSLExpression Inversesqrt(DSLExpression x, Position pos = {});
339
350
 
340
351
  /**
341
352
  * Returns the inverse of the matrix x.
342
353
  */
343
- DSLExpression Inverse(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
354
+ DSLExpression Inverse(DSLExpression x, Position pos = {});
344
355
 
345
356
  /**
346
357
  * Returns the length of the vector x.
347
358
  */
348
- DSLExpression Length(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
359
+ DSLExpression Length(DSLExpression x, Position pos = {});
349
360
 
350
361
  /**
351
362
  * Returns a boolean vector indicating whether components of x are less than the corresponding
352
363
  * components of y.
353
364
  */
354
365
  DSLExpression LessThan(DSLExpression x, DSLExpression y,
355
- PositionInfo pos = PositionInfo::Capture());
366
+ Position pos = {});
356
367
 
357
368
  /**
358
369
  * Returns a boolean vector indicating whether components of x are less than or equal to the
359
370
  * corresponding components of y.
360
371
  */
361
372
  DSLExpression LessThanEqual(DSLExpression x, DSLExpression y,
362
- PositionInfo pos = PositionInfo::Capture());
373
+ Position pos = {});
363
374
 
364
375
  /**
365
376
  * Returns the log base e of x. If x is a vector, operates componentwise.
366
377
  */
367
- DSLExpression Log(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
378
+ DSLExpression Log(DSLExpression x, Position pos = {});
368
379
 
369
380
  /**
370
381
  * Returns the log base 2 of x. If x is a vector, operates componentwise.
371
382
  */
372
- DSLExpression Log2(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
383
+ DSLExpression Log2(DSLExpression x, Position pos = {});
373
384
 
374
385
  /**
375
386
  * Returns the larger (closer to positive infinity) of x and y. If x is a vector, operates
376
387
  * componentwise. y may be either a vector of the same dimensions as x, or a scalar.
377
388
  */
378
- DSLExpression Max(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo::Capture());
389
+ DSLExpression Max(DSLExpression x, DSLExpression y, Position pos = {});
379
390
 
380
391
  /**
381
392
  * Returns the smaller (closer to negative infinity) of x and y. If x is a vector, operates
382
393
  * componentwise. y may be either a vector of the same dimensions as x, or a scalar.
383
394
  */
384
- DSLExpression Min(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo::Capture());
395
+ DSLExpression Min(DSLExpression x, DSLExpression y, Position pos = {});
385
396
 
386
397
  /**
387
398
  * Returns a linear intepolation between x and y at position a, where a=0 results in x and a=1
@@ -389,68 +400,68 @@ DSLExpression Min(DSLExpression x, DSLExpression y, PositionInfo pos = PositionI
389
400
  * same dimensions as x and y, or a scalar.
390
401
  */
391
402
  DSLExpression Mix(DSLExpression x, DSLExpression y, DSLExpression a,
392
- PositionInfo pos = PositionInfo::Capture());
403
+ Position pos = {});
393
404
 
394
405
  /**
395
406
  * Returns x modulo y. If x is a vector, operates componentwise. y may be either a vector of the
396
407
  * same dimensions as x, or a scalar.
397
408
  */
398
- DSLExpression Mod(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo::Capture());
409
+ DSLExpression Mod(DSLExpression x, DSLExpression y, Position pos = {});
399
410
 
400
411
  /**
401
412
  * Returns the vector x normalized to a length of 1.
402
413
  */
403
- DSLExpression Normalize(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
414
+ DSLExpression Normalize(DSLExpression x, Position pos = {});
404
415
 
405
416
  /**
406
417
  * Returns a boolean vector indicating whether components of x are not equal to the corresponding
407
418
  * components of y.
408
419
  */
409
420
  DSLExpression NotEqual(DSLExpression x, DSLExpression y,
410
- PositionInfo pos = PositionInfo::Capture());
421
+ Position pos = {});
411
422
 
412
423
  /**
413
424
  * Returns x raised to the power y. If x is a vector, operates componentwise. y may be either a
414
425
  * vector of the same dimensions as x, or a scalar.
415
426
  */
416
- DSLExpression Pow(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo::Capture());
427
+ DSLExpression Pow(DSLExpression x, DSLExpression y, Position pos = {});
417
428
 
418
429
  /**
419
430
  * Returns x converted from degrees to radians. If x is a vector, operates componentwise.
420
431
  */
421
- DSLExpression Radians(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
432
+ DSLExpression Radians(DSLExpression x, Position pos = {});
422
433
 
423
434
  /**
424
435
  * Returns i reflected from a surface with normal n.
425
436
  */
426
- DSLExpression Reflect(DSLExpression i, DSLExpression n, PositionInfo pos = PositionInfo::Capture());
437
+ DSLExpression Reflect(DSLExpression i, DSLExpression n, Position pos = {});
427
438
 
428
439
  /**
429
440
  * Returns i refracted across a surface with normal n and ratio of indices of refraction eta.
430
441
  */
431
442
  DSLExpression Refract(DSLExpression i, DSLExpression n, DSLExpression eta,
432
- PositionInfo pos = PositionInfo::Capture());
443
+ Position pos = {});
433
444
 
434
445
  /**
435
446
  * Returns x, rounded to the nearest integer. If x is a vector, operates componentwise.
436
447
  */
437
- DSLExpression Round(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
448
+ DSLExpression Round(DSLExpression x, Position pos = {});
438
449
 
439
450
  /**
440
451
  * Returns x clamped to the range [0, 1]. If x is a vector, operates componentwise.
441
452
  */
442
- DSLExpression Saturate(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
453
+ DSLExpression Saturate(DSLExpression x, Position pos = {});
443
454
 
444
455
  /**
445
456
  * Returns -1, 0, or 1 depending on whether x is negative, zero, or positive, respectively. If x is
446
457
  * a vector, operates componentwise.
447
458
  */
448
- DSLExpression Sign(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
459
+ DSLExpression Sign(DSLExpression x, Position pos = {});
449
460
 
450
461
  /**
451
462
  * Returns the sine of x. If x is a vector, operates componentwise.
452
463
  */
453
- DSLExpression Sin(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
464
+ DSLExpression Sin(DSLExpression x, Position pos = {});
454
465
 
455
466
  /**
456
467
  * Returns a smooth interpolation between 0 (at x=edge1) and 1 (at x=edge2). If x is a vector,
@@ -458,28 +469,28 @@ DSLExpression Sin(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
458
469
  * scalars.
459
470
  */
460
471
  DSLExpression Smoothstep(DSLExpression edge1, DSLExpression edge2, DSLExpression x,
461
- PositionInfo pos = PositionInfo::Capture());
472
+ Position pos = {});
462
473
 
463
474
  /**
464
475
  * Returns the square root of x. If x is a vector, operates componentwise.
465
476
  */
466
- DSLExpression Sqrt(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
477
+ DSLExpression Sqrt(DSLExpression x, Position pos = {});
467
478
 
468
479
  /**
469
480
  * Returns 0 if x < edge or 1 if x >= edge. If x is a vector, operates componentwise. edge may be
470
481
  * either a vector of the same dimensions as x, or a scalar.
471
482
  */
472
- DSLExpression Step(DSLExpression edge, DSLExpression x, PositionInfo pos = PositionInfo::Capture());
483
+ DSLExpression Step(DSLExpression edge, DSLExpression x, Position pos = {});
473
484
 
474
485
  /**
475
486
  * Returns the tangent of x. If x is a vector, operates componentwise.
476
487
  */
477
- DSLExpression Tan(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
488
+ DSLExpression Tan(DSLExpression x, Position pos = {});
478
489
 
479
490
  /**
480
491
  * Returns x converted from premultipled to unpremultiplied alpha.
481
492
  */
482
- DSLExpression Unpremul(DSLExpression x, PositionInfo pos = PositionInfo::Capture());
493
+ DSLExpression Unpremul(DSLExpression x, Position pos = {});
483
494
 
484
495
  } // namespace dsl
485
496