@shopify/react-native-skia 0.1.196 → 0.1.199

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 (221) hide show
  1. package/android/CMakeLists.txt +32 -31
  2. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +4 -2
  3. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -0
  4. package/cpp/api/JsiSkImage.h +1 -1
  5. package/cpp/api/JsiSkShaderFactory.h +4 -4
  6. package/cpp/api/JsiSkSurface.h +0 -1
  7. package/cpp/api/JsiSkSurfaceFactory.h +2 -1
  8. package/cpp/rnskia/RNSkView.h +20 -40
  9. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +2 -2
  10. package/cpp/rnskia/values/RNSkReadonlyValue.h +6 -7
  11. package/cpp/skia/include/android/SkCanvasAndroid.h +20 -0
  12. package/cpp/skia/include/android/SkHeifDecoder.h +43 -0
  13. package/cpp/skia/include/android/SkSurfaceAndroid.h +50 -0
  14. package/cpp/skia/include/codec/SkAvifDecoder.h +43 -0
  15. package/cpp/skia/include/codec/SkBmpDecoder.h +43 -0
  16. package/cpp/skia/include/codec/SkCodec.h +25 -1
  17. package/cpp/skia/include/codec/SkGifDecoder.h +43 -0
  18. package/cpp/skia/include/codec/SkIcoDecoder.h +43 -0
  19. package/cpp/skia/include/codec/SkJpegDecoder.h +43 -0
  20. package/cpp/skia/include/codec/SkJpegxlDecoder.h +43 -0
  21. package/cpp/skia/include/codec/SkPngDecoder.h +43 -0
  22. package/cpp/skia/include/codec/SkRawDecoder.h +49 -0
  23. package/cpp/skia/include/codec/SkWbmpDecoder.h +43 -0
  24. package/cpp/skia/include/codec/SkWebpDecoder.h +43 -0
  25. package/cpp/skia/include/core/SkBBHFactory.h +5 -1
  26. package/cpp/skia/include/core/SkBlender.h +0 -2
  27. package/cpp/skia/include/core/SkCanvas.h +4 -23
  28. package/cpp/skia/include/core/SkColorFilter.h +14 -1
  29. package/cpp/skia/include/core/SkColorTable.h +59 -0
  30. package/cpp/skia/include/core/SkContourMeasure.h +3 -0
  31. package/cpp/skia/include/core/SkDeferredDisplayList.h +8 -104
  32. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +8 -91
  33. package/cpp/skia/include/core/SkDrawable.h +5 -2
  34. package/cpp/skia/include/core/SkGraphics.h +7 -19
  35. package/cpp/skia/include/core/SkImage.h +157 -249
  36. package/cpp/skia/include/core/SkImageGenerator.h +0 -31
  37. package/cpp/skia/include/core/SkMilestone.h +1 -1
  38. package/cpp/skia/include/core/SkPathMeasure.h +3 -3
  39. package/cpp/skia/include/core/SkPictureRecorder.h +1 -1
  40. package/cpp/skia/include/core/SkPoint.h +5 -563
  41. package/cpp/skia/include/core/SkPoint3.h +1 -0
  42. package/cpp/skia/include/core/SkPromiseImageTexture.h +4 -30
  43. package/cpp/skia/include/core/SkRect.h +8 -8
  44. package/cpp/skia/include/core/SkSamplingOptions.h +4 -2
  45. package/cpp/skia/include/core/SkScalar.h +1 -1
  46. package/cpp/skia/include/core/SkSerialProcs.h +5 -1
  47. package/cpp/skia/include/core/SkShader.h +14 -21
  48. package/cpp/skia/include/core/SkString.h +2 -0
  49. package/cpp/skia/include/core/SkSurface.h +169 -701
  50. package/cpp/skia/include/core/SkSurfaceCharacterization.h +8 -256
  51. package/cpp/skia/include/core/SkTiledImageUtils.h +97 -0
  52. package/cpp/skia/include/core/SkTypes.h +4 -2
  53. package/cpp/skia/include/core/SkYUVAPixmaps.h +0 -5
  54. package/cpp/skia/include/effects/SkGradientShader.h +10 -1
  55. package/cpp/skia/include/effects/SkImageFilters.h +62 -37
  56. package/cpp/skia/include/effects/SkPerlinNoiseShader.h +28 -29
  57. package/cpp/skia/include/effects/SkRuntimeEffect.h +17 -12
  58. package/cpp/skia/include/gpu/GrBackendSurface.h +12 -39
  59. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +6 -0
  60. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +3 -3
  61. package/cpp/skia/include/gpu/GrDirectContext.h +103 -3
  62. package/cpp/skia/include/gpu/GrRecordingContext.h +10 -19
  63. package/cpp/skia/include/gpu/MutableTextureState.h +4 -0
  64. package/cpp/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +54 -0
  65. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +20 -76
  66. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +217 -0
  67. package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +73 -0
  68. package/cpp/skia/include/gpu/gl/GrGLTypes.h +13 -2
  69. package/cpp/skia/include/gpu/graphite/BackendSemaphore.h +78 -0
  70. package/cpp/skia/include/gpu/graphite/BackendTexture.h +1 -0
  71. package/cpp/skia/include/gpu/graphite/Image.h +277 -0
  72. package/cpp/skia/include/gpu/graphite/ImageProvider.h +1 -1
  73. package/cpp/skia/include/gpu/graphite/Recording.h +1 -4
  74. package/cpp/skia/include/gpu/graphite/Surface.h +81 -0
  75. package/cpp/skia/include/gpu/graphite/TextureInfo.h +5 -7
  76. package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +2 -2
  77. package/cpp/skia/include/gpu/mock/GrMockTypes.h +23 -8
  78. package/cpp/skia/include/ports/SkTypeface_fontations.h +21 -0
  79. package/cpp/skia/include/private/SkGainmapInfo.h +2 -0
  80. package/cpp/skia/include/private/SkGainmapShader.h +1 -0
  81. package/cpp/skia/include/private/SkJpegMetadataDecoder.h +19 -1
  82. package/cpp/skia/include/private/SkPathRef.h +13 -15
  83. package/cpp/skia/include/private/SkXmp.h +53 -0
  84. package/cpp/skia/include/private/base/SkFeatures.h +0 -4
  85. package/cpp/skia/include/private/base/SkFloatingPoint.h +11 -5
  86. package/cpp/skia/include/private/base/SkPoint_impl.h +569 -0
  87. package/cpp/skia/include/private/base/SkSpan_impl.h +3 -7
  88. package/cpp/skia/include/private/base/SkTArray.h +11 -11
  89. package/cpp/skia/include/private/chromium/GrDeferredDisplayList.h +120 -0
  90. package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +98 -0
  91. package/cpp/skia/include/private/chromium/GrPromiseImageTexture.h +43 -0
  92. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +215 -0
  93. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +6 -6
  94. package/cpp/skia/include/private/chromium/SkImageChromium.h +104 -0
  95. package/cpp/skia/include/private/chromium/Slug.h +7 -3
  96. package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +7 -3
  97. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +2 -0
  98. package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +3 -2
  99. package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +10 -2
  100. package/cpp/skia/include/{gpu → private/gpu}/ganesh/GrTextureGenerator.h +2 -13
  101. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
  102. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +7 -0
  103. package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +19 -6
  104. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +13 -0
  105. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +0 -1
  106. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +14 -1
  107. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +999 -79
  108. package/cpp/skia/modules/skcms/src/Transform_inl.h +36 -236
  109. package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -0
  110. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +16 -0
  111. package/cpp/skia/modules/skparagraph/include/TextStyle.h +6 -2
  112. package/cpp/skia/modules/skresources/include/SkResources.h +1 -1
  113. package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
  114. package/cpp/skia/modules/svg/include/SkSVGClipPath.h +1 -1
  115. package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
  116. package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
  117. package/cpp/skia/modules/svg/include/SkSVGDefs.h +1 -1
  118. package/cpp/skia/modules/svg/include/SkSVGEllipse.h +1 -1
  119. package/cpp/skia/modules/svg/include/SkSVGFe.h +1 -1
  120. package/cpp/skia/modules/svg/include/SkSVGFeBlend.h +1 -1
  121. package/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h +1 -1
  122. package/cpp/skia/modules/svg/include/SkSVGFeComposite.h +1 -1
  123. package/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h +1 -1
  124. package/cpp/skia/modules/svg/include/SkSVGFeFlood.h +1 -1
  125. package/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h +1 -1
  126. package/cpp/skia/modules/svg/include/SkSVGFeImage.h +1 -1
  127. package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
  128. package/cpp/skia/modules/svg/include/SkSVGFeLighting.h +1 -1
  129. package/cpp/skia/modules/svg/include/SkSVGFeOffset.h +1 -1
  130. package/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h +1 -1
  131. package/cpp/skia/modules/svg/include/SkSVGFilter.h +1 -1
  132. package/cpp/skia/modules/svg/include/SkSVGG.h +1 -1
  133. package/cpp/skia/modules/svg/include/SkSVGGradient.h +1 -1
  134. package/cpp/skia/modules/svg/include/SkSVGHiddenContainer.h +1 -1
  135. package/cpp/skia/modules/svg/include/SkSVGImage.h +1 -1
  136. package/cpp/skia/modules/svg/include/SkSVGLine.h +1 -1
  137. package/cpp/skia/modules/svg/include/SkSVGLinearGradient.h +1 -1
  138. package/cpp/skia/modules/svg/include/SkSVGMask.h +1 -1
  139. package/cpp/skia/modules/svg/include/SkSVGNode.h +1 -1
  140. package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
  141. package/cpp/skia/modules/svg/include/SkSVGPattern.h +1 -1
  142. package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
  143. package/cpp/skia/modules/svg/include/SkSVGRadialGradient.h +1 -1
  144. package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
  145. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
  146. package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
  147. package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -1
  148. package/cpp/skia/modules/svg/include/SkSVGStop.h +1 -1
  149. package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
  150. package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +1 -1
  151. package/cpp/skia/modules/svg/include/SkSVGTypes.h +21 -21
  152. package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
  153. package/cpp/skia/modules/svg/include/SkSVGValue.h +2 -2
  154. package/cpp/skia/{include/private → src/core}/SkChecksum.h +32 -17
  155. package/cpp/skia/src/core/SkTHash.h +1 -1
  156. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
  157. package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +3 -1
  158. package/lib/commonjs/renderer/Canvas.js +24 -13
  159. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  160. package/lib/commonjs/skia/core/Data.d.ts +2 -2
  161. package/lib/commonjs/skia/core/Data.js.map +1 -1
  162. package/lib/commonjs/skia/core/RRect.js +5 -1
  163. package/lib/commonjs/skia/core/RRect.js.map +1 -1
  164. package/lib/commonjs/skia/core/Rect.js +32 -6
  165. package/lib/commonjs/skia/core/Rect.js.map +1 -1
  166. package/lib/commonjs/skia/types/Color.js.map +1 -1
  167. package/lib/commonjs/skia/types/JsiInstance.d.ts +2 -4
  168. package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
  169. package/lib/module/renderer/Canvas.js +25 -14
  170. package/lib/module/renderer/Canvas.js.map +1 -1
  171. package/lib/module/skia/core/Data.d.ts +2 -2
  172. package/lib/module/skia/core/Data.js.map +1 -1
  173. package/lib/module/skia/core/RRect.js +5 -1
  174. package/lib/module/skia/core/RRect.js.map +1 -1
  175. package/lib/module/skia/core/Rect.js +32 -6
  176. package/lib/module/skia/core/Rect.js.map +1 -1
  177. package/lib/module/skia/types/Color.js.map +1 -1
  178. package/lib/module/skia/types/JsiInstance.d.ts +2 -4
  179. package/lib/module/skia/types/JsiInstance.js.map +1 -1
  180. package/lib/typescript/src/skia/core/Data.d.ts +2 -2
  181. package/lib/typescript/src/skia/types/JsiInstance.d.ts +2 -4
  182. package/libs/android/arm64-v8a/libskia.a +0 -0
  183. package/libs/android/arm64-v8a/libskottie.a +0 -0
  184. package/libs/android/arm64-v8a/libsksg.a +0 -0
  185. package/libs/android/arm64-v8a/libsvg.a +0 -0
  186. package/libs/android/armeabi-v7a/libskia.a +0 -0
  187. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  188. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  189. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  190. package/libs/android/x86/libskia.a +0 -0
  191. package/libs/android/x86/libskottie.a +0 -0
  192. package/libs/android/x86/libsksg.a +0 -0
  193. package/libs/android/x86/libsvg.a +0 -0
  194. package/libs/android/x86_64/libskia.a +0 -0
  195. package/libs/android/x86_64/libskottie.a +0 -0
  196. package/libs/android/x86_64/libsksg.a +0 -0
  197. package/libs/android/x86_64/libsvg.a +0 -0
  198. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  199. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  200. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  201. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  202. package/libs/ios/libsksg.xcframework/Info.plist +5 -5
  203. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  204. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  205. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  206. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  207. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  208. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  209. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  210. package/package.json +3 -4
  211. package/src/renderer/Canvas.tsx +25 -19
  212. package/src/skia/core/Data.ts +3 -3
  213. package/src/skia/core/RRect.tsx +4 -2
  214. package/src/skia/core/Rect.ts +29 -12
  215. package/src/skia/types/Color.ts +1 -1
  216. package/src/skia/types/JsiInstance.ts +2 -5
  217. package/cpp/skia/include/effects/SkTableColorFilter.h +0 -29
  218. package/cpp/skia/include/private/SkOpts_spi.h +0 -23
  219. package/cpp/skia/include/private/SkSpinlock.h +0 -57
  220. package/cpp/skia/include/private/chromium/GrSlug.h +0 -16
  221. package/scripts/install-npm.js +0 -33
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright 2023 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
+ #ifndef SkJpegDecoder_DEFINED
8
+ #define SkJpegDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkJpegDecoder {
19
+
20
+ /** Returns true if this data claims to be a JPEG image. */
21
+ SK_API bool IsJpeg(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a JPEG.
25
+ *
26
+ * If the bytes are not a JPEG, returns nullptr.
27
+ *
28
+ * DecodeContext is ignored
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "jpeg", IsJpeg, Decode };
39
+ }
40
+
41
+ } // namespace SkJpegDecoder
42
+
43
+ #endif // SkJpegDecoder_DEFINED
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright 2023 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
+ #ifndef SkJpegxlDecoder_DEFINED
8
+ #define SkJpegxlDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkJpegxlDecoder {
19
+
20
+ /** Returns true if this data claims to be a JPEGXL image. */
21
+ SK_API bool IsJpegxl(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a JPEGXL.
25
+ *
26
+ * If the bytes are not a JPEGXL, returns nullptr.
27
+ *
28
+ * DecodeContext is ignored
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "jpegxl", IsJpegxl, Decode };
39
+ }
40
+
41
+ } // namespace SkJpegxlDecoder
42
+
43
+ #endif // SkJpegxlDecoder_DEFINED
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright 2023 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
+ #ifndef SkPngDecoder_DEFINED
8
+ #define SkPngDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkPngDecoder {
19
+
20
+ /** Returns true if this data claims to be a PNG image. */
21
+ SK_API bool IsPng(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a PNG.
25
+ *
26
+ * If the bytes are not a PNG, returns nullptr.
27
+ *
28
+ * DecodeContext, if non-null, is expected to be a SkPngChunkReader*
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "png", IsPng, Decode };
39
+ }
40
+
41
+ } // namespace SkPngDecoder
42
+
43
+ #endif // SkPngDecoder_DEFINED
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Copyright 2023 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
+ #ifndef SkRawDecoder_DEFINED
8
+ #define SkRawDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkRawDecoder {
19
+
20
+ inline bool IsRaw(const void*, size_t) {
21
+ // Raw formats are tricky to detect just by reading in the first several bytes.
22
+ // For example, PIEX might need to read 10k bytes to detect Sony's arw format
23
+ // https://github.com/google/piex/blob/f1e15dd837c04347504149f71db67a78fbeddc73/src/image_type_recognition/image_type_recognition_lite.cc#L152
24
+ // Thus, we just assume everything might be a RAW file and check it last.
25
+ return true;
26
+ }
27
+
28
+ /**
29
+ * Attempts to decode the given bytes as a raw image.
30
+ *
31
+ * If the bytes are not a raw, returns nullptr.
32
+ *
33
+ * DecodeContext is ignored
34
+ */
35
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
36
+ SkCodec::Result*,
37
+ SkCodecs::DecodeContext = nullptr);
38
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
39
+ SkCodec::Result*,
40
+ SkCodecs::DecodeContext = nullptr);
41
+
42
+ // This decoder will always be checked last, no matter when it is registered.
43
+ inline SkCodecs::Decoder Decoder() {
44
+ return { "raw", IsRaw, Decode };
45
+ }
46
+
47
+ } // namespace SkRawDecoder
48
+
49
+ #endif // SkRawDecoder_DEFINED
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright 2023 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
+ #ifndef SkWbmpDecoder_DEFINED
8
+ #define SkWbmpDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkWbmpDecoder {
19
+
20
+ /** Returns true if this data claims to be a WBMP image. */
21
+ SK_API bool IsWbmp(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a WBMP.
25
+ *
26
+ * If the bytes are not a WBMP, returns nullptr.
27
+ *
28
+ * DecodeContext is ignored
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "wbmp", IsWbmp, Decode };
39
+ }
40
+
41
+ } // namespace SkWbmpDecoder
42
+
43
+ #endif // SkWbmpDecoder_DEFINED
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright 2023 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
+ #ifndef SkWebpDecoder_DEFINED
8
+ #define SkWebpDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkWebpDecoder {
19
+
20
+ /** Returns true if this data claims to be a WEBP image. */
21
+ SK_API bool IsWebp(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a WEBP.
25
+ *
26
+ * If the bytes are not a WEBP, returns nullptr.
27
+ *
28
+ * DecodeContext is ignored
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "webp", IsWebp, Decode };
39
+ }
40
+
41
+ } // namespace SkWebpDecoder
42
+
43
+ #endif // SkWebpDecoder_DEFINED
@@ -8,9 +8,13 @@
8
8
  #ifndef SkBBHFactory_DEFINED
9
9
  #define SkBBHFactory_DEFINED
10
10
 
11
- #include "include/core/SkRect.h"
12
11
  #include "include/core/SkRefCnt.h"
13
12
  #include "include/core/SkTypes.h"
13
+
14
+ // TODO(kjlubick) fix client users and then make this a forward declare
15
+ #include "include/core/SkRect.h" // IWYU pragma: keep
16
+
17
+ #include <cstddef>
14
18
  #include <vector>
15
19
 
16
20
  class SkBBoxHierarchy : public SkRefCnt {
@@ -26,8 +26,6 @@ public:
26
26
  private:
27
27
  SkBlender() = default;
28
28
  friend class SkBlenderBase;
29
-
30
- using INHERITED = SkFlattenable;
31
29
  };
32
30
 
33
31
  #endif
@@ -74,15 +74,6 @@ namespace skgpu::graphite { class Recorder; }
74
74
  namespace sktext::gpu { class Slug; }
75
75
  namespace SkRecords { class Draw; }
76
76
 
77
- #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && defined(SK_GANESH)
78
- class GrBackendRenderTarget;
79
- #endif
80
-
81
- // TODO:
82
- // This is not ideal but Chrome is depending on a forward decl of GrSlug here.
83
- // It should be removed once Chrome has migrated to sktext::gpu::Slug.
84
- using GrSlug = sktext::gpu::Slug;
85
-
86
77
  /** \class SkCanvas
87
78
  SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
88
79
  SkCanvas contains a stack of SkMatrix and clip values.
@@ -2183,12 +2174,6 @@ public:
2183
2174
 
2184
2175
  ///////////////////////////////////////////////////////////////////////////
2185
2176
 
2186
- #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && defined(SK_GANESH)
2187
- // These methods exist to support WebView in Android Framework.
2188
- SkIRect topLayerBounds() const;
2189
- GrBackendRenderTarget topLayerBackendRenderTarget() const;
2190
- #endif
2191
-
2192
2177
  /**
2193
2178
  * Returns the global clip as a region. If the clip contains AA, then only the bounds
2194
2179
  * of the clip may be returned.
@@ -2300,16 +2285,14 @@ protected:
2300
2285
 
2301
2286
  virtual void onDiscard();
2302
2287
 
2303
- #if (defined(SK_GANESH) || defined(SK_GRAPHITE))
2304
- /** Experimental
2288
+ /**
2305
2289
  */
2306
2290
  virtual sk_sp<sktext::gpu::Slug> onConvertGlyphRunListToSlug(
2307
2291
  const sktext::GlyphRunList& glyphRunList, const SkPaint& paint);
2308
2292
 
2309
- /** Experimental
2293
+ /**
2310
2294
  */
2311
2295
  virtual void onDrawSlug(const sktext::gpu::Slug* slug);
2312
- #endif
2313
2296
 
2314
2297
  private:
2315
2298
 
@@ -2457,19 +2440,17 @@ private:
2457
2440
  SkCanvas& operator=(SkCanvas&&) = delete;
2458
2441
  SkCanvas& operator=(const SkCanvas&) = delete;
2459
2442
 
2460
- #if (defined(SK_GANESH) || defined(SK_GRAPHITE))
2461
2443
  friend class sktext::gpu::Slug;
2462
- /** Experimental
2444
+ /**
2463
2445
  * Convert a SkTextBlob to a sktext::gpu::Slug using the current canvas state.
2464
2446
  */
2465
2447
  sk_sp<sktext::gpu::Slug> convertBlobToSlug(const SkTextBlob& blob, SkPoint origin,
2466
2448
  const SkPaint& paint);
2467
2449
 
2468
- /** Experimental
2450
+ /**
2469
2451
  * Draw an sktext::gpu::Slug given the current canvas state.
2470
2452
  */
2471
2453
  void drawSlug(const sktext::gpu::Slug* slug);
2472
- #endif
2473
2454
 
2474
2455
  /** Experimental
2475
2456
  * Saves the specified subset of the current pixels in the current layer,
@@ -8,12 +8,20 @@
8
8
  #ifndef SkColorFilter_DEFINED
9
9
  #define SkColorFilter_DEFINED
10
10
 
11
- #include "include/core/SkBlendMode.h"
12
11
  #include "include/core/SkColor.h"
13
12
  #include "include/core/SkFlattenable.h"
13
+ #include "include/core/SkRefCnt.h"
14
+ #include "include/private/base/SkAPI.h"
15
+
16
+ #include <cstddef>
17
+ #include <cstdint>
14
18
 
15
19
  class SkColorMatrix;
16
20
  class SkColorSpace;
21
+ class SkColorTable;
22
+
23
+ enum class SkBlendMode;
24
+ struct SkDeserialProcs;
17
25
 
18
26
  /**
19
27
  * ColorFilters are optional objects in the drawing pipeline. When present in
@@ -113,6 +121,11 @@ public:
113
121
  const uint8_t tableG[256],
114
122
  const uint8_t tableB[256]);
115
123
 
124
+ /**
125
+ * Create a table colorfilter that holds a ref to the shared color table.
126
+ */
127
+ static sk_sp<SkColorFilter> Table(sk_sp<SkColorTable> table);
128
+
116
129
  /**
117
130
  * Create a colorfilter that multiplies the RGB channels by one color, and
118
131
  * then adds a second color, pinning the result for each component to
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Copyright 2023 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 SkColorTable_DEFINED
9
+ #define SkColorTable_DEFINED
10
+
11
+ #include "include/core/SkBitmap.h"
12
+ #include "include/core/SkRefCnt.h"
13
+
14
+ class SkReadBuffer;
15
+ class SkWriteBuffer;
16
+
17
+ /**
18
+ * SkColorTable holds the lookup tables for each channel (ARGB) used to define the filter behavior
19
+ * of `SkColorFilters::Table`, and provides a way to share the table data between client code and
20
+ * the returned SkColorFilter. Once created, an SkColorTable is immutable.
21
+ */
22
+ class SkColorTable : public SkRefCnt {
23
+ public:
24
+ // Creates a new SkColorTable with 'table' used for all four channels. The table is copied into
25
+ // the SkColorTable.
26
+ static sk_sp<SkColorTable> Make(const uint8_t table[256]) {
27
+ return Make(table, table, table, table);
28
+ }
29
+
30
+ // Creates a new SkColorTable with the per-channel lookup tables. Each non-null table is copied
31
+ // into the SkColorTable. Null parameters are interpreted as the identity table.
32
+ static sk_sp<SkColorTable> Make(const uint8_t tableA[256],
33
+ const uint8_t tableR[256],
34
+ const uint8_t tableG[256],
35
+ const uint8_t tableB[256]);
36
+
37
+ // Per-channel constant value lookup (0-255).
38
+ const uint8_t* alphaTable() const { return fTable.getAddr8(0, 0); }
39
+ const uint8_t* redTable() const { return fTable.getAddr8(0, 1); }
40
+ const uint8_t* greenTable() const { return fTable.getAddr8(0, 2); }
41
+ const uint8_t* blueTable() const { return fTable.getAddr8(0, 3); }
42
+
43
+ void flatten(SkWriteBuffer& buffer) const;
44
+
45
+ static sk_sp<SkColorTable> Deserialize(SkReadBuffer& buffer);
46
+
47
+ private:
48
+ friend class SkTableColorFilter; // for bitmap()
49
+
50
+ SkColorTable(const SkBitmap& table) : fTable(table) {}
51
+
52
+ // The returned SkBitmap is immutable; attempting to modify its pixel data will trigger asserts
53
+ // in debug builds and cause undefined behavior in release builds.
54
+ const SkBitmap& bitmap() const { return fTable; }
55
+
56
+ SkBitmap fTable; // A 256x4 A8 image
57
+ };
58
+
59
+ #endif // SkColorTable_DEFINED
@@ -102,6 +102,9 @@ public:
102
102
  SkContourMeasureIter(const SkPath& path, bool forceClosed, SkScalar resScale = 1);
103
103
  ~SkContourMeasureIter();
104
104
 
105
+ SkContourMeasureIter(SkContourMeasureIter&&);
106
+ SkContourMeasureIter& operator=(SkContourMeasureIter&&);
107
+
105
108
  /**
106
109
  * Reset the Iter with a path.
107
110
  * The parts of the path that are needed are copied, so the client is free to modify/delete
@@ -5,107 +5,11 @@
5
5
  * found in the LICENSE file.
6
6
  */
7
7
 
8
- #ifndef SkDeferredDisplayList_DEFINED
9
- #define SkDeferredDisplayList_DEFINED
10
-
11
- #include "include/core/SkRefCnt.h"
12
- #include "include/core/SkSurfaceCharacterization.h"
13
- #include "include/core/SkTypes.h"
14
-
15
- class SkDeferredDisplayListPriv;
16
- class SkPromiseImageTexture;
17
-
18
- #if defined(SK_GANESH)
19
- #include "include/gpu/GrRecordingContext.h"
20
- #include "include/private/base/SkTArray.h"
21
- #include <map>
22
- class GrRenderTask;
23
- class GrRenderTargetProxy;
24
- #else
25
- using GrRenderTargetProxy = SkRefCnt;
26
- #endif
27
-
28
- /*
29
- * This class contains pre-processed gpu operations that can be replayed into
30
- * an SkSurface via SkSurface::draw(SkDeferredDisplayList*).
31
- */
32
- class SkDeferredDisplayList : public SkNVRefCnt<SkDeferredDisplayList> {
33
- public:
34
- SK_API ~SkDeferredDisplayList();
35
-
36
- SK_API const SkSurfaceCharacterization& characterization() const {
37
- return fCharacterization;
38
- }
39
-
40
- #if defined(SK_GANESH)
41
- /**
42
- * Iterate through the programs required by the DDL.
43
- */
44
- class SK_API ProgramIterator {
45
- public:
46
- ProgramIterator(GrDirectContext*, SkDeferredDisplayList*);
47
- ~ProgramIterator();
48
-
49
- // This returns true if any work was done. Getting a cache hit does not count as work.
50
- bool compile();
51
- bool done() const;
52
- void next();
53
-
54
- private:
55
- GrDirectContext* fDContext;
56
- const skia_private::TArray<GrRecordingContext::ProgramData>& fProgramData;
57
- int fIndex;
58
- };
59
- #endif
60
-
61
- // Provides access to functions that aren't part of the public API.
62
- SkDeferredDisplayListPriv priv();
63
- const SkDeferredDisplayListPriv priv() const; // NOLINT(readability-const-return-type)
64
-
65
- private:
66
- friend class GrDrawingManager; // for access to 'fRenderTasks', 'fLazyProxyData', 'fArenas'
67
- friend class SkDeferredDisplayListRecorder; // for access to 'fLazyProxyData'
68
- friend class SkDeferredDisplayListPriv;
69
-
70
- // This object is the source from which the lazy proxy backing the DDL will pull its backing
71
- // texture when the DDL is replayed. It has to be separately ref counted bc the lazy proxy
72
- // can outlive the DDL.
73
- class LazyProxyData : public SkRefCnt {
74
- #if defined(SK_GANESH)
75
- public:
76
- // Upon being replayed - this field will be filled in (by the DrawingManager) with the
77
- // proxy backing the destination SkSurface. Note that, since there is no good place to
78
- // clear it, it can become a dangling pointer. Additionally, since the renderTargetProxy
79
- // doesn't get a ref here, the SkSurface that owns it must remain alive until the DDL
80
- // is flushed.
81
- // TODO: the drawing manager could ref the renderTargetProxy for the DDL and then add
82
- // a renderingTask to unref it after the DDL's ops have been executed.
83
- GrRenderTargetProxy* fReplayDest = nullptr;
84
- #endif
85
- };
86
-
87
- SK_API SkDeferredDisplayList(const SkSurfaceCharacterization& characterization,
88
- sk_sp<GrRenderTargetProxy> fTargetProxy,
89
- sk_sp<LazyProxyData>);
90
-
91
- #if defined(SK_GANESH)
92
- const skia_private::TArray<GrRecordingContext::ProgramData>& programData() const {
93
- return fProgramData;
94
- }
95
- #endif
96
-
97
- const SkSurfaceCharacterization fCharacterization;
98
-
99
- #if defined(SK_GANESH)
100
- // These are ordered such that the destructor cleans op tasks up first (which may refer back
101
- // to the arena and memory pool in their destructors).
102
- GrRecordingContext::OwnedArenas fArenas;
103
- skia_private::TArray<sk_sp<GrRenderTask>> fRenderTasks;
104
-
105
- skia_private::TArray<GrRecordingContext::ProgramData> fProgramData;
106
- sk_sp<GrRenderTargetProxy> fTargetProxy;
107
- sk_sp<LazyProxyData> fLazyProxyData;
108
- #endif
109
- };
110
-
111
- #endif
8
+ // TODO(kjlubick, robertphillips) migrate Chromium to use the new location and name
9
+ #include "include/private/chromium/GrDeferredDisplayList.h" // IWYU pragma: export
10
+
11
+ class GrDeferredDisplayListRecorder;
12
+ class GrSurfaceCharacterization;
13
+ using SkDeferredDisplayList = GrDeferredDisplayList;
14
+ using SkDeferredDisplayListRecorder = GrDeferredDisplayListRecorder;
15
+ using SkSurfaceCharacterization = GrSurfaceCharacterization;