@shopify/react-native-skia 1.11.9-next.1 → 2.0.0-next.1

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 (243) hide show
  1. package/android/CMakeLists.txt +153 -30
  2. package/cpp/skia/include/codec/SkCodec.h +2 -7
  3. package/cpp/skia/include/config/SkUserConfig.h +0 -11
  4. package/cpp/skia/include/core/SkCanvas.h +7 -11
  5. package/cpp/skia/include/core/SkColor.h +0 -10
  6. package/cpp/skia/include/core/SkColorSpace.h +2 -184
  7. package/cpp/skia/include/core/SkColorType.h +32 -114
  8. package/cpp/skia/include/core/SkFontScanner.h +8 -5
  9. package/cpp/skia/include/core/SkFontStyle.h +1 -1
  10. package/cpp/skia/include/core/SkMaskFilter.h +8 -0
  11. package/cpp/skia/include/core/SkMilestone.h +1 -1
  12. package/cpp/skia/include/core/SkPath.h +1 -1
  13. package/cpp/skia/include/core/SkRRect.h +1 -3
  14. package/cpp/skia/include/core/SkShader.h +3 -3
  15. package/cpp/skia/include/core/SkString.h +8 -8
  16. package/cpp/skia/include/core/SkSurface.h +0 -14
  17. package/cpp/skia/include/core/SkTypeface.h +7 -24
  18. package/cpp/skia/include/effects/SkGradientShader.h +1 -6
  19. package/cpp/skia/include/effects/SkRuntimeEffect.h +0 -1
  20. package/cpp/skia/include/encode/SkPngEncoder.h +0 -14
  21. package/cpp/skia/include/gpu/GpuTypes.h +0 -9
  22. package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +133 -135
  23. package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +0 -5
  24. package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +3 -3
  25. package/cpp/skia/include/gpu/ganesh/GrTypes.h +9 -14
  26. package/cpp/skia/include/gpu/graphite/Context.h +2 -25
  27. package/cpp/skia/include/gpu/graphite/ContextOptions.h +5 -23
  28. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +1 -20
  29. package/cpp/skia/include/gpu/graphite/Image.h +0 -1
  30. package/cpp/skia/include/gpu/graphite/Recorder.h +0 -6
  31. package/cpp/skia/include/gpu/graphite/Recording.h +1 -3
  32. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +36 -4
  33. package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +2 -3
  34. package/cpp/skia/include/pathops/SkPathOps.h +1 -9
  35. package/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h +0 -3
  36. package/cpp/skia/include/private/SkPathRef.h +21 -15
  37. package/cpp/skia/include/private/base/SkAttributes.h +10 -16
  38. package/cpp/skia/include/private/base/SkMutex.h +0 -8
  39. package/cpp/skia/include/private/base/SkTArray.h +1 -1
  40. package/cpp/skia/include/private/base/SkTDArray.h +1 -1
  41. package/cpp/skia/include/private/base/SkTemplates.h +11 -24
  42. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
  43. package/cpp/skia/include/sksl/SkSLDebugTrace.h +3 -0
  44. package/cpp/skia/modules/skcms/src/Transform_inl.h +20 -20
  45. package/cpp/skia/modules/skcms/src/skcms_Transform.h +3 -4
  46. package/cpp/skia/modules/skcms/src/skcms_public.h +15 -19
  47. package/cpp/skia/modules/skresources/include/SkResources.h +1 -3
  48. package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
  49. package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
  50. package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
  51. package/cpp/skia/modules/svg/include/SkSVGImage.h +2 -2
  52. package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
  53. package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
  54. package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
  55. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +0 -2
  56. package/cpp/skia/modules/svg/include/SkSVGShape.h +0 -1
  57. package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
  58. package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +0 -4
  59. package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
  60. package/cpp/skia/src/core/SkLRUCache.h +13 -19
  61. package/cpp/skia/src/core/SkTHash.h +4 -50
  62. package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +0 -1
  63. package/lib/commonjs/Platform/Platform.web.js +1 -0
  64. package/lib/commonjs/Platform/Platform.web.js.map +1 -1
  65. package/lib/commonjs/renderer/Canvas.d.ts +1 -1
  66. package/lib/commonjs/renderer/Canvas.js +2 -4
  67. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  68. package/lib/commonjs/renderer/__tests__/setup.d.ts +1 -0
  69. package/lib/commonjs/sksg/Elements.d.ts +1 -1
  70. package/lib/commonjs/sksg/Elements.js.map +1 -1
  71. package/lib/commonjs/sksg/HostConfig.d.ts +1 -1
  72. package/lib/commonjs/sksg/Reconciler.js +0 -1
  73. package/lib/commonjs/sksg/Reconciler.js.map +1 -1
  74. package/lib/module/Platform/Platform.web.js +2 -1
  75. package/lib/module/Platform/Platform.web.js.map +1 -1
  76. package/lib/module/dom/nodes/datatypes/Circle.js +2 -1
  77. package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -1
  78. package/lib/module/dom/nodes/datatypes/Gradient.js +3 -3
  79. package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
  80. package/lib/module/dom/nodes/datatypes/Rect.js +5 -3
  81. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  82. package/lib/module/external/reanimated/buffers.js +2 -1
  83. package/lib/module/external/reanimated/buffers.js.map +1 -1
  84. package/lib/module/external/reanimated/useAnimatedImageValue.js +1 -1
  85. package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
  86. package/lib/module/external/reanimated/useVideo.js +23 -10
  87. package/lib/module/external/reanimated/useVideo.js.map +1 -1
  88. package/lib/module/renderer/Canvas.d.ts +1 -1
  89. package/lib/module/renderer/Canvas.js +3 -5
  90. package/lib/module/renderer/Canvas.js.map +1 -1
  91. package/lib/module/renderer/__tests__/setup.d.ts +1 -0
  92. package/lib/module/skia/core/Vector.js +1 -1
  93. package/lib/module/skia/core/Vector.js.map +1 -1
  94. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js +4 -1
  95. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js.map +1 -1
  96. package/lib/module/skia/web/Host.js +7 -1
  97. package/lib/module/skia/web/Host.js.map +1 -1
  98. package/lib/module/skia/web/JsiSkAnimatedImage.js +6 -3
  99. package/lib/module/skia/web/JsiSkAnimatedImage.js.map +1 -1
  100. package/lib/module/skia/web/JsiSkCanvas.js +6 -3
  101. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  102. package/lib/module/skia/web/JsiSkColorFilter.js +6 -3
  103. package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
  104. package/lib/module/skia/web/JsiSkContourMeasure.js +6 -3
  105. package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
  106. package/lib/module/skia/web/JsiSkContourMeasureIter.js +6 -3
  107. package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
  108. package/lib/module/skia/web/JsiSkData.js +6 -3
  109. package/lib/module/skia/web/JsiSkData.js.map +1 -1
  110. package/lib/module/skia/web/JsiSkFont.js +6 -3
  111. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  112. package/lib/module/skia/web/JsiSkImage.js +12 -8
  113. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  114. package/lib/module/skia/web/JsiSkImageFilter.js +6 -3
  115. package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
  116. package/lib/module/skia/web/JsiSkMaskFilter.js +6 -3
  117. package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
  118. package/lib/module/skia/web/JsiSkMatrix.js +8 -5
  119. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  120. package/lib/module/skia/web/JsiSkPaint.js +6 -3
  121. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  122. package/lib/module/skia/web/JsiSkParagraphBuilder.js +3 -2
  123. package/lib/module/skia/web/JsiSkParagraphBuilder.js.map +1 -1
  124. package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js +1 -1
  125. package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js.map +1 -1
  126. package/lib/module/skia/web/JsiSkParagraphStyle.js +15 -15
  127. package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
  128. package/lib/module/skia/web/JsiSkPath.js +6 -3
  129. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  130. package/lib/module/skia/web/JsiSkPathEffect.js +6 -3
  131. package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
  132. package/lib/module/skia/web/JsiSkPicture.js +6 -3
  133. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  134. package/lib/module/skia/web/JsiSkPictureRecorder.js +6 -3
  135. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  136. package/lib/module/skia/web/JsiSkPoint.js +6 -3
  137. package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
  138. package/lib/module/skia/web/JsiSkRRect.js +6 -3
  139. package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
  140. package/lib/module/skia/web/JsiSkRSXform.js +6 -3
  141. package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
  142. package/lib/module/skia/web/JsiSkRect.js +6 -3
  143. package/lib/module/skia/web/JsiSkRect.js.map +1 -1
  144. package/lib/module/skia/web/JsiSkRuntimeEffect.js +6 -3
  145. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  146. package/lib/module/skia/web/JsiSkSVG.js +8 -5
  147. package/lib/module/skia/web/JsiSkSVG.js.map +1 -1
  148. package/lib/module/skia/web/JsiSkShader.js +6 -3
  149. package/lib/module/skia/web/JsiSkShader.js.map +1 -1
  150. package/lib/module/skia/web/JsiSkSurface.js +6 -3
  151. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  152. package/lib/module/skia/web/JsiSkTextBlob.js +6 -3
  153. package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
  154. package/lib/module/skia/web/JsiSkTypeface.js +6 -3
  155. package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
  156. package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +4 -1
  157. package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
  158. package/lib/module/skia/web/JsiSkVertices.js +6 -3
  159. package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
  160. package/lib/module/skia/web/JsiVideo.js +5 -2
  161. package/lib/module/skia/web/JsiVideo.js.map +1 -1
  162. package/lib/module/sksg/Container.js +8 -5
  163. package/lib/module/sksg/Container.js.map +1 -1
  164. package/lib/module/sksg/Elements.d.ts +1 -1
  165. package/lib/module/sksg/Elements.js.map +1 -1
  166. package/lib/module/sksg/HostConfig.d.ts +1 -1
  167. package/lib/module/sksg/Reconciler.js +5 -1
  168. package/lib/module/sksg/Reconciler.js.map +1 -1
  169. package/lib/module/sksg/Recorder/ReanimatedRecorder.js +5 -1
  170. package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
  171. package/lib/module/sksg/Recorder/Recorder.js +6 -3
  172. package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
  173. package/lib/module/sksg/Recorder/Visitor.js +1 -1
  174. package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
  175. package/lib/module/sksg/Recorder/commands/Drawing.js +4 -2
  176. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
  177. package/lib/module/sksg/Recorder/commands/Shaders.js +3 -2
  178. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
  179. package/lib/module/views/SkiaBaseWebView.js +12 -9
  180. package/lib/module/views/SkiaBaseWebView.js.map +1 -1
  181. package/lib/module/views/SkiaPictureView.js +5 -1
  182. package/lib/module/views/SkiaPictureView.js.map +1 -1
  183. package/lib/module/views/SkiaPictureView.web.js +4 -1
  184. package/lib/module/views/SkiaPictureView.web.js.map +1 -1
  185. package/lib/module/web/LoadSkiaWeb.js +2 -1
  186. package/lib/module/web/LoadSkiaWeb.js.map +1 -1
  187. package/lib/module/web/WithSkiaWeb.js +1 -1
  188. package/lib/module/web/WithSkiaWeb.js.map +1 -1
  189. package/lib/typescript/lib/module/Platform/Platform.web.d.ts +1 -1
  190. package/lib/typescript/lib/module/mock/index.d.ts +22 -11
  191. package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -1
  192. package/lib/typescript/lib/module/skia/web/CanvasKitWebGLBufferImpl.d.ts +2 -2
  193. package/lib/typescript/lib/module/skia/web/JsiSkAnimatedImage.d.ts +0 -1
  194. package/lib/typescript/lib/module/skia/web/JsiSkCanvas.d.ts +0 -1
  195. package/lib/typescript/lib/module/skia/web/JsiSkColorFilter.d.ts +0 -1
  196. package/lib/typescript/lib/module/skia/web/JsiSkContourMeasure.d.ts +0 -1
  197. package/lib/typescript/lib/module/skia/web/JsiSkContourMeasureIter.d.ts +0 -1
  198. package/lib/typescript/lib/module/skia/web/JsiSkData.d.ts +0 -1
  199. package/lib/typescript/lib/module/skia/web/JsiSkFont.d.ts +0 -1
  200. package/lib/typescript/lib/module/skia/web/JsiSkImage.d.ts +0 -1
  201. package/lib/typescript/lib/module/skia/web/JsiSkImageFilter.d.ts +0 -1
  202. package/lib/typescript/lib/module/skia/web/JsiSkMaskFilter.d.ts +0 -1
  203. package/lib/typescript/lib/module/skia/web/JsiSkMatrix.d.ts +0 -1
  204. package/lib/typescript/lib/module/skia/web/JsiSkPaint.d.ts +0 -1
  205. package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +0 -1
  206. package/lib/typescript/lib/module/skia/web/JsiSkPathEffect.d.ts +0 -1
  207. package/lib/typescript/lib/module/skia/web/JsiSkPicture.d.ts +0 -1
  208. package/lib/typescript/lib/module/skia/web/JsiSkPictureRecorder.d.ts +0 -1
  209. package/lib/typescript/lib/module/skia/web/JsiSkPoint.d.ts +0 -1
  210. package/lib/typescript/lib/module/skia/web/JsiSkRRect.d.ts +0 -1
  211. package/lib/typescript/lib/module/skia/web/JsiSkRSXform.d.ts +0 -1
  212. package/lib/typescript/lib/module/skia/web/JsiSkRect.d.ts +0 -1
  213. package/lib/typescript/lib/module/skia/web/JsiSkRuntimeEffect.d.ts +0 -1
  214. package/lib/typescript/lib/module/skia/web/JsiSkSVG.d.ts +0 -1
  215. package/lib/typescript/lib/module/skia/web/JsiSkShader.d.ts +0 -1
  216. package/lib/typescript/lib/module/skia/web/JsiSkSurface.d.ts +0 -1
  217. package/lib/typescript/lib/module/skia/web/JsiSkTextBlob.d.ts +0 -1
  218. package/lib/typescript/lib/module/skia/web/JsiSkTypeface.d.ts +0 -1
  219. package/lib/typescript/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +0 -1
  220. package/lib/typescript/lib/module/skia/web/JsiSkVertices.d.ts +0 -1
  221. package/lib/typescript/lib/module/skia/web/JsiVideo.d.ts +2 -2
  222. package/lib/typescript/lib/module/sksg/Container.d.ts +15 -7
  223. package/lib/typescript/lib/module/sksg/Reconciler.d.ts +21 -15
  224. package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +0 -1
  225. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +2 -5
  226. package/lib/typescript/lib/module/views/SkiaBaseWebView.d.ts +11 -12
  227. package/lib/typescript/lib/module/views/SkiaPictureView.d.ts +1 -1
  228. package/lib/typescript/lib/module/views/SkiaPictureView.web.d.ts +1 -1
  229. package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
  230. package/lib/typescript/src/renderer/__tests__/setup.d.ts +1 -0
  231. package/lib/typescript/src/sksg/Elements.d.ts +1 -1
  232. package/lib/typescript/src/sksg/HostConfig.d.ts +1 -1
  233. package/package.json +3 -3
  234. package/src/Platform/Platform.web.tsx +2 -1
  235. package/src/__tests__/snapshots/screens/snapshot2-android-ci.png +0 -0
  236. package/src/__tests__/snapshots/screens/snapshot3-android-ci.png +0 -0
  237. package/src/renderer/Canvas.tsx +3 -3
  238. package/src/renderer/__tests__/setup.tsx +5 -1
  239. package/src/sksg/Elements.tsx +1 -1
  240. package/src/sksg/Reconciler.ts +1 -2
  241. package/cpp/skia/include/gpu/graphite/LogPriority.h +0 -36
  242. package/cpp/skia/include/gpu/graphite/PrecompileContext.h +0 -52
  243. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +0 -48
@@ -13,6 +13,7 @@ set (SKIA_SKPARAGRAPH_LIB "skparagraph")
13
13
  set (SKIA_SKUNICODE_CORE_LIB "skunicode_core")
14
14
  set (SKIA_SKUNICODE_ICU_LIB "skunicode_icu")
15
15
 
16
+
16
17
  # Clear some variables
17
18
  unset(LIBRN_DIR CACHE)
18
19
  unset(libfbjni_link_DIRS CACHE)
@@ -39,6 +40,7 @@ if(SK_GRAPHITE)
39
40
  set(DAWN_PLATFORM_LIB "libdawn_platform_static")
40
41
  set(DAWN_PROC_LIB "libdawn_proc_static")
41
42
  set(BACKEND_SOURCES
43
+ #TODO: is this source needed to be added?
42
44
  "${PROJECT_SOURCE_DIR}/../cpp/rnskia/DawnWindowContext.cpp"
43
45
  )
44
46
  add_library(libdawn_native_static STATIC IMPORTED)
@@ -57,6 +59,14 @@ else()
57
59
  )
58
60
  endif()
59
61
 
62
+ if(${REACT_NATIVE_VERSION} LESS 66)
63
+ file(
64
+ TO_CMAKE_PATH
65
+ "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
66
+ INCLUDE_JSI_CPP
67
+ )
68
+ endif()
69
+
60
70
  add_library(
61
71
  ${PACKAGE_NAME}
62
72
  SHARED
@@ -81,6 +91,7 @@ add_library(
81
91
  ${BACKEND_SOURCES}
82
92
  )
83
93
 
94
+
84
95
  target_include_directories(
85
96
  ${PACKAGE_NAME}
86
97
  PRIVATE
@@ -129,48 +140,160 @@ set_property(TARGET skunicode_core PROPERTY IMPORTED_LOCATION "${SKIA_LIBS_PATH}
129
140
  add_library(skunicode_icu STATIC IMPORTED)
130
141
  set_property(TARGET skunicode_icu PROPERTY IMPORTED_LOCATION "${SKIA_LIBS_PATH}/libskunicode_icu.a")
131
142
 
143
+
132
144
  find_library(
133
145
  LOG_LIB
134
146
  log
135
147
  )
136
148
  message("-- LOG : " ${LOG_LIB})
137
149
 
138
- # Find the required packages for RN 0.78+
139
- find_package(fbjni REQUIRED CONFIG)
140
- find_package(ReactAndroid REQUIRED CONFIG)
150
+ if(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
151
+ # We need to find packages since from RN 0.71 binaries are prebuilt
152
+ find_package(fbjni REQUIRED CONFIG)
153
+ find_package(ReactAndroid REQUIRED CONFIG)
154
+ endif()
141
155
 
142
- # Set JSI library for RN 0.78+
143
- set (JSI_LIB ReactAndroid::jsi)
156
+ unset(JSI_LIB CACHE)
157
+ if(${REACT_NATIVE_VERSION} LESS 66)
158
+ # JSI lib didn't exist on RN 0.65 and before. Simply omit it.
159
+ set (JSI_LIB "")
160
+ elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
161
+ # RN 0.71 distributes prebuilt binaries.
162
+ set (JSI_LIB ReactAndroid::jsi)
163
+ else()
164
+ # RN 0.66 distributes libjsi.so, can be used instead of compiling jsi.cpp manually.
165
+ find_library(
166
+ JSI_LIB
167
+ jsi
168
+ PATHS ${LIBRN_DIR}
169
+ NO_CMAKE_FIND_ROOT_PATH
170
+ )
171
+ endif()
144
172
  message("-- JSI : " ${JSI_LIB})
145
173
 
146
- # Set React library for RN 0.78+
147
- set (REACT_LIB ReactAndroid::reactnative)
174
+ unset(REACT_LIB CACHE)
175
+ if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
176
+ # RN 0.76 packs react_nativemodule_core into ReactAndroid::reactnative
177
+ set (REACT_LIB ReactAndroid::reactnative)
178
+ elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
179
+ # RN 0.71 distributes prebuilt binaries.
180
+ set (REACT_LIB ReactAndroid::react_nativemodule_core)
181
+ else()
182
+ find_library(
183
+ REACT_LIB
184
+ react_nativemodule_core
185
+ PATHS ${LIBRN_DIR}
186
+ NO_CMAKE_FIND_ROOT_PATH
187
+ )
188
+ endif()
148
189
  message("-- REACT : " ${REACT_LIB})
149
190
 
150
- # Set FBJNI library for RN 0.78+
151
- set (FBJNI_LIBRARY fbjni::fbjni)
191
+ unset(FBJNI_LIBRARY CACHE)
192
+ if(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
193
+ # RN 0.71 distributes prebuilt binaries.
194
+ set (FBJNI_LIBRARY fbjni::fbjni)
195
+ else()
196
+ find_library(
197
+ FBJNI_LIBRARY
198
+ fbjni
199
+ PATHS ${libfbjni_link_DIRS}
200
+ NO_CMAKE_FIND_ROOT_PATH
201
+ )
202
+ endif()
152
203
  message("-- FBJNI : " ${FBJNI_LIBRARY})
153
204
 
154
- # Define React Native version
155
- add_definitions(-DREACT_NATIVE_VERSION=78)
156
-
157
- # Link libraries for RN 0.78+
158
- set(COMMON_LIBS
159
- ${LOG_LIB}
160
- ${REACT_LIB} # This is ReactAndroid::reactnative which includes all needed components
161
- ${FBJNI_LIBRARY}
162
- ${JSI_LIB}
163
- ${SKIA_SVG_LIB}
164
- ${SKIA_SKSHAPER_LIB}
165
- ${SKIA_SKPARAGRAPH_LIB}
166
- ${SKIA_SKUNICODE_CORE_LIB}
167
- ${SKIA_SKUNICODE_ICU_LIB}
168
- ${SKIA_LIB}
169
- -ljnigraphics
170
- -lGLESv2
171
- -lEGL
172
- -landroid
173
- )
205
+ unset(REACTNATIVEJNI_LIB CACHE)
206
+ if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
207
+ # RN 0.76 doesn't have reactnativejni
208
+ # DO NOTHING, we'll not link these libraries
209
+ elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
210
+ # RN 0.71 distributes prebuilt binaries.
211
+ set (REACTNATIVEJNI_LIB "ReactAndroid::reactnativejni")
212
+ else()
213
+ find_library(
214
+ REACTNATIVEJNI_LIB
215
+ reactnativejni
216
+ PATHS ${LIBRN_DIR}
217
+ NO_CMAKE_FIND_ROOT_PATH
218
+ )
219
+ endif()
220
+ message("-- REACTNATIVEJNI : " ${REACTNATIVEJNI_LIB})
221
+
222
+ unset(RUNTIMEEXECUTOR_LIB CACHE)
223
+ if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
224
+ # RN 0.76 doesn't have runtimeexecutor
225
+ # DO NOTHING, we'll not link these libraries
226
+ elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
227
+ # RN 0.71 distributes prebuilt binaries.
228
+ set (RUNTIMEEXECUTOR_LIB "ReactAndroid::runtimeexecutor")
229
+ else()
230
+ find_library(
231
+ RUNTIMEEXECUTOR_LIB
232
+ runtimeexecutor
233
+ PATHS ${LIBRN_DIR}
234
+ NO_CMAKE_FIND_ROOT_PATH
235
+ )
236
+ endif()
237
+ message("-- RUNTIMEEXECUTOR : " ${RUNTIMEEXECUTOR_LIB})
238
+
239
+ unset(TURBOMODULES_LIB CACHE)
240
+ if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
241
+ # RN 0.76 doesn't have turbomodulejsijni
242
+ # DO NOTHING, we'll not link these libraries
243
+ elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
244
+ # RN 0.71 distributes prebuilt binaries.
245
+ set (TURBOMODULES_LIB "ReactAndroid::turbomodulejsijni")
246
+ else()
247
+ find_library(
248
+ TURBOMODULES_LIB
249
+ turbomodulejsijni
250
+ PATHS ${LIBRN_DIR}
251
+ NO_CMAKE_FIND_ROOT_PATH
252
+ )
253
+ endif()
254
+ message("-- TURBO : " ${TURBOMODULES_LIB})
255
+
256
+ add_definitions(-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION})
257
+
258
+ # Link
259
+ if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
260
+ set(COMMON_LIBS
261
+ ${LOG_LIB}
262
+ ${REACT_LIB}
263
+ ${FBJNI_LIBRARY}
264
+ ${JSI_LIB}
265
+ ${SKIA_SVG_LIB}
266
+ ${SKIA_SKSHAPER_LIB}
267
+ ${SKIA_SKPARAGRAPH_LIB}
268
+ ${SKIA_SKUNICODE_CORE_LIB}
269
+ ${SKIA_SKUNICODE_ICU_LIB}
270
+ ${SKIA_LIB}
271
+ -ljnigraphics
272
+ -lGLESv2
273
+ -lEGL
274
+ -landroid
275
+ )
276
+ else()
277
+ set(COMMON_LIBS
278
+ ${LOG_LIB}
279
+ ${FBJNI_LIBRARY}
280
+ ${REACT_LIB}
281
+ ${JSI_LIB}
282
+ ${REACTNATIVEJNI_LIB}
283
+ ${RUNTIMEEXECUTOR_LIB}
284
+ ${TURBOMODULES_LIB}
285
+ ${SKIA_SVG_LIB}
286
+ ${SKIA_SKSHAPER_LIB}
287
+ ${SKIA_SKPARAGRAPH_LIB}
288
+ ${SKIA_SKUNICODE_CORE_LIB}
289
+ ${SKIA_SKUNICODE_ICU_LIB}
290
+ ${SKIA_LIB}
291
+ -ljnigraphics
292
+ -lGLESv2
293
+ -lEGL
294
+ -landroid
295
+ )
296
+ endif()
174
297
 
175
298
  if(SK_GRAPHITE)
176
299
  target_link_libraries(${PACKAGE_NAME}
@@ -185,4 +308,4 @@ else()
185
308
  -lGLESv2
186
309
  -lEGL
187
310
  )
188
- endif()
311
+ endif()
@@ -412,9 +412,6 @@ public:
412
412
  * If a scanline decode is in progress, scanline mode will end, requiring the client to call
413
413
  * startScanlineDecode() in order to return to decoding scanlines.
414
414
  *
415
- * For certain codecs, reading into a smaller bitmap than the original dimensions may not
416
- * produce correct results (e.g. animated webp).
417
- *
418
415
  * @return Result kSuccess, or another value explaining the type of failure.
419
416
  */
420
417
  Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options*);
@@ -815,7 +812,6 @@ protected:
815
812
  }
816
813
 
817
814
  virtual bool onGetGainmapCodec(SkGainmapInfo*, std::unique_ptr<SkCodec>*) { return false; }
818
- virtual bool onGetGainmapInfo(SkGainmapInfo*) { return false; }
819
815
 
820
816
  // TODO(issues.skia.org/363544350): This API only works for JPEG images. Remove this API once
821
817
  // it is no longer used.
@@ -1057,9 +1053,8 @@ private:
1057
1053
  friend class PNGCodecGM; // for fillIncompleteImage
1058
1054
  friend class SkSampledCodec;
1059
1055
  friend class SkIcoCodec;
1060
- friend class SkPngCodec; // for onGetGainmapCodec
1061
- friend class SkAndroidCodec; // for handleFrameIndex
1062
- friend class SkCodecPriv; // for fEncodedInfo
1056
+ friend class SkAndroidCodec; // for fEncodedInfo
1057
+ friend class SkPDFBitmap; // for fEncodedInfo
1063
1058
  };
1064
1059
 
1065
1060
  namespace SkCodecs {
@@ -74,12 +74,6 @@
74
74
  */
75
75
  //#define SK_R32_SHIFT 16
76
76
 
77
- /* This controls how much space should be pre-allocated in an SkCanvas object
78
- to store the SkMatrix and clip via calls to SkCanvas::save() (and balanced with
79
- SkCanvas::restore()).
80
- */
81
- //#define SK_CANVAS_SAVE_RESTORE_PREALLOC_COUNT 32
82
-
83
77
  /* Determines whether to build code that supports the Ganesh GPU backend. Some classes
84
78
  that are not GPU-specific, such as SkShader subclasses, have optional code
85
79
  that is used allows them to interact with this GPU backend. If you'd like to
@@ -101,11 +95,6 @@
101
95
  //#define SK_HISTOGRAM_MEMORY_KB(name, sample)
102
96
  //#define SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(name, sampleUSec, minUSec, maxUSec, bucketCount)
103
97
 
104
- /*
105
- * Skia can provide extensive logging of Graphite Pipeline lifetimes.
106
- */
107
- //#define SK_PIPELINE_LIFETIME_LOGGING
108
-
109
98
  // To use smaller but slower mipmap builder
110
99
  //#define SK_USE_DRAWING_MIPMAP_DOWNSAMPLER
111
100
 
@@ -34,7 +34,6 @@
34
34
  #include "include/private/base/SkDeque.h"
35
35
  #include "include/private/base/SkTArray.h"
36
36
 
37
- #include <cstddef>
38
37
  #include <cstdint>
39
38
  #include <cstring>
40
39
  #include <memory>
@@ -2503,18 +2502,15 @@ private:
2503
2502
  void reset(SkDevice* device);
2504
2503
  };
2505
2504
 
2506
- #if defined(SK_CANVAS_SAVE_RESTORE_PREALLOC_COUNT)
2507
- static constexpr int kMCRecCount = SK_CANVAS_SAVE_RESTORE_PREALLOC_COUNT;
2508
- #else
2509
- static constexpr int kMCRecCount = 32; // common depth for save/restores
2510
- #endif
2505
+ // the first N recs that can fit here mean we won't call malloc
2506
+ static constexpr int kMCRecSize = 96; // most recent measurement
2507
+ static constexpr int kMCRecCount = 32; // common depth for save/restores
2511
2508
 
2512
- // This stack allocation of memory will be used to house the first kMCRecCount
2513
- // layers without need to call malloc.
2514
- alignas(MCRec) std::byte fMCRecStorage[sizeof(MCRec) * kMCRecCount];
2509
+ intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)];
2515
2510
 
2516
- SkDeque fMCStack; // uses the stack memory
2517
- MCRec* fMCRec; // points to top of stack for convenience
2511
+ SkDeque fMCStack;
2512
+ // points to top of stack
2513
+ MCRec* fMCRec;
2518
2514
 
2519
2515
  // Installed via init()
2520
2516
  sk_sp<SkDevice> fRootDevice;
@@ -12,7 +12,6 @@
12
12
  #include "include/core/SkScalar.h"
13
13
  #include "include/core/SkTypes.h"
14
14
  #include "include/private/base/SkCPUTypes.h"
15
- #include "include/private/base/SkTPin.h"
16
15
 
17
16
  #include <array>
18
17
  #include <cstdint>
@@ -416,15 +415,6 @@ struct SkRGBA4f {
416
415
  SkRGBA4f makeOpaque() const {
417
416
  return { fR, fG, fB, 1.0f };
418
417
  }
419
-
420
- /**
421
- Returns a copy of the SkRGBA4f but with the alpha component pinned to [0, 1].
422
-
423
- @return color with pinned alpha
424
- */
425
- SkRGBA4f pinAlpha() const {
426
- return { fR, fG, fB, SkTPin(fA, 0.f, 1.f) };
427
- }
428
418
  };
429
419
 
430
420
  /** \struct SkColor4f
@@ -39,85 +39,6 @@ struct SK_API SkColorSpacePrimaries {
39
39
  bool toXYZD50(skcms_Matrix3x3* toXYZD50) const;
40
40
  };
41
41
 
42
- namespace SkNamedPrimaries {
43
-
44
- ////////////////////////////////////////////////////////////////////////////////
45
- // Color primaries defined by ITU-T H.273, table 2. Names are given by the first
46
- // specification referenced in the value's row.
47
-
48
- // Rec. ITU-R BT.709-6, value 1.
49
- static constexpr SkColorSpacePrimaries kRec709 = {
50
- 0.64f, 0.33f, 0.3f, 0.6f, 0.15f, 0.06f, 0.3127f, 0.329f};
51
-
52
- // Rec. ITU-R BT.470-6 System M (historical), value 4.
53
- static constexpr SkColorSpacePrimaries kRec470SystemM = {
54
- 0.67f, 0.33f, 0.21f, 0.71f, 0.14f, 0.08f, 0.31f, 0.316f};
55
-
56
- // Rec. ITU-R BT.470-6 System B, G (historical), value 5.
57
- static constexpr SkColorSpacePrimaries kRec470SystemBG = {
58
- 0.64f, 0.33f, 0.29f, 0.60f, 0.15f, 0.06f, 0.3127f, 0.3290f};
59
-
60
- // Rec. ITU-R BT.601-7 525, value 6.
61
- static constexpr SkColorSpacePrimaries kRec601 = {
62
- 0.630f, 0.340f, 0.310f, 0.595f, 0.155f, 0.070f, 0.3127f, 0.3290f};
63
-
64
- // SMPTE ST 240, value 7 (functionally the same as value 6).
65
- static constexpr SkColorSpacePrimaries kSMPTE_ST_240 = kRec601;
66
-
67
- // Generic film (colour filters using Illuminant C), value 8.
68
- static constexpr SkColorSpacePrimaries kGenericFilm = {
69
- 0.681f, 0.319f, 0.243f, 0.692f, 0.145f, 0.049f, 0.310f, 0.316f};
70
-
71
- // Rec. ITU-R BT.2020-2, value 9.
72
- static constexpr SkColorSpacePrimaries kRec2020{
73
- 0.708f, 0.292f, 0.170f, 0.797f, 0.131f, 0.046f, 0.3127f, 0.3290f};
74
-
75
- // SMPTE ST 428-1, value 10.
76
- static constexpr SkColorSpacePrimaries kSMPTE_ST_428_1 = {
77
- 1.f, 0.f, 0.f, 1.f, 0.f, 0.f, 1.f / 3.f, 1.f / 3.f};
78
-
79
- // SMPTE RP 431-2, value 11.
80
- static constexpr SkColorSpacePrimaries kSMPTE_RP_431_2 = {
81
- 0.680f, 0.320f, 0.265f, 0.690f, 0.150f, 0.060f, 0.314f, 0.351f};
82
-
83
- // SMPTE EG 432-1, value 12.
84
- static constexpr SkColorSpacePrimaries kSMPTE_EG_432_1 = {
85
- 0.680f, 0.320f, 0.265f, 0.690f, 0.150f, 0.060f, 0.3127f, 0.3290f};
86
-
87
- // No corresponding industry specification identified, value 22.
88
- // This is sometimes referred to as EBU 3213-E, but that document doesn't
89
- // specify these values.
90
- static constexpr SkColorSpacePrimaries kITU_T_H273_Value22 = {
91
- 0.630f, 0.340f, 0.295f, 0.605f, 0.155f, 0.077f, 0.3127f, 0.3290f};
92
-
93
- // Mapping between names of color primaries and the number of the corresponding
94
- // row in ITU-T H.273, table 2. As above, the constants are named based on the
95
- // first specification referenced in the value's row.
96
- enum class CicpId : uint8_t {
97
- // Value 0 is reserved.
98
- kRec709 = 1,
99
- // Value 2 is unspecified.
100
- // Value 3 is reserved.
101
- kRec470SystemM = 4,
102
- kRec470SystemBG = 5,
103
- kRec601 = 6,
104
- kSMPTE_ST_240 = 7,
105
- kGenericFilm = 8,
106
- kRec2020 = 9,
107
- kSMPTE_ST_428_1 = 10,
108
- kSMPTE_RP_431_2 = 11,
109
- kSMPTE_EG_432_1 = 12,
110
- // Values 13-21 are reserved.
111
- kITU_T_H273_Value22 = 22,
112
- // Values 23-255 are reserved.
113
- };
114
-
115
- // https://www.w3.org/TR/css-color-4/#predefined-prophoto-rgb
116
- static constexpr SkColorSpacePrimaries kProPhotoRGB = {
117
- 0.7347f, 0.2653f, 0.1596f, 0.8404f, 0.0366f, 0.0001f, 0.34567f, 0.35850f};
118
-
119
- } // namespace SkNamedPrimaries
120
-
121
42
  namespace SkNamedTransferFn {
122
43
 
123
44
  // Like SkNamedGamut::kSRGB, keeping this bitwise exactly the same as skcms makes things fastest.
@@ -127,98 +48,18 @@ static constexpr skcms_TransferFunction kSRGB =
127
48
  static constexpr skcms_TransferFunction k2Dot2 =
128
49
  { 2.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
129
50
 
130
- static constexpr skcms_TransferFunction kRec2020 = {
131
- 2.22222f, 0.909672f, 0.0903276f, 0.222222f, 0.0812429f, 0, 0};
132
-
133
- ////////////////////////////////////////////////////////////////////////////////
134
- // Color primaries defined by ITU-T H.273, table 3. Names are given by the first
135
- // specification referenced in the value's row.
136
-
137
- // Rec. ITU-R BT.709-6, value 1.
138
- static constexpr skcms_TransferFunction kRec709 = {2.222222222222f,
139
- 0.909672415686f,
140
- 0.090327584314f,
141
- 0.222222222222f,
142
- 0.081242858299f,
143
- 0.f,
144
- 0.f};
145
-
146
- // Rec. ITU-R BT.470-6 System M (historical) assumed display gamma 2.2, value 4.
147
- static constexpr skcms_TransferFunction kRec470SystemM = {2.2f, 1.f, 0.f, 0.f, 0.f, 0.f, 0.f};
148
-
149
- // Rec. ITU-R BT.470-6 System B, G (historical) assumed display gamma 2.8,
150
- // value 5.
151
- static constexpr skcms_TransferFunction kRec470SystemBG = {2.8f, 1.f, 0.f, 0.f, 0.f, 0.f, 0.f};
152
-
153
- // Rec. ITU-R BT.601-7, same as kRec709, value 6.
154
- static constexpr skcms_TransferFunction kRec601 = kRec709;
155
-
156
- // SMPTE ST 240, value 7.
157
- static constexpr skcms_TransferFunction kSMPTE_ST_240 = {
158
- 2.222222222222f, 0.899626676224f, 0.100373323776f, 0.25f, 0.091286342118f, 0.f, 0.f};
159
-
160
- // Linear, value 8
161
51
  static constexpr skcms_TransferFunction kLinear =
162
52
  { 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
163
53
 
164
- // IEC 61966-2-4, value 11, same as kRec709 (but is explicitly extended).
165
- static constexpr skcms_TransferFunction kIEC61966_2_4 = kRec709;
166
-
167
- // IEC 61966-2-1 sRGB, value 13.
168
- static constexpr skcms_TransferFunction kIEC61966_2_1 = kSRGB;
169
-
170
- // Rec. ITU-R BT.2020-2 (10-bit system), value 14.
171
- static constexpr skcms_TransferFunction kRec2020_10bit = kRec709;
54
+ static constexpr skcms_TransferFunction kRec2020 =
55
+ {2.22222f, 0.909672f, 0.0903276f, 0.222222f, 0.0812429f, 0, 0};
172
56
 
173
- // Rec. ITU-R BT.2020-2 (12-bit system), value 15.
174
- static constexpr skcms_TransferFunction kRec2020_12bit = kRec709;
175
-
176
- // Rec. ITU-R BT.2100-2 perceptual quantization (PQ) system, value 16.
177
57
  static constexpr skcms_TransferFunction kPQ =
178
58
  {-2.0f, -107/128.0f, 1.0f, 32/2523.0f, 2413/128.0f, -2392/128.0f, 8192/1305.0f };
179
59
 
180
- // SMPTE ST 428-1, value 17.
181
- static constexpr skcms_TransferFunction kSMPTE_ST_428_1 = {
182
- 2.6f, 1.034080527699f, 0.f, 0.f, 0.f, 0.f, 0.f};
183
-
184
- // Rec. ITU-R BT.2100-2 hybrid log-gamma (HLG) system, value 18.
185
60
  static constexpr skcms_TransferFunction kHLG =
186
61
  {-3.0f, 2.0f, 2.0f, 1/0.17883277f, 0.28466892f, 0.55991073f, 0.0f };
187
62
 
188
- // Mapping between transfer function names and the number of the corresponding
189
- // row in ITU-T H.273, table 3. As above, the constants are named based on the
190
- // first specification referenced in the value's row.
191
- enum class CicpId : uint8_t {
192
- // Value 0 is reserved.
193
- kRec709 = 1,
194
- // Value 2 is unspecified.
195
- // Value 3 is reserved.
196
- kRec470SystemM = 4,
197
- kRec470SystemBG = 5,
198
- kRec601 = 6,
199
- kSMPTE_ST_240 = 7,
200
- kLinear = 8,
201
- // Value 9 is not supported by `SkColorSpace::MakeCICP`.
202
- // Value 10 is not supported by `SkColorSpace::MakeCICP`.
203
- kIEC61966_2_4 = 11,
204
- // Value 12 is not supported by `SkColorSpace::MakeCICP`.
205
- kIEC61966_2_1 = 13,
206
- kSRGB = kIEC61966_2_1,
207
- kRec2020_10bit = 14,
208
- kRec2020_12bit = 15,
209
- kPQ = 16,
210
- kSMPTE_ST_428_1 = 17,
211
- kHLG = 18,
212
- // Values 19-255 are reserved.
213
- };
214
-
215
- // https://w3.org/TR/css-color-4/#valdef-color-prophoto-rgb
216
- // "The transfer curve is a gamma function with a value of 1/1.8"
217
- static constexpr skcms_TransferFunction kProPhotoRGB = {1.8f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
218
-
219
- // https://www.w3.org/TR/css-color-4/#predefined-a98-rgb
220
- static constexpr skcms_TransferFunction kA98RGB = k2Dot2;
221
-
222
63
  } // namespace SkNamedTransferFn
223
64
 
224
65
  namespace SkNamedGamut {
@@ -281,29 +122,6 @@ public:
281
122
  static sk_sp<SkColorSpace> MakeRGB(const skcms_TransferFunction& transferFn,
282
123
  const skcms_Matrix3x3& toXYZ);
283
124
 
284
- /**
285
- * Create an SkColorSpace from code points specified in Rec. ITU-T H.273.
286
- * Null will be returned for invalid or unsupported combination of code
287
- * points.
288
- *
289
- * Parameters:
290
- *
291
- * - `color_primaries` identifies an entry in Rec. ITU-T H.273, Table 2.
292
- * - `transfer_characteristics` identifies an entry in Rec. ITU-T H.273, Table 3.
293
- *
294
- * `SkColorSpace` (and the underlying `skcms_ICCProfile`) only supports RGB
295
- * color spaces and therefore this function does not take a
296
- * `matrix_coefficients` parameter - the caller is expected to verify that
297
- * `matrix_coefficients` is `0`.
298
- *
299
- * Narrow range images are extremely rare - see
300
- * https://github.com/w3c/png/issues/312#issuecomment-2327349614. Therefore
301
- * this function doesn't take a `video_full_range_flag` - the caller is
302
- * expected to verify that it is `1` (indicating a full range image).
303
- */
304
- static sk_sp<SkColorSpace> MakeCICP(SkNamedPrimaries::CicpId color_primaries,
305
- SkNamedTransferFn::CicpId transfer_characteristics);
306
-
307
125
  /**
308
126
  * Create an SkColorSpace from a parsed (skcms) ICC profile.
309
127
  */