@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
@@ -51,11 +51,19 @@ using U8 = V<uint8_t>;
51
51
  // This is more for organizational clarity... skcms.cc doesn't force these.
52
52
  #if N > 1 && defined(__ARM_NEON)
53
53
  #define USING_NEON
54
- #if __ARM_FP & 2
55
- #define USING_NEON_F16C
56
- #endif
57
- #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(SKCMS_OPT_INTO_NEON_FP16)
58
- #define USING_NEON_FP16
54
+
55
+ // We have to use two different mechanisms to enable the f16 conversion intrinsics:
56
+ #if defined(__clang__)
57
+ // Clang's arm_neon.h guards them with the FP hardware bit:
58
+ #if __ARM_FP & 2
59
+ #define USING_NEON_F16C
60
+ #endif
61
+ #elif defined(__GNUC__)
62
+ // GCC's arm_neon.h guards them with the FP16 format macros (IEEE and ALTERNATIVE).
63
+ // We don't actually want the alternative format - we're reading/writing IEEE f16 values.
64
+ #if defined(__ARM_FP16_FORMAT_IEEE)
65
+ #define USING_NEON_F16C
66
+ #endif
59
67
  #endif
60
68
  #endif
61
69
 
@@ -132,12 +140,7 @@ SI D bit_pun(const S& v) {
132
140
  // When we convert from float to fixed point, it's very common to want to round,
133
141
  // and for some reason compilers generate better code when converting to int32_t.
134
142
  // To serve both those ends, we use this function to_fixed() instead of direct cast().
135
- #if defined(USING_NEON_FP16)
136
- // NEON's got a F16 -> U16 instruction, so this should be fine without going via I16.
137
- SI U16 to_fixed(F f) { return cast<U16>(f + 0.5f); }
138
- #else
139
- SI U32 to_fixed(F f) { return (U32)cast<I32>(f + 0.5f); }
140
- #endif
143
+ SI U32 to_fixed(F f) { return (U32)cast<I32>(f + 0.5f); }
141
144
 
142
145
 
143
146
  // Sometimes we do something crazy on one branch of a conditonal,
@@ -158,9 +161,7 @@ SI D bit_pun(const S& v) {
158
161
 
159
162
 
160
163
  SI F F_from_Half(U16 half) {
161
- #if defined(USING_NEON_FP16)
162
- return bit_pun<F>(half);
163
- #elif defined(USING_NEON_F16C)
164
+ #if defined(USING_NEON_F16C)
164
165
  return vcvt_f32_f16((float16x4_t)half);
165
166
  #elif defined(USING_AVX512F)
166
167
  return (F)_mm512_cvtph_ps((__m256i)half);
@@ -187,9 +188,7 @@ SI F F_from_Half(U16 half) {
187
188
  __attribute__((no_sanitize("unsigned-integer-overflow")))
188
189
  #endif
189
190
  SI U16 Half_from_F(F f) {
190
- #if defined(USING_NEON_FP16)
191
- return bit_pun<U16>(f);
192
- #elif defined(USING_NEON_F16C)
191
+ #if defined(USING_NEON_F16C)
193
192
  return (U16)vcvt_f16_f32(f);
194
193
  #elif defined(USING_AVX512F)
195
194
  return (U16)_mm512_cvtps_ph((__m512 )f, _MM_FROUND_CUR_DIRECTION );
@@ -208,11 +207,7 @@ SI U16 Half_from_F(F f) {
208
207
  }
209
208
 
210
209
  // Swap high and low bytes of 16-bit lanes, converting between big-endian and little-endian.
211
- #if defined(USING_NEON_FP16)
212
- SI U16 swap_endian_16(U16 v) {
213
- return (U16)vrev16q_u8((uint8x16_t) v);
214
- }
215
- #elif defined(USING_NEON)
210
+ #if defined(USING_NEON)
216
211
  SI U16 swap_endian_16(U16 v) {
217
212
  return (U16)vrev16_u8((uint8x8_t) v);
218
213
  }
@@ -223,10 +218,7 @@ SI U64 swap_endian_16x4(const U64& rgba) {
223
218
  | (rgba & 0xff00ff00ff00ff00) >> 8;
224
219
  }
225
220
 
226
- #if defined(USING_NEON_FP16)
227
- SI F min_(F x, F y) { return (F)vminq_f16((float16x8_t)x, (float16x8_t)y); }
228
- SI F max_(F x, F y) { return (F)vmaxq_f16((float16x8_t)x, (float16x8_t)y); }
229
- #elif defined(USING_NEON)
221
+ #if defined(USING_NEON)
230
222
  SI F min_(F x, F y) { return (F)vminq_f32((float32x4_t)x, (float32x4_t)y); }
231
223
  SI F max_(F x, F y) { return (F)vmaxq_f32((float32x4_t)x, (float32x4_t)y); }
232
224
  #else
@@ -237,8 +229,6 @@ SI U64 swap_endian_16x4(const U64& rgba) {
237
229
  SI F floor_(F x) {
238
230
  #if N == 1
239
231
  return floorf_(x);
240
- #elif defined(USING_NEON_FP16)
241
- return vrndmq_f16(x);
242
232
  #elif defined(__aarch64__)
243
233
  return vrndmq_f32(x);
244
234
  #elif defined(USING_AVX512F)
@@ -263,10 +253,6 @@ SI F floor_(F x) {
263
253
  }
264
254
 
265
255
  SI F approx_log2(F x) {
266
- #if defined(USING_NEON_FP16)
267
- // TODO(mtklein)
268
- return x;
269
- #else
270
256
  // The first approximation of log2(x) is its exponent 'e', minus 127.
271
257
  I32 bits = bit_pun<I32>(x);
272
258
 
@@ -278,7 +264,6 @@ SI F approx_log2(F x) {
278
264
  return e - 124.225514990f
279
265
  - 1.498030302f*m
280
266
  - 1.725879990f/(0.3520887068f + m);
281
- #endif
282
267
  }
283
268
 
284
269
  SI F approx_log(F x) {
@@ -287,10 +272,6 @@ SI F approx_log(F x) {
287
272
  }
288
273
 
289
274
  SI F approx_exp2(F x) {
290
- #if defined(USING_NEON_FP16)
291
- // TODO(mtklein)
292
- return x;
293
- #else
294
275
  F fract = x - floor_(x);
295
276
 
296
277
  F fbits = (1.0f * (1<<23)) * (x + 121.274057500f
@@ -299,7 +280,6 @@ SI F approx_exp2(F x) {
299
280
  I32 bits = cast<I32>(min_(max_(fbits, F0), FInfBits));
300
281
 
301
282
  return bit_pun<F>(bits);
302
- #endif
303
283
  }
304
284
 
305
285
  SI F approx_pow(F x, float y) {
@@ -314,11 +294,6 @@ SI F approx_exp(F x) {
314
294
 
315
295
  // Return tf(x).
316
296
  SI F apply_tf(const skcms_TransferFunction* tf, F x) {
317
- #if defined(USING_NEON_FP16)
318
- // TODO(mtklein)
319
- (void)tf;
320
- return x;
321
- #else
322
297
  // Peel off the sign bit and set x = |x|.
323
298
  U32 bits = bit_pun<U32>(x),
324
299
  sign = bits & 0x80000000;
@@ -330,15 +305,9 @@ SI F apply_tf(const skcms_TransferFunction* tf, F x) {
330
305
 
331
306
  // Tack the sign bit back on.
332
307
  return bit_pun<F>(sign | bit_pun<U32>(v));
333
- #endif
334
308
  }
335
309
 
336
310
  SI F apply_pq(const skcms_TransferFunction* tf, F x) {
337
- #if defined(USING_NEON_FP16)
338
- // TODO(mtklein)
339
- (void)tf;
340
- return x;
341
- #else
342
311
  U32 bits = bit_pun<U32>(x),
343
312
  sign = bits & 0x80000000;
344
313
  x = bit_pun<F>(bits ^ sign);
@@ -348,15 +317,9 @@ SI F apply_pq(const skcms_TransferFunction* tf, F x) {
348
317
  tf->f);
349
318
 
350
319
  return bit_pun<F>(sign | bit_pun<U32>(v));
351
- #endif
352
320
  }
353
321
 
354
322
  SI F apply_hlg(const skcms_TransferFunction* tf, F x) {
355
- #if defined(USING_NEON_FP16)
356
- // TODO(mtklein)
357
- (void)tf;
358
- return x;
359
- #else
360
323
  const float R = tf->a, G = tf->b,
361
324
  a = tf->c, b = tf->d, c = tf->e,
362
325
  K = tf->f + 1;
@@ -368,15 +331,9 @@ SI F apply_hlg(const skcms_TransferFunction* tf, F x) {
368
331
  , approx_exp((x-c)*a) + b);
369
332
 
370
333
  return K*bit_pun<F>(sign | bit_pun<U32>(v));
371
- #endif
372
334
  }
373
335
 
374
336
  SI F apply_hlginv(const skcms_TransferFunction* tf, F x) {
375
- #if defined(USING_NEON_FP16)
376
- // TODO(mtklein)
377
- (void)tf;
378
- return x;
379
- #else
380
337
  const float R = tf->a, G = tf->b,
381
338
  a = tf->c, b = tf->d, c = tf->e,
382
339
  K = tf->f + 1;
@@ -389,7 +346,6 @@ SI F apply_hlginv(const skcms_TransferFunction* tf, F x) {
389
346
  , a * approx_log(x - b) + c);
390
347
 
391
348
  return bit_pun<F>(sign | bit_pun<U32>(v));
392
- #endif
393
349
  }
394
350
 
395
351
 
@@ -636,11 +592,7 @@ SI U16 U16_from_F(F v) {
636
592
  }
637
593
 
638
594
  SI F minus_1_ulp(F v) {
639
- #if defined(USING_NEON_FP16)
640
- return bit_pun<F>( bit_pun<U16>(v) - 1 );
641
- #else
642
595
  return bit_pun<F>( bit_pun<U32>(v) - 1 );
643
- #endif
644
596
  }
645
597
 
646
598
  SI F table(const skcms_Curve* curve, F v) {
@@ -835,23 +787,7 @@ static void exec_ops(const Op* ops, const void** args,
835
787
 
836
788
  case Op_load_888:{
837
789
  const uint8_t* rgb = (const uint8_t*)(src + 3*i);
838
- #if defined(USING_NEON_FP16)
839
- // See the explanation under USING_NEON below. This is that doubled up.
840
- uint8x16x3_t v = {{ vdupq_n_u8(0), vdupq_n_u8(0), vdupq_n_u8(0) }};
841
- v = vld3q_lane_u8(rgb+ 0, v, 0);
842
- v = vld3q_lane_u8(rgb+ 3, v, 2);
843
- v = vld3q_lane_u8(rgb+ 6, v, 4);
844
- v = vld3q_lane_u8(rgb+ 9, v, 6);
845
-
846
- v = vld3q_lane_u8(rgb+12, v, 8);
847
- v = vld3q_lane_u8(rgb+15, v, 10);
848
- v = vld3q_lane_u8(rgb+18, v, 12);
849
- v = vld3q_lane_u8(rgb+21, v, 14);
850
-
851
- r = cast<F>((U16)v.val[0]) * (1/255.0f);
852
- g = cast<F>((U16)v.val[1]) * (1/255.0f);
853
- b = cast<F>((U16)v.val[2]) * (1/255.0f);
854
- #elif defined(USING_NEON)
790
+ #if defined(USING_NEON)
855
791
  // There's no uint8x4x3_t or vld3 load for it, so we'll load each rgb pixel one at
856
792
  // a time. Since we're doing that, we might as well load them into 16-bit lanes.
857
793
  // (We'd even load into 32-bit lanes, but that's not possible on ARMv7.)
@@ -917,12 +853,7 @@ static void exec_ops(const Op* ops, const void** args,
917
853
  uintptr_t ptr = (uintptr_t)(src + 6*i);
918
854
  assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
919
855
  const uint16_t* rgb = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
920
- #if defined(USING_NEON_FP16)
921
- uint16x8x3_t v = vld3q_u16(rgb);
922
- r = cast<F>((U16)v.val[0]) * (1/65535.0f);
923
- g = cast<F>((U16)v.val[1]) * (1/65535.0f);
924
- b = cast<F>((U16)v.val[2]) * (1/65535.0f);
925
- #elif defined(USING_NEON)
856
+ #if defined(USING_NEON)
926
857
  uint16x4x3_t v = vld3_u16(rgb);
927
858
  r = cast<F>((U16)v.val[0]) * (1/65535.0f);
928
859
  g = cast<F>((U16)v.val[1]) * (1/65535.0f);
@@ -938,13 +869,7 @@ static void exec_ops(const Op* ops, const void** args,
938
869
  uintptr_t ptr = (uintptr_t)(src + 8*i);
939
870
  assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
940
871
  const uint16_t* rgba = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
941
- #if defined(USING_NEON_FP16)
942
- uint16x8x4_t v = vld4q_u16(rgba);
943
- r = cast<F>((U16)v.val[0]) * (1/65535.0f);
944
- g = cast<F>((U16)v.val[1]) * (1/65535.0f);
945
- b = cast<F>((U16)v.val[2]) * (1/65535.0f);
946
- a = cast<F>((U16)v.val[3]) * (1/65535.0f);
947
- #elif defined(USING_NEON)
872
+ #if defined(USING_NEON)
948
873
  uint16x4x4_t v = vld4_u16(rgba);
949
874
  r = cast<F>((U16)v.val[0]) * (1/65535.0f);
950
875
  g = cast<F>((U16)v.val[1]) * (1/65535.0f);
@@ -964,12 +889,7 @@ static void exec_ops(const Op* ops, const void** args,
964
889
  uintptr_t ptr = (uintptr_t)(src + 6*i);
965
890
  assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
966
891
  const uint16_t* rgb = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
967
- #if defined(USING_NEON_FP16)
968
- uint16x8x3_t v = vld3q_u16(rgb);
969
- r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f);
970
- g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f);
971
- b = cast<F>(swap_endian_16((U16)v.val[2])) * (1/65535.0f);
972
- #elif defined(USING_NEON)
892
+ #if defined(USING_NEON)
973
893
  uint16x4x3_t v = vld3_u16(rgb);
974
894
  r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f);
975
895
  g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f);
@@ -989,13 +909,7 @@ static void exec_ops(const Op* ops, const void** args,
989
909
  uintptr_t ptr = (uintptr_t)(src + 8*i);
990
910
  assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
991
911
  const uint16_t* rgba = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
992
- #if defined(USING_NEON_FP16)
993
- uint16x8x4_t v = vld4q_u16(rgba);
994
- r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f);
995
- g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f);
996
- b = cast<F>(swap_endian_16((U16)v.val[2])) * (1/65535.0f);
997
- a = cast<F>(swap_endian_16((U16)v.val[3])) * (1/65535.0f);
998
- #elif defined(USING_NEON)
912
+ #if defined(USING_NEON)
999
913
  uint16x4x4_t v = vld4_u16(rgba);
1000
914
  r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f);
1001
915
  g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f);
@@ -1015,12 +929,7 @@ static void exec_ops(const Op* ops, const void** args,
1015
929
  uintptr_t ptr = (uintptr_t)(src + 6*i);
1016
930
  assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
1017
931
  const uint16_t* rgb = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
1018
- #if defined(USING_NEON_FP16)
1019
- uint16x8x3_t v = vld3q_u16(rgb);
1020
- U16 R = (U16)v.val[0],
1021
- G = (U16)v.val[1],
1022
- B = (U16)v.val[2];
1023
- #elif defined(USING_NEON)
932
+ #if defined(USING_NEON)
1024
933
  uint16x4x3_t v = vld3_u16(rgb);
1025
934
  U16 R = (U16)v.val[0],
1026
935
  G = (U16)v.val[1],
@@ -1039,13 +948,7 @@ static void exec_ops(const Op* ops, const void** args,
1039
948
  uintptr_t ptr = (uintptr_t)(src + 8*i);
1040
949
  assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
1041
950
  const uint16_t* rgba = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
1042
- #if defined(USING_NEON_FP16)
1043
- uint16x8x4_t v = vld4q_u16(rgba);
1044
- U16 R = (U16)v.val[0],
1045
- G = (U16)v.val[1],
1046
- B = (U16)v.val[2],
1047
- A = (U16)v.val[3];
1048
- #elif defined(USING_NEON)
951
+ #if defined(USING_NEON)
1049
952
  uint16x4x4_t v = vld4_u16(rgba);
1050
953
  U16 R = (U16)v.val[0],
1051
954
  G = (U16)v.val[1],
@@ -1068,13 +971,7 @@ static void exec_ops(const Op* ops, const void** args,
1068
971
  uintptr_t ptr = (uintptr_t)(src + 12*i);
1069
972
  assert( (ptr & 3) == 0 ); // src must be 4-byte aligned for this
1070
973
  const float* rgb = (const float*)ptr; // cast to const float* to be safe.
1071
- #if defined(USING_NEON_FP16)
1072
- float32x4x3_t lo = vld3q_f32(rgb + 0),
1073
- hi = vld3q_f32(rgb + 12);
1074
- r = (F)vcombine_f16(vcvt_f16_f32(lo.val[0]), vcvt_f16_f32(hi.val[0]));
1075
- g = (F)vcombine_f16(vcvt_f16_f32(lo.val[1]), vcvt_f16_f32(hi.val[1]));
1076
- b = (F)vcombine_f16(vcvt_f16_f32(lo.val[2]), vcvt_f16_f32(hi.val[2]));
1077
- #elif defined(USING_NEON)
974
+ #if defined(USING_NEON)
1078
975
  float32x4x3_t v = vld3q_f32(rgb);
1079
976
  r = (F)v.val[0];
1080
977
  g = (F)v.val[1];
@@ -1090,14 +987,7 @@ static void exec_ops(const Op* ops, const void** args,
1090
987
  uintptr_t ptr = (uintptr_t)(src + 16*i);
1091
988
  assert( (ptr & 3) == 0 ); // src must be 4-byte aligned for this
1092
989
  const float* rgba = (const float*)ptr; // cast to const float* to be safe.
1093
- #if defined(USING_NEON_FP16)
1094
- float32x4x4_t lo = vld4q_f32(rgba + 0),
1095
- hi = vld4q_f32(rgba + 16);
1096
- r = (F)vcombine_f16(vcvt_f16_f32(lo.val[0]), vcvt_f16_f32(hi.val[0]));
1097
- g = (F)vcombine_f16(vcvt_f16_f32(lo.val[1]), vcvt_f16_f32(hi.val[1]));
1098
- b = (F)vcombine_f16(vcvt_f16_f32(lo.val[2]), vcvt_f16_f32(hi.val[2]));
1099
- a = (F)vcombine_f16(vcvt_f16_f32(lo.val[3]), vcvt_f16_f32(hi.val[3]));
1100
- #elif defined(USING_NEON)
990
+ #if defined(USING_NEON)
1101
991
  float32x4x4_t v = vld4q_f32(rgba);
1102
992
  r = (F)v.val[0];
1103
993
  g = (F)v.val[1];
@@ -1280,23 +1170,7 @@ static void exec_ops(const Op* ops, const void** args,
1280
1170
 
1281
1171
  case Op_store_888: {
1282
1172
  uint8_t* rgb = (uint8_t*)dst + 3*i;
1283
- #if defined(USING_NEON_FP16)
1284
- // See the explanation under USING_NEON below. This is that doubled up.
1285
- U16 R = to_fixed(r * 255),
1286
- G = to_fixed(g * 255),
1287
- B = to_fixed(b * 255);
1288
-
1289
- uint8x16x3_t v = {{ (uint8x16_t)R, (uint8x16_t)G, (uint8x16_t)B }};
1290
- vst3q_lane_u8(rgb+ 0, v, 0);
1291
- vst3q_lane_u8(rgb+ 3, v, 2);
1292
- vst3q_lane_u8(rgb+ 6, v, 4);
1293
- vst3q_lane_u8(rgb+ 9, v, 6);
1294
-
1295
- vst3q_lane_u8(rgb+12, v, 8);
1296
- vst3q_lane_u8(rgb+15, v, 10);
1297
- vst3q_lane_u8(rgb+18, v, 12);
1298
- vst3q_lane_u8(rgb+21, v, 14);
1299
- #elif defined(USING_NEON)
1173
+ #if defined(USING_NEON)
1300
1174
  // Same deal as load_888 but in reverse... we'll store using uint8x8x3_t, but
1301
1175
  // get there via U16 to save some instructions converting to float. And just
1302
1176
  // like load_888, we'd prefer to go via U32 but for ARMv7 support.
@@ -1343,14 +1217,7 @@ static void exec_ops(const Op* ops, const void** args,
1343
1217
  uintptr_t ptr = (uintptr_t)(dst + 6*i);
1344
1218
  assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned
1345
1219
  uint16_t* rgb = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
1346
- #if defined(USING_NEON_FP16)
1347
- uint16x8x3_t v = {{
1348
- (uint16x8_t)U16_from_F(r),
1349
- (uint16x8_t)U16_from_F(g),
1350
- (uint16x8_t)U16_from_F(b),
1351
- }};
1352
- vst3q_u16(rgb, v);
1353
- #elif defined(USING_NEON)
1220
+ #if defined(USING_NEON)
1354
1221
  uint16x4x3_t v = {{
1355
1222
  (uint16x4_t)U16_from_F(r),
1356
1223
  (uint16x4_t)U16_from_F(g),
@@ -1369,15 +1236,7 @@ static void exec_ops(const Op* ops, const void** args,
1369
1236
  uintptr_t ptr = (uintptr_t)(dst + 8*i);
1370
1237
  assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned
1371
1238
  uint16_t* rgba = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
1372
- #if defined(USING_NEON_FP16)
1373
- uint16x8x4_t v = {{
1374
- (uint16x8_t)U16_from_F(r),
1375
- (uint16x8_t)U16_from_F(g),
1376
- (uint16x8_t)U16_from_F(b),
1377
- (uint16x8_t)U16_from_F(a),
1378
- }};
1379
- vst4q_u16(rgba, v);
1380
- #elif defined(USING_NEON)
1239
+ #if defined(USING_NEON)
1381
1240
  uint16x4x4_t v = {{
1382
1241
  (uint16x4_t)U16_from_F(r),
1383
1242
  (uint16x4_t)U16_from_F(g),
@@ -1398,14 +1257,7 @@ static void exec_ops(const Op* ops, const void** args,
1398
1257
  uintptr_t ptr = (uintptr_t)(dst + 6*i);
1399
1258
  assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned
1400
1259
  uint16_t* rgb = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
1401
- #if defined(USING_NEON_FP16)
1402
- uint16x8x3_t v = {{
1403
- (uint16x8_t)swap_endian_16(U16_from_F(r)),
1404
- (uint16x8_t)swap_endian_16(U16_from_F(g)),
1405
- (uint16x8_t)swap_endian_16(U16_from_F(b)),
1406
- }};
1407
- vst3q_u16(rgb, v);
1408
- #elif defined(USING_NEON)
1260
+ #if defined(USING_NEON)
1409
1261
  uint16x4x3_t v = {{
1410
1262
  (uint16x4_t)swap_endian_16(cast<U16>(U16_from_F(r))),
1411
1263
  (uint16x4_t)swap_endian_16(cast<U16>(U16_from_F(g))),
@@ -1427,15 +1279,7 @@ static void exec_ops(const Op* ops, const void** args,
1427
1279
  uintptr_t ptr = (uintptr_t)(dst + 8*i);
1428
1280
  assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned
1429
1281
  uint16_t* rgba = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
1430
- #if defined(USING_NEON_FP16)
1431
- uint16x8x4_t v = {{
1432
- (uint16x8_t)swap_endian_16(U16_from_F(r)),
1433
- (uint16x8_t)swap_endian_16(U16_from_F(g)),
1434
- (uint16x8_t)swap_endian_16(U16_from_F(b)),
1435
- (uint16x8_t)swap_endian_16(U16_from_F(a)),
1436
- }};
1437
- vst4q_u16(rgba, v);
1438
- #elif defined(USING_NEON)
1282
+ #if defined(USING_NEON)
1439
1283
  uint16x4x4_t v = {{
1440
1284
  (uint16x4_t)swap_endian_16(cast<U16>(U16_from_F(r))),
1441
1285
  (uint16x4_t)swap_endian_16(cast<U16>(U16_from_F(g))),
@@ -1460,14 +1304,7 @@ static void exec_ops(const Op* ops, const void** args,
1460
1304
  U16 R = Half_from_F(r),
1461
1305
  G = Half_from_F(g),
1462
1306
  B = Half_from_F(b);
1463
- #if defined(USING_NEON_FP16)
1464
- uint16x8x3_t v = {{
1465
- (uint16x8_t)R,
1466
- (uint16x8_t)G,
1467
- (uint16x8_t)B,
1468
- }};
1469
- vst3q_u16(rgb, v);
1470
- #elif defined(USING_NEON)
1307
+ #if defined(USING_NEON)
1471
1308
  uint16x4x3_t v = {{
1472
1309
  (uint16x4_t)R,
1473
1310
  (uint16x4_t)G,
@@ -1490,15 +1327,7 @@ static void exec_ops(const Op* ops, const void** args,
1490
1327
  G = Half_from_F(g),
1491
1328
  B = Half_from_F(b),
1492
1329
  A = Half_from_F(a);
1493
- #if defined(USING_NEON_FP16)
1494
- uint16x8x4_t v = {{
1495
- (uint16x8_t)R,
1496
- (uint16x8_t)G,
1497
- (uint16x8_t)B,
1498
- (uint16x8_t)A,
1499
- }};
1500
- vst4q_u16(rgba, v);
1501
- #elif defined(USING_NEON)
1330
+ #if defined(USING_NEON)
1502
1331
  uint16x4x4_t v = {{
1503
1332
  (uint16x4_t)R,
1504
1333
  (uint16x4_t)G,
@@ -1519,19 +1348,7 @@ static void exec_ops(const Op* ops, const void** args,
1519
1348
  uintptr_t ptr = (uintptr_t)(dst + 12*i);
1520
1349
  assert( (ptr & 3) == 0 ); // The dst pointer must be 4-byte aligned
1521
1350
  float* rgb = (float*)ptr; // for this cast to float* to be safe.
1522
- #if defined(USING_NEON_FP16)
1523
- float32x4x3_t lo = {{
1524
- vcvt_f32_f16(vget_low_f16(r)),
1525
- vcvt_f32_f16(vget_low_f16(g)),
1526
- vcvt_f32_f16(vget_low_f16(b)),
1527
- }}, hi = {{
1528
- vcvt_f32_f16(vget_high_f16(r)),
1529
- vcvt_f32_f16(vget_high_f16(g)),
1530
- vcvt_f32_f16(vget_high_f16(b)),
1531
- }};
1532
- vst3q_f32(rgb + 0, lo);
1533
- vst3q_f32(rgb + 12, hi);
1534
- #elif defined(USING_NEON)
1351
+ #if defined(USING_NEON)
1535
1352
  float32x4x3_t v = {{
1536
1353
  (float32x4_t)r,
1537
1354
  (float32x4_t)g,
@@ -1549,21 +1366,7 @@ static void exec_ops(const Op* ops, const void** args,
1549
1366
  uintptr_t ptr = (uintptr_t)(dst + 16*i);
1550
1367
  assert( (ptr & 3) == 0 ); // The dst pointer must be 4-byte aligned
1551
1368
  float* rgba = (float*)ptr; // for this cast to float* to be safe.
1552
- #if defined(USING_NEON_FP16)
1553
- float32x4x4_t lo = {{
1554
- vcvt_f32_f16(vget_low_f16(r)),
1555
- vcvt_f32_f16(vget_low_f16(g)),
1556
- vcvt_f32_f16(vget_low_f16(b)),
1557
- vcvt_f32_f16(vget_low_f16(a)),
1558
- }}, hi = {{
1559
- vcvt_f32_f16(vget_high_f16(r)),
1560
- vcvt_f32_f16(vget_high_f16(g)),
1561
- vcvt_f32_f16(vget_high_f16(b)),
1562
- vcvt_f32_f16(vget_high_f16(a)),
1563
- }};
1564
- vst4q_f32(rgba + 0, lo);
1565
- vst4q_f32(rgba + 16, hi);
1566
- #elif defined(USING_NEON)
1369
+ #if defined(USING_NEON)
1567
1370
  float32x4x4_t v = {{
1568
1371
  (float32x4_t)r,
1569
1372
  (float32x4_t)g,
@@ -1621,8 +1424,5 @@ static void run_program(const Op* program, const void** arguments,
1621
1424
  #if defined(USING_NEON_F16C)
1622
1425
  #undef USING_NEON_F16C
1623
1426
  #endif
1624
- #if defined(USING_NEON_FP16)
1625
- #undef USING_NEON_FP16
1626
- #endif
1627
1427
 
1628
1428
  #undef FALLTHROUGH
@@ -6,6 +6,7 @@
6
6
  #include "modules/skparagraph/include/Metrics.h"
7
7
  #include "modules/skparagraph/include/ParagraphStyle.h"
8
8
  #include "modules/skparagraph/include/TextStyle.h"
9
+ #include <unordered_set>
9
10
 
10
11
  class SkCanvas;
11
12
 
@@ -69,6 +70,7 @@ public:
69
70
  // This function will return the number of unresolved glyphs or
70
71
  // -1 if not applicable (has not been shaped yet - valid case)
71
72
  virtual int32_t unresolvedGlyphs() = 0;
73
+ virtual std::unordered_set<SkUnichar> unresolvedCodepoints() = 0;
72
74
 
73
75
  // Experimental API that allows fast way to update some of "immutable" paragraph attributes
74
76
  // but not the text itself
@@ -10,6 +10,7 @@
10
10
  #include "modules/skparagraph/include/Paragraph.h"
11
11
  #include "modules/skparagraph/include/ParagraphStyle.h"
12
12
  #include "modules/skparagraph/include/TextStyle.h"
13
+ #include "modules/skunicode/include/SkUnicode.h"
13
14
 
14
15
  namespace skia {
15
16
  namespace textlayout {
@@ -55,6 +56,21 @@ public:
55
56
  // Constructs a SkParagraph object that can be used to layout and paint the text to a SkCanvas.
56
57
  virtual std::unique_ptr<Paragraph> Build() = 0;
57
58
 
59
+ virtual SkSpan<char> getText() = 0;
60
+ virtual const ParagraphStyle& getParagraphStyle() const = 0;
61
+
62
+ // Mainly, support for "Client" unicode
63
+ virtual void setWordsUtf8(std::vector<SkUnicode::Position> wordsUtf8) = 0;
64
+ virtual void setWordsUtf16(std::vector<SkUnicode::Position> wordsUtf16) = 0;
65
+
66
+ virtual void setGraphemeBreaksUtf8(std::vector<SkUnicode::Position> graphemesUtf8) = 0;
67
+ virtual void setGraphemeBreaksUtf16(std::vector<SkUnicode::Position> graphemesUtf16) = 0;
68
+
69
+ virtual void setLineBreaksUtf8(std::vector<SkUnicode::LineBreakBefore> lineBreaksUtf8) = 0;
70
+ virtual void setLineBreaksUtf16(std::vector<SkUnicode::LineBreakBefore> lineBreaksUtf16) = 0;
71
+
72
+ virtual void SetUnicode(std::unique_ptr<SkUnicode> unicode) = 0;
73
+
58
74
  // Resets this builder to its initial state, discarding any text, styles, placeholders that have
59
75
  // been added, but keeping the initial ParagraphStyle.
60
76
  virtual void Reset() = 0;
@@ -173,10 +173,12 @@ public:
173
173
  ParagraphPainter::SkPaintOrID getForegroundPaintOrID() const {
174
174
  return fForeground;
175
175
  }
176
- void setForegroundColor(SkPaint paint) {
176
+ void setForegroundPaint(SkPaint paint) {
177
177
  fHasForeground = true;
178
178
  fForeground = std::move(paint);
179
179
  }
180
+ // DEPRECATED: prefer `setForegroundPaint`.
181
+ void setForegroundColor(SkPaint paint) { setForegroundPaint(paint); }
180
182
  // Set the foreground to a paint ID. This is intended for use by clients
181
183
  // that implement a custom ParagraphPainter that can not accept an SkPaint.
182
184
  void setForegroundPaintID(ParagraphPainter::PaintID paintID) {
@@ -193,10 +195,12 @@ public:
193
195
  ParagraphPainter::SkPaintOrID getBackgroundPaintOrID() const {
194
196
  return fBackground;
195
197
  }
196
- void setBackgroundColor(SkPaint paint) {
198
+ void setBackgroundPaint(SkPaint paint) {
197
199
  fHasBackground = true;
198
200
  fBackground = std::move(paint);
199
201
  }
202
+ // DEPRECATED: prefer `setBackgroundPaint`.
203
+ void setBackgroundColor(SkPaint paint) { setBackgroundPaint(paint); }
200
204
  void setBackgroundPaintID(ParagraphPainter::PaintID paintID) {
201
205
  fHasBackground = true;
202
206
  fBackground = paintID;
@@ -225,7 +225,7 @@ protected:
225
225
  sk_sp<SkData> loadFont(const char[], const char[]) const override;
226
226
  sk_sp<ExternalTrackAsset> loadAudioAsset(const char[], const char[], const char[]) override;
227
227
 
228
- private:
228
+ protected:
229
229
  const sk_sp<ResourceProvider> fProxy;
230
230
  };
231
231
 
@@ -13,7 +13,7 @@
13
13
 
14
14
  struct SkPoint;
15
15
 
16
- class SkSVGCircle final : public SkSVGShape {
16
+ class SK_API SkSVGCircle final : public SkSVGShape {
17
17
  public:
18
18
  static sk_sp<SkSVGCircle> Make() { return sk_sp<SkSVGCircle>(new SkSVGCircle()); }
19
19
 
@@ -11,7 +11,7 @@
11
11
  #include "modules/svg/include/SkSVGHiddenContainer.h"
12
12
  #include "modules/svg/include/SkSVGTypes.h"
13
13
 
14
- class SkSVGClipPath final : public SkSVGHiddenContainer {
14
+ class SK_API SkSVGClipPath final : public SkSVGHiddenContainer {
15
15
  public:
16
16
  static sk_sp<SkSVGClipPath> Make() {
17
17
  return sk_sp<SkSVGClipPath>(new SkSVGClipPath());
@@ -11,7 +11,7 @@
11
11
  #include "include/private/base/SkTArray.h"
12
12
  #include "modules/svg/include/SkSVGTransformableNode.h"
13
13
 
14
- class SkSVGContainer : public SkSVGTransformableNode {
14
+ class SK_API SkSVGContainer : public SkSVGTransformableNode {
15
15
  public:
16
16
  void appendChild(sk_sp<SkSVGNode>) override;
17
17
 
@@ -22,7 +22,7 @@ class SkSVGNode;
22
22
  struct SkSVGPresentationContext;
23
23
  class SkSVGSVG;
24
24
 
25
- class SkSVGDOM : public SkRefCnt {
25
+ class SK_API SkSVGDOM : public SkRefCnt {
26
26
  public:
27
27
  class Builder final {
28
28
  public:
@@ -10,7 +10,7 @@
10
10
 
11
11
  #include "modules/svg/include/SkSVGHiddenContainer.h"
12
12
 
13
- class SkSVGDefs : public SkSVGHiddenContainer {
13
+ class SK_API SkSVGDefs : public SkSVGHiddenContainer {
14
14
  public:
15
15
  static sk_sp<SkSVGDefs> Make() { return sk_sp<SkSVGDefs>(new SkSVGDefs()); }
16
16
 
@@ -13,7 +13,7 @@
13
13
 
14
14
  struct SkRect;
15
15
 
16
- class SkSVGEllipse final : public SkSVGShape {
16
+ class SK_API SkSVGEllipse final : public SkSVGShape {
17
17
  public:
18
18
  static sk_sp<SkSVGEllipse> Make() { return sk_sp<SkSVGEllipse>(new SkSVGEllipse()); }
19
19
 
@@ -15,7 +15,7 @@
15
15
  class SkImageFilter;
16
16
  class SkSVGFilterContext;
17
17
 
18
- class SkSVGFe : public SkSVGHiddenContainer {
18
+ class SK_API SkSVGFe : public SkSVGHiddenContainer {
19
19
  public:
20
20
  static bool IsFilterEffect(const sk_sp<SkSVGNode>& node) {
21
21
  switch (node->tag()) {