@nativescript/canvas 2.0.0-alpha.9 → 2.0.0-beta.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 (557) hide show
  1. package/Canvas/common.d.ts +213 -25
  2. package/Canvas/common.js +705 -452
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +10 -1
  5. package/Canvas/index.android.js +155 -52
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +8 -0
  8. package/Canvas/index.ios.d.ts +7 -4
  9. package/Canvas/index.ios.js +159 -106
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas2D/CanvasGradient/index.d.ts +1 -3
  12. package/Canvas2D/CanvasGradient/index.js +1 -10
  13. package/Canvas2D/CanvasGradient/index.js.map +1 -1
  14. package/Canvas2D/CanvasPattern/index.d.ts +1 -3
  15. package/Canvas2D/CanvasPattern/index.js +1 -10
  16. package/Canvas2D/CanvasPattern/index.js.map +1 -1
  17. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +11 -5
  18. package/Canvas2D/CanvasRenderingContext2D/index.js +183 -245
  19. package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
  20. package/Canvas2D/DOMMatrix/index.js +5 -3
  21. package/Canvas2D/DOMMatrix/index.js.map +1 -1
  22. package/Canvas2D/ImageData/index.js +6 -6
  23. package/Canvas2D/ImageData/index.js.map +1 -1
  24. package/Canvas2D/Path2D/index.d.ts +0 -2
  25. package/Canvas2D/Path2D/index.js +32 -42
  26. package/Canvas2D/Path2D/index.js.map +1 -1
  27. package/Dom/Dom.js +7 -2
  28. package/Dom/Dom.js.map +1 -1
  29. package/Dom/Group.d.ts +7 -7
  30. package/Dom/Group.js +47 -21
  31. package/Dom/Group.js.map +1 -1
  32. package/Dom/Image.js +2 -3
  33. package/Dom/Image.js.map +1 -1
  34. package/Dom/Paint.d.ts +1 -0
  35. package/Dom/Paint.js +10 -5
  36. package/Dom/Paint.js.map +1 -1
  37. package/Dom/Text.js +3 -4
  38. package/Dom/Text.js.map +1 -1
  39. package/Dom/shapes/Circle.js +2 -3
  40. package/Dom/shapes/Circle.js.map +1 -1
  41. package/Dom/shapes/Path.js +1 -0
  42. package/Dom/shapes/Path.js.map +1 -1
  43. package/Dom/shapes/Points.js +1 -2
  44. package/Dom/shapes/Points.js.map +1 -1
  45. package/Dom/shapes/Rect.js +2 -2
  46. package/Dom/shapes/Rect.js.map +1 -1
  47. package/Dom/shapes/RoundedRect.js +8 -9
  48. package/Dom/shapes/RoundedRect.js.map +1 -1
  49. package/ImageAsset/index.d.ts +2 -2
  50. package/ImageAsset/index.js +33 -37
  51. package/ImageAsset/index.js.map +1 -1
  52. package/ImageBitmap/index.d.ts +0 -2
  53. package/ImageBitmap/index.js +47 -33
  54. package/ImageBitmap/index.js.map +1 -1
  55. package/LICENSE +201 -0
  56. package/SVG/SVG.js +1 -1
  57. package/SVG/SVG.js.map +1 -1
  58. package/TextDecoder/index.d.ts +0 -2
  59. package/TextDecoder/index.js +3 -12
  60. package/TextDecoder/index.js.map +1 -1
  61. package/TextEncoder/index.d.ts +0 -2
  62. package/TextEncoder/index.js +4 -13
  63. package/TextEncoder/index.js.map +1 -1
  64. package/WebGL/WebGLExtensions/index.d.ts +4 -12
  65. package/WebGL/WebGLExtensions/index.js +27 -77
  66. package/WebGL/WebGLExtensions/index.js.map +1 -1
  67. package/WebGL/WebGLProgram.d.ts +0 -1
  68. package/WebGL/WebGLProgram.js +0 -3
  69. package/WebGL/WebGLProgram.js.map +1 -1
  70. package/WebGL/WebGLRenderingContext/common.d.ts +1 -3
  71. package/WebGL/WebGLRenderingContext/common.js +3 -13
  72. package/WebGL/WebGLRenderingContext/common.js.map +1 -1
  73. package/WebGL/WebGLRenderingContext/index.d.ts +19 -17
  74. package/WebGL/WebGLRenderingContext/index.js +354 -728
  75. package/WebGL/WebGLRenderingContext/index.js.map +1 -1
  76. package/WebGL2/WebGL2RenderingContext/common.d.ts +2 -2
  77. package/WebGL2/WebGL2RenderingContext/common.js +2 -2
  78. package/WebGL2/WebGL2RenderingContext/common.js.map +1 -1
  79. package/WebGL2/WebGL2RenderingContext/index.d.ts +1 -1
  80. package/WebGL2/WebGL2RenderingContext/index.js +116 -285
  81. package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
  82. package/angular/esm2020/index.mjs +4 -4
  83. package/angular/fesm2015/nativescript-canvas-angular.mjs +4 -4
  84. package/angular/fesm2020/nativescript-canvas-angular.mjs +4 -4
  85. package/angular/package.json +2 -2
  86. package/index.js.map +1 -1
  87. package/package.json +3 -2
  88. package/platforms/android/canvas-release.aar +0 -0
  89. package/platforms/android/include.gradle +15 -0
  90. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  91. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +132 -68
  92. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative.h +10 -0
  93. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +144 -0
  94. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2808 -68
  95. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  96. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  97. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +5847 -2633
  98. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +43 -25
  99. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  100. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +43 -25
  101. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  102. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  103. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +264 -136
  104. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative.h +10 -0
  105. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +144 -0
  106. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2808 -68
  107. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
  108. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  109. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  110. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +5847 -2633
  111. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +43 -25
  112. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  113. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +43 -25
  114. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +5847 -2633
  115. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +43 -25
  116. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  117. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +43 -25
  118. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +42 -31
  119. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  120. package/platforms/ios/Podfile +5 -2
  121. package/platforms/ios/build.xcconfig +3 -3
  122. package/platforms/ios/src/CanvasModule.h +0 -2
  123. package/platforms/ios/src/CanvasModule.mm +4 -4
  124. package/platforms/ios/src/NSOperationQueueWrapper.h +11 -0
  125. package/platforms/ios/src/NSOperationQueueWrapper.mm +74 -0
  126. package/platforms/ios/src/cpp/Caches.cpp +35 -0
  127. package/platforms/ios/src/cpp/Caches.h +190 -0
  128. package/platforms/ios/src/cpp/CanvasJSIModule.cpp +1593 -0
  129. package/platforms/ios/src/cpp/CanvasJSIModule.h +16 -34
  130. package/platforms/ios/src/cpp/Common.h +30 -0
  131. package/platforms/ios/src/cpp/ConcurrentMap.h +54 -0
  132. package/platforms/ios/src/cpp/Helpers.h +336 -38
  133. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +802 -0
  134. package/platforms/ios/src/cpp/ImageAssetImpl.h +46 -12
  135. package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +189 -0
  136. package/platforms/ios/src/cpp/ImageBitmapImpl.h +42 -16
  137. package/platforms/ios/src/cpp/JSICallback.h +83 -5
  138. package/platforms/ios/src/cpp/JSIReadFileCallback.h +86 -6
  139. package/platforms/ios/src/cpp/JSIRuntime.cpp +21 -0
  140. package/platforms/ios/src/cpp/JSIRuntime.h +7 -0
  141. package/platforms/ios/src/cpp/ObjectWrapperImpl.h +33 -0
  142. package/platforms/ios/src/cpp/OneByteStringResource.cpp +55 -0
  143. package/platforms/ios/src/cpp/OneByteStringResource.h +36 -0
  144. package/platforms/ios/src/cpp/PerIsolateData.cpp +49 -0
  145. package/platforms/ios/src/cpp/PerIsolateData.h +54 -0
  146. package/platforms/ios/src/cpp/RafImpl.cpp +8 -0
  147. package/platforms/ios/src/cpp/RafImpl.h +11 -8
  148. package/platforms/ios/src/cpp/TextDecoderImpl.cpp +193 -0
  149. package/platforms/ios/src/cpp/TextDecoderImpl.h +23 -13
  150. package/platforms/ios/src/cpp/TextEncoderImpl.cpp +139 -0
  151. package/platforms/ios/src/cpp/TextEncoderImpl.h +21 -12
  152. package/platforms/ios/src/cpp/URLImpl.cpp +464 -0
  153. package/platforms/ios/src/cpp/URLImpl.h +121 -0
  154. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.cpp +71 -0
  155. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.h +29 -13
  156. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +89 -0
  157. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.h +49 -12
  158. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +2837 -0
  159. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +1334 -21
  160. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.cpp +207 -0
  161. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.h +27 -13
  162. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +807 -0
  163. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +173 -13
  164. package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +499 -0
  165. package/platforms/ios/src/cpp/canvas2d/Path2D.h +422 -12
  166. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.cpp +253 -0
  167. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.h +51 -12
  168. package/platforms/ios/src/cpp/gl.h +57 -7
  169. package/platforms/ios/src/cpp/gl3stub.c +425 -0
  170. package/platforms/ios/src/cpp/gl3stub.h +665 -0
  171. package/platforms/ios/src/cpp/gles3jni.h +37 -0
  172. package/platforms/ios/src/cpp/include/robin_hood.h +2544 -0
  173. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.cpp +91 -0
  174. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.h +33 -13
  175. package/platforms/ios/src/cpp/webgl/WebGLBuffer.h +42 -7
  176. package/platforms/ios/src/cpp/webgl/WebGLFramebuffer.h +47 -11
  177. package/platforms/ios/src/cpp/webgl/WebGLProgram.h +41 -6
  178. package/platforms/ios/src/cpp/webgl/WebGLRenderbuffer.h +41 -7
  179. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +6845 -0
  180. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +3217 -388
  181. package/platforms/ios/src/cpp/webgl/{WebGLRenderingContextBase.mm → WebGLRenderingContextBase.cpp} +18 -17
  182. package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.h +16 -36
  183. package/platforms/ios/src/cpp/webgl/WebGLShader.h +41 -7
  184. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.cpp +50 -0
  185. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.h +67 -12
  186. package/platforms/ios/src/cpp/webgl/WebGLTexture.h +41 -7
  187. package/platforms/ios/src/cpp/webgl/WebGLUniformLocation.h +45 -9
  188. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.cpp +136 -0
  189. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.h +88 -12
  190. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.cpp +35 -0
  191. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.h +26 -6
  192. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.cpp +41 -0
  193. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.h +26 -6
  194. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.cpp +306 -0
  195. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.h +47 -13
  196. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.h +49 -6
  197. package/platforms/ios/src/cpp/webgl/extensions/EXT_shader_texture_lodImpl.h +37 -15
  198. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.h +47 -6
  199. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.h +49 -6
  200. package/platforms/ios/src/cpp/webgl/extensions/OES_fbo_render_mipmap.h +41 -16
  201. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.h +44 -6
  202. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_floatImpl.h +39 -16
  203. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_float_linearImpl.h +37 -16
  204. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.h +42 -6
  205. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_float_linearImpl.h +40 -16
  206. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.cpp +110 -0
  207. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.h +149 -14
  208. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.h +51 -8
  209. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.h +49 -6
  210. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.h +49 -8
  211. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.h +76 -6
  212. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.h +57 -6
  213. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.h +53 -6
  214. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.h +59 -6
  215. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.h +46 -6
  216. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.cpp +38 -0
  217. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.h +157 -14
  218. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.cpp +32 -0
  219. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.h +61 -13
  220. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +4564 -0
  221. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.h +1790 -342
  222. package/platforms/ios/src/cpp/webgl2/WebGLQuery.h +41 -4
  223. package/platforms/ios/src/cpp/webgl2/WebGLSampler.h +42 -3
  224. package/platforms/ios/src/cpp/webgl2/WebGLSyncImpl.h +45 -11
  225. package/platforms/ios/src/cpp/webgl2/WebGLTransformFeedback.h +43 -4
  226. package/platforms/ios/src/cpp/webgl2/WebGLVertexArrayObject.h +44 -4
  227. package/platforms/ios/src/module.modulemap +1 -0
  228. package/{pods → src-native/ios}/NativeScript.podspec +12 -25
  229. package/typings/objc!CanvasNative.d.ts +2038 -0
  230. package/typings/objc!CanvasNative.js +1 -0
  231. package/typings/objc!CanvasNative.js.map +1 -0
  232. package/utils.d.ts +3 -1
  233. package/utils.js +7 -20
  234. package/utils.js.map +1 -1
  235. package/angular/nativescript-canvas-angular.d.ts +0 -5
  236. package/platforms/ios/src/cpp/CanvasJSIModule.mm +0 -1105
  237. package/platforms/ios/src/cpp/ImageAssetImpl.mm +0 -417
  238. package/platforms/ios/src/cpp/ImageBitmapImpl.mm +0 -126
  239. package/platforms/ios/src/cpp/RafImpl.mm +0 -10
  240. package/platforms/ios/src/cpp/TextDecoderImpl.mm +0 -97
  241. package/platforms/ios/src/cpp/TextEncoderImpl.mm +0 -60
  242. package/platforms/ios/src/cpp/VecMutableBuffer.h +0 -46
  243. package/platforms/ios/src/cpp/canvas-cxx/src/lib.rs.cc +0 -6156
  244. package/platforms/ios/src/cpp/canvas-cxx/src/lib.rs.h +0 -2867
  245. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.mm +0 -42
  246. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.mm +0 -49
  247. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.mm +0 -1972
  248. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.mm +0 -68
  249. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.mm +0 -149
  250. package/platforms/ios/src/cpp/canvas2d/Path2D.mm +0 -335
  251. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.mm +0 -68
  252. package/platforms/ios/src/cpp/rust/cxx.cc +0 -793
  253. package/platforms/ios/src/cpp/rust/cxx.h +0 -1111
  254. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.mm +0 -39
  255. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.mm +0 -5958
  256. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.mm +0 -40
  257. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.mm +0 -108
  258. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.mm +0 -28
  259. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.mm +0 -42
  260. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.mm +0 -295
  261. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.mm +0 -40
  262. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.mm +0 -37
  263. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.mm +0 -28
  264. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.mm +0 -31
  265. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.mm +0 -28
  266. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.mm +0 -127
  267. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.mm +0 -45
  268. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.mm +0 -45
  269. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.mm +0 -31
  270. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.mm +0 -70
  271. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.mm +0 -47
  272. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.mm +0 -46
  273. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.mm +0 -49
  274. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.mm +0 -30
  275. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.mm +0 -177
  276. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.mm +0 -64
  277. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.mm +0 -4543
  278. package/pods/Headers/jsi/decorator.h +0 -770
  279. package/pods/Headers/jsi/instrumentation.h +0 -117
  280. package/pods/Headers/jsi/jsi-inl.h +0 -338
  281. package/pods/Headers/jsi/jsi.h +0 -1571
  282. package/pods/Headers/jsi/jsilib.h +0 -59
  283. package/pods/Headers/jsi/threadsafe.h +0 -79
  284. package/pods/Headers/v8runtime/HostProxy.h +0 -71
  285. package/pods/Headers/v8runtime/JSIV8ValueConverter.h +0 -74
  286. package/pods/Headers/v8runtime/V8PointerValue.h +0 -44
  287. package/pods/Headers/v8runtime/V8Runtime.h +0 -240
  288. package/pods/Headers/v8runtime/V8RuntimeConfig.h +0 -26
  289. package/pods/Headers/v8runtime/V8RuntimeFactory.h +0 -21
  290. /package/platforms/ios/src/cpp/{OnRafCallback.mm → OnRafCallback.cpp} +0 -0
  291. /package/{pods → src-native/ios}/Headers/include/APIDesign.md +0 -0
  292. /package/{pods → src-native/ios}/Headers/include/DEPS +0 -0
  293. /package/{pods → src-native/ios}/Headers/include/DIR_METADATA +0 -0
  294. /package/{pods → src-native/ios}/Headers/include/OWNERS +0 -0
  295. /package/{pods → src-native/ios}/Headers/include/cppgc/DEPS +0 -0
  296. /package/{pods → src-native/ios}/Headers/include/cppgc/OWNERS +0 -0
  297. /package/{pods → src-native/ios}/Headers/include/cppgc/README.md +0 -0
  298. /package/{pods → src-native/ios}/Headers/include/cppgc/allocation.h +0 -0
  299. /package/{pods → src-native/ios}/Headers/include/cppgc/common.h +0 -0
  300. /package/{pods → src-native/ios}/Headers/include/cppgc/cross-thread-persistent.h +0 -0
  301. /package/{pods → src-native/ios}/Headers/include/cppgc/custom-space.h +0 -0
  302. /package/{pods → src-native/ios}/Headers/include/cppgc/default-platform.h +0 -0
  303. /package/{pods → src-native/ios}/Headers/include/cppgc/ephemeron-pair.h +0 -0
  304. /package/{pods → src-native/ios}/Headers/include/cppgc/explicit-management.h +0 -0
  305. /package/{pods → src-native/ios}/Headers/include/cppgc/garbage-collected.h +0 -0
  306. /package/{pods → src-native/ios}/Headers/include/cppgc/heap-consistency.h +0 -0
  307. /package/{pods → src-native/ios}/Headers/include/cppgc/heap-state.h +0 -0
  308. /package/{pods → src-native/ios}/Headers/include/cppgc/heap-statistics.h +0 -0
  309. /package/{pods → src-native/ios}/Headers/include/cppgc/heap.h +0 -0
  310. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/api-constants.h +0 -0
  311. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/atomic-entry-flag.h +0 -0
  312. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/caged-heap-local-data.h +0 -0
  313. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/compiler-specific.h +0 -0
  314. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/finalizer-trait.h +0 -0
  315. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/gc-info.h +0 -0
  316. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/logging.h +0 -0
  317. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/name-trait.h +0 -0
  318. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/persistent-node.h +0 -0
  319. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/pointer-policies.h +0 -0
  320. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/write-barrier.h +0 -0
  321. /package/{pods → src-native/ios}/Headers/include/cppgc/liveness-broker.h +0 -0
  322. /package/{pods → src-native/ios}/Headers/include/cppgc/macros.h +0 -0
  323. /package/{pods → src-native/ios}/Headers/include/cppgc/member.h +0 -0
  324. /package/{pods → src-native/ios}/Headers/include/cppgc/name-provider.h +0 -0
  325. /package/{pods → src-native/ios}/Headers/include/cppgc/object-size-trait.h +0 -0
  326. /package/{pods → src-native/ios}/Headers/include/cppgc/persistent.h +0 -0
  327. /package/{pods → src-native/ios}/Headers/include/cppgc/platform.h +0 -0
  328. /package/{pods → src-native/ios}/Headers/include/cppgc/prefinalizer.h +0 -0
  329. /package/{pods → src-native/ios}/Headers/include/cppgc/process-heap-statistics.h +0 -0
  330. /package/{pods → src-native/ios}/Headers/include/cppgc/sentinel-pointer.h +0 -0
  331. /package/{pods → src-native/ios}/Headers/include/cppgc/source-location.h +0 -0
  332. /package/{pods → src-native/ios}/Headers/include/cppgc/testing.h +0 -0
  333. /package/{pods → src-native/ios}/Headers/include/cppgc/trace-trait.h +0 -0
  334. /package/{pods → src-native/ios}/Headers/include/cppgc/type-traits.h +0 -0
  335. /package/{pods → src-native/ios}/Headers/include/cppgc/visitor.h +0 -0
  336. /package/{pods → src-native/ios}/Headers/include/js_protocol-1.2.json +0 -0
  337. /package/{pods → src-native/ios}/Headers/include/js_protocol-1.3.json +0 -0
  338. /package/{pods → src-native/ios}/Headers/include/js_protocol.pdl +0 -0
  339. /package/{pods → src-native/ios}/Headers/include/libffi/arm64/ffi.h +0 -0
  340. /package/{pods → src-native/ios}/Headers/include/libffi/arm64/ffitarget.h +0 -0
  341. /package/{pods → src-native/ios}/Headers/include/libffi/x86_64/ffi.h +0 -0
  342. /package/{pods → src-native/ios}/Headers/include/libffi/x86_64/ffitarget.h +0 -0
  343. /package/{pods → src-native/ios}/Headers/include/libffi.h +0 -0
  344. /package/{pods → src-native/ios}/Headers/include/libplatform/DEPS +0 -0
  345. /package/{pods → src-native/ios}/Headers/include/libplatform/libplatform-export.h +0 -0
  346. /package/{pods → src-native/ios}/Headers/include/libplatform/libplatform.h +0 -0
  347. /package/{pods → src-native/ios}/Headers/include/libplatform/v8-tracing.h +0 -0
  348. /package/{pods → src-native/ios}/Headers/include/v8-array-buffer.h +0 -0
  349. /package/{pods → src-native/ios}/Headers/include/v8-callbacks.h +0 -0
  350. /package/{pods → src-native/ios}/Headers/include/v8-container.h +0 -0
  351. /package/{pods → src-native/ios}/Headers/include/v8-context.h +0 -0
  352. /package/{pods → src-native/ios}/Headers/include/v8-cppgc.h +0 -0
  353. /package/{pods → src-native/ios}/Headers/include/v8-data.h +0 -0
  354. /package/{pods → src-native/ios}/Headers/include/v8-date.h +0 -0
  355. /package/{pods → src-native/ios}/Headers/include/v8-debug.h +0 -0
  356. /package/{pods → src-native/ios}/Headers/include/v8-embedder-heap.h +0 -0
  357. /package/{pods → src-native/ios}/Headers/include/v8-embedder-state-scope.h +0 -0
  358. /package/{pods → src-native/ios}/Headers/include/v8-exception.h +0 -0
  359. /package/{pods → src-native/ios}/Headers/include/v8-extension.h +0 -0
  360. /package/{pods → src-native/ios}/Headers/include/v8-external.h +0 -0
  361. /package/{pods → src-native/ios}/Headers/include/v8-fast-api-calls.h +0 -0
  362. /package/{pods → src-native/ios}/Headers/include/v8-forward.h +0 -0
  363. /package/{pods → src-native/ios}/Headers/include/v8-function-callback.h +0 -0
  364. /package/{pods → src-native/ios}/Headers/include/v8-function.h +0 -0
  365. /package/{pods → src-native/ios}/Headers/include/v8-initialization.h +0 -0
  366. /package/{pods → src-native/ios}/Headers/include/v8-inspector-protocol.h +0 -0
  367. /package/{pods → src-native/ios}/Headers/include/v8-inspector.h +0 -0
  368. /package/{pods → src-native/ios}/Headers/include/v8-internal.h +0 -0
  369. /package/{pods → src-native/ios}/Headers/include/v8-isolate.h +0 -0
  370. /package/{pods → src-native/ios}/Headers/include/v8-json.h +0 -0
  371. /package/{pods → src-native/ios}/Headers/include/v8-local-handle.h +0 -0
  372. /package/{pods → src-native/ios}/Headers/include/v8-locker.h +0 -0
  373. /package/{pods → src-native/ios}/Headers/include/v8-maybe.h +0 -0
  374. /package/{pods → src-native/ios}/Headers/include/v8-memory-span.h +0 -0
  375. /package/{pods → src-native/ios}/Headers/include/v8-message.h +0 -0
  376. /package/{pods → src-native/ios}/Headers/include/v8-metrics.h +0 -0
  377. /package/{pods → src-native/ios}/Headers/include/v8-microtask-queue.h +0 -0
  378. /package/{pods → src-native/ios}/Headers/include/v8-microtask.h +0 -0
  379. /package/{pods → src-native/ios}/Headers/include/v8-object.h +0 -0
  380. /package/{pods → src-native/ios}/Headers/include/v8-persistent-handle.h +0 -0
  381. /package/{pods → src-native/ios}/Headers/include/v8-platform.h +0 -0
  382. /package/{pods → src-native/ios}/Headers/include/v8-primitive-object.h +0 -0
  383. /package/{pods → src-native/ios}/Headers/include/v8-primitive.h +0 -0
  384. /package/{pods → src-native/ios}/Headers/include/v8-profiler.h +0 -0
  385. /package/{pods → src-native/ios}/Headers/include/v8-promise.h +0 -0
  386. /package/{pods → src-native/ios}/Headers/include/v8-proxy.h +0 -0
  387. /package/{pods → src-native/ios}/Headers/include/v8-regexp.h +0 -0
  388. /package/{pods → src-native/ios}/Headers/include/v8-script.h +0 -0
  389. /package/{pods → src-native/ios}/Headers/include/v8-snapshot.h +0 -0
  390. /package/{pods → src-native/ios}/Headers/include/v8-statistics.h +0 -0
  391. /package/{pods → src-native/ios}/Headers/include/v8-template.h +0 -0
  392. /package/{pods → src-native/ios}/Headers/include/v8-traced-handle.h +0 -0
  393. /package/{pods → src-native/ios}/Headers/include/v8-typed-array.h +0 -0
  394. /package/{pods → src-native/ios}/Headers/include/v8-unwinder-state.h +0 -0
  395. /package/{pods → src-native/ios}/Headers/include/v8-unwinder.h +0 -0
  396. /package/{pods → src-native/ios}/Headers/include/v8-util.h +0 -0
  397. /package/{pods → src-native/ios}/Headers/include/v8-value-serializer-version.h +0 -0
  398. /package/{pods → src-native/ios}/Headers/include/v8-value-serializer.h +0 -0
  399. /package/{pods → src-native/ios}/Headers/include/v8-value.h +0 -0
  400. /package/{pods → src-native/ios}/Headers/include/v8-version-string.h +0 -0
  401. /package/{pods → src-native/ios}/Headers/include/v8-version.h +0 -0
  402. /package/{pods → src-native/ios}/Headers/include/v8-wasm-trap-handler-posix.h +0 -0
  403. /package/{pods → src-native/ios}/Headers/include/v8-wasm-trap-handler-win.h +0 -0
  404. /package/{pods → src-native/ios}/Headers/include/v8-wasm.h +0 -0
  405. /package/{pods → src-native/ios}/Headers/include/v8-weak-callback-info.h +0 -0
  406. /package/{pods → src-native/ios}/Headers/include/v8.h +0 -0
  407. /package/{pods → src-native/ios}/Headers/include/v8config.h +0 -0
  408. /package/{pods → src-native/ios}/Headers/inspector/InspectorServer.h +0 -0
  409. /package/{pods → src-native/ios}/Headers/inspector/JsV8InspectorClient.h +0 -0
  410. /package/{pods → src-native/ios}/Headers/inspector/base/trace_event/common/trace_event_common.h +0 -0
  411. /package/{pods → src-native/ios}/Headers/inspector/base64.h +0 -0
  412. /package/{pods → src-native/ios}/Headers/inspector/src/base/address-region.h +0 -0
  413. /package/{pods → src-native/ios}/Headers/inspector/src/base/atomic-utils.h +0 -0
  414. /package/{pods → src-native/ios}/Headers/inspector/src/base/atomicops.h +0 -0
  415. /package/{pods → src-native/ios}/Headers/inspector/src/base/atomicops_internals_atomicword_compat.h +0 -0
  416. /package/{pods → src-native/ios}/Headers/inspector/src/base/base-export.h +0 -0
  417. /package/{pods → src-native/ios}/Headers/inspector/src/base/bits.h +0 -0
  418. /package/{pods → src-native/ios}/Headers/inspector/src/base/build_config.h +0 -0
  419. /package/{pods → src-native/ios}/Headers/inspector/src/base/compiler-specific.h +0 -0
  420. /package/{pods → src-native/ios}/Headers/inspector/src/base/export-template.h +0 -0
  421. /package/{pods → src-native/ios}/Headers/inspector/src/base/flags.h +0 -0
  422. /package/{pods → src-native/ios}/Headers/inspector/src/base/immediate-crash.h +0 -0
  423. /package/{pods → src-native/ios}/Headers/inspector/src/base/lazy-instance.h +0 -0
  424. /package/{pods → src-native/ios}/Headers/inspector/src/base/logging.h +0 -0
  425. /package/{pods → src-native/ios}/Headers/inspector/src/base/macros.h +0 -0
  426. /package/{pods → src-native/ios}/Headers/inspector/src/base/memory.h +0 -0
  427. /package/{pods → src-native/ios}/Headers/inspector/src/base/once.h +0 -0
  428. /package/{pods → src-native/ios}/Headers/inspector/src/base/optional.h +0 -0
  429. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/mutex.h +0 -0
  430. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/platform.h +0 -0
  431. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/semaphore.h +0 -0
  432. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/v8-time.h +0 -0
  433. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/wrappers.h +0 -0
  434. /package/{pods → src-native/ios}/Headers/inspector/src/base/safe_conversions.h +0 -0
  435. /package/{pods → src-native/ios}/Headers/inspector/src/base/safe_conversions_impl.h +0 -0
  436. /package/{pods → src-native/ios}/Headers/inspector/src/base/template-utils.h +0 -0
  437. /package/{pods → src-native/ios}/Headers/inspector/src/base/v8-fallthrough.h +0 -0
  438. /package/{pods → src-native/ios}/Headers/inspector/src/common/checks.h +0 -0
  439. /package/{pods → src-native/ios}/Headers/inspector/src/common/globals.h +0 -0
  440. /package/{pods → src-native/ios}/Headers/inspector/src/debug/debug-interface.h +0 -0
  441. /package/{pods → src-native/ios}/Headers/inspector/src/debug/interface-types.h +0 -0
  442. /package/{pods → src-native/ios}/Headers/inspector/src/init/v8.h +0 -0
  443. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/custom-preview.h +0 -0
  444. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/injected-script.h +0 -0
  445. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/inspected-context.h +0 -0
  446. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/CSS.h +0 -0
  447. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Console.h +0 -0
  448. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/DOM.h +0 -0
  449. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Debugger.h +0 -0
  450. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Forward.h +0 -0
  451. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/HeapProfiler.h +0 -0
  452. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Log.h +0 -0
  453. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Network.h +0 -0
  454. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Overlay.h +0 -0
  455. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Page.h +0 -0
  456. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Profiler.h +0 -0
  457. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Protocol.h +0 -0
  458. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Runtime.h +0 -0
  459. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Schema.h +0 -0
  460. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Security.h +0 -0
  461. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/remote-object-id.h +0 -0
  462. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/search-util.h +0 -0
  463. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/string-16.h +0 -0
  464. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/string-util.h +0 -0
  465. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-console-agent-impl.h +0 -0
  466. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-console-message.h +0 -0
  467. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-console.h +0 -0
  468. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-css-agent-impl.h +0 -0
  469. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger-agent-impl.h +0 -0
  470. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger-id.h +0 -0
  471. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger-script.h +0 -0
  472. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger.h +0 -0
  473. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-dom-agent-impl.h +0 -0
  474. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-heap-profiler-agent-impl.h +0 -0
  475. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-inspector-impl.h +0 -0
  476. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-inspector-session-impl.h +0 -0
  477. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-log-agent-impl.h +0 -0
  478. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-network-agent-impl.h +0 -0
  479. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-ns-debugger-agent-impl.h +0 -0
  480. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-overlay-agent-impl.h +0 -0
  481. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-page-agent-impl.h +0 -0
  482. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-profiler-agent-impl.h +0 -0
  483. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-regex.h +0 -0
  484. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-runtime-agent-impl.h +0 -0
  485. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-schema-agent-impl.h +0 -0
  486. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-stack-trace-impl.h +0 -0
  487. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-string-conversions.h +0 -0
  488. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-value-utils.h +0 -0
  489. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/value-mirror.h +0 -0
  490. /package/{pods → src-native/ios}/Headers/inspector/src/libplatform/default-platform.h +0 -0
  491. /package/{pods → src-native/ios}/Headers/inspector/src/logging/tracing-flags.h +0 -0
  492. /package/{pods → src-native/ios}/Headers/inspector/src/numbers/conversions.h +0 -0
  493. /package/{pods → src-native/ios}/Headers/inspector/src/tracing/trace-event.h +0 -0
  494. /package/{pods → src-native/ios}/Headers/inspector/src/utils/allocation.h +0 -0
  495. /package/{pods → src-native/ios}/Headers/inspector/src/utils/vector.h +0 -0
  496. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/cbor.h +0 -0
  497. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/dispatch.h +0 -0
  498. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/error_support.h +0 -0
  499. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/export.h +0 -0
  500. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/find_by_first.h +0 -0
  501. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/frontend_channel.h +0 -0
  502. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/glue.h +0 -0
  503. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/json.h +0 -0
  504. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/json_platform.h +0 -0
  505. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/maybe.h +0 -0
  506. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/parser_handler.h +0 -0
  507. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/protocol_core.h +0 -0
  508. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/serializable.h +0 -0
  509. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/serializer_traits.h +0 -0
  510. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/span.h +0 -0
  511. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/status.h +0 -0
  512. /package/{pods → src-native/ios}/Headers/inspector/utils.h +0 -0
  513. /package/{pods → src-native/ios}/Headers/inspector/v8-inspector-platform.h +0 -0
  514. /package/{pods → src-native/ios}/Headers/runtime/ArgConverter.h +0 -0
  515. /package/{pods → src-native/ios}/Headers/runtime/ArrayAdapter.h +0 -0
  516. /package/{pods → src-native/ios}/Headers/runtime/Caches.h +0 -0
  517. /package/{pods → src-native/ios}/Headers/runtime/ClassBuilder.h +0 -0
  518. /package/{pods → src-native/ios}/Headers/runtime/Common.h +0 -0
  519. /package/{pods → src-native/ios}/Headers/runtime/ConcurrentMap.h +0 -0
  520. /package/{pods → src-native/ios}/Headers/runtime/ConcurrentQueue.h +0 -0
  521. /package/{pods → src-native/ios}/Headers/runtime/Console.h +0 -0
  522. /package/{pods → src-native/ios}/Headers/runtime/Constants.h +0 -0
  523. /package/{pods → src-native/ios}/Headers/runtime/DataWrapper.h +0 -0
  524. /package/{pods → src-native/ios}/Headers/runtime/DictionaryAdapter.h +0 -0
  525. /package/{pods → src-native/ios}/Headers/runtime/ExtVector.h +0 -0
  526. /package/{pods → src-native/ios}/Headers/runtime/FFICall.h +0 -0
  527. /package/{pods → src-native/ios}/Headers/runtime/FastEnumerationAdapter.h +0 -0
  528. /package/{pods → src-native/ios}/Headers/runtime/FunctionReference.h +0 -0
  529. /package/{pods → src-native/ios}/Headers/runtime/Helpers.h +0 -0
  530. /package/{pods → src-native/ios}/Headers/runtime/InlineFunctions.h +0 -0
  531. /package/{pods → src-native/ios}/Headers/runtime/Interop.h +0 -0
  532. /package/{pods → src-native/ios}/Headers/runtime/KnownUnknownClassPair.h +0 -0
  533. /package/{pods → src-native/ios}/Headers/runtime/Metadata.h +0 -0
  534. /package/{pods → src-native/ios}/Headers/runtime/MetadataBuilder.h +0 -0
  535. /package/{pods → src-native/ios}/Headers/runtime/MetadataInlines.h +0 -0
  536. /package/{pods → src-native/ios}/Headers/runtime/ModuleInternal.h +0 -0
  537. /package/{pods → src-native/ios}/Headers/runtime/NSDataAdapter.h +0 -0
  538. /package/{pods → src-native/ios}/Headers/runtime/NativeScriptException.h +0 -0
  539. /package/{pods → src-native/ios}/Headers/runtime/ObjectManager.h +0 -0
  540. /package/{pods → src-native/ios}/Headers/runtime/OneByteStringResource.h +0 -0
  541. /package/{pods → src-native/ios}/Headers/runtime/Pointer.h +0 -0
  542. /package/{pods → src-native/ios}/Headers/runtime/PromiseProxy.h +0 -0
  543. /package/{pods → src-native/ios}/Headers/runtime/Reference.h +0 -0
  544. /package/{pods → src-native/ios}/Headers/runtime/Runtime.h +0 -0
  545. /package/{pods → src-native/ios}/Headers/runtime/RuntimeConfig.h +0 -0
  546. /package/{pods → src-native/ios}/Headers/runtime/SetTimeout.h +0 -0
  547. /package/{pods → src-native/ios}/Headers/runtime/SimpleAllocator.h +0 -0
  548. /package/{pods → src-native/ios}/Headers/runtime/StringHasher.h +0 -0
  549. /package/{pods → src-native/ios}/Headers/runtime/SymbolIterator.h +0 -0
  550. /package/{pods → src-native/ios}/Headers/runtime/SymbolLoader.h +0 -0
  551. /package/{pods → src-native/ios}/Headers/runtime/TNSDerivedClass.h +0 -0
  552. /package/{pods → src-native/ios}/Headers/runtime/TSHelpers.h +0 -0
  553. /package/{pods → src-native/ios}/Headers/runtime/Tasks.h +0 -0
  554. /package/{pods → src-native/ios}/Headers/runtime/UnmanagedType.h +0 -0
  555. /package/{pods → src-native/ios}/Headers/runtime/WeakRef.h +0 -0
  556. /package/{pods → src-native/ios}/Headers/runtime/Worker.h +0 -0
  557. /package/{pods → src-native/ios}/Headers/runtime/robin_hood.h +0 -0
@@ -0,0 +1,1593 @@
1
+ //
2
+ // Created by Osei Fortune on 25/02/2023.
3
+ //
4
+
5
+ #include "CanvasJSIModule.h"
6
+ #include "JSICallback.h"
7
+ #include "JSIRuntime.h"
8
+ #include "JSIReadFileCallback.h"
9
+ #include "Helpers.h"
10
+ #include "PerIsolateData.h"
11
+
12
+ void CanvasJSIModule::install(v8::Isolate *isolate) {
13
+
14
+ auto context = isolate->GetCurrentContext();
15
+ auto global = context->Global();
16
+
17
+ if (!global->
18
+ HasOwnProperty(context, ConvertToV8String(isolate, "CanvasJSIModule")).FromMaybe(
19
+ false)) {
20
+
21
+
22
+ v8::Locker locker(isolate);
23
+ v8::Isolate::Scope isolate_scope(isolate);
24
+ v8::HandleScope handle_scope(isolate);
25
+
26
+ auto v8Global = context->Global();
27
+
28
+ auto canvasMod = v8::Object::New(isolate);
29
+ TextDecoderImpl::Init(canvasMod, isolate);
30
+ TextEncoderImpl::Init(canvasMod, isolate);
31
+ Path2D::Init(canvasMod, isolate);
32
+ ImageDataImpl::Init(canvasMod, isolate);
33
+ ImageAssetImpl::Init(canvasMod, isolate);
34
+ CanvasGradient::Init(canvasMod, isolate);
35
+ CanvasPattern::Init(canvasMod, isolate);
36
+ MatrixImpl::Init(canvasMod, isolate);
37
+ TextMetricsImpl::Init(canvasMod, isolate);
38
+ URLImpl::Init(canvasMod, isolate);
39
+
40
+ // always use the last slot
41
+ auto lastSlot = isolate->GetNumberOfDataSlots() - 1;
42
+ auto data = new PerIsolateData(isolate);
43
+ isolate->SetData(lastSlot, data);
44
+
45
+ v8Global->Set(context, ConvertToV8String(isolate, "CanvasModule"), canvasMod);
46
+ canvasMod->Set(context, ConvertToV8String(isolate, "create2DContext"),
47
+ v8::FunctionTemplate::New(isolate, &Create2DContext)->GetFunction(
48
+ context).ToLocalChecked());
49
+ canvasMod->Set(context, ConvertToV8String(isolate, "createImageBitmap"),
50
+ v8::FunctionTemplate::New(isolate, &CreateImageBitmap)->GetFunction(
51
+ context).ToLocalChecked());
52
+ canvasMod->Set(context, ConvertToV8String(isolate, "create2DContextWithPointer"),
53
+ v8::FunctionTemplate::New(isolate, &Create2DContextWithPointer)->GetFunction(
54
+ context).ToLocalChecked());
55
+ canvasMod->Set(context, ConvertToV8String(isolate, "readFile"),
56
+ v8::FunctionTemplate::New(isolate, &ReadFile)->GetFunction(
57
+ context).ToLocalChecked());
58
+
59
+ canvasMod->Set(context, ConvertToV8String(isolate, "createWebGLContext"),
60
+ v8::FunctionTemplate::New(isolate, &CreateWebGLContext)->GetFunction(
61
+ context).ToLocalChecked());
62
+
63
+ canvasMod->Set(context, ConvertToV8String(isolate, "createWebGL2Context"),
64
+ v8::FunctionTemplate::New(isolate, &CreateWebGL2Context)->GetFunction(
65
+ context).ToLocalChecked());
66
+
67
+
68
+ canvasMod->Set(context, ConvertToV8String(isolate, "__addFontFamily"),
69
+ v8::FunctionTemplate::New(isolate, &AddFontFamily)->GetFunction(
70
+ context).ToLocalChecked());
71
+
72
+ global->Set(context,
73
+ ConvertToV8String(isolate, "CanvasModule"), canvasMod);
74
+
75
+ }
76
+ }
77
+
78
+
79
+ void CanvasJSIModule::AddFontFamily(const v8::FunctionCallbackInfo<v8::Value> &args) {
80
+ auto isolate = args.GetIsolate();
81
+ auto context = isolate->GetCurrentContext();
82
+ auto aliasValue = args[0];
83
+ auto familyValue = args[1];
84
+
85
+ // todo improve
86
+ if (familyValue->IsArray()) {
87
+ auto family = familyValue.As<v8::Array>();
88
+ auto len = family->Length();
89
+ std::vector<std::string> buf;
90
+ std::vector<const char *> buffer;
91
+ buf.reserve(len);
92
+
93
+ for (uint32_t i = 0; i < len; i++) {
94
+ buf.emplace_back(
95
+ ConvertFromV8String(isolate, family->Get(context, i).ToLocalChecked()));
96
+ buffer.emplace_back(buf[0].c_str());
97
+ }
98
+
99
+ if (aliasValue->IsString()) {
100
+ auto alias = ConvertFromV8String(isolate, aliasValue);
101
+ canvas_native_font_add_family(alias.c_str(), buffer.data(), buffer.size());
102
+ } else {
103
+ canvas_native_font_add_family(nullptr, buffer.data(), buffer.size());
104
+ }
105
+
106
+ }
107
+
108
+ }
109
+
110
+ void CanvasJSIModule::Create2DContext(const v8::FunctionCallbackInfo<v8::Value> &args) {
111
+ auto isolate = args.GetIsolate();
112
+ auto context = isolate->GetCurrentContext();
113
+ auto ptr = args[0].As<v8::BigInt>()->Int64Value();
114
+ auto width = (float) args[1]->NumberValue(context).ToChecked();
115
+ auto height = (float) args[2]->NumberValue(context).ToChecked();
116
+ auto density = (float) args[3]->NumberValue(context).ToChecked();
117
+ auto samples = (int) args[4]->NumberValue(context).ToChecked();
118
+ auto alpha = (bool) args[5]->BooleanValue(isolate);
119
+ auto font_color = (int) args[6]->NumberValue(context).ToChecked();
120
+ auto ppi = (float) args[7]->NumberValue(context).ToChecked();
121
+ auto direction = (int) args[8]->NumberValue(context).ToChecked();
122
+
123
+ auto context_2d = canvas_native_context_create_gl(width, height, density,
124
+ ptr,
125
+ samples, alpha,
126
+ font_color, ppi, direction);
127
+
128
+ auto ret = CanvasRenderingContext2DImpl::NewInstance(isolate, new CanvasRenderingContext2DImpl(
129
+ context_2d));
130
+
131
+ args.GetReturnValue().Set(ret);
132
+ }
133
+
134
+ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value> &args) {
135
+ auto count = args.Length();
136
+ auto isolate = args.GetIsolate();
137
+ auto context = isolate->GetCurrentContext();
138
+
139
+ auto image = args[0];
140
+ auto sx_or_options = args[1];
141
+ auto sy = args[2];
142
+ auto sw = args[3];
143
+ auto sh = args[4];
144
+
145
+ auto len = count - 1;
146
+ auto cb = args[count - 1];
147
+
148
+ if ((len == 1 && !image->IsObject()) || image->IsFunction()) {
149
+ isolate->ThrowError("Illegal constructor");
150
+ return;
151
+ }
152
+
153
+ Options options;
154
+
155
+ if (len == 0) {
156
+ isolate->ThrowError("Illegal constructor");
157
+ return;
158
+ }
159
+
160
+ if (!cb->IsObject() && !cb->IsFunction()) {
161
+ isolate->ThrowError("Illegal constructor");
162
+ return;
163
+ }
164
+
165
+
166
+ if (image->IsNullOrUndefined()) {
167
+ v8::Local<v8::Value> ret[2] = {ConvertToV8String(isolate, "Failed to load image"),
168
+ v8::Undefined(isolate)};
169
+
170
+ cb.As<v8::Function>()->Call(context, context->Global(), 2, ret);
171
+ return;
172
+ }
173
+
174
+ if (len >= 4 && (sw->IsNumber() && sw->IsNumber() == 0)) {
175
+
176
+ v8::Local<v8::Value> ret[2] = {ConvertToV8String(isolate,
177
+ "Failed to execute 'createImageBitmap' : The crop rect width is 0"),
178
+ v8::Undefined(isolate)};
179
+
180
+ cb.As<v8::Function>()->Call(context, context->Global(), 2, ret);
181
+
182
+ return;
183
+ }
184
+ if (len >= 5 && (sh->IsNumber() && sh->IsNumber() == 0)) {
185
+ v8::Local<v8::Value> ret[2] = {ConvertToV8String(isolate,
186
+ "Failed to execute 'createImageBitmap' : The crop rect height is 0"),
187
+ v8::Undefined(isolate)};
188
+
189
+ cb.As<v8::Function>()->Call(context, context->Global(), 2, ret);
190
+ return;
191
+ }
192
+
193
+
194
+ if (image->IsObject()) {
195
+ auto imageObject = image.As<v8::Object>();
196
+ auto isArrayBuffer = imageObject->IsArrayBuffer();
197
+ auto IsArrayBufferView = imageObject->IsArrayBufferView();
198
+ if (isArrayBuffer || IsArrayBufferView) {
199
+
200
+ if (len == 1 || len == 2) {
201
+ if (len == 2) {
202
+ options = ImageBitmapImpl::HandleOptions(isolate, args[1]);
203
+ }
204
+
205
+ auto asset = canvas_native_image_asset_create();
206
+
207
+ auto shared_asset = canvas_native_image_asset_shared_clone(asset);
208
+
209
+ auto ret = new ImageBitmapImpl(asset);
210
+
211
+
212
+ auto cbFunc = args[count - 1].As<v8::Function>();
213
+ auto data = v8::External::New(isolate, ret);
214
+
215
+ auto jsi_callback = new JSICallback(isolate, cbFunc, data);
216
+
217
+
218
+ #ifdef __ANDROID__
219
+ ALooper_addFd(jsi_callback->looper_,
220
+ jsi_callback->fd_[0],
221
+ ALOOPER_POLL_CALLBACK,
222
+ ALOOPER_EVENT_INPUT,
223
+ [](int fd, int events,
224
+ void *data) {
225
+ auto cb = static_cast<JSICallback *>(data);
226
+ bool done;
227
+ read(fd, &done,
228
+ sizeof(bool));
229
+
230
+
231
+ v8::Isolate *isolate = cb->isolate_;
232
+ v8::Locker locker(isolate);
233
+ v8::Isolate::Scope isolate_scope(isolate);
234
+ v8::HandleScope handle_scope(isolate);
235
+ v8::Local<v8::Function> callback = cb->callback_->Get(isolate);
236
+ v8::Local<v8::External> cbData = cb->data_->Get(
237
+ isolate).As<v8::External>();
238
+ v8::Local<v8::Context> context = callback->GetCreationContextChecked();
239
+ v8::Context::Scope context_scope(context);
240
+
241
+ auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
242
+
243
+ v8::Local<v8::Value> args[2];
244
+
245
+ if (done) {
246
+ args[0] = v8::Null(isolate);
247
+ args[1] = ret;
248
+
249
+ } else {
250
+ args[0] = v8::Exception::Error(
251
+ ConvertToV8String(isolate, "Failed to load image"));
252
+ args[1] = v8::Null(isolate);
253
+ }
254
+
255
+
256
+ callback->Call(context, context->Global(), 2, args);
257
+
258
+ delete static_cast<JSICallback *>(data);
259
+ return 0;
260
+ }, jsi_callback);
261
+
262
+ ALooper_wake(jsi_callback->looper_);
263
+
264
+ if (isArrayBuffer) {
265
+ auto arrayBuffer = imageObject.As<v8::ArrayBuffer>();
266
+ auto store = arrayBuffer->GetBackingStore();
267
+ auto dataBuffer = (uint8_t *) store->Data();
268
+ v8::Global<v8::ArrayBuffer> ab(isolate, arrayBuffer);
269
+ std::thread thread(
270
+ [&dataBuffer, jsi_callback, &options, store, shared_asset](
271
+ v8::Global<v8::ArrayBuffer> ab, size_t size) {
272
+
273
+
274
+ auto done = canvas_native_image_bitmap_create_from_encoded_bytes_with_output(
275
+ dataBuffer, size,
276
+ options.flipY,
277
+ options.premultiplyAlpha,
278
+ options.colorSpaceConversion,
279
+ options.resizeQuality,
280
+ options.resizeWidth,
281
+ options.resizeHeight,
282
+ shared_asset);
283
+
284
+ canvas_native_image_asset_destroy(shared_asset);
285
+
286
+ write(jsi_callback->fd_[1],
287
+ &done,
288
+ sizeof(bool));
289
+
290
+
291
+ }, std::move(ab), arrayBuffer->ByteLength());
292
+
293
+ thread.detach();
294
+ return;
295
+ }
296
+
297
+
298
+ auto ta = imageObject.As<v8::ArrayBufferView>();
299
+
300
+
301
+ auto array = ta->Buffer();
302
+ auto offset = ta->ByteOffset();
303
+ auto size = ta->ByteLength();
304
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
305
+
306
+
307
+ v8::Global<v8::ArrayBufferView> ab(isolate, ta);
308
+
309
+ std::thread thread(
310
+ [jsi_callback, &options, shared_asset, data_ptr, size](
311
+ v8::Global<v8::ArrayBufferView> ab) {
312
+
313
+ auto done = canvas_native_image_bitmap_create_from_encoded_bytes_with_output(
314
+ data_ptr, size,
315
+ options.flipY,
316
+ options.premultiplyAlpha,
317
+ options.colorSpaceConversion,
318
+ options.resizeQuality,
319
+ options.resizeWidth,
320
+ options.resizeHeight,
321
+ shared_asset);
322
+
323
+ canvas_native_image_asset_destroy(shared_asset);
324
+
325
+ write(jsi_callback->fd_[1],
326
+ &done,
327
+ sizeof(bool));
328
+
329
+
330
+ }, std::move(ab));
331
+ thread.detach();
332
+
333
+ #endif
334
+
335
+
336
+ #ifdef __APPLE__
337
+
338
+ auto current_queue = new NSOperationQueueWrapper(true);
339
+
340
+
341
+ if (isArrayBuffer) {
342
+ auto arrayBuffer = imageObject.As<v8::ArrayBuffer>();
343
+ auto store = arrayBuffer->GetBackingStore();
344
+ auto dataBuffer = (uint8_t *) store->Data();
345
+ v8::Global<v8::ArrayBuffer> ab(isolate, arrayBuffer);
346
+
347
+ std::thread thread(
348
+ [&dataBuffer, jsi_callback, &options, store, shared_asset, current_queue](
349
+ v8::Global<v8::ArrayBuffer> ab, size_t size
350
+ ) {
351
+
352
+ auto done = canvas_native_image_bitmap_create_from_encoded_bytes_with_output(
353
+ dataBuffer, size,
354
+ options.flipY,
355
+ options.premultiplyAlpha,
356
+ options.colorSpaceConversion,
357
+ options.resizeQuality,
358
+ options.resizeWidth,
359
+ options.resizeHeight,
360
+ shared_asset);
361
+
362
+ canvas_native_image_asset_destroy(shared_asset);
363
+
364
+
365
+ auto main_task = [jsi_callback, current_queue, done]() {
366
+
367
+
368
+ v8::Isolate *isolate = jsi_callback->isolate_;
369
+ v8::Locker locker(isolate);
370
+ v8::Isolate::Scope isolate_scope(isolate);
371
+ v8::HandleScope handle_scope(isolate);
372
+ v8::Local<v8::Function> callback = jsi_callback->callback_->Get(isolate);
373
+ v8::Local<v8::External> cbData = jsi_callback->data_->Get(
374
+ isolate).As<v8::External>();
375
+ v8::Local<v8::Context> context = callback->GetCreationContextChecked();
376
+ v8::Context::Scope context_scope(context);
377
+
378
+ auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
379
+
380
+ v8::Local<v8::Value> args[2];
381
+
382
+ if (done) {
383
+ args[0] = v8::Null(isolate);
384
+ args[1] = ret;
385
+
386
+ } else {
387
+ args[0] = v8::Exception::Error(
388
+ ConvertToV8String(isolate, "Failed to load image"));
389
+ args[1] = v8::Null(isolate);
390
+ }
391
+
392
+
393
+ callback->Call(context, context->Global(), 2, args);
394
+
395
+
396
+ delete jsi_callback;
397
+ delete current_queue;
398
+
399
+ };
400
+ current_queue->addOperation(main_task);
401
+
402
+ }, std::move(ab), arrayBuffer->ByteLength());
403
+
404
+ thread.detach();
405
+
406
+ return;
407
+ }
408
+
409
+ auto ta = imageObject.As<v8::ArrayBufferView>();
410
+
411
+
412
+ auto array = ta->Buffer();
413
+ auto offset = ta->ByteOffset();
414
+ auto size = ta->ByteLength();
415
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
416
+
417
+
418
+ v8::Global<v8::ArrayBufferView> ab(isolate, ta);
419
+
420
+
421
+ std::thread thread(
422
+ [jsi_callback, &options, shared_asset, data_ptr, size, current_queue](
423
+ v8::Global<v8::ArrayBufferView> ab
424
+ ) {
425
+
426
+ auto done = canvas_native_image_bitmap_create_from_encoded_bytes_with_output(
427
+ data_ptr, size,
428
+ options.flipY,
429
+ options.premultiplyAlpha,
430
+ options.colorSpaceConversion,
431
+ options.resizeQuality,
432
+ options.resizeWidth,
433
+ options.resizeHeight,
434
+ shared_asset);
435
+
436
+ canvas_native_image_asset_destroy(shared_asset);
437
+
438
+ auto main_task = [jsi_callback, current_queue, done]() {
439
+
440
+
441
+ v8::Isolate *isolate = jsi_callback->isolate_;
442
+ v8::Locker locker(isolate);
443
+ v8::Isolate::Scope isolate_scope(isolate);
444
+ v8::HandleScope handle_scope(isolate);
445
+ v8::Local<v8::Function> callback = jsi_callback->callback_->Get(isolate);
446
+ v8::Local<v8::External> cbData = jsi_callback->data_->Get(
447
+ isolate).As<v8::External>();
448
+ v8::Local<v8::Context> context = callback->GetCreationContextChecked();
449
+ v8::Context::Scope context_scope(context);
450
+
451
+ auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
452
+
453
+ v8::Local<v8::Value> args[2];
454
+
455
+ if (done) {
456
+ args[0] = v8::Null(isolate);
457
+ args[1] = ret;
458
+ } else {
459
+ args[0] = v8::Exception::Error(
460
+ ConvertToV8String(isolate, "Failed to load image"));
461
+ args[1] = v8::Null(isolate);
462
+ }
463
+
464
+ callback->Call(context, context->Global(), 2, args);
465
+
466
+
467
+ delete jsi_callback;
468
+ delete current_queue;
469
+
470
+ };
471
+ current_queue->addOperation(main_task);
472
+
473
+
474
+
475
+ }, std::move(ab));
476
+ thread.detach();
477
+
478
+ #endif
479
+
480
+ return;
481
+ } else if (len == 5 || len == 6) {
482
+ auto asset = canvas_native_image_asset_create();
483
+
484
+ auto shared_asset = canvas_native_image_asset_shared_clone(asset);
485
+
486
+ auto ret = new ImageBitmapImpl(asset);
487
+
488
+ auto cbFunc = args[count - 1].As<v8::Function>();
489
+ auto data = v8::External::New(isolate, ret);
490
+ if (len == 6) {
491
+ options = ImageBitmapImpl::HandleOptions(isolate, args[5]);
492
+ }
493
+
494
+ auto jsi_callback = new JSICallback(isolate, cbFunc, data);
495
+
496
+
497
+ #ifdef __ANDROID__
498
+ ALooper_addFd(jsi_callback->looper_,
499
+ jsi_callback->fd_[0],
500
+ ALOOPER_POLL_CALLBACK,
501
+ ALOOPER_EVENT_INPUT,
502
+ [](int fd, int events,
503
+ void *data) {
504
+ auto cb = static_cast<JSICallback *>(data);
505
+ bool done;
506
+ read(fd, &done,
507
+ sizeof(bool));
508
+
509
+ v8::Isolate *isolate = cb->isolate_;
510
+ v8::Locker locker(isolate);
511
+ v8::Isolate::Scope isolate_scope(isolate);
512
+ v8::HandleScope handle_scope(isolate);
513
+ v8::Local<v8::Function> callback = cb->callback_->Get(isolate);
514
+ v8::Local<v8::External> cbData = cb->data_->Get(
515
+ isolate).As<v8::External>();
516
+ v8::Local<v8::Context> context = callback->GetCreationContextChecked();
517
+ v8::Context::Scope context_scope(context);
518
+
519
+ auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
520
+
521
+ v8::Local<v8::Value> args[2];
522
+
523
+ if (done) {
524
+ args[0] = v8::Null(isolate);
525
+ args[1] = ret;
526
+ } else {
527
+ args[0] = v8::Exception::Error(
528
+ ConvertToV8String(isolate, "Failed to load image"));
529
+ args[1] = v8::Null(isolate);
530
+ }
531
+
532
+ callback->Call(context, context->Global(), 2, args);
533
+
534
+ delete static_cast<JSICallback *>(data);
535
+ return 0;
536
+ }, jsi_callback);
537
+
538
+ ALooper_wake(jsi_callback->looper_);
539
+
540
+ auto bufferValue = args[0];
541
+
542
+ if (isArrayBuffer) {
543
+ auto arrayBuffer = bufferValue.As<v8::ArrayBuffer>();
544
+ auto dataBuffer = (uint8_t *) arrayBuffer->GetBackingStore()->Data();
545
+ v8::Global<v8::ArrayBuffer> ab(isolate, arrayBuffer);
546
+ std::thread thread(
547
+ [&dataBuffer, jsi_callback, &options, shared_asset](
548
+ float sx_or_options,
549
+ float sy,
550
+ float sw,
551
+ float sh,
552
+ v8::Global<v8::ArrayBuffer> ab,
553
+ size_t size
554
+ ) {
555
+
556
+ auto done = canvas_native_image_bitmap_create_from_encoded_bytes_src_rect_with_output(
557
+ dataBuffer, size,
558
+ sx_or_options,
559
+ sy,
560
+ sw,
561
+ sh,
562
+ options.flipY,
563
+ options.premultiplyAlpha,
564
+ options.colorSpaceConversion,
565
+ options.resizeQuality,
566
+ options.resizeWidth,
567
+ options.resizeHeight, shared_asset);
568
+
569
+ canvas_native_image_asset_destroy(shared_asset);
570
+
571
+
572
+ write(jsi_callback->fd_[1],
573
+ &done,
574
+ sizeof(bool));
575
+
576
+ },
577
+ (float) sx_or_options->NumberValue(context).ToChecked(),
578
+ (float) sy->NumberValue(context).ToChecked(),
579
+ (float) sw->NumberValue(context).ToChecked(),
580
+ (float) sh->NumberValue(context).ToChecked(), std::move(ab),
581
+ arrayBuffer->ByteLength());
582
+
583
+ thread.detach();
584
+
585
+ return;
586
+ }
587
+
588
+ auto ta = bufferValue.As<v8::ArrayBufferView>();
589
+
590
+ auto array = ta->Buffer();
591
+ auto offset = ta->ByteOffset();
592
+ auto size = ta->ByteLength();
593
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
594
+
595
+
596
+ v8::Global<v8::ArrayBufferView> ab(isolate, ta);
597
+ std::thread thread(
598
+ [jsi_callback, &options, shared_asset, data_ptr, size](
599
+ float sx_or_options,
600
+ float sy,
601
+ float sw,
602
+ float sh,
603
+ v8::Global<v8::ArrayBufferView> ab
604
+ ) {
605
+
606
+ auto done = canvas_native_image_bitmap_create_from_encoded_bytes_src_rect_with_output(
607
+ data_ptr, size,
608
+ sx_or_options,
609
+ sy,
610
+ sw,
611
+ sh,
612
+ options.flipY,
613
+ options.premultiplyAlpha,
614
+ options.colorSpaceConversion,
615
+ options.resizeQuality,
616
+ options.resizeWidth,
617
+ options.resizeHeight, shared_asset);
618
+
619
+ canvas_native_image_asset_destroy(shared_asset);
620
+
621
+
622
+ write(jsi_callback->fd_[1],
623
+ &done,
624
+ sizeof(bool));
625
+
626
+ },
627
+ (float) sx_or_options->NumberValue(context).ToChecked(),
628
+ (float) sy->NumberValue(context).ToChecked(),
629
+ (float) sw->NumberValue(context).ToChecked(),
630
+ (float) sh->NumberValue(context).ToChecked(), std::move(ab));
631
+ thread.detach();
632
+
633
+ #endif
634
+
635
+ #ifdef __APPLE__
636
+
637
+ auto current_queue = new NSOperationQueueWrapper(true);
638
+
639
+
640
+ auto bufferValue = args[0];
641
+
642
+ if (isArrayBuffer) {
643
+ auto arrayBuffer = bufferValue.As<v8::ArrayBuffer>();
644
+ auto dataBuffer = (uint8_t *) arrayBuffer->GetBackingStore()->Data();
645
+ v8::Global<v8::ArrayBuffer> ab(isolate, arrayBuffer);
646
+ std::thread thread(
647
+ [&dataBuffer, jsi_callback, &options, shared_asset, current_queue](
648
+ float sx_or_options,
649
+ float sy,
650
+ float sw,
651
+ float sh,
652
+ v8::Global<v8::ArrayBuffer> ab,
653
+ size_t size
654
+ ) {
655
+
656
+ auto done = canvas_native_image_bitmap_create_from_encoded_bytes_src_rect_with_output(
657
+ dataBuffer, size,
658
+ sx_or_options,
659
+ sy,
660
+ sw,
661
+ sh,
662
+ options.flipY,
663
+ options.premultiplyAlpha,
664
+ options.colorSpaceConversion,
665
+ options.resizeQuality,
666
+ options.resizeWidth,
667
+ options.resizeHeight, shared_asset);
668
+
669
+ canvas_native_image_asset_destroy(shared_asset);
670
+
671
+
672
+ auto main_task = [jsi_callback, current_queue, done]() {
673
+
674
+
675
+ v8::Isolate *isolate = jsi_callback->isolate_;
676
+ v8::Locker locker(isolate);
677
+ v8::Isolate::Scope isolate_scope(isolate);
678
+ v8::HandleScope handle_scope(isolate);
679
+ v8::Local<v8::Function> callback = jsi_callback->callback_->Get(isolate);
680
+ v8::Local<v8::External> cbData = jsi_callback->data_->Get(
681
+ isolate).As<v8::External>();
682
+ v8::Local<v8::Context> context = callback->GetCreationContextChecked();
683
+ v8::Context::Scope context_scope(context);
684
+
685
+
686
+
687
+ auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
688
+
689
+ v8::Local<v8::Value> args[2];
690
+
691
+ if (done) {
692
+ args[0] = v8::Null(isolate);
693
+ args[1] = ret;
694
+ } else {
695
+ args[0] = v8::Exception::Error(
696
+ ConvertToV8String(isolate, "Failed to load image"));
697
+ args[1] = v8::Null(isolate);
698
+ }
699
+
700
+ callback->Call(context, context->Global(), 2, args);
701
+
702
+
703
+ delete jsi_callback;
704
+ delete current_queue;
705
+
706
+ };
707
+ current_queue->addOperation(main_task);
708
+
709
+ },
710
+ (float) sx_or_options->NumberValue(context).ToChecked(),
711
+ (float) sy->NumberValue(context).ToChecked(),
712
+ (float) sw->NumberValue(context).ToChecked(),
713
+ (float) sh->NumberValue(context).ToChecked(),
714
+ std::move(ab),
715
+ arrayBuffer->ByteLength());
716
+
717
+ thread.detach();
718
+
719
+ return;
720
+ }
721
+
722
+ auto ta = bufferValue.As<v8::ArrayBufferView>();
723
+
724
+ auto array = ta->Buffer();
725
+ auto offset = ta->ByteOffset();
726
+ auto size = ta->ByteLength();
727
+ auto data_ptr = static_cast<uint8_t*>(array->GetBackingStore()->Data()) + offset;
728
+
729
+
730
+
731
+ v8::Global<v8::ArrayBufferView> ab(isolate, ta);
732
+ std::thread thread(
733
+ [jsi_callback, &options, data_ptr, size, shared_asset, current_queue](
734
+ float sx_or_options,
735
+ float sy,
736
+ float sw,
737
+ float sh,
738
+ v8::Global<v8::ArrayBufferView> ab
739
+ ) {
740
+
741
+ auto done = canvas_native_image_bitmap_create_from_encoded_bytes_src_rect_with_output(
742
+ data_ptr, size,
743
+ sx_or_options,
744
+ sy,
745
+ sw,
746
+ sh,
747
+ options.flipY,
748
+ options.premultiplyAlpha,
749
+ options.colorSpaceConversion,
750
+ options.resizeQuality,
751
+ options.resizeWidth,
752
+ options.resizeHeight, shared_asset);
753
+
754
+ canvas_native_image_asset_destroy(shared_asset);
755
+
756
+ auto main_task = [jsi_callback, current_queue, done]() {
757
+
758
+
759
+ v8::Isolate *isolate = jsi_callback->isolate_;
760
+ v8::Locker locker(isolate);
761
+ v8::Isolate::Scope isolate_scope(isolate);
762
+ v8::HandleScope handle_scope(isolate);
763
+ v8::Local<v8::Function> callback = jsi_callback->callback_->Get(isolate);
764
+ v8::Local<v8::External> cbData = jsi_callback->data_->Get(
765
+ isolate).As<v8::External>();
766
+ v8::Local<v8::Context> context = callback->GetCreationContextChecked();
767
+ v8::Context::Scope context_scope(context);
768
+
769
+ auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
770
+
771
+ v8::Local<v8::Value> args[2];
772
+
773
+ if (done) {
774
+ args[0] = v8::Null(isolate);
775
+ args[1] = ret;
776
+ } else {
777
+ args[0] = v8::Exception::Error(
778
+ ConvertToV8String(isolate, "Failed to load image"));
779
+ args[1] = v8::Null(isolate);
780
+ }
781
+
782
+ callback->Call(context, context->Global(), 2, args);
783
+
784
+
785
+ delete jsi_callback;
786
+ delete current_queue;
787
+
788
+ };
789
+ current_queue->addOperation(main_task);
790
+
791
+
792
+
793
+ },
794
+ (float) sx_or_options->NumberValue(context).ToChecked(),
795
+ (float) sy->NumberValue(context).ToChecked(),
796
+ (float) sw->NumberValue(context).ToChecked(),
797
+ (float) sh->NumberValue(context).ToChecked(), std::move(ab));
798
+ thread.detach();
799
+
800
+
801
+
802
+ #endif
803
+
804
+
805
+ return;
806
+ }
807
+ }
808
+ }
809
+
810
+ auto type = GetNativeType( image);
811
+
812
+ if (len == 1 || len == 2) {
813
+ if (len == 2) {
814
+ options = ImageBitmapImpl::HandleOptions(isolate, args[1]);
815
+ }
816
+
817
+ v8::Local<v8::Value> retArgs[2];
818
+ retArgs[0] = v8::Null(isolate);
819
+
820
+ switch (type) {
821
+ case NativeType::ImageAsset: {
822
+ auto image_asset = ImageAssetImpl::GetPointer(image.As<v8::Object>());
823
+ auto ret = canvas_native_image_bitmap_create_from_asset(
824
+ image_asset->GetImageAsset(),
825
+ options.flipY,
826
+ options.premultiplyAlpha,
827
+ options.colorSpaceConversion,
828
+ options.resizeQuality,
829
+ options.resizeWidth,
830
+ options.resizeHeight);
831
+
832
+
833
+ auto bitmap = new ImageBitmapImpl(ret);
834
+ auto data = v8::External::New(isolate, bitmap);
835
+
836
+ auto object = ImageBitmapImpl::NewInstance(isolate, data);
837
+
838
+ retArgs[1] = object;
839
+ }
840
+ break;
841
+ case NativeType::ImageBitmap: {
842
+ auto image_bitmap = ImageBitmapImpl::GetPointer(image.As<v8::Object>());
843
+ auto ret = canvas_native_image_bitmap_create_from_asset(
844
+ image_bitmap->GetImageAsset(),
845
+ options.flipY,
846
+ options.premultiplyAlpha,
847
+ options.colorSpaceConversion,
848
+ options.resizeQuality,
849
+ options.resizeWidth,
850
+ options.resizeHeight);
851
+
852
+
853
+ auto bitmap = new ImageBitmapImpl(ret);
854
+ auto data = v8::External::New(isolate, bitmap);
855
+ auto object = ImageBitmapImpl::NewInstance(isolate, data);
856
+
857
+ retArgs[1] = object;
858
+
859
+ }
860
+ break;
861
+ default:
862
+ break;
863
+ }
864
+
865
+ cb.As<v8::Function>()->Call(context, context->Global(), 2, retArgs);
866
+
867
+ return;
868
+ } else if (len == 5 || len == 6) {
869
+
870
+ if (len == 6) {
871
+ options = ImageBitmapImpl::HandleOptions(isolate, args[5]);
872
+ }
873
+
874
+ v8::Local<v8::Value> retArgs[2];
875
+ retArgs[0] = v8::Null(isolate);
876
+
877
+
878
+ switch (type) {
879
+ case NativeType::ImageAsset: {
880
+ auto image_asset = ImageBitmapImpl::GetPointer(image.As<v8::Object>());
881
+ auto ret = canvas_native_image_bitmap_create_from_asset_src_rect(
882
+ image_asset->GetImageAsset(),
883
+ (float) sx_or_options->NumberValue(context).ToChecked(),
884
+ (float) sy->NumberValue(context).ToChecked(),
885
+ (float) sw->NumberValue(context).ToChecked(),
886
+ (float) sh->NumberValue(context).ToChecked(),
887
+ options.flipY,
888
+ options.premultiplyAlpha,
889
+ options.colorSpaceConversion,
890
+ options.resizeQuality,
891
+ options.resizeWidth,
892
+ options.resizeHeight);
893
+
894
+
895
+ auto bitmap = new ImageBitmapImpl(ret);
896
+ auto data = v8::External::New(isolate, bitmap);
897
+ auto object = ImageBitmapImpl::NewInstance(isolate, data);
898
+
899
+ retArgs[1] = object;
900
+ }
901
+ break;
902
+ case NativeType::ImageBitmap: {
903
+ auto image_bitmap = ImageBitmapImpl::GetPointer(image.As<v8::Object>());
904
+ auto ret = canvas_native_image_bitmap_create_from_asset_src_rect(
905
+ image_bitmap->GetImageAsset(),
906
+ (float) sx_or_options->NumberValue(context).ToChecked(),
907
+ (float) sy->NumberValue(context).ToChecked(),
908
+ (float) sw->NumberValue(context).ToChecked(),
909
+ (float) sh->NumberValue(context).ToChecked(),
910
+ options.flipY,
911
+ options.premultiplyAlpha,
912
+ options.colorSpaceConversion,
913
+ options.resizeQuality,
914
+ options.resizeWidth,
915
+ options.resizeHeight);
916
+
917
+
918
+ auto bitmap = new ImageBitmapImpl(ret);
919
+ auto data = v8::External::New(isolate, bitmap);
920
+ auto object = ImageBitmapImpl::NewInstance(isolate, data);
921
+
922
+ retArgs[1] = object;
923
+
924
+ }
925
+ break;
926
+ default:
927
+ break;
928
+ }
929
+
930
+
931
+ cb.As<v8::Function>()->Call(context, context->Global(), 2, retArgs);
932
+
933
+ return;
934
+ }
935
+
936
+
937
+ args.GetReturnValue().SetUndefined();
938
+
939
+ }
940
+
941
+ void CanvasJSIModule::Create2DContextWithPointer(const v8::FunctionCallbackInfo<v8::Value> &args) {
942
+ auto isolate = args.GetIsolate();
943
+ auto context = isolate->GetCurrentContext();
944
+ auto ptr = args[0]->ToBigInt(context).ToLocalChecked()->Int64Value();
945
+
946
+ auto context_2d = canvas_native_context_create_with_pointer(ptr);
947
+
948
+ auto ret = CanvasRenderingContext2DImpl::NewInstance(isolate, new CanvasRenderingContext2DImpl(
949
+ context_2d));
950
+ args.GetReturnValue().Set(ret);
951
+ }
952
+
953
+ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args) {
954
+ auto isolate = args.GetIsolate();
955
+ auto file = ConvertFromV8String(isolate, args[0]);
956
+ auto cbFunc = args[1].As<v8::Function>();
957
+
958
+ auto jsi_callback = new JSIReadFileCallback(isolate, cbFunc);
959
+
960
+ #ifdef __ANDROID__
961
+ ALooper_addFd(jsi_callback->looper_,
962
+ jsi_callback->fd_[0],
963
+ ALOOPER_POLL_CALLBACK,
964
+ ALOOPER_EVENT_INPUT,
965
+ [](int fd, int events,
966
+ void *data) {
967
+
968
+ auto cb = static_cast<JSIReadFileCallback *>(data);
969
+ bool done;
970
+ read(fd, &done,
971
+ sizeof(bool));
972
+
973
+ if (cb->data_ == nullptr) {
974
+ return 1;
975
+ }
976
+
977
+ v8::Isolate *isolate = cb->isolate_;
978
+ v8::Locker locker(isolate);
979
+ v8::Isolate::Scope isolate_scope(isolate);
980
+ v8::HandleScope handle_scope(isolate);
981
+ v8::Local<v8::Function> callback = cb->callback_.Get(isolate);
982
+ v8::Local<v8::Context> context = callback->GetCreationContextChecked();
983
+ v8::Context::Scope context_scope(context);
984
+
985
+ v8::Local<v8::Value> args[2];
986
+
987
+ if (done) {
988
+ args[0] = v8::Null(isolate);
989
+
990
+ auto vec = cb->data_;
991
+
992
+ auto buf = (void *) canvas_native_u8_buffer_get_bytes_mut(vec);
993
+ auto size = (size_t) canvas_native_u8_buffer_get_length(vec);
994
+
995
+ auto store = v8::ArrayBuffer::NewBackingStore(buf, size,
996
+ [](void *data,
997
+ size_t length,
998
+ void *deleter_data) {
999
+ if (deleter_data !=
1000
+ nullptr) {
1001
+ // a little extreme :'D
1002
+ delete static_cast<JSIReadFileCallback *>(deleter_data);
1003
+ }
1004
+ },
1005
+ data);
1006
+
1007
+ args[1] = v8::ArrayBuffer::New(isolate, std::move(store));
1008
+ } else {
1009
+ auto error = cb->error_;
1010
+ args[0] = v8::Exception::Error(ConvertToV8String(isolate, error));
1011
+ args[1] = v8::Null(isolate);
1012
+ }
1013
+
1014
+ v8::TryCatch tc(isolate);
1015
+ v8::Local<v8::Value> result;
1016
+ if (!callback->Call(context, context->Global(), 2, args).ToLocal(
1017
+ &result)) {
1018
+ if (tc.HasCaught()) {
1019
+
1020
+ v8::Local<v8::Value> stack;
1021
+ bool success = tc.StackTrace(context).ToLocal(&stack);
1022
+ if (!success || stack.IsEmpty()) {
1023
+ if (!done) {
1024
+ delete cb;
1025
+ }
1026
+ return 0;
1027
+ }
1028
+
1029
+ v8::Local<v8::String> stackV8Str;
1030
+ success = stack->ToDetailString(context).ToLocal(&stackV8Str);
1031
+ if (!success || stackV8Str.IsEmpty()) {
1032
+ if (!done) {
1033
+ delete cb;
1034
+ }
1035
+ return 0;
1036
+ }
1037
+ LogToConsole(ConvertFromV8String(isolate, stackV8Str));
1038
+
1039
+ }
1040
+ }
1041
+
1042
+ if (!done) {
1043
+ delete cb;
1044
+ }
1045
+ return 0;
1046
+ }, jsi_callback);
1047
+
1048
+ ALooper_wake(jsi_callback->looper_);
1049
+
1050
+ std::thread thread(
1051
+ [jsi_callback](const std::string &file) {
1052
+ bool done = false;
1053
+ auto ret = canvas_native_helper_read_file(file.c_str());
1054
+
1055
+ if (!canvas_native_helper_read_file_has_error(ret)) {
1056
+ auto buf = canvas_native_helper_read_file_get_data(ret);
1057
+
1058
+ jsi_callback->SetData(buf);
1059
+
1060
+ done = true;
1061
+ } else {
1062
+ auto error = canvas_native_helper_read_file_get_error(ret);
1063
+
1064
+ jsi_callback->SetError(const_cast<char *>(error));
1065
+ }
1066
+ canvas_native_helper_destroy(ret);
1067
+
1068
+ write(jsi_callback->fd_[1],
1069
+ &done,
1070
+ sizeof(bool));
1071
+
1072
+ }, std::move(file));
1073
+
1074
+ thread.detach();
1075
+
1076
+ #endif
1077
+
1078
+
1079
+ #ifdef __APPLE__
1080
+
1081
+ auto current_queue = new NSOperationQueueWrapper(true);
1082
+
1083
+ auto queue = new NSOperationQueueWrapper(false);
1084
+
1085
+ auto task = [jsi_callback, current_queue, queue, file]() {
1086
+
1087
+
1088
+
1089
+ bool done = false;
1090
+ auto ret = canvas_native_helper_read_file(file.c_str());
1091
+
1092
+ if (!canvas_native_helper_read_file_has_error(ret)) {
1093
+ auto buf = canvas_native_helper_read_file_get_data(ret);
1094
+
1095
+ jsi_callback->SetData(buf);
1096
+
1097
+ done = true;
1098
+ } else {
1099
+ auto error = canvas_native_helper_read_file_get_error(ret);
1100
+
1101
+ jsi_callback->SetError((char*)error);
1102
+ }
1103
+
1104
+ canvas_native_helper_destroy(ret);
1105
+
1106
+ auto main_task = [jsi_callback, current_queue, queue, done]() {
1107
+
1108
+ v8::Isolate *isolate = jsi_callback->isolate_;
1109
+ v8::Locker locker(isolate);
1110
+ v8::Isolate::Scope isolate_scope(isolate);
1111
+ v8::HandleScope handle_scope(isolate);
1112
+ v8::Local<v8::Function> callback = jsi_callback->callback_.Get(isolate);
1113
+ v8::Local<v8::Context> context = callback->GetCreationContextChecked();
1114
+ v8::Context::Scope context_scope(context);
1115
+
1116
+ v8::Local<v8::Value> args[2];
1117
+
1118
+ if (done) {
1119
+ args[0] = v8::Null(isolate);
1120
+
1121
+ auto vec = jsi_callback->data_;
1122
+
1123
+
1124
+ auto buf = (void*)canvas_native_u8_buffer_get_bytes_mut(vec);
1125
+
1126
+ auto size = (size_t)canvas_native_u8_buffer_get_length(vec);
1127
+
1128
+ auto store = v8::ArrayBuffer::NewBackingStore(buf, size,
1129
+ [](void *data,
1130
+ size_t length,
1131
+ void *deleter_data) {
1132
+ if (deleter_data !=
1133
+ nullptr) {
1134
+ // a little extreme :'D
1135
+ delete static_cast<JSIReadFileCallback *>(deleter_data);
1136
+ }
1137
+ },
1138
+ jsi_callback);
1139
+
1140
+ args[1] = v8::ArrayBuffer::New(isolate, std::move(store));
1141
+ } else {
1142
+ auto error = jsi_callback->error_;
1143
+ args[0] = v8::Exception::Error(ConvertToV8String(isolate, error));
1144
+ args[1] = v8::Null(isolate);
1145
+ }
1146
+
1147
+ v8::TryCatch tc(isolate);
1148
+ v8::Local<v8::Value> result;
1149
+ if (!callback->Call(context, context->Global(), 2, args).ToLocal(
1150
+ &result)) {
1151
+ if (tc.HasCaught()) {
1152
+
1153
+ v8::Local<v8::Value> stack;
1154
+ bool success = tc.StackTrace(context).ToLocal(&stack);
1155
+ if (!success || stack.IsEmpty()) {
1156
+ if (!done) {
1157
+ delete jsi_callback;
1158
+ }
1159
+ return;
1160
+ }
1161
+
1162
+ v8::Local<v8::String> stackV8Str;
1163
+ success = stack->ToDetailString(context).ToLocal(&stackV8Str);
1164
+ if (!success || stackV8Str.IsEmpty()) {
1165
+ if (!done) {
1166
+ delete jsi_callback;
1167
+ }
1168
+ return;
1169
+ }
1170
+ LogToConsole(ConvertFromV8String(isolate, stackV8Str));
1171
+
1172
+ }
1173
+ }
1174
+
1175
+ if (!done) {
1176
+ delete jsi_callback;
1177
+ }
1178
+
1179
+ delete queue;
1180
+ delete current_queue;
1181
+
1182
+ };
1183
+ current_queue->addOperation(main_task);
1184
+ };
1185
+
1186
+ queue->addOperation(task);
1187
+ #endif
1188
+
1189
+
1190
+ }
1191
+
1192
+ void CanvasJSIModule::CreateWebGLContext(const v8::FunctionCallbackInfo<v8::Value> &args) {
1193
+ auto configValue = args[0];
1194
+ auto isolate = args.GetIsolate();
1195
+ auto context = isolate->GetCurrentContext();
1196
+ if (!configValue->IsNullOrUndefined() && configValue->IsObject()) {
1197
+ auto config = configValue.As<v8::Object>();
1198
+ std::string version("none");
1199
+ auto alpha = true;
1200
+ auto antialias = true;
1201
+ auto depth = true;
1202
+ auto fail_if_major_performance_caveat = false;
1203
+ std::string power_preference("default");
1204
+ auto premultiplied_alpha = true;
1205
+ auto preserve_drawing_buffer = false;
1206
+ auto stencil = false;
1207
+ auto desynchronized = false;
1208
+ auto xr_compatible = false;
1209
+
1210
+ auto last = isolate->GetNumberOfDataSlots() - 1;
1211
+ auto data = isolate->GetData(last);
1212
+
1213
+ if (data != nullptr) {
1214
+ auto consts = static_cast<PerIsolateData *>(data);
1215
+
1216
+ v8::Local<v8::Value> versionValue;
1217
+
1218
+ config->Get(context, consts->VERSION_PERSISTENT->Get(isolate)).ToLocal(&versionValue);
1219
+
1220
+ if (!versionValue.IsEmpty() && versionValue->IsString()) {
1221
+ version = ConvertFromV8String(isolate, versionValue);
1222
+ }
1223
+
1224
+ v8::Local<v8::Value> alphaValue;
1225
+
1226
+ config->Get(context, consts->ALPHA_PERSISTENT->Get(isolate)).ToLocal(&alphaValue);
1227
+ if (!alphaValue.IsEmpty() && alphaValue->IsBoolean()) {
1228
+ alpha = alphaValue->BooleanValue(isolate);
1229
+ }
1230
+
1231
+ v8::Local<v8::Value> antialiasValue;
1232
+ config->Get(context, consts->ANTIALIAS_PERSISTENT->Get(isolate)).ToLocal(
1233
+ &antialiasValue);
1234
+ if (!antialiasValue.IsEmpty() && antialiasValue->IsBoolean()) {
1235
+ antialias = antialiasValue->BooleanValue(isolate);
1236
+ }
1237
+
1238
+ v8::Local<v8::Value> failIfMajorPerformanceCaveatValue;
1239
+ config->Get(context,
1240
+ consts->FAIL_IF_MAJOR_PERFORMANCE_CAVEAT_PERSISTENT->Get(isolate)).ToLocal(
1241
+ &failIfMajorPerformanceCaveatValue);
1242
+ if (!failIfMajorPerformanceCaveatValue.IsEmpty() &&
1243
+ failIfMajorPerformanceCaveatValue->IsBoolean()) {
1244
+ fail_if_major_performance_caveat = failIfMajorPerformanceCaveatValue->BooleanValue(
1245
+ isolate);
1246
+ }
1247
+
1248
+ v8::Local<v8::Value> powerPreferenceValue;
1249
+ config->Get(context, consts->POWER_PREFERENCE_PERSISTENT->Get(isolate)).ToLocal(
1250
+ &powerPreferenceValue);
1251
+ if (!powerPreferenceValue.IsEmpty() && powerPreferenceValue->IsString()) {
1252
+ power_preference = ConvertFromV8String(isolate, powerPreferenceValue);
1253
+ }
1254
+
1255
+ v8::Local<v8::Value> premultipliedAlphaValue;
1256
+ config->Get(context,
1257
+ consts->PREMULTIPLIED_ALPHA_PERSISTENT->Get(isolate)).ToLocal(
1258
+ &premultipliedAlphaValue);
1259
+ if (!premultipliedAlphaValue.IsEmpty() && premultipliedAlphaValue->IsBoolean()) {
1260
+ premultiplied_alpha = premultipliedAlphaValue->BooleanValue(isolate);
1261
+ }
1262
+
1263
+ v8::Local<v8::Value> preserveDrawingBufferValue;
1264
+ config->Get(context,
1265
+ consts->PRESERVE_DRAWING_BUFFER_PERSISTENT->Get(isolate)).ToLocal(
1266
+ &preserveDrawingBufferValue);
1267
+ if (!preserveDrawingBufferValue.IsEmpty() && preserveDrawingBufferValue->IsBoolean()) {
1268
+ preserve_drawing_buffer = preserveDrawingBufferValue->BooleanValue(isolate);
1269
+ }
1270
+
1271
+ v8::Local<v8::Value> stencilValue;
1272
+ config->Get(context, consts->STENCIL_PERSISTENT->Get(isolate)).ToLocal(&stencilValue);
1273
+ if (!stencilValue.IsEmpty() && stencilValue->IsBoolean()) {
1274
+ stencil = stencilValue->BooleanValue(isolate);
1275
+ }
1276
+
1277
+ v8::Local<v8::Value> desynchronizedValue;
1278
+ config->Get(context, consts->DESYNCHRONIZED_PERSISTENT->Get(isolate)).ToLocal(
1279
+ &desynchronizedValue);
1280
+ if (!desynchronizedValue.IsEmpty() && desynchronizedValue->IsBoolean()) {
1281
+ desynchronized = desynchronizedValue->BooleanValue(isolate);
1282
+ }
1283
+
1284
+ v8::Local<v8::Value> xrCompatibleValue;
1285
+ config->Get(context,
1286
+ consts->XR_COMPATIBLE_PERSISTENT->Get(isolate)).ToLocal(&xrCompatibleValue);
1287
+ if (!xrCompatibleValue.IsEmpty() && xrCompatibleValue->IsBoolean()) {
1288
+ xr_compatible = xrCompatibleValue->BooleanValue(isolate);
1289
+ }
1290
+ }
1291
+
1292
+
1293
+ if (version !=
1294
+ "v1") {
1295
+ args.GetReturnValue().SetNull();
1296
+ return;
1297
+ } else {
1298
+ auto count = args.Length();
1299
+ if (count == 6) {
1300
+ auto ctx = args[1].As<v8::BigInt>()->Int64Value();
1301
+ // auto density = args[2]->NumberValue(context).ToChecked();
1302
+ // auto fontColor = args[3]->NumberValue(context).ToChecked();
1303
+ // auto ppi = args[4]->NumberValue(context).ToChecked();
1304
+ // auto direction = args[5]->NumberValue(context).ToChecked();
1305
+ auto webgl = canvas_native_webgl_create(
1306
+ ctx,
1307
+ version.c_str(),
1308
+ alpha,
1309
+ antialias,
1310
+ depth,
1311
+ fail_if_major_performance_caveat,
1312
+ power_preference.c_str(),
1313
+ premultiplied_alpha,
1314
+ preserve_drawing_buffer,
1315
+ stencil,
1316
+ desynchronized,
1317
+ xr_compatible
1318
+ );
1319
+
1320
+ auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
1321
+ new WebGLRenderingContext(
1322
+ webgl));
1323
+
1324
+ args.GetReturnValue().Set(renderingContext);
1325
+ return;
1326
+ } else if (count == 7) {
1327
+ auto width = args[1]->NumberValue(context).ToChecked();
1328
+ auto height = args[2]->NumberValue(context).ToChecked();
1329
+ // auto density = args[3]->NumberValue(context).ToChecked();
1330
+ // auto fontColor = args[4]->NumberValue(context).ToChecked();
1331
+ // auto ppi = args[5]->NumberValue(context).ToChecked();
1332
+ // auto direction = args[6]->NumberValue(context).ToChecked();
1333
+ auto ctx = canvas_native_webgl_create_no_window(
1334
+ (int32_t) width,
1335
+ (int32_t) height,
1336
+ version.c_str(),
1337
+ alpha,
1338
+ antialias,
1339
+ depth,
1340
+ fail_if_major_performance_caveat,
1341
+ power_preference.c_str(),
1342
+ premultiplied_alpha,
1343
+ preserve_drawing_buffer,
1344
+ stencil,
1345
+ desynchronized,
1346
+ xr_compatible,
1347
+ false
1348
+ );
1349
+
1350
+ auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
1351
+ new WebGLRenderingContext(
1352
+ ctx));
1353
+
1354
+ args.GetReturnValue().Set(renderingContext);
1355
+ return;
1356
+
1357
+ } else {
1358
+ auto width = (int32_t) args[1]->NumberValue(context).ToChecked();
1359
+ auto height = (int32_t) args[2]->NumberValue(context).ToChecked();
1360
+
1361
+ auto ctx = canvas_native_webgl_create_no_window(
1362
+ width,
1363
+ height,
1364
+ version.c_str(),
1365
+ alpha,
1366
+ antialias,
1367
+ depth,
1368
+ fail_if_major_performance_caveat,
1369
+ power_preference.c_str(),
1370
+ premultiplied_alpha,
1371
+ preserve_drawing_buffer,
1372
+ stencil,
1373
+ desynchronized,
1374
+ xr_compatible,
1375
+ false
1376
+ );
1377
+
1378
+ auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
1379
+ new WebGLRenderingContext(
1380
+ ctx));
1381
+
1382
+ args.GetReturnValue().Set(renderingContext);
1383
+ return;
1384
+ }
1385
+
1386
+ }
1387
+ }
1388
+ args.GetReturnValue().SetNull();
1389
+ }
1390
+
1391
+ void CanvasJSIModule::CreateWebGL2Context(const v8::FunctionCallbackInfo<v8::Value> &args) {
1392
+ auto configValue = args[0];
1393
+ auto isolate = args.GetIsolate();
1394
+ auto context = isolate->GetCurrentContext();
1395
+ if (!configValue->IsNullOrUndefined() && configValue->IsObject()) {
1396
+ auto config = configValue.As<v8::Object>();
1397
+ std::string version("none");
1398
+ auto alpha = true;
1399
+ auto antialias = true;
1400
+ auto depth = true;
1401
+ auto fail_if_major_performance_caveat = false;
1402
+ std::string power_preference("default");
1403
+ auto premultiplied_alpha = true;
1404
+ auto preserve_drawing_buffer = false;
1405
+ auto stencil = false;
1406
+ auto desynchronized = false;
1407
+ auto xr_compatible = false;
1408
+
1409
+
1410
+ auto last = isolate->GetNumberOfDataSlots() - 1;
1411
+ auto data = isolate->GetData(last);
1412
+
1413
+ if (data != nullptr) {
1414
+ auto consts = static_cast<PerIsolateData *>(data);
1415
+
1416
+ v8::Local<v8::Value> versionValue;
1417
+
1418
+ config->Get(context, consts->VERSION_PERSISTENT->Get(isolate)).ToLocal(&versionValue);
1419
+
1420
+ if (!versionValue.IsEmpty() && versionValue->IsString()) {
1421
+ version = ConvertFromV8String(isolate, versionValue);
1422
+ }
1423
+
1424
+ v8::Local<v8::Value> alphaValue;
1425
+
1426
+ config->Get(context, consts->ALPHA_PERSISTENT->Get(isolate)).ToLocal(&alphaValue);
1427
+ if (!alphaValue.IsEmpty() && alphaValue->IsBoolean()) {
1428
+ alpha = alphaValue->BooleanValue(isolate);
1429
+ }
1430
+
1431
+ v8::Local<v8::Value> antialiasValue;
1432
+ config->Get(context, consts->ANTIALIAS_PERSISTENT->Get(isolate)).ToLocal(
1433
+ &antialiasValue);
1434
+ if (!antialiasValue.IsEmpty() && antialiasValue->IsBoolean()) {
1435
+ antialias = antialiasValue->BooleanValue(isolate);
1436
+ }
1437
+
1438
+ v8::Local<v8::Value> failIfMajorPerformanceCaveatValue;
1439
+ config->Get(context,
1440
+ consts->FAIL_IF_MAJOR_PERFORMANCE_CAVEAT_PERSISTENT->Get(isolate)).ToLocal(
1441
+ &failIfMajorPerformanceCaveatValue);
1442
+ if (!failIfMajorPerformanceCaveatValue.IsEmpty() &&
1443
+ failIfMajorPerformanceCaveatValue->IsBoolean()) {
1444
+ fail_if_major_performance_caveat = failIfMajorPerformanceCaveatValue->BooleanValue(
1445
+ isolate);
1446
+ }
1447
+
1448
+ v8::Local<v8::Value> powerPreferenceValue;
1449
+ config->Get(context, consts->POWER_PREFERENCE_PERSISTENT->Get(isolate)).ToLocal(
1450
+ &powerPreferenceValue);
1451
+ if (!powerPreferenceValue.IsEmpty() && powerPreferenceValue->IsString()) {
1452
+ power_preference = ConvertFromV8String(isolate, powerPreferenceValue);
1453
+ }
1454
+
1455
+ v8::Local<v8::Value> premultipliedAlphaValue;
1456
+ config->Get(context,
1457
+ consts->PREMULTIPLIED_ALPHA_PERSISTENT->Get(isolate)).ToLocal(
1458
+ &premultipliedAlphaValue);
1459
+ if (!premultipliedAlphaValue.IsEmpty() && premultipliedAlphaValue->IsBoolean()) {
1460
+ premultiplied_alpha = premultipliedAlphaValue->BooleanValue(isolate);
1461
+ }
1462
+
1463
+ v8::Local<v8::Value> preserveDrawingBufferValue;
1464
+ config->Get(context,
1465
+ consts->PRESERVE_DRAWING_BUFFER_PERSISTENT->Get(isolate)).ToLocal(
1466
+ &preserveDrawingBufferValue);
1467
+ if (!preserveDrawingBufferValue.IsEmpty() && preserveDrawingBufferValue->IsBoolean()) {
1468
+ preserve_drawing_buffer = preserveDrawingBufferValue->BooleanValue(isolate);
1469
+ }
1470
+
1471
+ v8::Local<v8::Value> stencilValue;
1472
+ config->Get(context, consts->STENCIL_PERSISTENT->Get(isolate)).ToLocal(&stencilValue);
1473
+ if (!stencilValue.IsEmpty() && stencilValue->IsBoolean()) {
1474
+ stencil = stencilValue->BooleanValue(isolate);
1475
+ }
1476
+
1477
+ v8::Local<v8::Value> desynchronizedValue;
1478
+ config->Get(context, consts->DESYNCHRONIZED_PERSISTENT->Get(isolate)).ToLocal(
1479
+ &desynchronizedValue);
1480
+ if (!desynchronizedValue.IsEmpty() && desynchronizedValue->IsBoolean()) {
1481
+ desynchronized = desynchronizedValue->BooleanValue(isolate);
1482
+ }
1483
+
1484
+ v8::Local<v8::Value> xrCompatibleValue;
1485
+ config->Get(context,
1486
+ consts->XR_COMPATIBLE_PERSISTENT->Get(isolate)).ToLocal(&xrCompatibleValue);
1487
+ if (!xrCompatibleValue.IsEmpty() && xrCompatibleValue->IsBoolean()) {
1488
+ xr_compatible = xrCompatibleValue->BooleanValue(isolate);
1489
+ }
1490
+ }
1491
+
1492
+
1493
+ if (version !=
1494
+ "v2") {
1495
+ args.GetReturnValue().SetNull();
1496
+ return;
1497
+ } else {
1498
+ auto count = args.Length();
1499
+ if (count == 6) {
1500
+ auto ctx = args[1].As<v8::BigInt>()->Int64Value();
1501
+ // auto density = args[2]->NumberValue(context).ToChecked();
1502
+ // auto fontColor = args[3]->NumberValue(context).ToChecked();
1503
+ // auto ppi = args[4]->NumberValue(context).ToChecked();
1504
+ // auto direction = args[5]->NumberValue(context).ToChecked();
1505
+
1506
+ auto webgl = canvas_native_webgl_create(
1507
+ ctx,
1508
+ version.c_str(),
1509
+ alpha,
1510
+ antialias,
1511
+ depth,
1512
+ fail_if_major_performance_caveat,
1513
+ power_preference.c_str(),
1514
+ premultiplied_alpha,
1515
+ preserve_drawing_buffer,
1516
+ stencil,
1517
+ desynchronized,
1518
+ xr_compatible
1519
+ );
1520
+
1521
+ auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
1522
+ new WebGL2RenderingContext(
1523
+ webgl,
1524
+ WebGLRenderingVersion::V2));
1525
+
1526
+ args.GetReturnValue().Set(renderingContext);
1527
+ return;
1528
+
1529
+ } else if (count ==
1530
+ 7) {
1531
+ auto width = args[1]->NumberValue(context).ToChecked();
1532
+ auto height = args[2]->NumberValue(context).ToChecked();
1533
+ // auto density = args[3]->NumberValue(context).ToChecked();
1534
+ // auto fontColor = args[4]->NumberValue(context).ToChecked();
1535
+ // auto ppi = args[5]->NumberValue(context).ToChecked();
1536
+ // auto direction = args[6]->NumberValue(context).ToChecked();
1537
+ auto ctx = canvas_native_webgl_create_no_window(
1538
+ (int32_t) width,
1539
+ (int32_t) height,
1540
+ version.c_str(),
1541
+ alpha,
1542
+ antialias,
1543
+ depth,
1544
+ fail_if_major_performance_caveat,
1545
+ power_preference.c_str(),
1546
+ premultiplied_alpha,
1547
+ preserve_drawing_buffer,
1548
+ stencil,
1549
+ desynchronized,
1550
+ xr_compatible,
1551
+ false
1552
+ );
1553
+ auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
1554
+ new WebGL2RenderingContext(
1555
+ ctx,
1556
+ WebGLRenderingVersion::V2));
1557
+
1558
+ args.GetReturnValue().Set(renderingContext);
1559
+ return;
1560
+
1561
+ } else {
1562
+ auto width = (int32_t) args[1]->NumberValue(context).ToChecked();
1563
+ auto height = (int32_t) args[2]->NumberValue(context).ToChecked();
1564
+ auto ctx = canvas_native_webgl_create_no_window(
1565
+ width,
1566
+ height,
1567
+ version.c_str(),
1568
+ alpha,
1569
+ antialias,
1570
+ depth,
1571
+ fail_if_major_performance_caveat,
1572
+ power_preference.c_str(),
1573
+ premultiplied_alpha,
1574
+ preserve_drawing_buffer,
1575
+ stencil,
1576
+ desynchronized,
1577
+ xr_compatible,
1578
+ false
1579
+ );
1580
+
1581
+ auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
1582
+ new WebGL2RenderingContext(
1583
+ ctx,
1584
+ WebGLRenderingVersion::V2));
1585
+
1586
+ args.GetReturnValue().Set(renderingContext);
1587
+ return;
1588
+ }
1589
+ }
1590
+ }
1591
+
1592
+ args.GetReturnValue().SetNull();
1593
+ }