@shopify/react-native-skia 0.1.129 → 0.1.130

Sign up to get free protection for your applications and to get access to all the features.
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,102 @@
1
+ /*
2
+ * Copyright 2021 Google LLC.
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 SKSL_POSITION
9
+ #define SKSL_POSITION
10
+
11
+ #include "include/core/SkTypes.h"
12
+ #include <string_view>
13
+
14
+ namespace SkSL {
15
+
16
+ class Position {
17
+ public:
18
+ Position()
19
+ : fStartOffset(-1)
20
+ , fLength(0) {}
21
+
22
+ static Position Range(int startOffset, int endOffset) {
23
+ SkASSERT(startOffset <= endOffset);
24
+ SkASSERT(startOffset <= 0xFFFFFF);
25
+ int length = endOffset - startOffset;
26
+ Position result;
27
+ result.fStartOffset = startOffset;
28
+ result.fLength = length <= 0xFF ? length : 0xFF;
29
+ return result;
30
+ }
31
+
32
+ bool valid() const {
33
+ return fStartOffset != -1;
34
+ }
35
+
36
+ int line(std::string_view source) const;
37
+
38
+ int startOffset() const {
39
+ SkASSERT(this->valid());
40
+ return fStartOffset;
41
+ }
42
+
43
+ int endOffset() const {
44
+ SkASSERT(this->valid());
45
+ return fStartOffset + fLength;
46
+ }
47
+
48
+ // Returns the position from this through, and including the entirety of, end.
49
+ Position rangeThrough(Position end) const {
50
+ if (fStartOffset == -1 || end.fStartOffset == -1) {
51
+ return *this;
52
+ }
53
+ SkASSERTF(this->startOffset() <= end.startOffset() && this->endOffset() <= end.endOffset(),
54
+ "Invalid range: (%d-%d) - (%d-%d)\n", this->startOffset(), this->endOffset(),
55
+ end.startOffset(), end.endOffset());
56
+ return Range(this->startOffset(), end.endOffset());
57
+ }
58
+
59
+ // Returns a position representing the character immediately after this position
60
+ Position after() const {
61
+ int endOffset = this->endOffset();
62
+ return Range(endOffset, endOffset + 1);
63
+ }
64
+
65
+ bool operator==(const Position& other) const {
66
+ return fStartOffset == other.fStartOffset && fLength == other.fLength;
67
+ }
68
+
69
+ bool operator!=(const Position& other) const {
70
+ return !(*this == other);
71
+ }
72
+
73
+ bool operator>(const Position& other) const {
74
+ return fStartOffset > other.fStartOffset;
75
+ }
76
+
77
+ bool operator>=(const Position& other) const {
78
+ return fStartOffset >= other.fStartOffset;
79
+ }
80
+
81
+ bool operator<(const Position& other) const {
82
+ return fStartOffset < other.fStartOffset;
83
+ }
84
+
85
+ bool operator<=(const Position& other) const {
86
+ return fStartOffset <= other.fStartOffset;
87
+ }
88
+
89
+ private:
90
+ int32_t fStartOffset : 24;
91
+ uint32_t fLength : 8;
92
+ };
93
+
94
+ struct ForLoopPositions {
95
+ Position initPosition = Position();
96
+ Position conditionPosition = Position();
97
+ Position nextPosition = Position();
98
+ };
99
+
100
+ } // namespace SkSL
101
+
102
+ #endif
@@ -8,9 +8,13 @@
8
8
  #ifndef SkSVGCanvas_DEFINED
9
9
  #define SkSVGCanvas_DEFINED
10
10
 
11
- #include "include/core/SkCanvas.h"
11
+ #include "include/core/SkTypes.h"
12
12
 
13
+ #include <memory>
14
+
15
+ class SkCanvas;
13
16
  class SkWStream;
17
+ struct SkRect;
14
18
 
15
19
  class SK_API SkSVGCanvas {
16
20
  public:
@@ -9,6 +9,13 @@
9
9
  #define SkAnimCodecPlayer_DEFINED
10
10
 
11
11
  #include "include/codec/SkCodec.h"
12
+ #include "include/core/SkImageInfo.h"
13
+ #include "include/core/SkRefCnt.h"
14
+ #include "include/core/SkSize.h"
15
+
16
+ #include <stdint.h>
17
+ #include <memory>
18
+ #include <vector>
12
19
 
13
20
  class SkImage;
14
21
 
@@ -12,6 +12,8 @@
12
12
 
13
13
  #include "include/core/SkM44.h"
14
14
  #include "include/core/SkMatrix.h"
15
+ #include "include/core/SkScalar.h"
16
+ #include "include/core/SkTypes.h"
15
17
  #include "include/private/SkNoncopyable.h"
16
18
 
17
19
  // NOTE -- This entire header / impl is deprecated, and will be removed from Skia soon.
@@ -8,8 +8,11 @@
8
8
  #ifndef SkCanvasStateUtils_DEFINED
9
9
  #define SkCanvasStateUtils_DEFINED
10
10
 
11
- #include "include/core/SkCanvas.h"
11
+ #include "include/core/SkTypes.h"
12
12
 
13
+ #include <memory>
14
+
15
+ class SkCanvas;
13
16
  class SkCanvasState;
14
17
 
15
18
  /**
@@ -10,15 +10,17 @@
10
10
 
11
11
  #include "include/core/SkFontMetrics.h"
12
12
  #include "include/core/SkFontStyle.h"
13
- #include "include/core/SkImage.h"
14
- #include "include/core/SkPaint.h"
15
13
  #include "include/core/SkPath.h"
16
- #include "include/core/SkPicture.h"
17
- #include "include/core/SkTypeface.h"
14
+ #include "include/core/SkRefCnt.h"
15
+ #include "include/core/SkTypes.h"
18
16
 
19
17
  #include <vector>
20
18
 
19
+ class SkImage;
20
+ class SkPaint;
21
+ class SkPicture;
21
22
  class SkStream;
23
+ class SkTypeface;
22
24
 
23
25
  class SkCustomTypefaceBuilder {
24
26
  public:
@@ -9,10 +9,41 @@
9
9
  #ifndef SkNWayCanvas_DEFINED
10
10
  #define SkNWayCanvas_DEFINED
11
11
 
12
+ #include "include/core/SkBlendMode.h"
13
+ #include "include/core/SkCanvas.h"
12
14
  #include "include/core/SkCanvasVirtualEnforcer.h"
15
+ #include "include/core/SkClipOp.h"
16
+ #include "include/core/SkColor.h"
17
+ #include "include/core/SkM44.h"
18
+ #include "include/core/SkRefCnt.h"
19
+ #include "include/core/SkSamplingOptions.h"
20
+ #include "include/core/SkScalar.h"
21
+ #include "include/core/SkTypes.h"
13
22
  #include "include/private/SkTDArray.h"
14
23
  #include "include/utils/SkNoDrawCanvas.h"
15
24
 
25
+ class SkData;
26
+ class SkDrawable;
27
+ class SkGlyphRunList;
28
+ class SkImage;
29
+ class SkMatrix;
30
+ class SkPaint;
31
+ class SkPath;
32
+ class SkPicture;
33
+ class SkRRect;
34
+ class SkRegion;
35
+ class SkShader;
36
+ class SkTextBlob;
37
+ class SkVertices;
38
+ struct SkDrawShadowRec;
39
+ struct SkPoint;
40
+ struct SkRSXform;
41
+ struct SkRect;
42
+
43
+ #if SK_SUPPORT_GPU
44
+ class GrSlug;
45
+ #endif
46
+
16
47
  class SK_API SkNWayCanvas : public SkCanvasVirtualEnforcer<SkNoDrawCanvas> {
17
48
  public:
18
49
  SkNWayCanvas(int width, int height);
@@ -39,6 +70,9 @@ protected:
39
70
  void onDrawGlyphRunList(const SkGlyphRunList&, const SkPaint&) override;
40
71
  void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
41
72
  const SkPaint& paint) override;
73
+ #if SK_SUPPORT_GPU
74
+ void onDrawSlug(const GrSlug* slug) override;
75
+ #endif
42
76
  void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
43
77
  const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint) override;
44
78
 
@@ -8,7 +8,11 @@
8
8
  #ifndef SkNullCanvas_DEFINED
9
9
  #define SkNullCanvas_DEFINED
10
10
 
11
- #include "include/core/SkCanvas.h"
11
+ #include "include/core/SkTypes.h"
12
+
13
+ #include <memory>
14
+
15
+ class SkCanvas;
12
16
 
13
17
  /**
14
18
  * Creates a canvas that draws nothing. This is useful for performance testing.
@@ -9,7 +9,19 @@
9
9
  #define SkOrderedFontMgr_DEFINED
10
10
 
11
11
  #include "include/core/SkFontMgr.h"
12
+ #include "include/core/SkRefCnt.h"
13
+ #include "include/core/SkTypes.h"
14
+
15
+ #include <memory>
12
16
  #include <vector>
17
+
18
+ class SkData;
19
+ class SkFontStyle;
20
+ class SkStreamAsset;
21
+ class SkString;
22
+ class SkTypeface;
23
+ struct SkFontArguments;
24
+
13
25
  /**
14
26
  * Collects an order list of other font managers, and visits them in order
15
27
  * when a request to find or match is issued.
@@ -8,10 +8,39 @@
8
8
  #ifndef SkPaintFilterCanvas_DEFINED
9
9
  #define SkPaintFilterCanvas_DEFINED
10
10
 
11
+ #include "include/core/SkBlendMode.h"
12
+ #include "include/core/SkCanvas.h"
11
13
  #include "include/core/SkCanvasVirtualEnforcer.h"
14
+ #include "include/core/SkColor.h"
15
+ #include "include/core/SkImageInfo.h"
16
+ #include "include/core/SkRefCnt.h"
17
+ #include "include/core/SkSamplingOptions.h"
18
+ #include "include/core/SkScalar.h"
19
+ #include "include/core/SkSize.h"
20
+ #include "include/core/SkTypes.h"
21
+ #include "include/private/SkTDArray.h"
12
22
  #include "include/utils/SkNWayCanvas.h"
13
23
 
14
- class SkAndroidFrameworkUtils;
24
+ class GrRecordingContext;
25
+ class SkData;
26
+ class SkDrawable;
27
+ class SkGlyphRunList;
28
+ class SkImage;
29
+ class SkMatrix;
30
+ class SkPaint;
31
+ class SkPath;
32
+ class SkPicture;
33
+ class SkPixmap;
34
+ class SkRRect;
35
+ class SkRegion;
36
+ class SkSurface;
37
+ class SkSurfaceProps;
38
+ class SkTextBlob;
39
+ class SkVertices;
40
+ struct SkDrawShadowRec;
41
+ struct SkPoint;
42
+ struct SkRSXform;
43
+ struct SkRect;
15
44
 
16
45
  /** \class SkPaintFilterCanvas
17
46
 
@@ -11,6 +11,8 @@
11
11
  #define SkParse_DEFINED
12
12
 
13
13
  #include "include/core/SkColor.h"
14
+ #include "include/core/SkScalar.h"
15
+ #include "include/core/SkTypes.h"
14
16
 
15
17
  class SK_API SkParse {
16
18
  public:
@@ -9,14 +9,15 @@
9
9
  #define SkShadowUtils_DEFINED
10
10
 
11
11
  #include "include/core/SkColor.h"
12
- #include "include/core/SkPoint3.h"
13
12
  #include "include/core/SkScalar.h"
13
+ #include "include/core/SkTypes.h"
14
14
  #include "include/private/SkShadowFlags.h"
15
15
 
16
16
  class SkCanvas;
17
17
  class SkMatrix;
18
18
  class SkPath;
19
- class SkResourceCache;
19
+ struct SkPoint3;
20
+ struct SkRect;
20
21
 
21
22
  class SK_API SkShadowUtils {
22
23
  public:
@@ -8,11 +8,15 @@
8
8
  #ifndef SkTextUtils_DEFINED
9
9
  #define SkTextUtils_DEFINED
10
10
 
11
- #include "include/core/SkCanvas.h"
12
- #include "include/core/SkFont.h"
13
- #include "include/core/SkPaint.h"
14
- #include "include/core/SkString.h"
11
+ #include "include/core/SkFontTypes.h"
12
+ #include "include/core/SkScalar.h"
13
+ #include "include/core/SkTypes.h"
15
14
 
15
+ #include <string.h>
16
+
17
+ class SkCanvas;
18
+ class SkFont;
19
+ class SkPaint;
16
20
  class SkPath;
17
21
 
18
22
  class SK_API SkTextUtils {
@@ -71,6 +71,26 @@ public:
71
71
  }
72
72
 
73
73
  private:
74
+ class RestoreCurPos {
75
+ public:
76
+ explicit RestoreCurPos(SkSVGAttributeParser* self)
77
+ : fSelf(self), fCurPos(self->fCurPos) {}
78
+
79
+ ~RestoreCurPos() {
80
+ if (fSelf) {
81
+ fSelf->fCurPos = this->fCurPos;
82
+ }
83
+ }
84
+
85
+ void clear() { fSelf = nullptr; }
86
+ private:
87
+ SkSVGAttributeParser* fSelf;
88
+ const char* fCurPos;
89
+
90
+ RestoreCurPos( const RestoreCurPos&) = delete;
91
+ RestoreCurPos& operator=(const RestoreCurPos&) = delete;
92
+ };
93
+
74
94
  // Stack-only
75
95
  void* operator new(size_t) = delete;
76
96
  void* operator new(size_t, void*) = delete;
@@ -82,6 +102,7 @@ private:
82
102
  bool advanceWhile(F func);
83
103
 
84
104
  bool matchStringToken(const char* token, const char** newPos = nullptr) const;
105
+ bool matchHexToken(const char** newPos) const;
85
106
 
86
107
  bool parseWSToken();
87
108
  bool parseEOSToken();
@@ -90,12 +111,16 @@ private:
90
111
  bool parseExpectedStringToken(const char*);
91
112
  bool parseScalarToken(SkScalar*);
92
113
  bool parseInt32Token(int32_t*);
93
- bool parseHexToken(uint32_t*);
114
+ bool parseEscape(SkUnichar*);
115
+ bool parseIdentToken(SkString*);
94
116
  bool parseLengthUnitToken(SkSVGLength::Unit*);
95
117
  bool parseNamedColorToken(SkColor*);
96
118
  bool parseHexColorToken(SkColor*);
97
119
  bool parseColorComponentToken(int32_t*);
120
+ bool parseColorToken(SkColor*);
98
121
  bool parseRGBColorToken(SkColor*);
122
+ bool parseSVGColor(SkSVGColor*, SkSVGColor::Vars&&);
123
+ bool parseSVGColorType(SkSVGColorType*);
99
124
  bool parseFuncIRI(SkSVGFuncIRI*);
100
125
 
101
126
  // Transform helpers
@@ -127,6 +152,7 @@ private:
127
152
 
128
153
  // The current position in the input string.
129
154
  const char* fCurPos;
155
+ const char* fEndPos;
130
156
 
131
157
  using INHERITED = SkNoncopyable;
132
158
  };
@@ -19,6 +19,7 @@ class SkCanvas;
19
19
  class SkDOM;
20
20
  class SkStream;
21
21
  class SkSVGNode;
22
+ struct SkSVGPresentationContext;
22
23
  class SkSVGSVG;
23
24
 
24
25
  class SkSVGDOM : public SkRefCnt {
@@ -81,6 +82,9 @@ public:
81
82
 
82
83
  void render(SkCanvas*) const;
83
84
 
85
+ /** Render the node with the given id as if it were the only child of the root. */
86
+ void renderNode(SkCanvas*, SkSVGPresentationContext&, const char* id) const;
87
+
84
88
  private:
85
89
  SkSVGDOM(sk_sp<SkSVGSVG>, sk_sp<SkFontMgr>, sk_sp<skresources::ResourceProvider>,
86
90
  SkSVGIDMapper&&);
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright 2022 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 SkSVGOpenTypeSVGDecoder_DEFINED
9
+ #define SkSVGOpenTypeSVGDecoder_DEFINED
10
+
11
+ #include "include/core/SkColor.h"
12
+ #include "include/core/SkOpenTypeSVGDecoder.h"
13
+ #include "include/core/SkSpan.h"
14
+ #include "include/core/SkTypes.h"
15
+
16
+ class SkCanvas;
17
+ class SkSVGDOM;
18
+
19
+ class SkSVGOpenTypeSVGDecoder : public SkOpenTypeSVGDecoder {
20
+ public:
21
+ static std::unique_ptr<SkOpenTypeSVGDecoder> Make(const uint8_t* svg, size_t svgLength);
22
+ size_t approximateSize() override;
23
+ bool render(SkCanvas&, int upem, SkGlyphID glyphId,
24
+ SkColor foregroundColor, SkSpan<SkColor> palette) override;
25
+ ~SkSVGOpenTypeSVGDecoder() override;
26
+ private:
27
+ SkSVGOpenTypeSVGDecoder(sk_sp<SkSVGDOM> skSvg, size_t approximateSize);
28
+ sk_sp<SkSVGDOM> fSkSvg;
29
+ size_t fApproximateSize;
30
+ };
31
+
32
+ #endif // SkSVGOpenTypeSVGDecoder_DEFINED
@@ -15,6 +15,7 @@
15
15
  #include "include/core/SkRect.h"
16
16
  #include "include/core/SkSize.h"
17
17
  #include "include/core/SkTypes.h"
18
+ #include "include/private/SkTHash.h"
18
19
  #include "modules/skresources/include/SkResources.h"
19
20
  #include "modules/svg/include/SkSVGAttribute.h"
20
21
  #include "modules/svg/include/SkSVGIDMapper.h"
@@ -51,6 +52,8 @@ struct SkSVGPresentationContext {
51
52
  SkSVGPresentationContext(const SkSVGPresentationContext&) = default;
52
53
  SkSVGPresentationContext& operator=(const SkSVGPresentationContext&) = default;
53
54
 
55
+ const SkTHashMap<SkString, SkSVGColorType>* fNamedColors = nullptr;
56
+
54
57
  // Inherited presentation attributes, computed for the current node.
55
58
  SkSVGPresentationAttributes fInherited;
56
59
  };
@@ -97,9 +100,6 @@ public:
97
100
  }
98
101
  }
99
102
 
100
- // Required until C++17 copy elision
101
- BorrowedNode(BorrowedNode&&) = default;
102
-
103
103
  ~BorrowedNode() {
104
104
  if (fOwner) {
105
105
  *fOwner = std::move(fBorrowed);
@@ -32,6 +32,8 @@ public:
32
32
 
33
33
  SkSize intrinsicSize(const SkSVGLengthContext&) const;
34
34
 
35
+ void renderNode(const SkSVGRenderContext&, const SkSVGIRI& iri) const;
36
+
35
37
  protected:
36
38
  bool onPrepareToRender(SkSVGRenderContext*) const override;
37
39
 
@@ -13,7 +13,9 @@
13
13
  #include "include/core/SkPath.h"
14
14
  #include "include/core/SkPoint.h"
15
15
  #include "include/core/SkRect.h"
16
+ #include "include/core/SkRefCnt.h"
16
17
  #include "include/core/SkScalar.h"
18
+ #include "include/core/SkSpan.h"
17
19
  #include "include/core/SkString.h"
18
20
  #include "include/core/SkTypes.h"
19
21
  #include "include/private/SkTDArray.h"
@@ -81,13 +83,25 @@ public:
81
83
  fValue.set(std::move(value));
82
84
  }
83
85
 
84
- T* operator->() const {
86
+ T* operator->() {
85
87
  SkASSERT(fState == SkSVGPropertyState::kValue);
86
88
  SkASSERT(fValue.isValid());
87
89
  return fValue.get();
88
90
  }
89
91
 
90
- T& operator*() const {
92
+ const T* operator->() const {
93
+ SkASSERT(fState == SkSVGPropertyState::kValue);
94
+ SkASSERT(fValue.isValid());
95
+ return fValue.get();
96
+ }
97
+
98
+ T& operator*() {
99
+ SkASSERT(fState == SkSVGPropertyState::kValue);
100
+ SkASSERT(fValue.isValid());
101
+ return *fValue;
102
+ }
103
+
104
+ const T& operator*() const {
91
105
  SkASSERT(fState == SkSVGPropertyState::kValue);
92
106
  SkASSERT(fValue.isValid());
93
107
  return *fValue;
@@ -166,21 +180,44 @@ public:
166
180
  kColor,
167
181
  kICCColor,
168
182
  };
183
+ using Vars = SkSTArray<1, SkString>;
184
+
185
+ SkSVGColor() : SkSVGColor(SK_ColorBLACK) {}
186
+ explicit SkSVGColor(const SkSVGColorType& c) : fType(Type::kColor), fColor(c), fVars(nullptr) {}
187
+ explicit SkSVGColor(Type t, Vars&& vars)
188
+ : fType(t), fColor(SK_ColorBLACK)
189
+ , fVars(vars.empty() ? nullptr : new RefCntVars(std::move(vars))) {}
190
+ explicit SkSVGColor(const SkSVGColorType& c, Vars&& vars)
191
+ : fType(Type::kColor), fColor(c)
192
+ , fVars(vars.empty() ? nullptr : new RefCntVars(std::move(vars))) {}
193
+
194
+ SkSVGColor(const SkSVGColor&) = default;
195
+ SkSVGColor& operator=(const SkSVGColor&) = default;
196
+ SkSVGColor(SkSVGColor&&) = default;
197
+ SkSVGColor& operator=(SkSVGColor&&) = default;
169
198
 
170
- SkSVGColor() : fType(Type::kColor), fColor(SK_ColorBLACK) {}
171
- explicit SkSVGColor(Type t) : fType(t), fColor(SK_ColorBLACK) {}
172
- explicit SkSVGColor(const SkSVGColorType& c) : fType(Type::kColor), fColor(c) {}
173
199
  bool operator==(const SkSVGColor& other) const {
174
- return fType == other.fType && fColor == other.fColor;
200
+ return fType == other.fType && fColor == other.fColor && fVars == other.fVars;
175
201
  }
176
202
  bool operator!=(const SkSVGColor& other) const { return !(*this == other); }
177
203
 
178
204
  Type type() const { return fType; }
179
205
  const SkSVGColorType& color() const { SkASSERT(fType == Type::kColor); return fColor; }
206
+ SkSpan<const SkString> vars() const {
207
+ return fVars ? SkMakeSpan<const Vars>(fVars->fData) : SkSpan<const SkString>{nullptr, 0};
208
+ }
209
+ SkSpan< SkString> vars() {
210
+ return fVars ? SkMakeSpan< Vars>(fVars->fData) : SkSpan< SkString>{nullptr, 0};
211
+ }
180
212
 
181
213
  private:
182
214
  Type fType;
183
215
  SkSVGColorType fColor;
216
+ struct RefCntVars : public SkNVRefCnt<RefCntVars> {
217
+ RefCntVars(Vars&& vars) : fData(std::move(vars)) {}
218
+ Vars fData;
219
+ };
220
+ sk_sp<RefCntVars> fVars;
184
221
  };
185
222
 
186
223
  class SkSVGPaint {
@@ -193,12 +230,14 @@ public:
193
230
 
194
231
  SkSVGPaint() : fType(Type::kNone), fColor(SK_ColorBLACK) {}
195
232
  explicit SkSVGPaint(Type t) : fType(t), fColor(SK_ColorBLACK) {}
196
- explicit SkSVGPaint(const SkSVGColor& c) : fType(Type::kColor), fColor(c) {}
197
- SkSVGPaint(const SkSVGIRI& iri, const SkSVGColor& fallback_color)
198
- : fType(Type::kIRI), fColor(fallback_color), fIRI(iri) {}
233
+ explicit SkSVGPaint(SkSVGColor c) : fType(Type::kColor), fColor(std::move(c)) {}
234
+ SkSVGPaint(const SkSVGIRI& iri, SkSVGColor fallback_color)
235
+ : fType(Type::kIRI), fColor(std::move(fallback_color)), fIRI(iri) {}
199
236
 
200
237
  SkSVGPaint(const SkSVGPaint&) = default;
201
238
  SkSVGPaint& operator=(const SkSVGPaint&) = default;
239
+ SkSVGPaint(SkSVGPaint&&) = default;
240
+ SkSVGPaint& operator=(SkSVGPaint&&) = default;
202
241
 
203
242
  bool operator==(const SkSVGPaint& other) const {
204
243
  return fType == other.fType && fColor == other.fColor && fIRI == other.fIRI;
@@ -1,6 +1,6 @@
1
1
  #pragma once
2
2
 
3
- #import "RCTBridge.h"
3
+ #import <React/RCTBridge.h>
4
4
 
5
5
  #include <functional>
6
6
  #include <memory>
@@ -3,6 +3,7 @@
3
3
  #pragma clang diagnostic push
4
4
  #pragma clang diagnostic ignored "-Wdocumentation"
5
5
 
6
+ #import <SkColorSpace.h>
6
7
  #import <SkSurface.h>
7
8
  #import <SkCanvas.h>
8
9
 
@@ -1,4 +1,4 @@
1
- #import "RCTBridge.h"
1
+ #import <React/RCTBridge.h>
2
2
 
3
3
  #import <SkiaDrawView.h>
4
4
 
@@ -33,7 +33,6 @@ const onDeclare = (0, _Declaration.createDeclaration)((_ref, children) => {
33
33
  let {
34
34
  uniforms,
35
35
  source,
36
- opaque,
37
36
  ...transform
38
37
  } = _ref;
39
38
  const processedUniforms = new Array(source.getUniformCount()).fill(0).flatMap((_, i) => {
@@ -64,7 +63,7 @@ const onDeclare = (0, _Declaration.createDeclaration)((_ref, children) => {
64
63
  console.warn("Unused uniforms were provided: " + unusedUniform.join(", "));
65
64
  }
66
65
 
67
- return source.makeShaderWithChildren(processedUniforms, opaque, children.filter(_skia.isShader), (0, _processors.localMatrix)(transform));
66
+ return source.makeShaderWithChildren(processedUniforms, children.filter(_skia.isShader), (0, _processors.localMatrix)(transform));
68
67
  });
69
68
 
70
69
  const Shader = props => {