react-native-tgfx 0.0.0 → 0.0.2-alpha.0

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 (1792) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +141 -0
  3. package/NitroTgfx.podspec +69 -0
  4. package/README.md +147 -2
  5. package/android/CMakeLists.txt +122 -0
  6. package/android/build.gradle +172 -0
  7. package/android/consumer-rules.pro +7 -0
  8. package/android/fix-prefab.gradle +51 -0
  9. package/android/gradle.properties +5 -0
  10. package/android/src/main/AndroidManifest.xml +2 -0
  11. package/android/src/main/cpp/TgfxAndroid.cpp +347 -0
  12. package/android/src/main/cpp/cpp-adapter.cpp +11 -0
  13. package/android/src/main/java/com/margelo/nitro/tgfx/HybridTgfxView.kt +139 -0
  14. package/android/src/main/java/com/margelo/nitro/tgfx/NitroTgfxPackage.kt +24 -0
  15. package/android/src/main/java/com/margelo/nitro/tgfx/TgfxNative.kt +49 -0
  16. package/android/src/main/java/com/margelo/nitro/tgfx/TgfxRenderTarget.kt +158 -0
  17. package/android/src/main/java/com/margelo/nitro/tgfx/TgfxSurfaceView.kt +43 -0
  18. package/android/src/main/java/com/margelo/nitro/tgfx/TgfxTextureView.kt +37 -0
  19. package/cpp/Base64.hpp +49 -0
  20. package/cpp/FontRegistry.cpp +379 -0
  21. package/cpp/FontRegistry.hpp +80 -0
  22. package/cpp/HybridTgfxFonts.cpp +135 -0
  23. package/cpp/HybridTgfxFonts.hpp +29 -0
  24. package/cpp/HybridTgfxImage.hpp +54 -0
  25. package/cpp/HybridTgfxImageFactory.cpp +126 -0
  26. package/cpp/HybridTgfxImageFactory.hpp +27 -0
  27. package/cpp/HybridTgfxSlotsFactory.hpp +37 -0
  28. package/cpp/IdleGate.hpp +46 -0
  29. package/cpp/ImageRegistry.cpp +306 -0
  30. package/cpp/ImageRegistry.hpp +120 -0
  31. package/cpp/Log.hpp +18 -0
  32. package/cpp/SceneHash.hpp +55 -0
  33. package/cpp/SceneStrings.hpp +45 -0
  34. package/cpp/Snapshot.hpp +110 -0
  35. package/cpp/SvgPath.cpp +315 -0
  36. package/cpp/SvgPath.hpp +13 -0
  37. package/cpp/TextLayout.cpp +568 -0
  38. package/cpp/TextLayout.hpp +102 -0
  39. package/cpp/TgfxFrameSink.cpp +46 -0
  40. package/cpp/TgfxFrameSink.hpp +29 -0
  41. package/cpp/TgfxRenderer.cpp +439 -0
  42. package/cpp/TgfxRenderer.hpp +125 -0
  43. package/cpp/TgfxScene.cpp +1119 -0
  44. package/cpp/TgfxScene.hpp +207 -0
  45. package/cpp/Trace.hpp +26 -0
  46. package/cpp/third_party/tgfx/CMakeLists.txt +909 -0
  47. package/cpp/third_party/tgfx/DEPS +123 -0
  48. package/cpp/third_party/tgfx/LICENSE.txt +825 -0
  49. package/cpp/third_party/tgfx/README.md +488 -0
  50. package/cpp/third_party/tgfx/android/.idea/fileTemplates/includes/TGFX File Header.h +17 -0
  51. package/cpp/third_party/tgfx/android/.idea/misc.xml +14 -0
  52. package/cpp/third_party/tgfx/android/app/CMakeLists.txt +25 -0
  53. package/cpp/third_party/tgfx/android/app/build.gradle.kts +84 -0
  54. package/cpp/third_party/tgfx/android/app/proguard-rules.pro +21 -0
  55. package/cpp/third_party/tgfx/android/app/src/androidTest/java/org/tgfx/hello/ExampleInstrumentedTest.kt +24 -0
  56. package/cpp/third_party/tgfx/android/app/src/main/AndroidManifest.xml +24 -0
  57. package/cpp/third_party/tgfx/android/app/src/main/cpp/JNIHelper.cpp +29 -0
  58. package/cpp/third_party/tgfx/android/app/src/main/cpp/JTGFXView.cpp +251 -0
  59. package/cpp/third_party/tgfx/android/app/src/main/cpp/JTGFXView.h +66 -0
  60. package/cpp/third_party/tgfx/android/app/src/main/ic_launcher-playstore.png +0 -0
  61. package/cpp/third_party/tgfx/android/app/src/main/java/org/tgfx/hello2d/MainActivity.kt +100 -0
  62. package/cpp/third_party/tgfx/android/app/src/main/java/org/tgfx/hello2d/TGFXView.kt +176 -0
  63. package/cpp/third_party/tgfx/android/app/src/main/res/drawable/ic_launcher_background.xml +74 -0
  64. package/cpp/third_party/tgfx/android/app/src/main/res/layout/activity_main.xml +12 -0
  65. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  66. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  67. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  68. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp +0 -0
  69. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  70. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  71. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp +0 -0
  72. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  73. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  74. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp +0 -0
  75. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  76. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  77. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp +0 -0
  78. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  79. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  80. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp +0 -0
  81. package/cpp/third_party/tgfx/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
  82. package/cpp/third_party/tgfx/android/app/src/main/res/values/colors.xml +10 -0
  83. package/cpp/third_party/tgfx/android/app/src/main/res/values/strings.xml +3 -0
  84. package/cpp/third_party/tgfx/android/app/src/main/res/values/themes.xml +5 -0
  85. package/cpp/third_party/tgfx/android/app/src/main/res/xml/backup_rules.xml +13 -0
  86. package/cpp/third_party/tgfx/android/app/src/main/res/xml/data_extraction_rules.xml +19 -0
  87. package/cpp/third_party/tgfx/android/app/src/test/java/io/pag/tgfxdemo/ExampleUnitTest.kt +17 -0
  88. package/cpp/third_party/tgfx/android/build.gradle.kts +5 -0
  89. package/cpp/third_party/tgfx/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  90. package/cpp/third_party/tgfx/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  91. package/cpp/third_party/tgfx/android/gradle.properties +24 -0
  92. package/cpp/third_party/tgfx/android/gradlew +252 -0
  93. package/cpp/third_party/tgfx/android/gradlew.bat +94 -0
  94. package/cpp/third_party/tgfx/android/settings.gradle.kts +17 -0
  95. package/cpp/third_party/tgfx/include/tgfx/core/AlphaType.h +43 -0
  96. package/cpp/third_party/tgfx/include/tgfx/core/Bitmap.h +249 -0
  97. package/cpp/third_party/tgfx/include/tgfx/core/BlendMode.h +148 -0
  98. package/cpp/third_party/tgfx/include/tgfx/core/Brush.h +92 -0
  99. package/cpp/third_party/tgfx/include/tgfx/core/Buffer.h +144 -0
  100. package/cpp/third_party/tgfx/include/tgfx/core/BytesKey.h +117 -0
  101. package/cpp/third_party/tgfx/include/tgfx/core/Canvas.h +557 -0
  102. package/cpp/third_party/tgfx/include/tgfx/core/Clock.h +72 -0
  103. package/cpp/third_party/tgfx/include/tgfx/core/Color.h +232 -0
  104. package/cpp/third_party/tgfx/include/tgfx/core/ColorFilter.h +137 -0
  105. package/cpp/third_party/tgfx/include/tgfx/core/ColorSpace.h +491 -0
  106. package/cpp/third_party/tgfx/include/tgfx/core/ColorType.h +72 -0
  107. package/cpp/third_party/tgfx/include/tgfx/core/CustomTypeface.h +174 -0
  108. package/cpp/third_party/tgfx/include/tgfx/core/Data.h +118 -0
  109. package/cpp/third_party/tgfx/include/tgfx/core/DataView.h +260 -0
  110. package/cpp/third_party/tgfx/include/tgfx/core/EncodedFormat.h +28 -0
  111. package/cpp/third_party/tgfx/include/tgfx/core/Font.h +176 -0
  112. package/cpp/third_party/tgfx/include/tgfx/core/FontMetrics.h +69 -0
  113. package/cpp/third_party/tgfx/include/tgfx/core/FontStyle.h +125 -0
  114. package/cpp/third_party/tgfx/include/tgfx/core/GlyphRun.h +91 -0
  115. package/cpp/third_party/tgfx/include/tgfx/core/GradientType.h +52 -0
  116. package/cpp/third_party/tgfx/include/tgfx/core/Image.h +387 -0
  117. package/cpp/third_party/tgfx/include/tgfx/core/ImageBuffer.h +129 -0
  118. package/cpp/third_party/tgfx/include/tgfx/core/ImageCodec.h +136 -0
  119. package/cpp/third_party/tgfx/include/tgfx/core/ImageFilter.h +196 -0
  120. package/cpp/third_party/tgfx/include/tgfx/core/ImageGenerator.h +100 -0
  121. package/cpp/third_party/tgfx/include/tgfx/core/ImageInfo.h +215 -0
  122. package/cpp/third_party/tgfx/include/tgfx/core/MapDirection.h +39 -0
  123. package/cpp/third_party/tgfx/include/tgfx/core/MaskFilter.h +67 -0
  124. package/cpp/third_party/tgfx/include/tgfx/core/Matrix.h +1025 -0
  125. package/cpp/third_party/tgfx/include/tgfx/core/Matrix3D.h +395 -0
  126. package/cpp/third_party/tgfx/include/tgfx/core/Mesh.h +93 -0
  127. package/cpp/third_party/tgfx/include/tgfx/core/Orientation.h +74 -0
  128. package/cpp/third_party/tgfx/include/tgfx/core/Paint.h +266 -0
  129. package/cpp/third_party/tgfx/include/tgfx/core/Path.h +500 -0
  130. package/cpp/third_party/tgfx/include/tgfx/core/PathEffect.h +79 -0
  131. package/cpp/third_party/tgfx/include/tgfx/core/PathMeasure.h +70 -0
  132. package/cpp/third_party/tgfx/include/tgfx/core/PathProvider.h +57 -0
  133. package/cpp/third_party/tgfx/include/tgfx/core/PathTypes.h +124 -0
  134. package/cpp/third_party/tgfx/include/tgfx/core/Picture.h +115 -0
  135. package/cpp/third_party/tgfx/include/tgfx/core/PictureRecorder.h +59 -0
  136. package/cpp/third_party/tgfx/include/tgfx/core/Pixmap.h +226 -0
  137. package/cpp/third_party/tgfx/include/tgfx/core/Point.h +199 -0
  138. package/cpp/third_party/tgfx/include/tgfx/core/RRect.h +182 -0
  139. package/cpp/third_party/tgfx/include/tgfx/core/RSXform.h +118 -0
  140. package/cpp/third_party/tgfx/include/tgfx/core/Rect.h +504 -0
  141. package/cpp/third_party/tgfx/include/tgfx/core/RenderFlags.h +41 -0
  142. package/cpp/third_party/tgfx/include/tgfx/core/SamplingOptions.h +50 -0
  143. package/cpp/third_party/tgfx/include/tgfx/core/Shader.h +272 -0
  144. package/cpp/third_party/tgfx/include/tgfx/core/Shape.h +210 -0
  145. package/cpp/third_party/tgfx/include/tgfx/core/Size.h +204 -0
  146. package/cpp/third_party/tgfx/include/tgfx/core/SrcRectConstraint.h +37 -0
  147. package/cpp/third_party/tgfx/include/tgfx/core/Stream.h +109 -0
  148. package/cpp/third_party/tgfx/include/tgfx/core/Stroke.h +118 -0
  149. package/cpp/third_party/tgfx/include/tgfx/core/Surface.h +227 -0
  150. package/cpp/third_party/tgfx/include/tgfx/core/SurfaceReadback.h +93 -0
  151. package/cpp/third_party/tgfx/include/tgfx/core/Task.h +152 -0
  152. package/cpp/third_party/tgfx/include/tgfx/core/TextBlob.h +162 -0
  153. package/cpp/third_party/tgfx/include/tgfx/core/TextBlobBuilder.h +141 -0
  154. package/cpp/third_party/tgfx/include/tgfx/core/TileMode.h +47 -0
  155. package/cpp/third_party/tgfx/include/tgfx/core/Typeface.h +203 -0
  156. package/cpp/third_party/tgfx/include/tgfx/core/UTF.h +52 -0
  157. package/cpp/third_party/tgfx/include/tgfx/core/Vec.h +525 -0
  158. package/cpp/third_party/tgfx/include/tgfx/core/WriteStream.h +146 -0
  159. package/cpp/third_party/tgfx/include/tgfx/core/YUVColorSpace.h +62 -0
  160. package/cpp/third_party/tgfx/include/tgfx/core/YUVData.h +92 -0
  161. package/cpp/third_party/tgfx/include/tgfx/gpu/Attribute.h +90 -0
  162. package/cpp/third_party/tgfx/include/tgfx/gpu/Backend.h +352 -0
  163. package/cpp/third_party/tgfx/include/tgfx/gpu/BlendFactor.h +101 -0
  164. package/cpp/third_party/tgfx/include/tgfx/gpu/BlendOperation.h +57 -0
  165. package/cpp/third_party/tgfx/include/tgfx/gpu/ColorWriteMask.h +54 -0
  166. package/cpp/third_party/tgfx/include/tgfx/gpu/CommandBuffer.h +31 -0
  167. package/cpp/third_party/tgfx/include/tgfx/gpu/CommandEncoder.h +100 -0
  168. package/cpp/third_party/tgfx/include/tgfx/gpu/CommandQueue.h +105 -0
  169. package/cpp/third_party/tgfx/include/tgfx/gpu/CompareFunction.h +67 -0
  170. package/cpp/third_party/tgfx/include/tgfx/gpu/Context.h +222 -0
  171. package/cpp/third_party/tgfx/include/tgfx/gpu/Device.h +79 -0
  172. package/cpp/third_party/tgfx/include/tgfx/gpu/FilterMode.h +36 -0
  173. package/cpp/third_party/tgfx/include/tgfx/gpu/GPU.h +162 -0
  174. package/cpp/third_party/tgfx/include/tgfx/gpu/GPUBuffer.h +122 -0
  175. package/cpp/third_party/tgfx/include/tgfx/gpu/GPUFeatures.h +51 -0
  176. package/cpp/third_party/tgfx/include/tgfx/gpu/GPUInfo.h +56 -0
  177. package/cpp/third_party/tgfx/include/tgfx/gpu/GPULimits.h +55 -0
  178. package/cpp/third_party/tgfx/include/tgfx/gpu/ImageOrigin.h +41 -0
  179. package/cpp/third_party/tgfx/include/tgfx/gpu/MipmapMode.h +39 -0
  180. package/cpp/third_party/tgfx/include/tgfx/gpu/PixelFormat.h +61 -0
  181. package/cpp/third_party/tgfx/include/tgfx/gpu/Recording.h +44 -0
  182. package/cpp/third_party/tgfx/include/tgfx/gpu/RenderPass.h +363 -0
  183. package/cpp/third_party/tgfx/include/tgfx/gpu/RenderPipeline.h +440 -0
  184. package/cpp/third_party/tgfx/include/tgfx/gpu/RuntimeEffect.h +74 -0
  185. package/cpp/third_party/tgfx/include/tgfx/gpu/Sampler.h +108 -0
  186. package/cpp/third_party/tgfx/include/tgfx/gpu/Semaphore.h +37 -0
  187. package/cpp/third_party/tgfx/include/tgfx/gpu/ShaderModule.h +50 -0
  188. package/cpp/third_party/tgfx/include/tgfx/gpu/ShaderStage.h +36 -0
  189. package/cpp/third_party/tgfx/include/tgfx/gpu/ShaderVisibility.h +46 -0
  190. package/cpp/third_party/tgfx/include/tgfx/gpu/StencilOperation.h +74 -0
  191. package/cpp/third_party/tgfx/include/tgfx/gpu/Texture.h +183 -0
  192. package/cpp/third_party/tgfx/include/tgfx/gpu/Window.h +75 -0
  193. package/cpp/third_party/tgfx/include/tgfx/gpu/metal/MetalDevice.h +56 -0
  194. package/cpp/third_party/tgfx/include/tgfx/gpu/metal/MetalTypes.h +53 -0
  195. package/cpp/third_party/tgfx/include/tgfx/gpu/metal/MetalWindow.h +66 -0
  196. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/GLDevice.h +78 -0
  197. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/GLTypes.h +64 -0
  198. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/cgl/CGLDevice.h +57 -0
  199. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/cgl/CGLWindow.h +45 -0
  200. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/eagl/EAGLDevice.h +63 -0
  201. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/eagl/EAGLWindow.h +47 -0
  202. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/egl/EGLDevice.h +89 -0
  203. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/egl/EGLGlobals.h +53 -0
  204. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/egl/EGLWindow.h +59 -0
  205. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/qt/QGLDevice.h +88 -0
  206. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/qt/QGLWindow.h +92 -0
  207. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/webgl/WebGLDevice.h +54 -0
  208. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/webgl/WebGLWindow.h +42 -0
  209. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/wgl/WGLDevice.h +62 -0
  210. package/cpp/third_party/tgfx/include/tgfx/gpu/opengl/wgl/WGLWindow.h +43 -0
  211. package/cpp/third_party/tgfx/include/tgfx/gpu/vulkan/VulkanDevice.h +62 -0
  212. package/cpp/third_party/tgfx/include/tgfx/gpu/vulkan/VulkanTypes.h +69 -0
  213. package/cpp/third_party/tgfx/include/tgfx/gpu/vulkan/VulkanWindow.h +103 -0
  214. package/cpp/third_party/tgfx/include/tgfx/gpu/webgpu/WebGPUDevice.h +60 -0
  215. package/cpp/third_party/tgfx/include/tgfx/gpu/webgpu/WebGPUTypes.h +55 -0
  216. package/cpp/third_party/tgfx/include/tgfx/gpu/webgpu/WebGPUWindow.h +55 -0
  217. package/cpp/third_party/tgfx/include/tgfx/layers/DisplayList.h +407 -0
  218. package/cpp/third_party/tgfx/include/tgfx/layers/ImageLayer.h +74 -0
  219. package/cpp/third_party/tgfx/include/tgfx/layers/Layer.h +789 -0
  220. package/cpp/third_party/tgfx/include/tgfx/layers/LayerMaskType.h +39 -0
  221. package/cpp/third_party/tgfx/include/tgfx/layers/LayerPaint.h +119 -0
  222. package/cpp/third_party/tgfx/include/tgfx/layers/LayerProperty.h +66 -0
  223. package/cpp/third_party/tgfx/include/tgfx/layers/LayerRecorder.h +143 -0
  224. package/cpp/third_party/tgfx/include/tgfx/layers/LayerType.h +55 -0
  225. package/cpp/third_party/tgfx/include/tgfx/layers/MeshLayer.h +95 -0
  226. package/cpp/third_party/tgfx/include/tgfx/layers/ShapeLayer.h +265 -0
  227. package/cpp/third_party/tgfx/include/tgfx/layers/ShapeStyle.h +92 -0
  228. package/cpp/third_party/tgfx/include/tgfx/layers/SolidLayer.h +114 -0
  229. package/cpp/third_party/tgfx/include/tgfx/layers/StrokeAlign.h +39 -0
  230. package/cpp/third_party/tgfx/include/tgfx/layers/TextAlign.h +47 -0
  231. package/cpp/third_party/tgfx/include/tgfx/layers/TextLayer.h +166 -0
  232. package/cpp/third_party/tgfx/include/tgfx/layers/VectorLayer.h +72 -0
  233. package/cpp/third_party/tgfx/include/tgfx/layers/filters/BlendFilter.h +76 -0
  234. package/cpp/third_party/tgfx/include/tgfx/layers/filters/BlurFilter.h +90 -0
  235. package/cpp/third_party/tgfx/include/tgfx/layers/filters/ColorMatrixFilter.h +79 -0
  236. package/cpp/third_party/tgfx/include/tgfx/layers/filters/DropShadowFilter.h +132 -0
  237. package/cpp/third_party/tgfx/include/tgfx/layers/filters/InnerShadowFilter.h +133 -0
  238. package/cpp/third_party/tgfx/include/tgfx/layers/filters/LayerFilter.h +101 -0
  239. package/cpp/third_party/tgfx/include/tgfx/layers/filters/LayerImageFilter.h +55 -0
  240. package/cpp/third_party/tgfx/include/tgfx/layers/filters/NoiseFilter.h +285 -0
  241. package/cpp/third_party/tgfx/include/tgfx/layers/layerstyles/BackgroundBlurStyle.h +106 -0
  242. package/cpp/third_party/tgfx/include/tgfx/layers/layerstyles/DropShadowStyle.h +165 -0
  243. package/cpp/third_party/tgfx/include/tgfx/layers/layerstyles/GlassStyle.h +168 -0
  244. package/cpp/third_party/tgfx/include/tgfx/layers/layerstyles/InnerShadowStyle.h +149 -0
  245. package/cpp/third_party/tgfx/include/tgfx/layers/layerstyles/LayerStyle.h +166 -0
  246. package/cpp/third_party/tgfx/include/tgfx/layers/layerstyles/LayerStyleInput.h +139 -0
  247. package/cpp/third_party/tgfx/include/tgfx/layers/layerstyles/NoiseStyle.h +241 -0
  248. package/cpp/third_party/tgfx/include/tgfx/layers/layerstyles/StyledShape.h +84 -0
  249. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/ColorSource.h +64 -0
  250. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/Ellipse.h +91 -0
  251. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/FillStyle.h +135 -0
  252. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/Gradient.h +418 -0
  253. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/ImagePattern.h +160 -0
  254. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/MergePath.h +87 -0
  255. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/Polystar.h +182 -0
  256. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/Rectangle.h +118 -0
  257. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/Repeater.h +184 -0
  258. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/RoundCorner.h +65 -0
  259. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/ScaleMode.h +54 -0
  260. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/ShapePath.h +91 -0
  261. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/SolidColor.h +71 -0
  262. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/StrokeStyle.h +216 -0
  263. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/Text.h +97 -0
  264. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/TextModifier.h +215 -0
  265. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/TextPath.h +165 -0
  266. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/TextSelector.h +289 -0
  267. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/TrimPath.h +117 -0
  268. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/VectorElement.h +81 -0
  269. package/cpp/third_party/tgfx/include/tgfx/layers/vectors/VectorGroup.h +171 -0
  270. package/cpp/third_party/tgfx/include/tgfx/pdf/PDFDocument.h +75 -0
  271. package/cpp/third_party/tgfx/include/tgfx/pdf/PDFMetadata.h +252 -0
  272. package/cpp/third_party/tgfx/include/tgfx/platform/HardwareBuffer.h +158 -0
  273. package/cpp/third_party/tgfx/include/tgfx/platform/ImageReader.h +92 -0
  274. package/cpp/third_party/tgfx/include/tgfx/platform/NativeImage.h +53 -0
  275. package/cpp/third_party/tgfx/include/tgfx/platform/Print.h +31 -0
  276. package/cpp/third_party/tgfx/include/tgfx/platform/android/AndroidBitmap.h +56 -0
  277. package/cpp/third_party/tgfx/include/tgfx/platform/android/Global.h +82 -0
  278. package/cpp/third_party/tgfx/include/tgfx/platform/android/HardwareBufferJNI.h +37 -0
  279. package/cpp/third_party/tgfx/include/tgfx/platform/android/JNIEnvironment.h +67 -0
  280. package/cpp/third_party/tgfx/include/tgfx/platform/android/SurfaceTextureReader.h +58 -0
  281. package/cpp/third_party/tgfx/include/tgfx/platform/apple/CTTypeface.h +43 -0
  282. package/cpp/third_party/tgfx/include/tgfx/platform/ohos/OHOSPixelMap.h +42 -0
  283. package/cpp/third_party/tgfx/include/tgfx/platform/web/VideoElementReader.h +40 -0
  284. package/cpp/third_party/tgfx/include/tgfx/svg/SVGAttribute.h +122 -0
  285. package/cpp/third_party/tgfx/include/tgfx/svg/SVGCustomParser.h +42 -0
  286. package/cpp/third_party/tgfx/include/tgfx/svg/SVGCustomWriter.h +59 -0
  287. package/cpp/third_party/tgfx/include/tgfx/svg/SVGDOM.h +108 -0
  288. package/cpp/third_party/tgfx/include/tgfx/svg/SVGExporter.h +150 -0
  289. package/cpp/third_party/tgfx/include/tgfx/svg/SVGLengthContext.h +109 -0
  290. package/cpp/third_party/tgfx/include/tgfx/svg/SVGPathParser.h +55 -0
  291. package/cpp/third_party/tgfx/include/tgfx/svg/SVGTypes.h +939 -0
  292. package/cpp/third_party/tgfx/include/tgfx/svg/SVGValue.h +95 -0
  293. package/cpp/third_party/tgfx/include/tgfx/svg/TextShaper.h +53 -0
  294. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGCircle.h +65 -0
  295. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGClipPath.h +51 -0
  296. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGContainer.h +61 -0
  297. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGDefs.h +39 -0
  298. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGEllipse.h +63 -0
  299. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFe.h +104 -0
  300. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeBlend.h +64 -0
  301. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeColorMatrix.h +67 -0
  302. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeComponentTransfer.h +95 -0
  303. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeComposite.h +61 -0
  304. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeDisplacementMap.h +70 -0
  305. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeFlood.h +56 -0
  306. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeGaussianBlur.h +62 -0
  307. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeImage.h +58 -0
  308. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeLightSource.h +105 -0
  309. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeLighting.h +100 -0
  310. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeMerge.h +71 -0
  311. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeMorphology.h +65 -0
  312. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeOffset.h +58 -0
  313. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFeTurbulence.h +59 -0
  314. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGFilter.h +64 -0
  315. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGGradient.h +61 -0
  316. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGGroup.h +37 -0
  317. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGHiddenContainer.h +37 -0
  318. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGImage.h +75 -0
  319. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGLine.h +63 -0
  320. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGLinearGradient.h +53 -0
  321. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGMask.h +60 -0
  322. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGNode.h +302 -0
  323. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGPath.h +56 -0
  324. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGPattern.h +68 -0
  325. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGPoly.h +64 -0
  326. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGRadialGradient.h +55 -0
  327. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGRect.h +67 -0
  328. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGRoot.h +69 -0
  329. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGShape.h +54 -0
  330. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGStop.h +47 -0
  331. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGText.h +158 -0
  332. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGTransformableNode.h +58 -0
  333. package/cpp/third_party/tgfx/include/tgfx/svg/node/SVGUse.h +61 -0
  334. package/cpp/third_party/tgfx/include/tgfx/svg/xml/XMLDOM.h +115 -0
  335. package/cpp/third_party/tgfx/ios/gen_ios +18 -0
  336. package/cpp/third_party/tgfx/ios/gen_simulator +18 -0
  337. package/cpp/third_party/tgfx/ios/metal/Hello2D/AppDelegate.h +23 -0
  338. package/cpp/third_party/tgfx/ios/metal/Hello2D/AppDelegate.m +52 -0
  339. package/cpp/third_party/tgfx/ios/metal/Hello2D/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  340. package/cpp/third_party/tgfx/ios/metal/Hello2D/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  341. package/cpp/third_party/tgfx/ios/metal/Hello2D/Assets.xcassets/AppIcon.appiconset/tgfx.png +0 -0
  342. package/cpp/third_party/tgfx/ios/metal/Hello2D/Assets.xcassets/Contents.json +6 -0
  343. package/cpp/third_party/tgfx/ios/metal/Hello2D/Base.lproj/LaunchScreen.storyboard +25 -0
  344. package/cpp/third_party/tgfx/ios/metal/Hello2D/Base.lproj/Main.storyboard +48 -0
  345. package/cpp/third_party/tgfx/ios/metal/Hello2D/Info.plist +25 -0
  346. package/cpp/third_party/tgfx/ios/metal/Hello2D/SceneDelegate.h +25 -0
  347. package/cpp/third_party/tgfx/ios/metal/Hello2D/SceneDelegate.m +66 -0
  348. package/cpp/third_party/tgfx/ios/metal/Hello2D/TGFXView.h +31 -0
  349. package/cpp/third_party/tgfx/ios/metal/Hello2D/TGFXView.mm +187 -0
  350. package/cpp/third_party/tgfx/ios/metal/Hello2D/ViewController.h +23 -0
  351. package/cpp/third_party/tgfx/ios/metal/Hello2D/ViewController.mm +165 -0
  352. package/cpp/third_party/tgfx/ios/metal/Hello2D/main.m +29 -0
  353. package/cpp/third_party/tgfx/ios/metal/Hello2D.xcodeproj/project.pbxproj +441 -0
  354. package/cpp/third_party/tgfx/ios/opengl/Hello2D/AppDelegate.h +23 -0
  355. package/cpp/third_party/tgfx/ios/opengl/Hello2D/AppDelegate.m +52 -0
  356. package/cpp/third_party/tgfx/ios/opengl/Hello2D/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  357. package/cpp/third_party/tgfx/ios/opengl/Hello2D/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  358. package/cpp/third_party/tgfx/ios/opengl/Hello2D/Assets.xcassets/AppIcon.appiconset/tgfx.png +0 -0
  359. package/cpp/third_party/tgfx/ios/opengl/Hello2D/Assets.xcassets/Contents.json +6 -0
  360. package/cpp/third_party/tgfx/ios/opengl/Hello2D/Base.lproj/LaunchScreen.storyboard +25 -0
  361. package/cpp/third_party/tgfx/ios/opengl/Hello2D/Base.lproj/Main.storyboard +48 -0
  362. package/cpp/third_party/tgfx/ios/opengl/Hello2D/Info.plist +25 -0
  363. package/cpp/third_party/tgfx/ios/opengl/Hello2D/SceneDelegate.h +25 -0
  364. package/cpp/third_party/tgfx/ios/opengl/Hello2D/SceneDelegate.m +66 -0
  365. package/cpp/third_party/tgfx/ios/opengl/Hello2D/TGFXView.h +31 -0
  366. package/cpp/third_party/tgfx/ios/opengl/Hello2D/TGFXView.mm +181 -0
  367. package/cpp/third_party/tgfx/ios/opengl/Hello2D/ViewController.h +23 -0
  368. package/cpp/third_party/tgfx/ios/opengl/Hello2D/ViewController.mm +165 -0
  369. package/cpp/third_party/tgfx/ios/opengl/Hello2D/main.m +29 -0
  370. package/cpp/third_party/tgfx/ios/opengl/Hello2D.xcodeproj/project.pbxproj +442 -0
  371. package/cpp/third_party/tgfx/mac/gen_mac +18 -0
  372. package/cpp/third_party/tgfx/mac/metal/Hello2D/AppDelegate.h +23 -0
  373. package/cpp/third_party/tgfx/mac/metal/Hello2D/AppDelegate.m +35 -0
  374. package/cpp/third_party/tgfx/mac/metal/Hello2D/Assets.xcassets/AppIcon.appiconset/1024.png +0 -0
  375. package/cpp/third_party/tgfx/mac/metal/Hello2D/Assets.xcassets/AppIcon.appiconset/128.png +0 -0
  376. package/cpp/third_party/tgfx/mac/metal/Hello2D/Assets.xcassets/AppIcon.appiconset/16.png +0 -0
  377. package/cpp/third_party/tgfx/mac/metal/Hello2D/Assets.xcassets/AppIcon.appiconset/256.png +0 -0
  378. package/cpp/third_party/tgfx/mac/metal/Hello2D/Assets.xcassets/AppIcon.appiconset/32.png +0 -0
  379. package/cpp/third_party/tgfx/mac/metal/Hello2D/Assets.xcassets/AppIcon.appiconset/512.png +0 -0
  380. package/cpp/third_party/tgfx/mac/metal/Hello2D/Assets.xcassets/AppIcon.appiconset/64.png +0 -0
  381. package/cpp/third_party/tgfx/mac/metal/Hello2D/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
  382. package/cpp/third_party/tgfx/mac/metal/Hello2D/Assets.xcassets/Contents.json +6 -0
  383. package/cpp/third_party/tgfx/mac/metal/Hello2D/Base.lproj/Main.storyboard +718 -0
  384. package/cpp/third_party/tgfx/mac/metal/Hello2D/Hello2D.entitlements +10 -0
  385. package/cpp/third_party/tgfx/mac/metal/Hello2D/Info.plist +36 -0
  386. package/cpp/third_party/tgfx/mac/metal/Hello2D/TGFXView.h +37 -0
  387. package/cpp/third_party/tgfx/mac/metal/Hello2D/TGFXView.mm +251 -0
  388. package/cpp/third_party/tgfx/mac/metal/Hello2D/ViewController.h +23 -0
  389. package/cpp/third_party/tgfx/mac/metal/Hello2D/ViewController.mm +60 -0
  390. package/cpp/third_party/tgfx/mac/metal/Hello2D/WindowController.h +27 -0
  391. package/cpp/third_party/tgfx/mac/metal/Hello2D/WindowController.mm +35 -0
  392. package/cpp/third_party/tgfx/mac/metal/Hello2D/main.m +26 -0
  393. package/cpp/third_party/tgfx/mac/metal/Hello2D.xcodeproj/project.pbxproj +405 -0
  394. package/cpp/third_party/tgfx/mac/opengl/Hello2D/AppDelegate.h +23 -0
  395. package/cpp/third_party/tgfx/mac/opengl/Hello2D/AppDelegate.m +35 -0
  396. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Assets.xcassets/AppIcon.appiconset/1024.png +0 -0
  397. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Assets.xcassets/AppIcon.appiconset/128.png +0 -0
  398. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Assets.xcassets/AppIcon.appiconset/16.png +0 -0
  399. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Assets.xcassets/AppIcon.appiconset/256.png +0 -0
  400. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Assets.xcassets/AppIcon.appiconset/32.png +0 -0
  401. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Assets.xcassets/AppIcon.appiconset/512.png +0 -0
  402. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Assets.xcassets/AppIcon.appiconset/64.png +0 -0
  403. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
  404. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Assets.xcassets/Contents.json +6 -0
  405. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Base.lproj/Main.storyboard +718 -0
  406. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Hello2D.entitlements +10 -0
  407. package/cpp/third_party/tgfx/mac/opengl/Hello2D/Info.plist +36 -0
  408. package/cpp/third_party/tgfx/mac/opengl/Hello2D/TGFXView.h +39 -0
  409. package/cpp/third_party/tgfx/mac/opengl/Hello2D/TGFXView.mm +316 -0
  410. package/cpp/third_party/tgfx/mac/opengl/Hello2D/ViewController.h +23 -0
  411. package/cpp/third_party/tgfx/mac/opengl/Hello2D/ViewController.mm +61 -0
  412. package/cpp/third_party/tgfx/mac/opengl/Hello2D/WindowController.h +27 -0
  413. package/cpp/third_party/tgfx/mac/opengl/Hello2D/WindowController.mm +35 -0
  414. package/cpp/third_party/tgfx/mac/opengl/Hello2D/main.m +26 -0
  415. package/cpp/third_party/tgfx/mac/opengl/Hello2D.xcodeproj/project.pbxproj +402 -0
  416. package/cpp/third_party/tgfx/src/core/AdaptiveDashEffect.cpp +245 -0
  417. package/cpp/third_party/tgfx/src/core/AdaptiveDashEffect.h +37 -0
  418. package/cpp/third_party/tgfx/src/core/AdvancedTypefaceInfo.h +86 -0
  419. package/cpp/third_party/tgfx/src/core/Atlas.cpp +262 -0
  420. package/cpp/third_party/tgfx/src/core/Atlas.h +95 -0
  421. package/cpp/third_party/tgfx/src/core/AtlasManager.cpp +99 -0
  422. package/cpp/third_party/tgfx/src/core/AtlasManager.h +60 -0
  423. package/cpp/third_party/tgfx/src/core/AtlasStrikeCache.cpp +108 -0
  424. package/cpp/third_party/tgfx/src/core/AtlasStrikeCache.h +99 -0
  425. package/cpp/third_party/tgfx/src/core/AtlasTypes.cpp +82 -0
  426. package/cpp/third_party/tgfx/src/core/AtlasTypes.h +279 -0
  427. package/cpp/third_party/tgfx/src/core/Bitmap.cpp +131 -0
  428. package/cpp/third_party/tgfx/src/core/BoxFilterDownsample.cpp +449 -0
  429. package/cpp/third_party/tgfx/src/core/BoxFilterDownsample.h +49 -0
  430. package/cpp/third_party/tgfx/src/core/BoxFilterDownsampleSIMD.cpp +416 -0
  431. package/cpp/third_party/tgfx/src/core/BoxFilterDownsampleSIMD.h +40 -0
  432. package/cpp/third_party/tgfx/src/core/Brush.cpp +76 -0
  433. package/cpp/third_party/tgfx/src/core/Canvas.cpp +781 -0
  434. package/cpp/third_party/tgfx/src/core/CanvasState.cpp +30 -0
  435. package/cpp/third_party/tgfx/src/core/CanvasState.h +46 -0
  436. package/cpp/third_party/tgfx/src/core/Checksum.cpp +127 -0
  437. package/cpp/third_party/tgfx/src/core/Checksum.h +35 -0
  438. package/cpp/third_party/tgfx/src/core/ClipStack.cpp +720 -0
  439. package/cpp/third_party/tgfx/src/core/ClipStack.h +252 -0
  440. package/cpp/third_party/tgfx/src/core/Color.cpp +54 -0
  441. package/cpp/third_party/tgfx/src/core/ColorSpace.cpp +836 -0
  442. package/cpp/third_party/tgfx/src/core/ColorSpaceXformSteps.cpp +286 -0
  443. package/cpp/third_party/tgfx/src/core/ColorSpaceXformSteps.h +91 -0
  444. package/cpp/third_party/tgfx/src/core/CustomTypeface.cpp +104 -0
  445. package/cpp/third_party/tgfx/src/core/Data.cpp +95 -0
  446. package/cpp/third_party/tgfx/src/core/DataSource.h +140 -0
  447. package/cpp/third_party/tgfx/src/core/DrawContext.h +114 -0
  448. package/cpp/third_party/tgfx/src/core/Font.cpp +144 -0
  449. package/cpp/third_party/tgfx/src/core/GeometryShape.cpp +202 -0
  450. package/cpp/third_party/tgfx/src/core/GeometryShape.h +136 -0
  451. package/cpp/third_party/tgfx/src/core/GlyphRasterizer.cpp +58 -0
  452. package/cpp/third_party/tgfx/src/core/GlyphRasterizer.h +63 -0
  453. package/cpp/third_party/tgfx/src/core/GlyphTransform.cpp +110 -0
  454. package/cpp/third_party/tgfx/src/core/GlyphTransform.h +57 -0
  455. package/cpp/third_party/tgfx/src/core/GradientGenerator.cpp +78 -0
  456. package/cpp/third_party/tgfx/src/core/GradientGenerator.h +42 -0
  457. package/cpp/third_party/tgfx/src/core/HairlineTriangulator.cpp +569 -0
  458. package/cpp/third_party/tgfx/src/core/HairlineTriangulator.h +52 -0
  459. package/cpp/third_party/tgfx/src/core/ImageBuffer.cpp +95 -0
  460. package/cpp/third_party/tgfx/src/core/ImageCodec.cpp +221 -0
  461. package/cpp/third_party/tgfx/src/core/ImageFilter.cpp +116 -0
  462. package/cpp/third_party/tgfx/src/core/ImageInfo.cpp +118 -0
  463. package/cpp/third_party/tgfx/src/core/ImageSource.cpp +43 -0
  464. package/cpp/third_party/tgfx/src/core/ImageSource.h +48 -0
  465. package/cpp/third_party/tgfx/src/core/ImageUserTypeface.cpp +144 -0
  466. package/cpp/third_party/tgfx/src/core/ImageUserTypeface.h +54 -0
  467. package/cpp/third_party/tgfx/src/core/LayerUnrollContext.cpp +103 -0
  468. package/cpp/third_party/tgfx/src/core/LayerUnrollContext.h +80 -0
  469. package/cpp/third_party/tgfx/src/core/Matrix.cpp +610 -0
  470. package/cpp/third_party/tgfx/src/core/Matrix3D.cpp +469 -0
  471. package/cpp/third_party/tgfx/src/core/Matrix3DUtils.cpp +67 -0
  472. package/cpp/third_party/tgfx/src/core/Matrix3DUtils.h +89 -0
  473. package/cpp/third_party/tgfx/src/core/MatrixSIMD.cpp +350 -0
  474. package/cpp/third_party/tgfx/src/core/MatrixUtils.cpp +45 -0
  475. package/cpp/third_party/tgfx/src/core/MatrixUtils.h +33 -0
  476. package/cpp/third_party/tgfx/src/core/MeasureContext.cpp +131 -0
  477. package/cpp/third_party/tgfx/src/core/MeasureContext.h +72 -0
  478. package/cpp/third_party/tgfx/src/core/Mesh.cpp +44 -0
  479. package/cpp/third_party/tgfx/src/core/MeshBase.h +66 -0
  480. package/cpp/third_party/tgfx/src/core/NoConicsPathIterator.cpp +153 -0
  481. package/cpp/third_party/tgfx/src/core/NoConicsPathIterator.h +91 -0
  482. package/cpp/third_party/tgfx/src/core/Orientation.cpp +49 -0
  483. package/cpp/third_party/tgfx/src/core/Paint.cpp +40 -0
  484. package/cpp/third_party/tgfx/src/core/Path.cpp +716 -0
  485. package/cpp/third_party/tgfx/src/core/PathEffect.cpp +63 -0
  486. package/cpp/third_party/tgfx/src/core/PathMeasure.cpp +76 -0
  487. package/cpp/third_party/tgfx/src/core/PathProvider.cpp +43 -0
  488. package/cpp/third_party/tgfx/src/core/PathRasterizer.cpp +49 -0
  489. package/cpp/third_party/tgfx/src/core/PathRasterizer.h +61 -0
  490. package/cpp/third_party/tgfx/src/core/PathRef.cpp +58 -0
  491. package/cpp/third_party/tgfx/src/core/PathRef.h +59 -0
  492. package/cpp/third_party/tgfx/src/core/PathTriangulator.cpp +89 -0
  493. package/cpp/third_party/tgfx/src/core/PathTriangulator.h +60 -0
  494. package/cpp/third_party/tgfx/src/core/PathUserTypeface.cpp +217 -0
  495. package/cpp/third_party/tgfx/src/core/PathUserTypeface.h +53 -0
  496. package/cpp/third_party/tgfx/src/core/Picture.cpp +260 -0
  497. package/cpp/third_party/tgfx/src/core/PictureContext.cpp +263 -0
  498. package/cpp/third_party/tgfx/src/core/PictureContext.h +92 -0
  499. package/cpp/third_party/tgfx/src/core/PictureRecorder.cpp +51 -0
  500. package/cpp/third_party/tgfx/src/core/PictureRecords.h +419 -0
  501. package/cpp/third_party/tgfx/src/core/PixelBuffer.cpp +158 -0
  502. package/cpp/third_party/tgfx/src/core/PixelBuffer.h +113 -0
  503. package/cpp/third_party/tgfx/src/core/PixelBufferCodec.cpp +46 -0
  504. package/cpp/third_party/tgfx/src/core/PixelBufferCodec.h +43 -0
  505. package/cpp/third_party/tgfx/src/core/PixelRef.cpp +68 -0
  506. package/cpp/third_party/tgfx/src/core/PixelRef.h +111 -0
  507. package/cpp/third_party/tgfx/src/core/Pixmap.cpp +186 -0
  508. package/cpp/third_party/tgfx/src/core/PlaybackContext.cpp +117 -0
  509. package/cpp/third_party/tgfx/src/core/PlaybackContext.h +78 -0
  510. package/cpp/third_party/tgfx/src/core/Point.cpp +28 -0
  511. package/cpp/third_party/tgfx/src/core/RRect.cpp +154 -0
  512. package/cpp/third_party/tgfx/src/core/RRectUtils.cpp +334 -0
  513. package/cpp/third_party/tgfx/src/core/RRectUtils.h +79 -0
  514. package/cpp/third_party/tgfx/src/core/RSXform.cpp +31 -0
  515. package/cpp/third_party/tgfx/src/core/RawPixelCodec.cpp +89 -0
  516. package/cpp/third_party/tgfx/src/core/RawPixelCodec.h +49 -0
  517. package/cpp/third_party/tgfx/src/core/Rect.cpp +68 -0
  518. package/cpp/third_party/tgfx/src/core/RectPackSkyline.cpp +104 -0
  519. package/cpp/third_party/tgfx/src/core/RectPackSkyline.h +67 -0
  520. package/cpp/third_party/tgfx/src/core/RectSIMD.cpp +91 -0
  521. package/cpp/third_party/tgfx/src/core/RunRecord.cpp +76 -0
  522. package/cpp/third_party/tgfx/src/core/RunRecord.h +61 -0
  523. package/cpp/third_party/tgfx/src/core/ScaledImageGenerator.cpp +47 -0
  524. package/cpp/third_party/tgfx/src/core/ScaledImageGenerator.h +46 -0
  525. package/cpp/third_party/tgfx/src/core/ScalerContext.cpp +81 -0
  526. package/cpp/third_party/tgfx/src/core/ScalerContext.h +98 -0
  527. package/cpp/third_party/tgfx/src/core/Shader.cpp +38 -0
  528. package/cpp/third_party/tgfx/src/core/ShapeMesh.cpp +48 -0
  529. package/cpp/third_party/tgfx/src/core/ShapeMesh.h +62 -0
  530. package/cpp/third_party/tgfx/src/core/ShapeRasterizer.cpp +83 -0
  531. package/cpp/third_party/tgfx/src/core/ShapeRasterizer.h +71 -0
  532. package/cpp/third_party/tgfx/src/core/ShapeVertexSource.cpp +57 -0
  533. package/cpp/third_party/tgfx/src/core/ShapeVertexSource.h +42 -0
  534. package/cpp/third_party/tgfx/src/core/StencilCoverPathTessellator.cpp +258 -0
  535. package/cpp/third_party/tgfx/src/core/StencilCoverPathTessellator.h +100 -0
  536. package/cpp/third_party/tgfx/src/core/Stroke.cpp +65 -0
  537. package/cpp/third_party/tgfx/src/core/Surface.cpp +292 -0
  538. package/cpp/third_party/tgfx/src/core/SurfaceReadback.cpp +143 -0
  539. package/cpp/third_party/tgfx/src/core/TextBlob.cpp +330 -0
  540. package/cpp/third_party/tgfx/src/core/TextBlobBuilder.cpp +215 -0
  541. package/cpp/third_party/tgfx/src/core/TrimPathEffect.cpp +188 -0
  542. package/cpp/third_party/tgfx/src/core/TrimPathEffect.h +35 -0
  543. package/cpp/third_party/tgfx/src/core/Typeface.cpp +170 -0
  544. package/cpp/third_party/tgfx/src/core/UserScalerContext.h +66 -0
  545. package/cpp/third_party/tgfx/src/core/UserTypeface.h +95 -0
  546. package/cpp/third_party/tgfx/src/core/Vec.cpp +53 -0
  547. package/cpp/third_party/tgfx/src/core/VecSIMD.cpp +325 -0
  548. package/cpp/third_party/tgfx/src/core/VertexMesh.cpp +111 -0
  549. package/cpp/third_party/tgfx/src/core/VertexMesh.h +107 -0
  550. package/cpp/third_party/tgfx/src/core/YUVColorSpace.cpp +33 -0
  551. package/cpp/third_party/tgfx/src/core/YUVData.cpp +81 -0
  552. package/cpp/third_party/tgfx/src/core/YUVHardwareBuffer.cpp +98 -0
  553. package/cpp/third_party/tgfx/src/core/YUVHardwareBuffer.h +63 -0
  554. package/cpp/third_party/tgfx/src/core/codecs/jpeg/JpegCodec.cpp +445 -0
  555. package/cpp/third_party/tgfx/src/core/codecs/jpeg/JpegCodec.h +61 -0
  556. package/cpp/third_party/tgfx/src/core/codecs/png/PngCodec.cpp +457 -0
  557. package/cpp/third_party/tgfx/src/core/codecs/png/PngCodec.h +57 -0
  558. package/cpp/third_party/tgfx/src/core/codecs/webp/WebpCodec.cpp +253 -0
  559. package/cpp/third_party/tgfx/src/core/codecs/webp/WebpCodec.h +56 -0
  560. package/cpp/third_party/tgfx/src/core/codecs/webp/WebpUtility.cpp +376 -0
  561. package/cpp/third_party/tgfx/src/core/codecs/webp/WebpUtility.h +41 -0
  562. package/cpp/third_party/tgfx/src/core/filters/AlphaThresholdColorFilter.cpp +44 -0
  563. package/cpp/third_party/tgfx/src/core/filters/AlphaThresholdColorFilter.h +46 -0
  564. package/cpp/third_party/tgfx/src/core/filters/BlendImageFilter.cpp +72 -0
  565. package/cpp/third_party/tgfx/src/core/filters/BlendImageFilter.h +45 -0
  566. package/cpp/third_party/tgfx/src/core/filters/ColorImageFilter.cpp +59 -0
  567. package/cpp/third_party/tgfx/src/core/filters/ColorImageFilter.h +41 -0
  568. package/cpp/third_party/tgfx/src/core/filters/ComposeColorFilter.cpp +70 -0
  569. package/cpp/third_party/tgfx/src/core/filters/ComposeColorFilter.h +47 -0
  570. package/cpp/third_party/tgfx/src/core/filters/ComposeImageFilter.cpp +98 -0
  571. package/cpp/third_party/tgfx/src/core/filters/ComposeImageFilter.h +45 -0
  572. package/cpp/third_party/tgfx/src/core/filters/DropShadowImageFilter.cpp +128 -0
  573. package/cpp/third_party/tgfx/src/core/filters/DropShadowImageFilter.h +60 -0
  574. package/cpp/third_party/tgfx/src/core/filters/GaussianBlurImageFilter.cpp +226 -0
  575. package/cpp/third_party/tgfx/src/core/filters/GaussianBlurImageFilter.h +62 -0
  576. package/cpp/third_party/tgfx/src/core/filters/InnerShadowImageFilter.cpp +104 -0
  577. package/cpp/third_party/tgfx/src/core/filters/InnerShadowImageFilter.h +58 -0
  578. package/cpp/third_party/tgfx/src/core/filters/LumaColorFilter.cpp +33 -0
  579. package/cpp/third_party/tgfx/src/core/filters/LumaColorFilter.h +42 -0
  580. package/cpp/third_party/tgfx/src/core/filters/MatrixColorFilter.cpp +60 -0
  581. package/cpp/third_party/tgfx/src/core/filters/MatrixColorFilter.h +48 -0
  582. package/cpp/third_party/tgfx/src/core/filters/ModeColorFilter.cpp +101 -0
  583. package/cpp/third_party/tgfx/src/core/filters/ModeColorFilter.h +50 -0
  584. package/cpp/third_party/tgfx/src/core/filters/RuntimeImageFilter.cpp +82 -0
  585. package/cpp/third_party/tgfx/src/core/filters/RuntimeImageFilter.h +48 -0
  586. package/cpp/third_party/tgfx/src/core/filters/ShaderMaskFilter.cpp +55 -0
  587. package/cpp/third_party/tgfx/src/core/filters/ShaderMaskFilter.h +56 -0
  588. package/cpp/third_party/tgfx/src/core/images/BufferImage.cpp +80 -0
  589. package/cpp/third_party/tgfx/src/core/images/BufferImage.h +62 -0
  590. package/cpp/third_party/tgfx/src/core/images/CodecImage.cpp +67 -0
  591. package/cpp/third_party/tgfx/src/core/images/CodecImage.h +65 -0
  592. package/cpp/third_party/tgfx/src/core/images/DecodedImage.cpp +62 -0
  593. package/cpp/third_party/tgfx/src/core/images/DecodedImage.h +69 -0
  594. package/cpp/third_party/tgfx/src/core/images/FilterImage.cpp +158 -0
  595. package/cpp/third_party/tgfx/src/core/images/FilterImage.h +80 -0
  596. package/cpp/third_party/tgfx/src/core/images/GeneratorImage.cpp +44 -0
  597. package/cpp/third_party/tgfx/src/core/images/GeneratorImage.h +64 -0
  598. package/cpp/third_party/tgfx/src/core/images/Image.cpp +249 -0
  599. package/cpp/third_party/tgfx/src/core/images/OrientImage.cpp +170 -0
  600. package/cpp/third_party/tgfx/src/core/images/OrientImage.h +59 -0
  601. package/cpp/third_party/tgfx/src/core/images/PictureImage.cpp +180 -0
  602. package/cpp/third_party/tgfx/src/core/images/PictureImage.h +84 -0
  603. package/cpp/third_party/tgfx/src/core/images/PixelImage.cpp +43 -0
  604. package/cpp/third_party/tgfx/src/core/images/PixelImage.h +42 -0
  605. package/cpp/third_party/tgfx/src/core/images/RGBAAAImage.cpp +140 -0
  606. package/cpp/third_party/tgfx/src/core/images/RGBAAAImage.h +56 -0
  607. package/cpp/third_party/tgfx/src/core/images/RasterizedImage.cpp +132 -0
  608. package/cpp/third_party/tgfx/src/core/images/RasterizedImage.h +84 -0
  609. package/cpp/third_party/tgfx/src/core/images/ScaledImage.cpp +102 -0
  610. package/cpp/third_party/tgfx/src/core/images/ScaledImage.h +70 -0
  611. package/cpp/third_party/tgfx/src/core/images/SubsetImage.cpp +131 -0
  612. package/cpp/third_party/tgfx/src/core/images/SubsetImage.h +65 -0
  613. package/cpp/third_party/tgfx/src/core/images/TextureImage.cpp +92 -0
  614. package/cpp/third_party/tgfx/src/core/images/TextureImage.h +96 -0
  615. package/cpp/third_party/tgfx/src/core/images/TransformImage.cpp +77 -0
  616. package/cpp/third_party/tgfx/src/core/images/TransformImage.h +64 -0
  617. package/cpp/third_party/tgfx/src/core/shaders/BlendShader.cpp +74 -0
  618. package/cpp/third_party/tgfx/src/core/shaders/BlendShader.h +47 -0
  619. package/cpp/third_party/tgfx/src/core/shaders/ColorFilterShader.cpp +65 -0
  620. package/cpp/third_party/tgfx/src/core/shaders/ColorFilterShader.h +54 -0
  621. package/cpp/third_party/tgfx/src/core/shaders/ColorShader.cpp +56 -0
  622. package/cpp/third_party/tgfx/src/core/shaders/ColorShader.h +50 -0
  623. package/cpp/third_party/tgfx/src/core/shaders/GradientShader.cpp +411 -0
  624. package/cpp/third_party/tgfx/src/core/shaders/GradientShader.h +126 -0
  625. package/cpp/third_party/tgfx/src/core/shaders/ImageShader.cpp +64 -0
  626. package/cpp/third_party/tgfx/src/core/shaders/ImageShader.h +56 -0
  627. package/cpp/third_party/tgfx/src/core/shaders/MatrixShader.cpp +73 -0
  628. package/cpp/third_party/tgfx/src/core/shaders/MatrixShader.h +59 -0
  629. package/cpp/third_party/tgfx/src/core/shaders/PerlinNoiseShader.cpp +216 -0
  630. package/cpp/third_party/tgfx/src/core/shaders/PerlinNoiseShader.h +91 -0
  631. package/cpp/third_party/tgfx/src/core/shaders/RuntimeShader.cpp +51 -0
  632. package/cpp/third_party/tgfx/src/core/shaders/RuntimeShader.h +31 -0
  633. package/cpp/third_party/tgfx/src/core/shapes/AppendShape.cpp +83 -0
  634. package/cpp/third_party/tgfx/src/core/shapes/AppendShape.h +53 -0
  635. package/cpp/third_party/tgfx/src/core/shapes/EffectShape.cpp +45 -0
  636. package/cpp/third_party/tgfx/src/core/shapes/EffectShape.h +51 -0
  637. package/cpp/third_party/tgfx/src/core/shapes/FillTypeShape.cpp +53 -0
  638. package/cpp/third_party/tgfx/src/core/shapes/FillTypeShape.h +51 -0
  639. package/cpp/third_party/tgfx/src/core/shapes/GlyphShape.cpp +79 -0
  640. package/cpp/third_party/tgfx/src/core/shapes/GlyphShape.h +50 -0
  641. package/cpp/third_party/tgfx/src/core/shapes/Matrix3DShape.cpp +93 -0
  642. package/cpp/third_party/tgfx/src/core/shapes/Matrix3DShape.h +58 -0
  643. package/cpp/third_party/tgfx/src/core/shapes/MatrixShape.cpp +94 -0
  644. package/cpp/third_party/tgfx/src/core/shapes/MatrixShape.h +55 -0
  645. package/cpp/third_party/tgfx/src/core/shapes/MergeShape.cpp +90 -0
  646. package/cpp/third_party/tgfx/src/core/shapes/MergeShape.h +49 -0
  647. package/cpp/third_party/tgfx/src/core/shapes/PathShape.cpp +34 -0
  648. package/cpp/third_party/tgfx/src/core/shapes/PathShape.h +58 -0
  649. package/cpp/third_party/tgfx/src/core/shapes/ProviderShape.cpp +36 -0
  650. package/cpp/third_party/tgfx/src/core/shapes/ProviderShape.h +48 -0
  651. package/cpp/third_party/tgfx/src/core/shapes/ReverseShape.cpp +47 -0
  652. package/cpp/third_party/tgfx/src/core/shapes/ReverseShape.h +49 -0
  653. package/cpp/third_party/tgfx/src/core/shapes/Shape.cpp +51 -0
  654. package/cpp/third_party/tgfx/src/core/shapes/StrokeShape.cpp +110 -0
  655. package/cpp/third_party/tgfx/src/core/shapes/StrokeShape.h +58 -0
  656. package/cpp/third_party/tgfx/src/core/shapes/TextShape.cpp +77 -0
  657. package/cpp/third_party/tgfx/src/core/shapes/TextShape.h +49 -0
  658. package/cpp/third_party/tgfx/src/core/shapes/UniqueKeyShape.h +34 -0
  659. package/cpp/third_party/tgfx/src/core/utils/AddressOf.h +35 -0
  660. package/cpp/third_party/tgfx/src/core/utils/AtomicCache.h +52 -0
  661. package/cpp/third_party/tgfx/src/core/utils/BlockAllocator.cpp +167 -0
  662. package/cpp/third_party/tgfx/src/core/utils/BlockAllocator.h +211 -0
  663. package/cpp/third_party/tgfx/src/core/utils/Buffer.cpp +121 -0
  664. package/cpp/third_party/tgfx/src/core/utils/BytesKey.cpp +71 -0
  665. package/cpp/third_party/tgfx/src/core/utils/ClearPixels.cpp +33 -0
  666. package/cpp/third_party/tgfx/src/core/utils/ClearPixels.h +28 -0
  667. package/cpp/third_party/tgfx/src/core/utils/Clock.cpp +80 -0
  668. package/cpp/third_party/tgfx/src/core/utils/ColorHelper.cpp +65 -0
  669. package/cpp/third_party/tgfx/src/core/utils/ColorHelper.h +28 -0
  670. package/cpp/third_party/tgfx/src/core/utils/ColorSpaceHelper.cpp +207 -0
  671. package/cpp/third_party/tgfx/src/core/utils/ColorSpaceHelper.h +44 -0
  672. package/cpp/third_party/tgfx/src/core/utils/CopyPixels.cpp +110 -0
  673. package/cpp/third_party/tgfx/src/core/utils/CopyPixels.h +30 -0
  674. package/cpp/third_party/tgfx/src/core/utils/DataView.cpp +290 -0
  675. package/cpp/third_party/tgfx/src/core/utils/DecomposeRects.cpp +89 -0
  676. package/cpp/third_party/tgfx/src/core/utils/DecomposeRects.h +31 -0
  677. package/cpp/third_party/tgfx/src/core/utils/EnumHasher.h +32 -0
  678. package/cpp/third_party/tgfx/src/core/utils/FauxBoldScale.cpp +70 -0
  679. package/cpp/third_party/tgfx/src/core/utils/FauxBoldScale.h +25 -0
  680. package/cpp/third_party/tgfx/src/core/utils/FontTableTag.h +34 -0
  681. package/cpp/third_party/tgfx/src/core/utils/GammaCorrection.cpp +44 -0
  682. package/cpp/third_party/tgfx/src/core/utils/GammaCorrection.h +29 -0
  683. package/cpp/third_party/tgfx/src/core/utils/GeometryExtra.h +58 -0
  684. package/cpp/third_party/tgfx/src/core/utils/GlyphConverter.cpp +51 -0
  685. package/cpp/third_party/tgfx/src/core/utils/GlyphConverter.h +46 -0
  686. package/cpp/third_party/tgfx/src/core/utils/HardwareBufferUtil.cpp +63 -0
  687. package/cpp/third_party/tgfx/src/core/utils/HardwareBufferUtil.h +38 -0
  688. package/cpp/third_party/tgfx/src/core/utils/HashRange.cpp +29 -0
  689. package/cpp/third_party/tgfx/src/core/utils/HashRange.h +28 -0
  690. package/cpp/third_party/tgfx/src/core/utils/Log.h +63 -0
  691. package/cpp/third_party/tgfx/src/core/utils/MD5.cpp +199 -0
  692. package/cpp/third_party/tgfx/src/core/utils/MD5.h +33 -0
  693. package/cpp/third_party/tgfx/src/core/utils/MathExtra.cpp +118 -0
  694. package/cpp/third_party/tgfx/src/core/utils/MathExtra.h +177 -0
  695. package/cpp/third_party/tgfx/src/core/utils/NextCacheScaleLevel.cpp +47 -0
  696. package/cpp/third_party/tgfx/src/core/utils/NextCacheScaleLevel.h +25 -0
  697. package/cpp/third_party/tgfx/src/core/utils/OrientationHelper.h +100 -0
  698. package/cpp/third_party/tgfx/src/core/utils/PathUtils.cpp +479 -0
  699. package/cpp/third_party/tgfx/src/core/utils/PathUtils.h +120 -0
  700. package/cpp/third_party/tgfx/src/core/utils/PixelFormatUtil.cpp +80 -0
  701. package/cpp/third_party/tgfx/src/core/utils/PixelFormatUtil.h +35 -0
  702. package/cpp/third_party/tgfx/src/core/utils/PlacementArray.h +252 -0
  703. package/cpp/third_party/tgfx/src/core/utils/PlacementPtr.h +183 -0
  704. package/cpp/third_party/tgfx/src/core/utils/PointUtils.cpp +58 -0
  705. package/cpp/third_party/tgfx/src/core/utils/PointUtils.h +55 -0
  706. package/cpp/third_party/tgfx/src/core/utils/RectToRectMatrix.cpp +34 -0
  707. package/cpp/third_party/tgfx/src/core/utils/RectToRectMatrix.h +30 -0
  708. package/cpp/third_party/tgfx/src/core/utils/ReturnQueue.cpp +51 -0
  709. package/cpp/third_party/tgfx/src/core/utils/ReturnQueue.h +77 -0
  710. package/cpp/third_party/tgfx/src/core/utils/ShapeUtils.cpp +73 -0
  711. package/cpp/third_party/tgfx/src/core/utils/ShapeUtils.h +61 -0
  712. package/cpp/third_party/tgfx/src/core/utils/SingleOwner.h +64 -0
  713. package/cpp/third_party/tgfx/src/core/utils/SlidingWindowTracker.cpp +54 -0
  714. package/cpp/third_party/tgfx/src/core/utils/SlidingWindowTracker.h +51 -0
  715. package/cpp/third_party/tgfx/src/core/utils/Stream.cpp +177 -0
  716. package/cpp/third_party/tgfx/src/core/utils/StrokeUtils.cpp +140 -0
  717. package/cpp/third_party/tgfx/src/core/utils/StrokeUtils.h +73 -0
  718. package/cpp/third_party/tgfx/src/core/utils/Task.cpp +114 -0
  719. package/cpp/third_party/tgfx/src/core/utils/TaskGroup.cpp +187 -0
  720. package/cpp/third_party/tgfx/src/core/utils/TaskGroup.h +56 -0
  721. package/cpp/third_party/tgfx/src/core/utils/TileSortCompareFunc.h +38 -0
  722. package/cpp/third_party/tgfx/src/core/utils/TileSortCompareFuncSIMD.cpp +67 -0
  723. package/cpp/third_party/tgfx/src/core/utils/Types.h +88 -0
  724. package/cpp/third_party/tgfx/src/core/utils/USE.h +46 -0
  725. package/cpp/third_party/tgfx/src/core/utils/UTF.cpp +151 -0
  726. package/cpp/third_party/tgfx/src/core/utils/UniqueID.cpp +32 -0
  727. package/cpp/third_party/tgfx/src/core/utils/UniqueID.h +28 -0
  728. package/cpp/third_party/tgfx/src/core/utils/VecUtils.h +97 -0
  729. package/cpp/third_party/tgfx/src/core/utils/WeakMap.h +61 -0
  730. package/cpp/third_party/tgfx/src/core/utils/WriteStream.cpp +160 -0
  731. package/cpp/third_party/tgfx/src/core/vectors/coregraphics/CGPathRasterizer.cpp +205 -0
  732. package/cpp/third_party/tgfx/src/core/vectors/coregraphics/CGPathRasterizer.h +35 -0
  733. package/cpp/third_party/tgfx/src/core/vectors/coregraphics/CGScalerContext.cpp +381 -0
  734. package/cpp/third_party/tgfx/src/core/vectors/coregraphics/CGScalerContext.h +56 -0
  735. package/cpp/third_party/tgfx/src/core/vectors/coregraphics/CGTypeface.cpp +448 -0
  736. package/cpp/third_party/tgfx/src/core/vectors/coregraphics/CGTypeface.h +88 -0
  737. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTFontData.h +36 -0
  738. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTLibrary.cpp +36 -0
  739. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTLibrary.h +45 -0
  740. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTPath.cpp +118 -0
  741. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTPath.h +58 -0
  742. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTPathRasterizer.cpp +135 -0
  743. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTPathRasterizer.h +35 -0
  744. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTRasterTarget.cpp +54 -0
  745. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTRasterTarget.h +33 -0
  746. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTScalerContext.cpp +970 -0
  747. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTScalerContext.h +99 -0
  748. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTTypeface.cpp +310 -0
  749. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTTypeface.h +99 -0
  750. package/cpp/third_party/tgfx/src/core/vectors/freetype/FTUtil.h +45 -0
  751. package/cpp/third_party/tgfx/src/core/vectors/freetype/SystemFont.cpp +279 -0
  752. package/cpp/third_party/tgfx/src/core/vectors/freetype/SystemFont.h +31 -0
  753. package/cpp/third_party/tgfx/src/gpu/AAType.h +30 -0
  754. package/cpp/third_party/tgfx/src/gpu/AlignTo.cpp +28 -0
  755. package/cpp/third_party/tgfx/src/gpu/AlignTo.h +24 -0
  756. package/cpp/third_party/tgfx/src/gpu/Attribute.cpp +59 -0
  757. package/cpp/third_party/tgfx/src/gpu/Backend.cpp +275 -0
  758. package/cpp/third_party/tgfx/src/gpu/BackingFit.h +37 -0
  759. package/cpp/third_party/tgfx/src/gpu/BlendFormula.cpp +162 -0
  760. package/cpp/third_party/tgfx/src/gpu/BlendFormula.h +121 -0
  761. package/cpp/third_party/tgfx/src/gpu/ColorSpaceXformHelper.cpp +89 -0
  762. package/cpp/third_party/tgfx/src/gpu/ColorSpaceXformHelper.h +103 -0
  763. package/cpp/third_party/tgfx/src/gpu/CommandEncoder.cpp +43 -0
  764. package/cpp/third_party/tgfx/src/gpu/Context.cpp +204 -0
  765. package/cpp/third_party/tgfx/src/gpu/CoordTransform.cpp +39 -0
  766. package/cpp/third_party/tgfx/src/gpu/CoordTransform.h +40 -0
  767. package/cpp/third_party/tgfx/src/gpu/Device.cpp +70 -0
  768. package/cpp/third_party/tgfx/src/gpu/DrawingBuffer.cpp +85 -0
  769. package/cpp/third_party/tgfx/src/gpu/DrawingBuffer.h +89 -0
  770. package/cpp/third_party/tgfx/src/gpu/DrawingManager.cpp +211 -0
  771. package/cpp/third_party/tgfx/src/gpu/DrawingManager.h +111 -0
  772. package/cpp/third_party/tgfx/src/gpu/FragmentShaderBuilder.cpp +61 -0
  773. package/cpp/third_party/tgfx/src/gpu/FragmentShaderBuilder.h +61 -0
  774. package/cpp/third_party/tgfx/src/gpu/GlobalCache.cpp +705 -0
  775. package/cpp/third_party/tgfx/src/gpu/GlobalCache.h +156 -0
  776. package/cpp/third_party/tgfx/src/gpu/InstanceProvider.cpp +75 -0
  777. package/cpp/third_party/tgfx/src/gpu/InstanceProvider.h +78 -0
  778. package/cpp/third_party/tgfx/src/gpu/OpsCompositor.cpp +1198 -0
  779. package/cpp/third_party/tgfx/src/gpu/OpsCompositor.h +229 -0
  780. package/cpp/third_party/tgfx/src/gpu/Program.cpp +38 -0
  781. package/cpp/third_party/tgfx/src/gpu/Program.h +47 -0
  782. package/cpp/third_party/tgfx/src/gpu/ProgramBuilder.cpp +208 -0
  783. package/cpp/third_party/tgfx/src/gpu/ProgramBuilder.h +105 -0
  784. package/cpp/third_party/tgfx/src/gpu/ProgramInfo.cpp +339 -0
  785. package/cpp/third_party/tgfx/src/gpu/ProgramInfo.h +173 -0
  786. package/cpp/third_party/tgfx/src/gpu/ProxyProvider.cpp +711 -0
  787. package/cpp/third_party/tgfx/src/gpu/ProxyProvider.h +223 -0
  788. package/cpp/third_party/tgfx/src/gpu/Quad.cpp +65 -0
  789. package/cpp/third_party/tgfx/src/gpu/Quad.h +73 -0
  790. package/cpp/third_party/tgfx/src/gpu/QuadRecord.h +71 -0
  791. package/cpp/third_party/tgfx/src/gpu/QuadsVertexProvider.cpp +603 -0
  792. package/cpp/third_party/tgfx/src/gpu/QuadsVertexProvider.h +109 -0
  793. package/cpp/third_party/tgfx/src/gpu/RRectsVertexProvider.cpp +722 -0
  794. package/cpp/third_party/tgfx/src/gpu/RRectsVertexProvider.h +108 -0
  795. package/cpp/third_party/tgfx/src/gpu/RectsVertexProvider.cpp +928 -0
  796. package/cpp/third_party/tgfx/src/gpu/RectsVertexProvider.h +153 -0
  797. package/cpp/third_party/tgfx/src/gpu/RenderContext.cpp +773 -0
  798. package/cpp/third_party/tgfx/src/gpu/RenderContext.h +113 -0
  799. package/cpp/third_party/tgfx/src/gpu/RenderPipeline.cpp +31 -0
  800. package/cpp/third_party/tgfx/src/gpu/ResourceCache.cpp +288 -0
  801. package/cpp/third_party/tgfx/src/gpu/ResourceCache.h +170 -0
  802. package/cpp/third_party/tgfx/src/gpu/SLType.h +48 -0
  803. package/cpp/third_party/tgfx/src/gpu/SamplerHandle.h +43 -0
  804. package/cpp/third_party/tgfx/src/gpu/SamplerState.h +57 -0
  805. package/cpp/third_party/tgfx/src/gpu/SamplingArgs.h +42 -0
  806. package/cpp/third_party/tgfx/src/gpu/ShaderBuilder.cpp +354 -0
  807. package/cpp/third_party/tgfx/src/gpu/ShaderBuilder.h +133 -0
  808. package/cpp/third_party/tgfx/src/gpu/ShaderCaps.cpp +104 -0
  809. package/cpp/third_party/tgfx/src/gpu/ShaderCaps.h +101 -0
  810. package/cpp/third_party/tgfx/src/gpu/ShaderCompiler.cpp +171 -0
  811. package/cpp/third_party/tgfx/src/gpu/ShaderCompiler.h +42 -0
  812. package/cpp/third_party/tgfx/src/gpu/ShaderVar.cpp +103 -0
  813. package/cpp/third_party/tgfx/src/gpu/ShaderVar.h +59 -0
  814. package/cpp/third_party/tgfx/src/gpu/Swizzle.cpp +77 -0
  815. package/cpp/third_party/tgfx/src/gpu/Swizzle.h +116 -0
  816. package/cpp/third_party/tgfx/src/gpu/TPArgs.h +64 -0
  817. package/cpp/third_party/tgfx/src/gpu/Texture.cpp +33 -0
  818. package/cpp/third_party/tgfx/src/gpu/Uniform.cpp +52 -0
  819. package/cpp/third_party/tgfx/src/gpu/Uniform.h +90 -0
  820. package/cpp/third_party/tgfx/src/gpu/UniformData.cpp +160 -0
  821. package/cpp/third_party/tgfx/src/gpu/UniformData.h +158 -0
  822. package/cpp/third_party/tgfx/src/gpu/UniformHandler.cpp +96 -0
  823. package/cpp/third_party/tgfx/src/gpu/UniformHandler.h +83 -0
  824. package/cpp/third_party/tgfx/src/gpu/UniqueDomain.cpp +49 -0
  825. package/cpp/third_party/tgfx/src/gpu/UniqueDomain.h +55 -0
  826. package/cpp/third_party/tgfx/src/gpu/VaryingHandler.cpp +79 -0
  827. package/cpp/third_party/tgfx/src/gpu/VaryingHandler.h +87 -0
  828. package/cpp/third_party/tgfx/src/gpu/VertexProvider.cpp +45 -0
  829. package/cpp/third_party/tgfx/src/gpu/VertexProvider.h +83 -0
  830. package/cpp/third_party/tgfx/src/gpu/VertexShaderBuilder.h +48 -0
  831. package/cpp/third_party/tgfx/src/gpu/Window.cpp +38 -0
  832. package/cpp/third_party/tgfx/src/gpu/YUVFormat.h +39 -0
  833. package/cpp/third_party/tgfx/src/gpu/glsl/GLSLBlend.cpp +551 -0
  834. package/cpp/third_party/tgfx/src/gpu/glsl/GLSLBlend.h +31 -0
  835. package/cpp/third_party/tgfx/src/gpu/glsl/GLSLFragmentShaderBuilder.cpp +67 -0
  836. package/cpp/third_party/tgfx/src/gpu/glsl/GLSLFragmentShaderBuilder.h +37 -0
  837. package/cpp/third_party/tgfx/src/gpu/glsl/GLSLProgramBuilder.cpp +240 -0
  838. package/cpp/third_party/tgfx/src/gpu/glsl/GLSLProgramBuilder.h +70 -0
  839. package/cpp/third_party/tgfx/src/gpu/glsl/GLSLVertexShaderBuilder.cpp +51 -0
  840. package/cpp/third_party/tgfx/src/gpu/glsl/GLSLVertexShaderBuilder.h +33 -0
  841. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLAlphaThresholdFragmentProcessor.cpp +49 -0
  842. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLAlphaThresholdFragmentProcessor.h +34 -0
  843. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLAtlasTextGeometryProcessor.cpp +99 -0
  844. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLAtlasTextGeometryProcessor.h +38 -0
  845. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLClampedGradientEffect.cpp +90 -0
  846. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLClampedGradientEffect.h +37 -0
  847. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLColorMatrixFragmentProcessor.cpp +66 -0
  848. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLColorMatrixFragmentProcessor.h +35 -0
  849. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLComplexEllipseGeometryProcessor.cpp +163 -0
  850. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLComplexEllipseGeometryProcessor.h +34 -0
  851. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLComplexNonAARRectGeometryProcessor.cpp +161 -0
  852. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLComplexNonAARRectGeometryProcessor.h +34 -0
  853. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLComposeFragmentProcessor.cpp +48 -0
  854. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLComposeFragmentProcessor.h +30 -0
  855. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLConicGradientLayout.cpp +50 -0
  856. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLConicGradientLayout.h +34 -0
  857. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLConstColorProcessor.cpp +52 -0
  858. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLConstColorProcessor.h +34 -0
  859. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLDefaultGeometryProcessor.cpp +77 -0
  860. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLDefaultGeometryProcessor.h +35 -0
  861. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLDeviceSpaceTextureEffect.cpp +66 -0
  862. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLDeviceSpaceTextureEffect.h +34 -0
  863. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLDiamondGradientLayout.cpp +39 -0
  864. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLDiamondGradientLayout.h +30 -0
  865. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLDualIntervalGradientColorizer.cpp +84 -0
  866. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLDualIntervalGradientColorizer.h +36 -0
  867. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLEllipseGeometryProcessor.cpp +109 -0
  868. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLEllipseGeometryProcessor.h +34 -0
  869. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLEmptyXferProcessor.cpp +31 -0
  870. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLEmptyXferProcessor.h +28 -0
  871. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLGaussianBlur1DFragmentProcessor.cpp +94 -0
  872. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLGaussianBlur1DFragmentProcessor.h +37 -0
  873. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLHairlineLineGeometryProcessor.cpp +92 -0
  874. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLHairlineLineGeometryProcessor.h +38 -0
  875. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLHairlineQuadGeometryProcessor.cpp +109 -0
  876. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLHairlineQuadGeometryProcessor.h +38 -0
  877. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLLinearGradientLayout.cpp +36 -0
  878. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLLinearGradientLayout.h +30 -0
  879. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLLumaFragmentProcessor.cpp +45 -0
  880. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLLumaFragmentProcessor.h +33 -0
  881. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLMeshGeometryProcessor.cpp +105 -0
  882. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLMeshGeometryProcessor.h +36 -0
  883. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLNonAARRectGeometryProcessor.cpp +131 -0
  884. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLNonAARRectGeometryProcessor.h +34 -0
  885. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLPerlinNoiseFragmentProcessor.cpp +240 -0
  886. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLPerlinNoiseFragmentProcessor.h +36 -0
  887. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLPorterDuffXferProcessor.cpp +102 -0
  888. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLPorterDuffXferProcessor.h +32 -0
  889. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLQuadPerEdgeAAGeometryProcessor.cpp +116 -0
  890. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLQuadPerEdgeAAGeometryProcessor.h +47 -0
  891. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLRRectEffect.cpp +158 -0
  892. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLRRectEffect.h +36 -0
  893. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLRadialGradientLayout.cpp +36 -0
  894. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLRadialGradientLayout.h +30 -0
  895. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLRectEffect.cpp +105 -0
  896. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLRectEffect.h +35 -0
  897. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLRoundStrokeRectGeometryProcessor.cpp +101 -0
  898. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLRoundStrokeRectGeometryProcessor.h +34 -0
  899. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLRuntimeShaderProcessor.cpp +210 -0
  900. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLRuntimeShaderProcessor.h +21 -0
  901. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLShapeInstancedGeometryProcessor.cpp +98 -0
  902. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLShapeInstancedGeometryProcessor.h +34 -0
  903. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLSingleIntervalGradientColorizer.cpp +47 -0
  904. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLSingleIntervalGradientColorizer.h +35 -0
  905. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLStencilCoverCoverPassGeometryProcessor.cpp +71 -0
  906. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLStencilCoverCoverPassGeometryProcessor.h +33 -0
  907. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLStencilCoverStencilPassGeometryProcessor.cpp +85 -0
  908. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLStencilCoverStencilPassGeometryProcessor.h +34 -0
  909. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLTextureEffect.cpp +295 -0
  910. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLTextureEffect.h +41 -0
  911. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLTextureGradientColorizer.cpp +41 -0
  912. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLTextureGradientColorizer.h +30 -0
  913. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLTiledTextureEffect.cpp +480 -0
  914. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLTiledTextureEffect.h +65 -0
  915. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLUnrolledBinaryGradientColorizer.cpp +291 -0
  916. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLUnrolledBinaryGradientColorizer.h +49 -0
  917. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLXfermodeFragmentProcessor.cpp +74 -0
  918. package/cpp/third_party/tgfx/src/gpu/glsl/processors/GLSLXfermodeFragmentProcessor.h +31 -0
  919. package/cpp/third_party/tgfx/src/gpu/metal/MetalBuffer.h +64 -0
  920. package/cpp/third_party/tgfx/src/gpu/metal/MetalBuffer.mm +112 -0
  921. package/cpp/third_party/tgfx/src/gpu/metal/MetalCaps.h +117 -0
  922. package/cpp/third_party/tgfx/src/gpu/metal/MetalCaps.mm +177 -0
  923. package/cpp/third_party/tgfx/src/gpu/metal/MetalCommandBuffer.h +45 -0
  924. package/cpp/third_party/tgfx/src/gpu/metal/MetalCommandBuffer.mm +31 -0
  925. package/cpp/third_party/tgfx/src/gpu/metal/MetalCommandEncoder.h +71 -0
  926. package/cpp/third_party/tgfx/src/gpu/metal/MetalCommandEncoder.mm +173 -0
  927. package/cpp/third_party/tgfx/src/gpu/metal/MetalCommandQueue.h +86 -0
  928. package/cpp/third_party/tgfx/src/gpu/metal/MetalCommandQueue.mm +208 -0
  929. package/cpp/third_party/tgfx/src/gpu/metal/MetalDefines.h +54 -0
  930. package/cpp/third_party/tgfx/src/gpu/metal/MetalDevice.h +30 -0
  931. package/cpp/third_party/tgfx/src/gpu/metal/MetalDevice.mm +72 -0
  932. package/cpp/third_party/tgfx/src/gpu/metal/MetalDrawableProxy.h +52 -0
  933. package/cpp/third_party/tgfx/src/gpu/metal/MetalDrawableProxy.mm +94 -0
  934. package/cpp/third_party/tgfx/src/gpu/metal/MetalExternalTexture.h +37 -0
  935. package/cpp/third_party/tgfx/src/gpu/metal/MetalGPU.h +159 -0
  936. package/cpp/third_party/tgfx/src/gpu/metal/MetalGPU.mm +267 -0
  937. package/cpp/third_party/tgfx/src/gpu/metal/MetalHardwareTexture.h +60 -0
  938. package/cpp/third_party/tgfx/src/gpu/metal/MetalHardwareTexture.mm +146 -0
  939. package/cpp/third_party/tgfx/src/gpu/metal/MetalRenderPass.h +110 -0
  940. package/cpp/third_party/tgfx/src/gpu/metal/MetalRenderPass.mm +386 -0
  941. package/cpp/third_party/tgfx/src/gpu/metal/MetalRenderPipeline.h +91 -0
  942. package/cpp/third_party/tgfx/src/gpu/metal/MetalRenderPipeline.mm +310 -0
  943. package/cpp/third_party/tgfx/src/gpu/metal/MetalResource.h +47 -0
  944. package/cpp/third_party/tgfx/src/gpu/metal/MetalResource.mm +21 -0
  945. package/cpp/third_party/tgfx/src/gpu/metal/MetalSampler.h +55 -0
  946. package/cpp/third_party/tgfx/src/gpu/metal/MetalSampler.mm +73 -0
  947. package/cpp/third_party/tgfx/src/gpu/metal/MetalSemaphore.h +81 -0
  948. package/cpp/third_party/tgfx/src/gpu/metal/MetalSemaphore.mm +66 -0
  949. package/cpp/third_party/tgfx/src/gpu/metal/MetalShaderModule.h +106 -0
  950. package/cpp/third_party/tgfx/src/gpu/metal/MetalShaderModule.mm +244 -0
  951. package/cpp/third_party/tgfx/src/gpu/metal/MetalTexture.h +67 -0
  952. package/cpp/third_party/tgfx/src/gpu/metal/MetalTexture.mm +157 -0
  953. package/cpp/third_party/tgfx/src/gpu/metal/MetalUtil.h +66 -0
  954. package/cpp/third_party/tgfx/src/gpu/metal/MetalUtil.mm +337 -0
  955. package/cpp/third_party/tgfx/src/gpu/metal/MetalWindow.mm +122 -0
  956. package/cpp/third_party/tgfx/src/gpu/opengl/GLBuffer.cpp +117 -0
  957. package/cpp/third_party/tgfx/src/gpu/opengl/GLBuffer.h +64 -0
  958. package/cpp/third_party/tgfx/src/gpu/opengl/GLCaps.cpp +325 -0
  959. package/cpp/third_party/tgfx/src/gpu/opengl/GLCaps.h +118 -0
  960. package/cpp/third_party/tgfx/src/gpu/opengl/GLCommandEncoder.cpp +178 -0
  961. package/cpp/third_party/tgfx/src/gpu/opengl/GLCommandEncoder.h +50 -0
  962. package/cpp/third_party/tgfx/src/gpu/opengl/GLCommandQueue.cpp +122 -0
  963. package/cpp/third_party/tgfx/src/gpu/opengl/GLCommandQueue.h +52 -0
  964. package/cpp/third_party/tgfx/src/gpu/opengl/GLCoreFunctions.h +112 -0
  965. package/cpp/third_party/tgfx/src/gpu/opengl/GLDefines.h +925 -0
  966. package/cpp/third_party/tgfx/src/gpu/opengl/GLDepthStencilTexture.cpp +66 -0
  967. package/cpp/third_party/tgfx/src/gpu/opengl/GLDepthStencilTexture.h +44 -0
  968. package/cpp/third_party/tgfx/src/gpu/opengl/GLDevice.cpp +104 -0
  969. package/cpp/third_party/tgfx/src/gpu/opengl/GLExternalTexture.h +42 -0
  970. package/cpp/third_party/tgfx/src/gpu/opengl/GLFunctions.h +293 -0
  971. package/cpp/third_party/tgfx/src/gpu/opengl/GLGPU.cpp +336 -0
  972. package/cpp/third_party/tgfx/src/gpu/opengl/GLGPU.h +119 -0
  973. package/cpp/third_party/tgfx/src/gpu/opengl/GLInterface.cpp +276 -0
  974. package/cpp/third_party/tgfx/src/gpu/opengl/GLInterface.h +48 -0
  975. package/cpp/third_party/tgfx/src/gpu/opengl/GLMultisampleTexture.cpp +98 -0
  976. package/cpp/third_party/tgfx/src/gpu/opengl/GLMultisampleTexture.h +46 -0
  977. package/cpp/third_party/tgfx/src/gpu/opengl/GLProcGetter.h +32 -0
  978. package/cpp/third_party/tgfx/src/gpu/opengl/GLRenderPass.cpp +293 -0
  979. package/cpp/third_party/tgfx/src/gpu/opengl/GLRenderPass.h +96 -0
  980. package/cpp/third_party/tgfx/src/gpu/opengl/GLRenderPipeline.cpp +336 -0
  981. package/cpp/third_party/tgfx/src/gpu/opengl/GLRenderPipeline.h +106 -0
  982. package/cpp/third_party/tgfx/src/gpu/opengl/GLResource.h +45 -0
  983. package/cpp/third_party/tgfx/src/gpu/opengl/GLSampler.h +53 -0
  984. package/cpp/third_party/tgfx/src/gpu/opengl/GLSemaphore.cpp +41 -0
  985. package/cpp/third_party/tgfx/src/gpu/opengl/GLSemaphore.h +47 -0
  986. package/cpp/third_party/tgfx/src/gpu/opengl/GLShaderModule.cpp +33 -0
  987. package/cpp/third_party/tgfx/src/gpu/opengl/GLShaderModule.h +40 -0
  988. package/cpp/third_party/tgfx/src/gpu/opengl/GLStandard.h +23 -0
  989. package/cpp/third_party/tgfx/src/gpu/opengl/GLState.cpp +261 -0
  990. package/cpp/third_party/tgfx/src/gpu/opengl/GLState.h +125 -0
  991. package/cpp/third_party/tgfx/src/gpu/opengl/GLTexture.cpp +173 -0
  992. package/cpp/third_party/tgfx/src/gpu/opengl/GLTexture.h +95 -0
  993. package/cpp/third_party/tgfx/src/gpu/opengl/GLUtil.cpp +217 -0
  994. package/cpp/third_party/tgfx/src/gpu/opengl/GLUtil.h +68 -0
  995. package/cpp/third_party/tgfx/src/gpu/opengl/cgl/CGLDevice.mm +136 -0
  996. package/cpp/third_party/tgfx/src/gpu/opengl/cgl/CGLGPU.h +42 -0
  997. package/cpp/third_party/tgfx/src/gpu/opengl/cgl/CGLGPU.mm +52 -0
  998. package/cpp/third_party/tgfx/src/gpu/opengl/cgl/CGLHardwareTexture.h +50 -0
  999. package/cpp/third_party/tgfx/src/gpu/opengl/cgl/CGLHardwareTexture.mm +90 -0
  1000. package/cpp/third_party/tgfx/src/gpu/opengl/cgl/CGLProcGetter.h +35 -0
  1001. package/cpp/third_party/tgfx/src/gpu/opengl/cgl/CGLProcGetter.mm +42 -0
  1002. package/cpp/third_party/tgfx/src/gpu/opengl/cgl/CGLWindow.mm +91 -0
  1003. package/cpp/third_party/tgfx/src/gpu/opengl/eagl/EAGLDevice.mm +308 -0
  1004. package/cpp/third_party/tgfx/src/gpu/opengl/eagl/EAGLGPU.h +46 -0
  1005. package/cpp/third_party/tgfx/src/gpu/opengl/eagl/EAGLGPU.mm +61 -0
  1006. package/cpp/third_party/tgfx/src/gpu/opengl/eagl/EAGLHardwareTexture.h +47 -0
  1007. package/cpp/third_party/tgfx/src/gpu/opengl/eagl/EAGLHardwareTexture.mm +127 -0
  1008. package/cpp/third_party/tgfx/src/gpu/opengl/eagl/EAGLLayerTexture.h +55 -0
  1009. package/cpp/third_party/tgfx/src/gpu/opengl/eagl/EAGLLayerTexture.mm +85 -0
  1010. package/cpp/third_party/tgfx/src/gpu/opengl/eagl/EAGLProcGetter.h +35 -0
  1011. package/cpp/third_party/tgfx/src/gpu/opengl/eagl/EAGLProcGetter.mm +41 -0
  1012. package/cpp/third_party/tgfx/src/gpu/opengl/eagl/EAGLWindow.mm +79 -0
  1013. package/cpp/third_party/tgfx/src/gpu/opengl/egl/EGLDevice.cpp +384 -0
  1014. package/cpp/third_party/tgfx/src/gpu/opengl/egl/EGLDisplayWrapper.cpp +111 -0
  1015. package/cpp/third_party/tgfx/src/gpu/opengl/egl/EGLDisplayWrapper.h +31 -0
  1016. package/cpp/third_party/tgfx/src/gpu/opengl/egl/EGLGPU.cpp +82 -0
  1017. package/cpp/third_party/tgfx/src/gpu/opengl/egl/EGLGPU.h +40 -0
  1018. package/cpp/third_party/tgfx/src/gpu/opengl/egl/EGLGlobals.cpp +100 -0
  1019. package/cpp/third_party/tgfx/src/gpu/opengl/egl/EGLHardwareTexture.cpp +163 -0
  1020. package/cpp/third_party/tgfx/src/gpu/opengl/egl/EGLHardwareTexture.h +57 -0
  1021. package/cpp/third_party/tgfx/src/gpu/opengl/egl/EGLProcGetter.cpp +53 -0
  1022. package/cpp/third_party/tgfx/src/gpu/opengl/egl/EGLProcGetter.h +28 -0
  1023. package/cpp/third_party/tgfx/src/gpu/opengl/egl/EGLWindow.cpp +126 -0
  1024. package/cpp/third_party/tgfx/src/gpu/opengl/qt/QGLDevice.cpp +171 -0
  1025. package/cpp/third_party/tgfx/src/gpu/opengl/qt/QGLDrawableProxy.cpp +94 -0
  1026. package/cpp/third_party/tgfx/src/gpu/opengl/qt/QGLDrawableProxy.h +61 -0
  1027. package/cpp/third_party/tgfx/src/gpu/opengl/qt/QGLGPU.cpp +76 -0
  1028. package/cpp/third_party/tgfx/src/gpu/opengl/qt/QGLGPU.h +52 -0
  1029. package/cpp/third_party/tgfx/src/gpu/opengl/qt/QGLProcGetter.cpp +33 -0
  1030. package/cpp/third_party/tgfx/src/gpu/opengl/qt/QGLProcGetter.h +35 -0
  1031. package/cpp/third_party/tgfx/src/gpu/opengl/qt/QGLWindow.cpp +293 -0
  1032. package/cpp/third_party/tgfx/src/gpu/opengl/webgl/WebGLBuffer.cpp +93 -0
  1033. package/cpp/third_party/tgfx/src/gpu/opengl/webgl/WebGLBuffer.h +45 -0
  1034. package/cpp/third_party/tgfx/src/gpu/opengl/webgl/WebGLDevice.cpp +161 -0
  1035. package/cpp/third_party/tgfx/src/gpu/opengl/webgl/WebGLGPU.cpp +30 -0
  1036. package/cpp/third_party/tgfx/src/gpu/opengl/webgl/WebGLGPU.h +32 -0
  1037. package/cpp/third_party/tgfx/src/gpu/opengl/webgl/WebGLProcGetter.cpp +50 -0
  1038. package/cpp/third_party/tgfx/src/gpu/opengl/webgl/WebGLProcGetter.h +28 -0
  1039. package/cpp/third_party/tgfx/src/gpu/opengl/webgl/WebGLWindow.cpp +59 -0
  1040. package/cpp/third_party/tgfx/src/gpu/opengl/wgl/WGLDefines.h +113 -0
  1041. package/cpp/third_party/tgfx/src/gpu/opengl/wgl/WGLDevice.cpp +335 -0
  1042. package/cpp/third_party/tgfx/src/gpu/opengl/wgl/WGLGPU.cpp +297 -0
  1043. package/cpp/third_party/tgfx/src/gpu/opengl/wgl/WGLGPU.h +78 -0
  1044. package/cpp/third_party/tgfx/src/gpu/opengl/wgl/WGLHardwareTexture.cpp +289 -0
  1045. package/cpp/third_party/tgfx/src/gpu/opengl/wgl/WGLHardwareTexture.h +53 -0
  1046. package/cpp/third_party/tgfx/src/gpu/opengl/wgl/WGLInterface.cpp +155 -0
  1047. package/cpp/third_party/tgfx/src/gpu/opengl/wgl/WGLInterface.h +75 -0
  1048. package/cpp/third_party/tgfx/src/gpu/opengl/wgl/WGLProcGetter.cpp +47 -0
  1049. package/cpp/third_party/tgfx/src/gpu/opengl/wgl/WGLProcGetter.h +36 -0
  1050. package/cpp/third_party/tgfx/src/gpu/opengl/wgl/WGLWindow.cpp +71 -0
  1051. package/cpp/third_party/tgfx/src/gpu/ops/AtlasTextOp.cpp +99 -0
  1052. package/cpp/third_party/tgfx/src/gpu/ops/AtlasTextOp.h +62 -0
  1053. package/cpp/third_party/tgfx/src/gpu/ops/DrawOp.cpp +41 -0
  1054. package/cpp/third_party/tgfx/src/gpu/ops/DrawOp.h +125 -0
  1055. package/cpp/third_party/tgfx/src/gpu/ops/HairlineLineOp.cpp +91 -0
  1056. package/cpp/third_party/tgfx/src/gpu/ops/HairlineLineOp.h +66 -0
  1057. package/cpp/third_party/tgfx/src/gpu/ops/HairlineQuadOp.cpp +91 -0
  1058. package/cpp/third_party/tgfx/src/gpu/ops/HairlineQuadOp.h +66 -0
  1059. package/cpp/third_party/tgfx/src/gpu/ops/MeshDrawOp.cpp +75 -0
  1060. package/cpp/third_party/tgfx/src/gpu/ops/MeshDrawOp.h +53 -0
  1061. package/cpp/third_party/tgfx/src/gpu/ops/Quads3DDrawOp.cpp +98 -0
  1062. package/cpp/third_party/tgfx/src/gpu/ops/Quads3DDrawOp.h +64 -0
  1063. package/cpp/third_party/tgfx/src/gpu/ops/RRectDrawOp.cpp +101 -0
  1064. package/cpp/third_party/tgfx/src/gpu/ops/RRectDrawOp.h +88 -0
  1065. package/cpp/third_party/tgfx/src/gpu/ops/RectDrawOp.cpp +116 -0
  1066. package/cpp/third_party/tgfx/src/gpu/ops/RectDrawOp.h +103 -0
  1067. package/cpp/third_party/tgfx/src/gpu/ops/ShapeDrawOp.cpp +104 -0
  1068. package/cpp/third_party/tgfx/src/gpu/ops/ShapeDrawOp.h +53 -0
  1069. package/cpp/third_party/tgfx/src/gpu/ops/ShapeInstancedDrawOp.cpp +136 -0
  1070. package/cpp/third_party/tgfx/src/gpu/ops/ShapeInstancedDrawOp.h +69 -0
  1071. package/cpp/third_party/tgfx/src/gpu/ops/StandardDrawOp.cpp +61 -0
  1072. package/cpp/third_party/tgfx/src/gpu/ops/StandardDrawOp.h +94 -0
  1073. package/cpp/third_party/tgfx/src/gpu/ops/StencilCoverPathDrawOp.cpp +302 -0
  1074. package/cpp/third_party/tgfx/src/gpu/ops/StencilCoverPathDrawOp.h +149 -0
  1075. package/cpp/third_party/tgfx/src/gpu/processors/AlphaThresholdFragmentProcessor.h +42 -0
  1076. package/cpp/third_party/tgfx/src/gpu/processors/AtlasTextGeometryProcessor.cpp +46 -0
  1077. package/cpp/third_party/tgfx/src/gpu/processors/AtlasTextGeometryProcessor.h +65 -0
  1078. package/cpp/third_party/tgfx/src/gpu/processors/ClampedGradientEffect.cpp +30 -0
  1079. package/cpp/third_party/tgfx/src/gpu/processors/ClampedGradientEffect.h +49 -0
  1080. package/cpp/third_party/tgfx/src/gpu/processors/ColorMatrixFragmentProcessor.h +43 -0
  1081. package/cpp/third_party/tgfx/src/gpu/processors/ColorSpaceXFormEffect.cpp +58 -0
  1082. package/cpp/third_party/tgfx/src/gpu/processors/ColorSpaceXFormEffect.h +52 -0
  1083. package/cpp/third_party/tgfx/src/gpu/processors/ComplexEllipseGeometryProcessor.cpp +44 -0
  1084. package/cpp/third_party/tgfx/src/gpu/processors/ComplexEllipseGeometryProcessor.h +66 -0
  1085. package/cpp/third_party/tgfx/src/gpu/processors/ComplexNonAARRectGeometryProcessor.cpp +45 -0
  1086. package/cpp/third_party/tgfx/src/gpu/processors/ComplexNonAARRectGeometryProcessor.h +62 -0
  1087. package/cpp/third_party/tgfx/src/gpu/processors/ComposeFragmentProcessor.cpp +58 -0
  1088. package/cpp/third_party/tgfx/src/gpu/processors/ComposeFragmentProcessor.h +42 -0
  1089. package/cpp/third_party/tgfx/src/gpu/processors/ConicGradientLayout.cpp +31 -0
  1090. package/cpp/third_party/tgfx/src/gpu/processors/ConicGradientLayout.h +44 -0
  1091. package/cpp/third_party/tgfx/src/gpu/processors/ConstColorProcessor.cpp +25 -0
  1092. package/cpp/third_party/tgfx/src/gpu/processors/ConstColorProcessor.h +48 -0
  1093. package/cpp/third_party/tgfx/src/gpu/processors/DefaultGeometryProcessor.cpp +37 -0
  1094. package/cpp/third_party/tgfx/src/gpu/processors/DefaultGeometryProcessor.h +58 -0
  1095. package/cpp/third_party/tgfx/src/gpu/processors/DeviceSpaceTextureEffect.cpp +35 -0
  1096. package/cpp/third_party/tgfx/src/gpu/processors/DeviceSpaceTextureEffect.h +46 -0
  1097. package/cpp/third_party/tgfx/src/gpu/processors/DiamondGradientLayout.cpp +31 -0
  1098. package/cpp/third_party/tgfx/src/gpu/processors/DiamondGradientLayout.h +41 -0
  1099. package/cpp/third_party/tgfx/src/gpu/processors/DualIntervalGradientColorizer.h +50 -0
  1100. package/cpp/third_party/tgfx/src/gpu/processors/EllipseGeometryProcessor.cpp +40 -0
  1101. package/cpp/third_party/tgfx/src/gpu/processors/EllipseGeometryProcessor.h +60 -0
  1102. package/cpp/third_party/tgfx/src/gpu/processors/EmptyXferProcessor.cpp +25 -0
  1103. package/cpp/third_party/tgfx/src/gpu/processors/EmptyXferProcessor.h +44 -0
  1104. package/cpp/third_party/tgfx/src/gpu/processors/FragmentProcessor.cpp +213 -0
  1105. package/cpp/third_party/tgfx/src/gpu/processors/FragmentProcessor.h +339 -0
  1106. package/cpp/third_party/tgfx/src/gpu/processors/GaussianBlur1DFragmentProcessor.cpp +35 -0
  1107. package/cpp/third_party/tgfx/src/gpu/processors/GaussianBlur1DFragmentProcessor.h +51 -0
  1108. package/cpp/third_party/tgfx/src/gpu/processors/GeometryProcessor.cpp +109 -0
  1109. package/cpp/third_party/tgfx/src/gpu/processors/GeometryProcessor.h +165 -0
  1110. package/cpp/third_party/tgfx/src/gpu/processors/HairlineLineGeometryProcessor.cpp +40 -0
  1111. package/cpp/third_party/tgfx/src/gpu/processors/HairlineLineGeometryProcessor.h +65 -0
  1112. package/cpp/third_party/tgfx/src/gpu/processors/HairlineQuadGeometryProcessor.cpp +40 -0
  1113. package/cpp/third_party/tgfx/src/gpu/processors/HairlineQuadGeometryProcessor.h +65 -0
  1114. package/cpp/third_party/tgfx/src/gpu/processors/LinearGradientLayout.cpp +31 -0
  1115. package/cpp/third_party/tgfx/src/gpu/processors/LinearGradientLayout.h +41 -0
  1116. package/cpp/third_party/tgfx/src/gpu/processors/LumaFragmentProcessor.cpp +55 -0
  1117. package/cpp/third_party/tgfx/src/gpu/processors/LumaFragmentProcessor.h +52 -0
  1118. package/cpp/third_party/tgfx/src/gpu/processors/MeshGeometryProcessor.cpp +54 -0
  1119. package/cpp/third_party/tgfx/src/gpu/processors/MeshGeometryProcessor.h +59 -0
  1120. package/cpp/third_party/tgfx/src/gpu/processors/NonAARRectGeometryProcessor.cpp +44 -0
  1121. package/cpp/third_party/tgfx/src/gpu/processors/NonAARRectGeometryProcessor.h +61 -0
  1122. package/cpp/third_party/tgfx/src/gpu/processors/PerlinNoiseFragmentProcessor.cpp +62 -0
  1123. package/cpp/third_party/tgfx/src/gpu/processors/PerlinNoiseFragmentProcessor.h +67 -0
  1124. package/cpp/third_party/tgfx/src/gpu/processors/PorterDuffXferProcessor.cpp +33 -0
  1125. package/cpp/third_party/tgfx/src/gpu/processors/PorterDuffXferProcessor.h +49 -0
  1126. package/cpp/third_party/tgfx/src/gpu/processors/Processor.h +54 -0
  1127. package/cpp/third_party/tgfx/src/gpu/processors/QuadPerEdgeAAGeometryProcessor.cpp +53 -0
  1128. package/cpp/third_party/tgfx/src/gpu/processors/QuadPerEdgeAAGeometryProcessor.h +63 -0
  1129. package/cpp/third_party/tgfx/src/gpu/processors/RRectEffect.cpp +32 -0
  1130. package/cpp/third_party/tgfx/src/gpu/processors/RRectEffect.h +82 -0
  1131. package/cpp/third_party/tgfx/src/gpu/processors/RadialGradientLayout.cpp +31 -0
  1132. package/cpp/third_party/tgfx/src/gpu/processors/RadialGradientLayout.h +41 -0
  1133. package/cpp/third_party/tgfx/src/gpu/processors/RectEffect.cpp +32 -0
  1134. package/cpp/third_party/tgfx/src/gpu/processors/RectEffect.h +76 -0
  1135. package/cpp/third_party/tgfx/src/gpu/processors/RoundStrokeRectGeometryProcessor.cpp +49 -0
  1136. package/cpp/third_party/tgfx/src/gpu/processors/RoundStrokeRectGeometryProcessor.h +58 -0
  1137. package/cpp/third_party/tgfx/src/gpu/processors/RuntimeShaderProcessor.cpp +35 -0
  1138. package/cpp/third_party/tgfx/src/gpu/processors/RuntimeShaderProcessor.h +40 -0
  1139. package/cpp/third_party/tgfx/src/gpu/processors/ShapeInstancedGeometryProcessor.cpp +47 -0
  1140. package/cpp/third_party/tgfx/src/gpu/processors/ShapeInstancedGeometryProcessor.h +56 -0
  1141. package/cpp/third_party/tgfx/src/gpu/processors/SingleIntervalGradientColorizer.h +44 -0
  1142. package/cpp/third_party/tgfx/src/gpu/processors/StencilCoverCoverPassGeometryProcessor.cpp +28 -0
  1143. package/cpp/third_party/tgfx/src/gpu/processors/StencilCoverCoverPassGeometryProcessor.h +61 -0
  1144. package/cpp/third_party/tgfx/src/gpu/processors/StencilCoverStencilPassGeometryProcessor.cpp +35 -0
  1145. package/cpp/third_party/tgfx/src/gpu/processors/StencilCoverStencilPassGeometryProcessor.h +62 -0
  1146. package/cpp/third_party/tgfx/src/gpu/processors/TextureEffect.cpp +117 -0
  1147. package/cpp/third_party/tgfx/src/gpu/processors/TextureEffect.h +76 -0
  1148. package/cpp/third_party/tgfx/src/gpu/processors/TextureGradientColorizer.h +52 -0
  1149. package/cpp/third_party/tgfx/src/gpu/processors/TiledTextureEffect.cpp +190 -0
  1150. package/cpp/third_party/tgfx/src/gpu/processors/TiledTextureEffect.h +85 -0
  1151. package/cpp/third_party/tgfx/src/gpu/processors/UnrolledBinaryGradientColorizer.cpp +25 -0
  1152. package/cpp/third_party/tgfx/src/gpu/processors/UnrolledBinaryGradientColorizer.h +72 -0
  1153. package/cpp/third_party/tgfx/src/gpu/processors/XferProcessor.h +64 -0
  1154. package/cpp/third_party/tgfx/src/gpu/processors/XfermodeFragmentProcessor.cpp +65 -0
  1155. package/cpp/third_party/tgfx/src/gpu/processors/XfermodeFragmentProcessor.h +68 -0
  1156. package/cpp/third_party/tgfx/src/gpu/proxies/DefaultTextureProxy.cpp +42 -0
  1157. package/cpp/third_party/tgfx/src/gpu/proxies/DefaultTextureProxy.h +37 -0
  1158. package/cpp/third_party/tgfx/src/gpu/proxies/ExternalRenderTargetProxy.h +71 -0
  1159. package/cpp/third_party/tgfx/src/gpu/proxies/ExternalTextureRenderTargetProxy.cpp +40 -0
  1160. package/cpp/third_party/tgfx/src/gpu/proxies/ExternalTextureRenderTargetProxy.h +36 -0
  1161. package/cpp/third_party/tgfx/src/gpu/proxies/GPUBufferProxy.h +42 -0
  1162. package/cpp/third_party/tgfx/src/gpu/proxies/GPUHairlineProxy.h +61 -0
  1163. package/cpp/third_party/tgfx/src/gpu/proxies/GPUMeshProxy.cpp +102 -0
  1164. package/cpp/third_party/tgfx/src/gpu/proxies/GPUMeshProxy.h +97 -0
  1165. package/cpp/third_party/tgfx/src/gpu/proxies/GPUShapeProxy.h +58 -0
  1166. package/cpp/third_party/tgfx/src/gpu/proxies/HardwareRenderTargetProxy.cpp +43 -0
  1167. package/cpp/third_party/tgfx/src/gpu/proxies/HardwareRenderTargetProxy.h +43 -0
  1168. package/cpp/third_party/tgfx/src/gpu/proxies/HardwareTextureProxy.cpp +41 -0
  1169. package/cpp/third_party/tgfx/src/gpu/proxies/HardwareTextureProxy.h +42 -0
  1170. package/cpp/third_party/tgfx/src/gpu/proxies/RenderTargetProxy.cpp +91 -0
  1171. package/cpp/third_party/tgfx/src/gpu/proxies/RenderTargetProxy.h +179 -0
  1172. package/cpp/third_party/tgfx/src/gpu/proxies/ResourceProxy.h +63 -0
  1173. package/cpp/third_party/tgfx/src/gpu/proxies/StencilCoverPathProxy.h +60 -0
  1174. package/cpp/third_party/tgfx/src/gpu/proxies/TextureProxy.h +124 -0
  1175. package/cpp/third_party/tgfx/src/gpu/proxies/TextureRenderTargetProxy.cpp +46 -0
  1176. package/cpp/third_party/tgfx/src/gpu/proxies/TextureRenderTargetProxy.h +87 -0
  1177. package/cpp/third_party/tgfx/src/gpu/proxies/VertexBufferView.h +60 -0
  1178. package/cpp/third_party/tgfx/src/gpu/resources/BufferResource.cpp +45 -0
  1179. package/cpp/third_party/tgfx/src/gpu/resources/BufferResource.h +76 -0
  1180. package/cpp/third_party/tgfx/src/gpu/resources/DefaultTextureView.cpp +36 -0
  1181. package/cpp/third_party/tgfx/src/gpu/resources/DefaultTextureView.h +42 -0
  1182. package/cpp/third_party/tgfx/src/gpu/resources/ExternalRenderTarget.cpp +37 -0
  1183. package/cpp/third_party/tgfx/src/gpu/resources/ExternalRenderTarget.h +61 -0
  1184. package/cpp/third_party/tgfx/src/gpu/resources/RenderTarget.h +142 -0
  1185. package/cpp/third_party/tgfx/src/gpu/resources/Resource.cpp +37 -0
  1186. package/cpp/third_party/tgfx/src/gpu/resources/Resource.h +103 -0
  1187. package/cpp/third_party/tgfx/src/gpu/resources/ResourceKey.cpp +210 -0
  1188. package/cpp/third_party/tgfx/src/gpu/resources/ResourceKey.h +222 -0
  1189. package/cpp/third_party/tgfx/src/gpu/resources/TextureRenderTarget.cpp +131 -0
  1190. package/cpp/third_party/tgfx/src/gpu/resources/TextureRenderTarget.h +73 -0
  1191. package/cpp/third_party/tgfx/src/gpu/resources/TextureView.cpp +154 -0
  1192. package/cpp/third_party/tgfx/src/gpu/resources/TextureView.h +235 -0
  1193. package/cpp/third_party/tgfx/src/gpu/resources/YUVTextureView.cpp +132 -0
  1194. package/cpp/third_party/tgfx/src/gpu/resources/YUVTextureView.h +92 -0
  1195. package/cpp/third_party/tgfx/src/gpu/tasks/AtlasUploadTask.cpp +154 -0
  1196. package/cpp/third_party/tgfx/src/gpu/tasks/AtlasUploadTask.h +62 -0
  1197. package/cpp/third_party/tgfx/src/gpu/tasks/GPUBufferUploadTask.cpp +50 -0
  1198. package/cpp/third_party/tgfx/src/gpu/tasks/GPUBufferUploadTask.h +43 -0
  1199. package/cpp/third_party/tgfx/src/gpu/tasks/GenerateMipmapsTask.cpp +36 -0
  1200. package/cpp/third_party/tgfx/src/gpu/tasks/GenerateMipmapsTask.h +34 -0
  1201. package/cpp/third_party/tgfx/src/gpu/tasks/HairlineBufferUploadTask.cpp +93 -0
  1202. package/cpp/third_party/tgfx/src/gpu/tasks/HairlineBufferUploadTask.h +49 -0
  1203. package/cpp/third_party/tgfx/src/gpu/tasks/MeshBufferUploadTask.cpp +148 -0
  1204. package/cpp/third_party/tgfx/src/gpu/tasks/MeshBufferUploadTask.h +78 -0
  1205. package/cpp/third_party/tgfx/src/gpu/tasks/OpsRenderTask.cpp +81 -0
  1206. package/cpp/third_party/tgfx/src/gpu/tasks/OpsRenderTask.h +41 -0
  1207. package/cpp/third_party/tgfx/src/gpu/tasks/ReadbackBufferCreateTask.cpp +38 -0
  1208. package/cpp/third_party/tgfx/src/gpu/tasks/ReadbackBufferCreateTask.h +35 -0
  1209. package/cpp/third_party/tgfx/src/gpu/tasks/RenderTargetCopyTask.cpp +48 -0
  1210. package/cpp/third_party/tgfx/src/gpu/tasks/RenderTargetCopyTask.h +38 -0
  1211. package/cpp/third_party/tgfx/src/gpu/tasks/RenderTask.h +37 -0
  1212. package/cpp/third_party/tgfx/src/gpu/tasks/ResourceTask.cpp +40 -0
  1213. package/cpp/third_party/tgfx/src/gpu/tasks/ResourceTask.h +48 -0
  1214. package/cpp/third_party/tgfx/src/gpu/tasks/RuntimeDrawTask.cpp +150 -0
  1215. package/cpp/third_party/tgfx/src/gpu/tasks/RuntimeDrawTask.h +52 -0
  1216. package/cpp/third_party/tgfx/src/gpu/tasks/ShapeBufferUploadTask.cpp +63 -0
  1217. package/cpp/third_party/tgfx/src/gpu/tasks/ShapeBufferUploadTask.h +39 -0
  1218. package/cpp/third_party/tgfx/src/gpu/tasks/StencilCoverPathUploadTask.cpp +55 -0
  1219. package/cpp/third_party/tgfx/src/gpu/tasks/StencilCoverPathUploadTask.h +43 -0
  1220. package/cpp/third_party/tgfx/src/gpu/tasks/TextureUploadTask.cpp +47 -0
  1221. package/cpp/third_party/tgfx/src/gpu/tasks/TextureUploadTask.h +36 -0
  1222. package/cpp/third_party/tgfx/src/gpu/tasks/TransferPixelsTask.cpp +42 -0
  1223. package/cpp/third_party/tgfx/src/gpu/tasks/TransferPixelsTask.h +38 -0
  1224. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanAPI.h +43 -0
  1225. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanBuffer.cpp +137 -0
  1226. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanBuffer.h +66 -0
  1227. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanCaps.cpp +172 -0
  1228. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanCaps.h +116 -0
  1229. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanCommandBuffer.cpp +34 -0
  1230. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanCommandBuffer.h +68 -0
  1231. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanCommandEncoder.cpp +361 -0
  1232. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanCommandEncoder.h +95 -0
  1233. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanCommandQueue.cpp +393 -0
  1234. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanCommandQueue.h +102 -0
  1235. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanDefines.h +56 -0
  1236. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanDevice.cpp +55 -0
  1237. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanDevice.h +24 -0
  1238. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanExtensions.cpp +224 -0
  1239. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanExtensions.h +93 -0
  1240. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanFrameSession.h +96 -0
  1241. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanGPU.cpp +970 -0
  1242. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanGPU.h +293 -0
  1243. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanHardwareTexture.cpp +306 -0
  1244. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanHardwareTexture.h +62 -0
  1245. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanRenderPass.cpp +551 -0
  1246. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanRenderPass.h +115 -0
  1247. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanRenderPipeline.cpp +596 -0
  1248. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanRenderPipeline.h +108 -0
  1249. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanResource.cpp +21 -0
  1250. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanResource.h +43 -0
  1251. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanSampler.cpp +108 -0
  1252. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanSampler.h +52 -0
  1253. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanSemaphore.cpp +82 -0
  1254. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanSemaphore.h +71 -0
  1255. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanShaderModule.cpp +65 -0
  1256. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanShaderModule.h +54 -0
  1257. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanSwapchainProxy.cpp +110 -0
  1258. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanSwapchainProxy.h +84 -0
  1259. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanTexture.cpp +208 -0
  1260. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanTexture.h +90 -0
  1261. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanUtil.cpp +236 -0
  1262. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanUtil.h +73 -0
  1263. package/cpp/third_party/tgfx/src/gpu/vulkan/VulkanWindow.cpp +764 -0
  1264. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUBuffer.cpp +171 -0
  1265. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUBuffer.h +72 -0
  1266. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUCaps.cpp +109 -0
  1267. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUCaps.h +78 -0
  1268. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUCommandBuffer.h +45 -0
  1269. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUCommandEncoder.cpp +223 -0
  1270. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUCommandEncoder.h +60 -0
  1271. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUCommandQueue.cpp +104 -0
  1272. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUCommandQueue.h +63 -0
  1273. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUDefines.h +58 -0
  1274. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUDevice.cpp +98 -0
  1275. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUDevice.h +24 -0
  1276. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUDrawableProxy.cpp +117 -0
  1277. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUDrawableProxy.h +58 -0
  1278. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUGPU.cpp +294 -0
  1279. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUGPU.h +136 -0
  1280. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPURenderPass.cpp +305 -0
  1281. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPURenderPass.h +97 -0
  1282. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPURenderPipeline.cpp +305 -0
  1283. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPURenderPipeline.h +72 -0
  1284. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUResource.cpp +21 -0
  1285. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUResource.h +43 -0
  1286. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUSampler.cpp +57 -0
  1287. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUSampler.h +47 -0
  1288. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUSemaphore.cpp +28 -0
  1289. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUSemaphore.h +33 -0
  1290. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUShaderModule.cpp +275 -0
  1291. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUShaderModule.h +57 -0
  1292. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUTexture.cpp +144 -0
  1293. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUTexture.h +73 -0
  1294. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUUtil.cpp +364 -0
  1295. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUUtil.h +72 -0
  1296. package/cpp/third_party/tgfx/src/gpu/webgpu/WebGPUWindow.cpp +156 -0
  1297. package/cpp/third_party/tgfx/src/layers/BackgroundHandler.cpp +363 -0
  1298. package/cpp/third_party/tgfx/src/layers/BackgroundHandler.h +217 -0
  1299. package/cpp/third_party/tgfx/src/layers/BackgroundSnapshotMap.h +102 -0
  1300. package/cpp/third_party/tgfx/src/layers/BackgroundSource.cpp +285 -0
  1301. package/cpp/third_party/tgfx/src/layers/BackgroundSource.h +104 -0
  1302. package/cpp/third_party/tgfx/src/layers/DashEffect.cpp +41 -0
  1303. package/cpp/third_party/tgfx/src/layers/DashEffect.h +33 -0
  1304. package/cpp/third_party/tgfx/src/layers/DisplayList.cpp +1250 -0
  1305. package/cpp/third_party/tgfx/src/layers/DrawArgs.h +76 -0
  1306. package/cpp/third_party/tgfx/src/layers/ImageLayer.cpp +50 -0
  1307. package/cpp/third_party/tgfx/src/layers/Layer.cpp +2257 -0
  1308. package/cpp/third_party/tgfx/src/layers/LayerProperty.cpp +62 -0
  1309. package/cpp/third_party/tgfx/src/layers/LayerRecorder.cpp +405 -0
  1310. package/cpp/third_party/tgfx/src/layers/LayerStyleSource.h +102 -0
  1311. package/cpp/third_party/tgfx/src/layers/MaskContext.cpp +225 -0
  1312. package/cpp/third_party/tgfx/src/layers/MaskContext.h +104 -0
  1313. package/cpp/third_party/tgfx/src/layers/MeshLayer.cpp +88 -0
  1314. package/cpp/third_party/tgfx/src/layers/NoiseDensityUtils.cpp +88 -0
  1315. package/cpp/third_party/tgfx/src/layers/NoiseDensityUtils.h +47 -0
  1316. package/cpp/third_party/tgfx/src/layers/OffscreenRenderer.cpp +265 -0
  1317. package/cpp/third_party/tgfx/src/layers/OffscreenRenderer.h +78 -0
  1318. package/cpp/third_party/tgfx/src/layers/OpaqueContext.cpp +477 -0
  1319. package/cpp/third_party/tgfx/src/layers/OpaqueContext.h +176 -0
  1320. package/cpp/third_party/tgfx/src/layers/OpaqueThreshold.h +23 -0
  1321. package/cpp/third_party/tgfx/src/layers/RegionTransformer.cpp +234 -0
  1322. package/cpp/third_party/tgfx/src/layers/RegionTransformer.h +109 -0
  1323. package/cpp/third_party/tgfx/src/layers/RootLayer.cpp +117 -0
  1324. package/cpp/third_party/tgfx/src/layers/RootLayer.h +91 -0
  1325. package/cpp/third_party/tgfx/src/layers/ShapeLayer.cpp +275 -0
  1326. package/cpp/third_party/tgfx/src/layers/ShapeStyle.cpp +37 -0
  1327. package/cpp/third_party/tgfx/src/layers/SolidLayer.cpp +95 -0
  1328. package/cpp/third_party/tgfx/src/layers/SpreadUtils.cpp +233 -0
  1329. package/cpp/third_party/tgfx/src/layers/SpreadUtils.h +71 -0
  1330. package/cpp/third_party/tgfx/src/layers/SubtreeCache.cpp +90 -0
  1331. package/cpp/third_party/tgfx/src/layers/SubtreeCache.h +62 -0
  1332. package/cpp/third_party/tgfx/src/layers/TextLayer.cpp +498 -0
  1333. package/cpp/third_party/tgfx/src/layers/TileCache.cpp +120 -0
  1334. package/cpp/third_party/tgfx/src/layers/TileCache.h +124 -0
  1335. package/cpp/third_party/tgfx/src/layers/VectorLayer.cpp +159 -0
  1336. package/cpp/third_party/tgfx/src/layers/compositing3d/BspTree.cpp +89 -0
  1337. package/cpp/third_party/tgfx/src/layers/compositing3d/BspTree.h +112 -0
  1338. package/cpp/third_party/tgfx/src/layers/compositing3d/Context3DCompositor.cpp +287 -0
  1339. package/cpp/third_party/tgfx/src/layers/compositing3d/Context3DCompositor.h +121 -0
  1340. package/cpp/third_party/tgfx/src/layers/compositing3d/DrawPolygon3D.cpp +269 -0
  1341. package/cpp/third_party/tgfx/src/layers/compositing3d/DrawPolygon3D.h +158 -0
  1342. package/cpp/third_party/tgfx/src/layers/compositing3d/Layer3DContext.cpp +85 -0
  1343. package/cpp/third_party/tgfx/src/layers/compositing3d/Layer3DContext.h +110 -0
  1344. package/cpp/third_party/tgfx/src/layers/compositing3d/Opaque3DContext.cpp +114 -0
  1345. package/cpp/third_party/tgfx/src/layers/compositing3d/Opaque3DContext.h +55 -0
  1346. package/cpp/third_party/tgfx/src/layers/compositing3d/Render3DContext.cpp +277 -0
  1347. package/cpp/third_party/tgfx/src/layers/compositing3d/Render3DContext.h +87 -0
  1348. package/cpp/third_party/tgfx/src/layers/contents/ComposeContent.cpp +109 -0
  1349. package/cpp/third_party/tgfx/src/layers/contents/ComposeContent.h +57 -0
  1350. package/cpp/third_party/tgfx/src/layers/contents/DrawContent.cpp +127 -0
  1351. package/cpp/third_party/tgfx/src/layers/contents/DrawContent.h +70 -0
  1352. package/cpp/third_party/tgfx/src/layers/contents/GeometryContent.h +44 -0
  1353. package/cpp/third_party/tgfx/src/layers/contents/LayerContent.h +107 -0
  1354. package/cpp/third_party/tgfx/src/layers/contents/MatrixContent.cpp +86 -0
  1355. package/cpp/third_party/tgfx/src/layers/contents/MatrixContent.h +53 -0
  1356. package/cpp/third_party/tgfx/src/layers/contents/MeshContent.cpp +48 -0
  1357. package/cpp/third_party/tgfx/src/layers/contents/MeshContent.h +45 -0
  1358. package/cpp/third_party/tgfx/src/layers/contents/PathContent.cpp +76 -0
  1359. package/cpp/third_party/tgfx/src/layers/contents/PathContent.h +49 -0
  1360. package/cpp/third_party/tgfx/src/layers/contents/RRectContent.cpp +66 -0
  1361. package/cpp/third_party/tgfx/src/layers/contents/RRectContent.h +48 -0
  1362. package/cpp/third_party/tgfx/src/layers/contents/RRectsContent.cpp +97 -0
  1363. package/cpp/third_party/tgfx/src/layers/contents/RRectsContent.h +49 -0
  1364. package/cpp/third_party/tgfx/src/layers/contents/RectContent.cpp +67 -0
  1365. package/cpp/third_party/tgfx/src/layers/contents/RectContent.h +48 -0
  1366. package/cpp/third_party/tgfx/src/layers/contents/RectsContent.cpp +94 -0
  1367. package/cpp/third_party/tgfx/src/layers/contents/RectsContent.h +48 -0
  1368. package/cpp/third_party/tgfx/src/layers/contents/ShapeContent.cpp +193 -0
  1369. package/cpp/third_party/tgfx/src/layers/contents/ShapeContent.h +81 -0
  1370. package/cpp/third_party/tgfx/src/layers/contents/TextContent.cpp +56 -0
  1371. package/cpp/third_party/tgfx/src/layers/contents/TextContent.h +46 -0
  1372. package/cpp/third_party/tgfx/src/layers/filters/BlendFilter.cpp +51 -0
  1373. package/cpp/third_party/tgfx/src/layers/filters/BlurFilter.cpp +60 -0
  1374. package/cpp/third_party/tgfx/src/layers/filters/ColorMatrixFilter.cpp +43 -0
  1375. package/cpp/third_party/tgfx/src/layers/filters/DropShadowFilter.cpp +92 -0
  1376. package/cpp/third_party/tgfx/src/layers/filters/InnerShadowFilter.cpp +93 -0
  1377. package/cpp/third_party/tgfx/src/layers/filters/LayerFilter.cpp +43 -0
  1378. package/cpp/third_party/tgfx/src/layers/filters/LayerImageFilter.cpp +56 -0
  1379. package/cpp/third_party/tgfx/src/layers/filters/NoiseFilter.cpp +356 -0
  1380. package/cpp/third_party/tgfx/src/layers/imagefilters/GlassRefractionImageFilter.cpp +81 -0
  1381. package/cpp/third_party/tgfx/src/layers/imagefilters/GlassRefractionImageFilter.h +48 -0
  1382. package/cpp/third_party/tgfx/src/layers/layerstyles/BackgroundBlurStyle.cpp +103 -0
  1383. package/cpp/third_party/tgfx/src/layers/layerstyles/DropShadowStyle.cpp +180 -0
  1384. package/cpp/third_party/tgfx/src/layers/layerstyles/GlassStyle.cpp +413 -0
  1385. package/cpp/third_party/tgfx/src/layers/layerstyles/InnerShadowStyle.cpp +219 -0
  1386. package/cpp/third_party/tgfx/src/layers/layerstyles/LayerStyle.cpp +42 -0
  1387. package/cpp/third_party/tgfx/src/layers/layerstyles/NoiseStyle.cpp +280 -0
  1388. package/cpp/third_party/tgfx/src/layers/layerstyles/StyledShape.cpp +51 -0
  1389. package/cpp/third_party/tgfx/src/layers/processors/GLSLGlassRefractionFragmentProcessor.cpp +282 -0
  1390. package/cpp/third_party/tgfx/src/layers/processors/GLSLGlassRefractionFragmentProcessor.h +39 -0
  1391. package/cpp/third_party/tgfx/src/layers/processors/GLSLTentBlur1DFragmentProcessor.cpp +134 -0
  1392. package/cpp/third_party/tgfx/src/layers/processors/GLSLTentBlur1DFragmentProcessor.h +37 -0
  1393. package/cpp/third_party/tgfx/src/layers/processors/GlassRefractionFragmentProcessor.cpp +78 -0
  1394. package/cpp/third_party/tgfx/src/layers/processors/GlassRefractionFragmentProcessor.h +94 -0
  1395. package/cpp/third_party/tgfx/src/layers/processors/TentBlur1DFragmentProcessor.cpp +37 -0
  1396. package/cpp/third_party/tgfx/src/layers/processors/TentBlur1DFragmentProcessor.h +54 -0
  1397. package/cpp/third_party/tgfx/src/layers/vectors/Ellipse.cpp +81 -0
  1398. package/cpp/third_party/tgfx/src/layers/vectors/FillStyle.cpp +173 -0
  1399. package/cpp/third_party/tgfx/src/layers/vectors/Geometry.cpp +304 -0
  1400. package/cpp/third_party/tgfx/src/layers/vectors/Geometry.h +142 -0
  1401. package/cpp/third_party/tgfx/src/layers/vectors/Gradient.cpp +196 -0
  1402. package/cpp/third_party/tgfx/src/layers/vectors/ImagePattern.cpp +147 -0
  1403. package/cpp/third_party/tgfx/src/layers/vectors/MergePath.cpp +78 -0
  1404. package/cpp/third_party/tgfx/src/layers/vectors/Painter.cpp +112 -0
  1405. package/cpp/third_party/tgfx/src/layers/vectors/Painter.h +158 -0
  1406. package/cpp/third_party/tgfx/src/layers/vectors/Polystar.cpp +285 -0
  1407. package/cpp/third_party/tgfx/src/layers/vectors/Rectangle.cpp +101 -0
  1408. package/cpp/third_party/tgfx/src/layers/vectors/Repeater.cpp +174 -0
  1409. package/cpp/third_party/tgfx/src/layers/vectors/RoundCorner.cpp +56 -0
  1410. package/cpp/third_party/tgfx/src/layers/vectors/ShapePath.cpp +68 -0
  1411. package/cpp/third_party/tgfx/src/layers/vectors/SolidColor.cpp +37 -0
  1412. package/cpp/third_party/tgfx/src/layers/vectors/StrokeStyle.cpp +260 -0
  1413. package/cpp/third_party/tgfx/src/layers/vectors/Text.cpp +77 -0
  1414. package/cpp/third_party/tgfx/src/layers/vectors/TextModifier.cpp +256 -0
  1415. package/cpp/third_party/tgfx/src/layers/vectors/TextPath.cpp +258 -0
  1416. package/cpp/third_party/tgfx/src/layers/vectors/TextSelector.cpp +493 -0
  1417. package/cpp/third_party/tgfx/src/layers/vectors/TrimPath.cpp +194 -0
  1418. package/cpp/third_party/tgfx/src/layers/vectors/VectorContext.cpp +80 -0
  1419. package/cpp/third_party/tgfx/src/layers/vectors/VectorContext.h +73 -0
  1420. package/cpp/third_party/tgfx/src/layers/vectors/VectorElement.cpp +31 -0
  1421. package/cpp/third_party/tgfx/src/layers/vectors/VectorGroup.cpp +188 -0
  1422. package/cpp/third_party/tgfx/src/pdf/DeflateStream.cpp +133 -0
  1423. package/cpp/third_party/tgfx/src/pdf/DeflateStream.h +42 -0
  1424. package/cpp/third_party/tgfx/src/pdf/PDFBitmap.cpp +414 -0
  1425. package/cpp/third_party/tgfx/src/pdf/PDFBitmap.h +39 -0
  1426. package/cpp/third_party/tgfx/src/pdf/PDFDocumentImpl.cpp +517 -0
  1427. package/cpp/third_party/tgfx/src/pdf/PDFDocumentImpl.h +208 -0
  1428. package/cpp/third_party/tgfx/src/pdf/PDFExportContext.cpp +1490 -0
  1429. package/cpp/third_party/tgfx/src/pdf/PDFExportContext.h +188 -0
  1430. package/cpp/third_party/tgfx/src/pdf/PDFFont.cpp +582 -0
  1431. package/cpp/third_party/tgfx/src/pdf/PDFFont.h +183 -0
  1432. package/cpp/third_party/tgfx/src/pdf/PDFFormXObject.cpp +54 -0
  1433. package/cpp/third_party/tgfx/src/pdf/PDFFormXObject.h +33 -0
  1434. package/cpp/third_party/tgfx/src/pdf/PDFGlyphUse.h +89 -0
  1435. package/cpp/third_party/tgfx/src/pdf/PDFGradientShader.cpp +1009 -0
  1436. package/cpp/third_party/tgfx/src/pdf/PDFGradientShader.h +44 -0
  1437. package/cpp/third_party/tgfx/src/pdf/PDFGraphicStackState.cpp +175 -0
  1438. package/cpp/third_party/tgfx/src/pdf/PDFGraphicStackState.h +65 -0
  1439. package/cpp/third_party/tgfx/src/pdf/PDFGraphicState.cpp +91 -0
  1440. package/cpp/third_party/tgfx/src/pdf/PDFGraphicState.h +75 -0
  1441. package/cpp/third_party/tgfx/src/pdf/PDFMetadata.cpp +109 -0
  1442. package/cpp/third_party/tgfx/src/pdf/PDFMetadataUtils.cpp +334 -0
  1443. package/cpp/third_party/tgfx/src/pdf/PDFMetadataUtils.h +39 -0
  1444. package/cpp/third_party/tgfx/src/pdf/PDFResourceDictionary.cpp +83 -0
  1445. package/cpp/third_party/tgfx/src/pdf/PDFResourceDictionary.h +42 -0
  1446. package/cpp/third_party/tgfx/src/pdf/PDFShader.cpp +392 -0
  1447. package/cpp/third_party/tgfx/src/pdf/PDFShader.h +46 -0
  1448. package/cpp/third_party/tgfx/src/pdf/PDFTag.cpp +441 -0
  1449. package/cpp/third_party/tgfx/src/pdf/PDFTag.h +158 -0
  1450. package/cpp/third_party/tgfx/src/pdf/PDFTypes.cpp +351 -0
  1451. package/cpp/third_party/tgfx/src/pdf/PDFTypes.h +174 -0
  1452. package/cpp/third_party/tgfx/src/pdf/PDFUnion.cpp +324 -0
  1453. package/cpp/third_party/tgfx/src/pdf/PDFUnion.h +104 -0
  1454. package/cpp/third_party/tgfx/src/pdf/PDFUtils.cpp +437 -0
  1455. package/cpp/third_party/tgfx/src/pdf/PDFUtils.h +100 -0
  1456. package/cpp/third_party/tgfx/src/pdf/fontSubset/PDFMakeCIDGlyphWidthsArray.cpp +203 -0
  1457. package/cpp/third_party/tgfx/src/pdf/fontSubset/PDFMakeCIDGlyphWidthsArray.h +36 -0
  1458. package/cpp/third_party/tgfx/src/pdf/fontSubset/PDFMakeToUnicodeCmap.cpp +221 -0
  1459. package/cpp/third_party/tgfx/src/pdf/fontSubset/PDFMakeToUnicodeCmap.h +32 -0
  1460. package/cpp/third_party/tgfx/src/pdf/fontSubset/PDFSubsetFont.cpp +128 -0
  1461. package/cpp/third_party/tgfx/src/pdf/fontSubset/PDFSubsetFont.h +30 -0
  1462. package/cpp/third_party/tgfx/src/pdf/fontSubset/PDFType1Font.cpp +339 -0
  1463. package/cpp/third_party/tgfx/src/pdf/fontSubset/PDFType1Font.h +28 -0
  1464. package/cpp/third_party/tgfx/src/platform/ImageReader.cpp +124 -0
  1465. package/cpp/third_party/tgfx/src/platform/ImageStream.h +78 -0
  1466. package/cpp/third_party/tgfx/src/platform/Print.cpp +43 -0
  1467. package/cpp/third_party/tgfx/src/platform/android/AHardwareBufferFunctions.cpp +55 -0
  1468. package/cpp/third_party/tgfx/src/platform/android/AHardwareBufferFunctions.h +53 -0
  1469. package/cpp/third_party/tgfx/src/platform/android/AndroidBitmap.cpp +133 -0
  1470. package/cpp/third_party/tgfx/src/platform/android/GlyphRenderer.cpp +437 -0
  1471. package/cpp/third_party/tgfx/src/platform/android/GlyphRenderer.h +92 -0
  1472. package/cpp/third_party/tgfx/src/platform/android/HandlerThread.cpp +69 -0
  1473. package/cpp/third_party/tgfx/src/platform/android/HandlerThread.h +43 -0
  1474. package/cpp/third_party/tgfx/src/platform/android/HardwareBuffer.cpp +127 -0
  1475. package/cpp/third_party/tgfx/src/platform/android/JNIEnvironment.cpp +94 -0
  1476. package/cpp/third_party/tgfx/src/platform/android/JNIInit.cpp +49 -0
  1477. package/cpp/third_party/tgfx/src/platform/android/JNIInit.h +26 -0
  1478. package/cpp/third_party/tgfx/src/platform/android/JNIUtil.cpp +38 -0
  1479. package/cpp/third_party/tgfx/src/platform/android/JNIUtil.h +32 -0
  1480. package/cpp/third_party/tgfx/src/platform/android/NativeCodec.cpp +415 -0
  1481. package/cpp/third_party/tgfx/src/platform/android/NativeCodec.h +52 -0
  1482. package/cpp/third_party/tgfx/src/platform/android/NativeImageBuffer.cpp +70 -0
  1483. package/cpp/third_party/tgfx/src/platform/android/NativeImageBuffer.h +59 -0
  1484. package/cpp/third_party/tgfx/src/platform/android/Print.cpp +38 -0
  1485. package/cpp/third_party/tgfx/src/platform/android/SurfaceTexture.cpp +309 -0
  1486. package/cpp/third_party/tgfx/src/platform/android/SurfaceTexture.h +84 -0
  1487. package/cpp/third_party/tgfx/src/platform/android/SurfaceTextureReader.cpp +71 -0
  1488. package/cpp/third_party/tgfx/src/platform/apple/BitmapContextUtil.h +26 -0
  1489. package/cpp/third_party/tgfx/src/platform/apple/BitmapContextUtil.mm +63 -0
  1490. package/cpp/third_party/tgfx/src/platform/apple/CGColorSpaceUtil.h +29 -0
  1491. package/cpp/third_party/tgfx/src/platform/apple/CGColorSpaceUtil.mm +46 -0
  1492. package/cpp/third_party/tgfx/src/platform/apple/CTTypeface.mm +44 -0
  1493. package/cpp/third_party/tgfx/src/platform/apple/HardwareBuffer.mm +102 -0
  1494. package/cpp/third_party/tgfx/src/platform/apple/NativeCodec.h +43 -0
  1495. package/cpp/third_party/tgfx/src/platform/apple/NativeCodec.mm +197 -0
  1496. package/cpp/third_party/tgfx/src/platform/mock/HardwareBuffer.cpp +47 -0
  1497. package/cpp/third_party/tgfx/src/platform/mock/NativeCodec.cpp +33 -0
  1498. package/cpp/third_party/tgfx/src/platform/ohos/HardwareBuffer.cpp +99 -0
  1499. package/cpp/third_party/tgfx/src/platform/ohos/NativeCodec.cpp +230 -0
  1500. package/cpp/third_party/tgfx/src/platform/ohos/NativeCodec.h +49 -0
  1501. package/cpp/third_party/tgfx/src/platform/ohos/OHOSImageInfo.cpp +85 -0
  1502. package/cpp/third_party/tgfx/src/platform/ohos/OHOSImageInfo.h +52 -0
  1503. package/cpp/third_party/tgfx/src/platform/ohos/OHOSPixelMap.cpp +66 -0
  1504. package/cpp/third_party/tgfx/src/platform/ohos/Print.cpp +45 -0
  1505. package/cpp/third_party/tgfx/src/platform/web/HardwareBuffer.cpp +51 -0
  1506. package/cpp/third_party/tgfx/src/platform/web/NativeCodec.cpp +113 -0
  1507. package/cpp/third_party/tgfx/src/platform/web/NativeCodec.h +45 -0
  1508. package/cpp/third_party/tgfx/src/platform/web/ReadPixelsFromCanvasImage.cpp +54 -0
  1509. package/cpp/third_party/tgfx/src/platform/web/ReadPixelsFromCanvasImage.h +31 -0
  1510. package/cpp/third_party/tgfx/src/platform/web/TGFXWasmBindings.cpp +79 -0
  1511. package/cpp/third_party/tgfx/src/platform/web/TGFXWasmBindings.h +23 -0
  1512. package/cpp/third_party/tgfx/src/platform/web/VideoElement.cpp +84 -0
  1513. package/cpp/third_party/tgfx/src/platform/web/VideoElement.h +51 -0
  1514. package/cpp/third_party/tgfx/src/platform/web/VideoElementReader.cpp +42 -0
  1515. package/cpp/third_party/tgfx/src/platform/web/WebAtlasUploadTask.cpp +67 -0
  1516. package/cpp/third_party/tgfx/src/platform/web/WebAtlasUploadTask.h +31 -0
  1517. package/cpp/third_party/tgfx/src/platform/web/WebGlyphRasterizer.cpp +47 -0
  1518. package/cpp/third_party/tgfx/src/platform/web/WebGlyphRasterizer.h +35 -0
  1519. package/cpp/third_party/tgfx/src/platform/web/WebImageBuffer.cpp +185 -0
  1520. package/cpp/third_party/tgfx/src/platform/web/WebImageBuffer.h +85 -0
  1521. package/cpp/third_party/tgfx/src/platform/web/WebImageInfo.cpp +134 -0
  1522. package/cpp/third_party/tgfx/src/platform/web/WebImageInfo.h +33 -0
  1523. package/cpp/third_party/tgfx/src/platform/web/WebPathRasterizer.cpp +108 -0
  1524. package/cpp/third_party/tgfx/src/platform/web/WebPathRasterizer.h +35 -0
  1525. package/cpp/third_party/tgfx/src/platform/web/WebScalerContext.cpp +118 -0
  1526. package/cpp/third_party/tgfx/src/platform/web/WebScalerContext.h +62 -0
  1527. package/cpp/third_party/tgfx/src/platform/web/WebTypeface.cpp +146 -0
  1528. package/cpp/third_party/tgfx/src/platform/web/WebTypeface.h +97 -0
  1529. package/cpp/third_party/tgfx/src/platform/win/D3D11Defines.h +129 -0
  1530. package/cpp/third_party/tgfx/src/platform/win/D3D11Util.cpp +69 -0
  1531. package/cpp/third_party/tgfx/src/platform/win/D3D11Util.h +47 -0
  1532. package/cpp/third_party/tgfx/src/platform/win/HardwareBuffer.cpp +215 -0
  1533. package/cpp/third_party/tgfx/src/platform/win/NativeCodec.cpp +351 -0
  1534. package/cpp/third_party/tgfx/src/platform/win/NativeCodec.h +47 -0
  1535. package/cpp/third_party/tgfx/src/svg/ElementWriter.cpp +1569 -0
  1536. package/cpp/third_party/tgfx/src/svg/ElementWriter.h +199 -0
  1537. package/cpp/third_party/tgfx/src/svg/ResourceStore.h +82 -0
  1538. package/cpp/third_party/tgfx/src/svg/SVGAttribute.cpp +63 -0
  1539. package/cpp/third_party/tgfx/src/svg/SVGAttributeParser.cpp +1293 -0
  1540. package/cpp/third_party/tgfx/src/svg/SVGAttributeParser.h +182 -0
  1541. package/cpp/third_party/tgfx/src/svg/SVGDOM.cpp +126 -0
  1542. package/cpp/third_party/tgfx/src/svg/SVGExportContext.cpp +894 -0
  1543. package/cpp/third_party/tgfx/src/svg/SVGExportContext.h +169 -0
  1544. package/cpp/third_party/tgfx/src/svg/SVGExporter.cpp +76 -0
  1545. package/cpp/third_party/tgfx/src/svg/SVGFilterContext.cpp +132 -0
  1546. package/cpp/third_party/tgfx/src/svg/SVGFilterContext.h +86 -0
  1547. package/cpp/third_party/tgfx/src/svg/SVGLengthContext.cpp +124 -0
  1548. package/cpp/third_party/tgfx/src/svg/SVGNodeConstructor.cpp +490 -0
  1549. package/cpp/third_party/tgfx/src/svg/SVGNodeConstructor.h +94 -0
  1550. package/cpp/third_party/tgfx/src/svg/SVGParseColor.cpp +363 -0
  1551. package/cpp/third_party/tgfx/src/svg/SVGPathParser.cpp +292 -0
  1552. package/cpp/third_party/tgfx/src/svg/SVGRenderContext.cpp +505 -0
  1553. package/cpp/third_party/tgfx/src/svg/SVGRenderContext.h +250 -0
  1554. package/cpp/third_party/tgfx/src/svg/SVGTextBuilder.cpp +112 -0
  1555. package/cpp/third_party/tgfx/src/svg/SVGTextBuilder.h +43 -0
  1556. package/cpp/third_party/tgfx/src/svg/SVGUtils.cpp +508 -0
  1557. package/cpp/third_party/tgfx/src/svg/SVGUtils.h +89 -0
  1558. package/cpp/third_party/tgfx/src/svg/TextShaper.cpp +119 -0
  1559. package/cpp/third_party/tgfx/src/svg/node/SVGCircle.cpp +86 -0
  1560. package/cpp/third_party/tgfx/src/svg/node/SVGClipPath.cpp +47 -0
  1561. package/cpp/third_party/tgfx/src/svg/node/SVGContainer.cpp +74 -0
  1562. package/cpp/third_party/tgfx/src/svg/node/SVGEllipse.cpp +79 -0
  1563. package/cpp/third_party/tgfx/src/svg/node/SVGFe.cpp +145 -0
  1564. package/cpp/third_party/tgfx/src/svg/node/SVGFeBlend.cpp +55 -0
  1565. package/cpp/third_party/tgfx/src/svg/node/SVGFeColorMatrix.cpp +159 -0
  1566. package/cpp/third_party/tgfx/src/svg/node/SVGFeComponentTransfer.cpp +140 -0
  1567. package/cpp/third_party/tgfx/src/svg/node/SVGFeComposite.cpp +78 -0
  1568. package/cpp/third_party/tgfx/src/svg/node/SVGFeDisplacementMap.cpp +64 -0
  1569. package/cpp/third_party/tgfx/src/svg/node/SVGFeGaussianBlur.cpp +54 -0
  1570. package/cpp/third_party/tgfx/src/svg/node/SVGFeImage.cpp +36 -0
  1571. package/cpp/third_party/tgfx/src/svg/node/SVGFeLightSource.cpp +50 -0
  1572. package/cpp/third_party/tgfx/src/svg/node/SVGFeLighting.cpp +60 -0
  1573. package/cpp/third_party/tgfx/src/svg/node/SVGFeMerge.cpp +53 -0
  1574. package/cpp/third_party/tgfx/src/svg/node/SVGFeMorphology.cpp +60 -0
  1575. package/cpp/third_party/tgfx/src/svg/node/SVGFeOffset.cpp +37 -0
  1576. package/cpp/third_party/tgfx/src/svg/node/SVGFeTurbulence.cpp +100 -0
  1577. package/cpp/third_party/tgfx/src/svg/node/SVGFilter.cpp +219 -0
  1578. package/cpp/third_party/tgfx/src/svg/node/SVGGradient.cpp +117 -0
  1579. package/cpp/third_party/tgfx/src/svg/node/SVGImage.cpp +126 -0
  1580. package/cpp/third_party/tgfx/src/svg/node/SVGLine.cpp +82 -0
  1581. package/cpp/third_party/tgfx/src/svg/node/SVGLinearGradient.cpp +56 -0
  1582. package/cpp/third_party/tgfx/src/svg/node/SVGMask.cpp +80 -0
  1583. package/cpp/third_party/tgfx/src/svg/node/SVGNode.cpp +201 -0
  1584. package/cpp/third_party/tgfx/src/svg/node/SVGPath.cpp +84 -0
  1585. package/cpp/third_party/tgfx/src/svg/node/SVGPattern.cpp +161 -0
  1586. package/cpp/third_party/tgfx/src/svg/node/SVGPoly.cpp +83 -0
  1587. package/cpp/third_party/tgfx/src/svg/node/SVGRadialGradient.cpp +63 -0
  1588. package/cpp/third_party/tgfx/src/svg/node/SVGRect.cpp +104 -0
  1589. package/cpp/third_party/tgfx/src/svg/node/SVGRoot.cpp +133 -0
  1590. package/cpp/third_party/tgfx/src/svg/node/SVGShape.cpp +59 -0
  1591. package/cpp/third_party/tgfx/src/svg/node/SVGStop.cpp +31 -0
  1592. package/cpp/third_party/tgfx/src/svg/node/SVGText.cpp +190 -0
  1593. package/cpp/third_party/tgfx/src/svg/node/SVGTransformableNode.cpp +71 -0
  1594. package/cpp/third_party/tgfx/src/svg/node/SVGUse.cpp +90 -0
  1595. package/cpp/third_party/tgfx/src/svg/xml/DOMParser.cpp +107 -0
  1596. package/cpp/third_party/tgfx/src/svg/xml/DOMParser.h +62 -0
  1597. package/cpp/third_party/tgfx/src/svg/xml/XMLDOM.cpp +156 -0
  1598. package/cpp/third_party/tgfx/src/svg/xml/XMLParser.cpp +187 -0
  1599. package/cpp/third_party/tgfx/src/svg/xml/XMLParser.h +59 -0
  1600. package/cpp/third_party/tgfx/src/svg/xml/XMLWriter.cpp +289 -0
  1601. package/cpp/third_party/tgfx/src/svg/xml/XMLWriter.h +132 -0
  1602. package/cpp/third_party/tgfx/vendor.json +434 -0
  1603. package/ios/HybridTgfxView.swift +95 -0
  1604. package/ios/TgfxMetalView.h +42 -0
  1605. package/ios/TgfxMetalView.mm +267 -0
  1606. package/ios/libs/libtgfx.xcframework/Info.plist +43 -0
  1607. package/ios/libs/libtgfx.xcframework/ios-arm64/libtgfx-ios.a +0 -0
  1608. package/ios/libs/libtgfx.xcframework/ios-arm64-simulator/libtgfx-ios.a +0 -0
  1609. package/lib/compiler/colors.d.ts +26 -0
  1610. package/lib/compiler/colors.js +364 -0
  1611. package/lib/compiler/compile.d.ts +17 -0
  1612. package/lib/compiler/compile.js +474 -0
  1613. package/lib/compiler/filters.d.ts +43 -0
  1614. package/lib/compiler/filters.js +98 -0
  1615. package/lib/compiler/image.d.ts +31 -0
  1616. package/lib/compiler/image.js +71 -0
  1617. package/lib/compiler/paint.d.ts +65 -0
  1618. package/lib/compiler/paint.js +207 -0
  1619. package/lib/compiler/sksl.d.ts +10 -0
  1620. package/lib/compiler/sksl.js +180 -0
  1621. package/lib/compiler/text.d.ts +37 -0
  1622. package/lib/compiler/text.js +77 -0
  1623. package/lib/compiler/transform.d.ts +34 -0
  1624. package/lib/compiler/transform.js +11 -0
  1625. package/lib/compiler/values.d.ts +22 -0
  1626. package/lib/compiler/values.js +22 -0
  1627. package/lib/compiler/writer.d.ts +70 -0
  1628. package/lib/compiler/writer.js +142 -0
  1629. package/lib/components/Canvas.d.ts +10 -0
  1630. package/lib/components/Canvas.js +139 -0
  1631. package/lib/components/Group.d.ts +7 -0
  1632. package/lib/components/Group.js +6 -0
  1633. package/lib/components/Paint.d.ts +45 -0
  1634. package/lib/components/Paint.js +44 -0
  1635. package/lib/components/drawings.d.ts +56 -0
  1636. package/lib/components/drawings.js +55 -0
  1637. package/lib/hooks/source.d.ts +18 -0
  1638. package/lib/hooks/source.js +47 -0
  1639. package/lib/hooks/useCameraFrame.d.ts +94 -0
  1640. package/lib/hooks/useCameraFrame.js +139 -0
  1641. package/lib/hooks/useClock.d.ts +13 -0
  1642. package/lib/hooks/useClock.js +27 -0
  1643. package/lib/hooks/useFonts.d.ts +81 -0
  1644. package/lib/hooks/useFonts.js +117 -0
  1645. package/lib/hooks/useImage.d.ts +70 -0
  1646. package/lib/hooks/useImage.js +116 -0
  1647. package/lib/imperative.d.ts +59 -0
  1648. package/lib/imperative.js +582 -0
  1649. package/lib/index.d.ts +17 -0
  1650. package/lib/index.js +11 -0
  1651. package/lib/reanimated/AnimationDriver.d.ts +9 -0
  1652. package/lib/reanimated/AnimationDriver.js +24 -0
  1653. package/lib/reanimated/liveValue.d.ts +28 -0
  1654. package/lib/reanimated/liveValue.js +44 -0
  1655. package/lib/reanimated/moduleNotFound.d.ts +2 -0
  1656. package/lib/reanimated/moduleNotFound.js +13 -0
  1657. package/lib/reanimated/peer.d.ts +40 -0
  1658. package/lib/reanimated/peer.js +55 -0
  1659. package/lib/reanimated/slotFlags.d.ts +16 -0
  1660. package/lib/reanimated/slotFlags.js +50 -0
  1661. package/lib/reconciler/Container.d.ts +24 -0
  1662. package/lib/reconciler/Container.js +56 -0
  1663. package/lib/reconciler/Reconciler.d.ts +14 -0
  1664. package/lib/reconciler/Reconciler.js +159 -0
  1665. package/lib/reconciler/directNodes.d.ts +19 -0
  1666. package/lib/reconciler/directNodes.js +68 -0
  1667. package/lib/reconciler/types.d.ts +43 -0
  1668. package/lib/reconciler/types.js +38 -0
  1669. package/lib/specs/TgfxFonts.nitro.d.ts +92 -0
  1670. package/lib/specs/TgfxFonts.nitro.js +1 -0
  1671. package/lib/specs/TgfxImage.nitro.d.ts +85 -0
  1672. package/lib/specs/TgfxImage.nitro.js +1 -0
  1673. package/lib/specs/TgfxSlots.nitro.d.ts +44 -0
  1674. package/lib/specs/TgfxSlots.nitro.js +1 -0
  1675. package/lib/specs/TgfxView.nitro.d.ts +98 -0
  1676. package/lib/specs/TgfxView.nitro.js +1 -0
  1677. package/lib/types.d.ts +399 -0
  1678. package/lib/types.js +1 -0
  1679. package/lib/views/TgfxNativeView.d.ts +9 -0
  1680. package/lib/views/TgfxNativeView.js +8 -0
  1681. package/nitro.json +48 -0
  1682. package/nitrogen/generated/.gitattributes +1 -0
  1683. package/nitrogen/generated/android/NitroTgfx+autolinking.cmake +88 -0
  1684. package/nitrogen/generated/android/NitroTgfx+autolinking.gradle +27 -0
  1685. package/nitrogen/generated/android/NitroTgfxOnLoad.cpp +86 -0
  1686. package/nitrogen/generated/android/NitroTgfxOnLoad.hpp +34 -0
  1687. package/nitrogen/generated/android/c++/JHybridTgfxViewSpec.cpp +135 -0
  1688. package/nitrogen/generated/android/c++/JHybridTgfxViewSpec.hpp +70 -0
  1689. package/nitrogen/generated/android/c++/JNativeSnapshot.hpp +71 -0
  1690. package/nitrogen/generated/android/c++/JNativeSnapshotOptions.hpp +81 -0
  1691. package/nitrogen/generated/android/c++/views/JHybridTgfxViewStateUpdater.cpp +60 -0
  1692. package/nitrogen/generated/android/c++/views/JHybridTgfxViewStateUpdater.hpp +49 -0
  1693. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxViewSpec.kt +83 -0
  1694. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NativeSnapshot.kt +66 -0
  1695. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NativeSnapshotOptions.kt +81 -0
  1696. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NitroTgfxOnLoad.kt +35 -0
  1697. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/views/HybridTgfxViewManager.kt +80 -0
  1698. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/views/HybridTgfxViewStateUpdater.kt +23 -0
  1699. package/nitrogen/generated/ios/NitroTgfx+autolinking.rb +62 -0
  1700. package/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Bridge.cpp +57 -0
  1701. package/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Bridge.hpp +193 -0
  1702. package/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Umbrella.hpp +53 -0
  1703. package/nitrogen/generated/ios/NitroTgfxAutolinking.mm +63 -0
  1704. package/nitrogen/generated/ios/NitroTgfxAutolinking.swift +26 -0
  1705. package/nitrogen/generated/ios/c++/HybridTgfxViewSpecSwift.cpp +11 -0
  1706. package/nitrogen/generated/ios/c++/HybridTgfxViewSpecSwift.hpp +130 -0
  1707. package/nitrogen/generated/ios/c++/views/HybridTgfxViewComponent.mm +127 -0
  1708. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  1709. package/nitrogen/generated/ios/swift/Func_void_NativeSnapshot.swift +46 -0
  1710. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  1711. package/nitrogen/generated/ios/swift/HybridTgfxViewSpec.swift +60 -0
  1712. package/nitrogen/generated/ios/swift/HybridTgfxViewSpec_cxx.swift +238 -0
  1713. package/nitrogen/generated/ios/swift/NativeSnapshot.swift +44 -0
  1714. package/nitrogen/generated/ios/swift/NativeSnapshotOptions.swift +59 -0
  1715. package/nitrogen/generated/shared/c++/HybridTgfxFontsSpec.cpp +27 -0
  1716. package/nitrogen/generated/shared/c++/HybridTgfxFontsSpec.hpp +75 -0
  1717. package/nitrogen/generated/shared/c++/HybridTgfxImageFactorySpec.cpp +26 -0
  1718. package/nitrogen/generated/shared/c++/HybridTgfxImageFactorySpec.hpp +74 -0
  1719. package/nitrogen/generated/shared/c++/HybridTgfxImageSpec.cpp +24 -0
  1720. package/nitrogen/generated/shared/c++/HybridTgfxImageSpec.hpp +65 -0
  1721. package/nitrogen/generated/shared/c++/HybridTgfxSlotsFactorySpec.cpp +21 -0
  1722. package/nitrogen/generated/shared/c++/HybridTgfxSlotsFactorySpec.hpp +64 -0
  1723. package/nitrogen/generated/shared/c++/HybridTgfxSlotsSpec.cpp +21 -0
  1724. package/nitrogen/generated/shared/c++/HybridTgfxSlotsSpec.hpp +62 -0
  1725. package/nitrogen/generated/shared/c++/HybridTgfxViewSpec.cpp +29 -0
  1726. package/nitrogen/generated/shared/c++/HybridTgfxViewSpec.hpp +77 -0
  1727. package/nitrogen/generated/shared/c++/LineMeasurement.hpp +107 -0
  1728. package/nitrogen/generated/shared/c++/NativeSnapshot.hpp +96 -0
  1729. package/nitrogen/generated/shared/c++/NativeSnapshotOptions.hpp +107 -0
  1730. package/nitrogen/generated/shared/c++/PixelFormat.hpp +100 -0
  1731. package/nitrogen/generated/shared/c++/TextLayoutStyle.hpp +119 -0
  1732. package/nitrogen/generated/shared/c++/TextMeasurement.hpp +105 -0
  1733. package/nitrogen/generated/shared/c++/views/HybridTgfxViewComponent.cpp +94 -0
  1734. package/nitrogen/generated/shared/c++/views/HybridTgfxViewComponent.hpp +111 -0
  1735. package/nitrogen/generated/shared/json/TgfxViewConfig.json +11 -0
  1736. package/package.json +144 -8
  1737. package/react-native.config.js +16 -0
  1738. package/scripts/build-tgfx-ios.sh +60 -0
  1739. package/src/compiler/colors.test.ts +195 -0
  1740. package/src/compiler/colors.ts +402 -0
  1741. package/src/compiler/compile.test.ts +971 -0
  1742. package/src/compiler/compile.ts +565 -0
  1743. package/src/compiler/filters.ts +140 -0
  1744. package/src/compiler/image.ts +109 -0
  1745. package/src/compiler/paint.ts +321 -0
  1746. package/src/compiler/sceneHash.test.ts +70 -0
  1747. package/src/compiler/sksl.test.ts +219 -0
  1748. package/src/compiler/sksl.ts +218 -0
  1749. package/src/compiler/stringTable.test.ts +136 -0
  1750. package/src/compiler/svgPath.test.ts +147 -0
  1751. package/src/compiler/text.ts +97 -0
  1752. package/src/compiler/transform.ts +34 -0
  1753. package/src/compiler/values.ts +44 -0
  1754. package/src/compiler/writer.ts +159 -0
  1755. package/src/components/Canvas.test.tsx +735 -0
  1756. package/src/components/Canvas.tsx +199 -0
  1757. package/src/components/Group.ts +9 -0
  1758. package/src/components/Paint.ts +77 -0
  1759. package/src/components/drawings.ts +86 -0
  1760. package/src/hooks/source.ts +64 -0
  1761. package/src/hooks/useCameraFrame.test.tsx +286 -0
  1762. package/src/hooks/useCameraFrame.ts +222 -0
  1763. package/src/hooks/useClock.test.ts +50 -0
  1764. package/src/hooks/useClock.ts +36 -0
  1765. package/src/hooks/useFonts.test.tsx +186 -0
  1766. package/src/hooks/useFonts.ts +163 -0
  1767. package/src/hooks/useImage.test.tsx +236 -0
  1768. package/src/hooks/useImage.ts +143 -0
  1769. package/src/imperative.ts +697 -0
  1770. package/src/index.ts +125 -0
  1771. package/src/reanimated/AnimationDriver.test.ts +12 -0
  1772. package/src/reanimated/AnimationDriver.tsx +34 -0
  1773. package/src/reanimated/liveValue.ts +53 -0
  1774. package/src/reanimated/moduleNotFound.test.ts +54 -0
  1775. package/src/reanimated/moduleNotFound.ts +16 -0
  1776. package/src/reanimated/peer.ts +92 -0
  1777. package/src/reanimated/slotFlags.ts +73 -0
  1778. package/src/reconciler/Container.ts +78 -0
  1779. package/src/reconciler/Reconciler.test.ts +28 -0
  1780. package/src/reconciler/Reconciler.ts +210 -0
  1781. package/src/reconciler/directNodes.test.tsx +150 -0
  1782. package/src/reconciler/directNodes.ts +73 -0
  1783. package/src/reconciler/types.ts +51 -0
  1784. package/src/specs/TgfxFonts.nitro.ts +102 -0
  1785. package/src/specs/TgfxImage.nitro.ts +106 -0
  1786. package/src/specs/TgfxSlots.nitro.ts +46 -0
  1787. package/src/specs/TgfxView.nitro.ts +112 -0
  1788. package/src/testing/cppHarness.ts +116 -0
  1789. package/src/testing/nativeMocks.ts +21 -0
  1790. package/src/types.ts +441 -0
  1791. package/src/views/TgfxNativeView.ts +15 -0
  1792. package/src/views/idleGate.test.ts +58 -0
@@ -0,0 +1,2257 @@
1
+ /////////////////////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Tencent is pleased to support the open source community by making tgfx available.
4
+ //
5
+ // Copyright (C) 2024 Tencent. All rights reserved.
6
+ //
7
+ // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
8
+ // in compliance with the License. You may obtain a copy of the License at
9
+ //
10
+ // https://opensource.org/licenses/BSD-3-Clause
11
+ //
12
+ // unless required by applicable law or agreed to in writing, software distributed under the
13
+ // license is distributed on an "as is" basis, without warranties or conditions of any kind,
14
+ // either express or implied. see the license for the specific language governing permissions
15
+ // and limitations under the license.
16
+ //
17
+ /////////////////////////////////////////////////////////////////////////////////////////////////
18
+
19
+ #include "tgfx/layers/Layer.h"
20
+ #include <algorithm>
21
+ #include <atomic>
22
+ #include <cmath>
23
+ #include <unordered_map>
24
+ #include <unordered_set>
25
+ #include <utility>
26
+ #include "compositing3d/Context3DCompositor.h"
27
+ #include "compositing3d/Layer3DContext.h"
28
+ #include "core/Matrix3DUtils.h"
29
+ #include "core/images/TextureImage.h"
30
+ #include "core/utils/Log.h"
31
+ #include "core/utils/MathExtra.h"
32
+ #include "core/utils/Types.h"
33
+ #include "layers/BackgroundHandler.h"
34
+ #include "layers/BackgroundSnapshotMap.h"
35
+ #include "layers/BackgroundSource.h"
36
+ #include "layers/DrawArgs.h"
37
+ #include "layers/LayerStyleSource.h"
38
+ #include "layers/MaskContext.h"
39
+ #include "layers/OffscreenRenderer.h"
40
+ #include "layers/OpaqueContext.h"
41
+ #include "layers/RegionTransformer.h"
42
+ #include "layers/RootLayer.h"
43
+ #include "layers/SubtreeCache.h"
44
+ #include "layers/contents/LayerContent.h"
45
+ #include "tgfx/core/ColorSpace.h"
46
+ #include "tgfx/core/PictureRecorder.h"
47
+ #include "tgfx/core/Surface.h"
48
+ #include "tgfx/layers/ShapeLayer.h"
49
+
50
+ namespace tgfx {
51
+
52
+ // The minimum size (longest edge) for subtree cache. This prevents creating excessively small
53
+ // mipmap levels that would be inefficient to cache.
54
+ static constexpr int SUBTREE_CACHE_MIN_SIZE = 32;
55
+ static std::atomic_bool AllowsEdgeAntialiasing = true;
56
+ static std::atomic_bool AllowsGroupOpacity = false;
57
+
58
+ /**
59
+ * Clips the canvas using the scroll rect. If the sublayer's Matrix contains 3D transformations or
60
+ * projection transformations, because this matrix has been merged into the Canvas, it can be
61
+ * directly completed through the clipping rectangle. Otherwise, the canvas will not contain this
62
+ * matrix information, and clipping needs to be done by transforming the Path.
63
+ */
64
+ static void ClipScrollRect(Canvas* canvas, const Rect* scrollRect, const Matrix3D* transform,
65
+ bool antiAlias) {
66
+ if (scrollRect == nullptr) {
67
+ return;
68
+ }
69
+
70
+ if (transform != nullptr) {
71
+ Path path;
72
+ path.addRect(*scrollRect);
73
+ path.transform3D(*transform);
74
+ canvas->clipPath(path, antiAlias);
75
+ } else {
76
+ canvas->clipRect(*scrollRect, antiAlias);
77
+ }
78
+ }
79
+
80
+ struct MaskData {
81
+ Path clipPath = {};
82
+ std::shared_ptr<MaskFilter> maskFilter = nullptr;
83
+ };
84
+
85
+ // Computes which layers need to be marked dirty during children reordering.
86
+ // Uses LIS (Longest Increasing Subsequence) algorithm to minimize dirty area
87
+ // by identifying layers that maintain their relative order.
88
+ static void ComputeDirtyNodesForReordering(const std::vector<Layer*>& retainedChildren,
89
+ const std::vector<size_t>& newPositions,
90
+ std::vector<Layer*>* nodesToMarkDirty) {
91
+ size_t n = retainedChildren.size();
92
+ if (n == 0) {
93
+ return;
94
+ }
95
+
96
+ std::vector<size_t> lis;
97
+ std::vector<size_t> predecessors(n, SIZE_MAX);
98
+ std::vector<size_t> lisIndices;
99
+
100
+ for (size_t i = 0; i < n; ++i) {
101
+ size_t pos = newPositions[i];
102
+ auto it = std::lower_bound(lis.begin(), lis.end(), pos);
103
+ size_t insertPos = static_cast<size_t>(it - lis.begin());
104
+
105
+ if (it == lis.end()) {
106
+ lis.push_back(pos);
107
+ lisIndices.push_back(i);
108
+ } else {
109
+ *it = pos;
110
+ lisIndices[insertPos] = i;
111
+ }
112
+
113
+ if (insertPos > 0) {
114
+ predecessors[i] = lisIndices[insertPos - 1];
115
+ }
116
+ }
117
+
118
+ std::vector<bool> inLIS(n, false);
119
+ if (!lisIndices.empty()) {
120
+ size_t current = lisIndices.back();
121
+ while (current != SIZE_MAX) {
122
+ inLIS[current] = true;
123
+ current = predecessors[current];
124
+ }
125
+ }
126
+
127
+ for (size_t i = 0; i < n; ++i) {
128
+ if (!inLIS[i]) {
129
+ nodesToMarkDirty->push_back(retainedChildren[i]);
130
+ }
131
+ }
132
+ }
133
+
134
+ static std::optional<Rect> GetClipBounds(const Canvas* canvas) {
135
+ if (canvas == nullptr) {
136
+ return std::nullopt;
137
+ }
138
+ const auto clipBound = canvas->getTotalClipBounds();
139
+ auto clipRect = Rect::MakeEmpty();
140
+ auto surface = canvas->getSurface();
141
+ if (!clipBound.has_value()) {
142
+ if (!surface) {
143
+ return std::nullopt;
144
+ }
145
+ clipRect = Rect::MakeWH(surface->width(), surface->height());
146
+ } else {
147
+ clipRect = *clipBound;
148
+ if (surface && !clipRect.intersect(Rect::MakeWH(surface->width(), surface->height()))) {
149
+ return Rect::MakeEmpty();
150
+ }
151
+ }
152
+ if (clipRect.isEmpty()) {
153
+ return Rect::MakeEmpty();
154
+ }
155
+ auto invert = Matrix::I();
156
+ auto viewMatrix = canvas->getMatrix();
157
+ if (!viewMatrix.invert(&invert)) {
158
+ return Rect::MakeEmpty();
159
+ }
160
+ clipRect = invert.mapRect(clipRect);
161
+ clipRect.roundOut();
162
+ return clipRect;
163
+ }
164
+
165
+ static int GetMipmapCacheLongEdge(int maxSize, float contentScale, const Rect& layerBounds) {
166
+ auto maxBoundsSize = std::max(layerBounds.width(), layerBounds.height());
167
+ auto scaleBoundsSize = FloatRoundToInt(maxBoundsSize * contentScale);
168
+ if (scaleBoundsSize > maxSize) {
169
+ return scaleBoundsSize;
170
+ }
171
+ if (SUBTREE_CACHE_MIN_SIZE >= maxSize) {
172
+ return maxSize;
173
+ }
174
+ auto targetSize = std::max(scaleBoundsSize, SUBTREE_CACHE_MIN_SIZE);
175
+ auto currentLongEdge = maxSize;
176
+ while ((currentLongEdge >> 1) >= targetSize) {
177
+ currentLongEdge >>= 1;
178
+ }
179
+ return currentLongEdge;
180
+ }
181
+
182
+ /**
183
+ * Creates a 3D rendering context for compositing layers with 3D transformations.
184
+ * @param bounds The bounding rectangle of the 3D context in DisplayList coordinates.
185
+ */
186
+ static std::shared_ptr<Layer3DContext> Create3DContext(const DrawArgs& args, Canvas* canvas,
187
+ const Rect& bounds) {
188
+ if (args.context == nullptr) {
189
+ DEBUG_ASSERT(false);
190
+ return nullptr;
191
+ }
192
+
193
+ // The processing area of the compositor is consistent with the actual effective drawing area.
194
+ auto clipBounds = GetClipBounds(canvas);
195
+
196
+ auto validRenderRect = bounds;
197
+ // The clip bounds may be slightly larger than the dirty region.
198
+ if (clipBounds.has_value() && !validRenderRect.intersect(*clipBounds)) {
199
+ return nullptr;
200
+ }
201
+ // validRenderRect is in DisplayList coordinate system. Apply canvas scale to adapt to pixel
202
+ // coordinates, avoiding excessive scaling when rendering to offscreen texture which would affect
203
+ // the final visual quality.
204
+ auto contentScale = canvas->getMatrix().getMaxScale();
205
+ if (contentScale <= 0.0f) {
206
+ return nullptr;
207
+ }
208
+ validRenderRect.scale(contentScale, contentScale);
209
+ validRenderRect.roundOut();
210
+ if (validRenderRect.isEmpty()) {
211
+ return nullptr;
212
+ }
213
+
214
+ bool opaqueMode = args.opaqueContext != nullptr;
215
+ return Layer3DContext::Make(opaqueMode, args.context, validRenderRect, contentScale,
216
+ args.dstColorSpace);
217
+ }
218
+
219
+ bool Layer::DefaultAllowsEdgeAntialiasing() {
220
+ return AllowsEdgeAntialiasing;
221
+ }
222
+
223
+ void Layer::SetDefaultAllowsEdgeAntialiasing(bool value) {
224
+ AllowsEdgeAntialiasing = value;
225
+ }
226
+
227
+ bool Layer::DefaultAllowsGroupOpacity() {
228
+ return AllowsGroupOpacity;
229
+ }
230
+
231
+ void Layer::SetDefaultAllowsGroupOpacity(bool value) {
232
+ AllowsGroupOpacity = value;
233
+ }
234
+
235
+ std::shared_ptr<Layer> Layer::Make() {
236
+ return std::shared_ptr<Layer>(new Layer());
237
+ }
238
+
239
+ Layer::~Layer() {
240
+ for (const auto& filter : _filters) {
241
+ DEBUG_ASSERT(filter != nullptr);
242
+ filter->detachFromLayer(this);
243
+ }
244
+ for (const auto& layerStyle : _layerStyles) {
245
+ DEBUG_ASSERT(layerStyle != nullptr);
246
+ layerStyle->detachFromLayer(this);
247
+ }
248
+ if (_mask) {
249
+ _mask->maskOwner = nullptr;
250
+ }
251
+ removeChildren();
252
+ delete contentBounds;
253
+ }
254
+
255
+ Layer::Layer() {
256
+ memset(&bitFields, 0, sizeof(bitFields));
257
+ bitFields.visible = true;
258
+ bitFields.allowsEdgeAntialiasing = AllowsEdgeAntialiasing;
259
+ bitFields.allowsGroupOpacity = AllowsGroupOpacity;
260
+ bitFields.blendMode = static_cast<uint8_t>(BlendMode::SrcOver);
261
+ bitFields.passThroughBackground = true;
262
+ bitFields.matrix3DIsAffine = true;
263
+ }
264
+
265
+ void Layer::setAlpha(float value) {
266
+ if (_alpha == value) {
267
+ return;
268
+ }
269
+ _alpha = value;
270
+ invalidateTransform();
271
+ }
272
+
273
+ void Layer::setBlendMode(BlendMode value) {
274
+ uint8_t uValue = static_cast<uint8_t>(value);
275
+ if (bitFields.blendMode == uValue) {
276
+ return;
277
+ }
278
+ bitFields.blendMode = uValue;
279
+ invalidateTransform();
280
+ }
281
+
282
+ void Layer::setPassThroughBackground(bool value) {
283
+ if (bitFields.passThroughBackground == value) {
284
+ return;
285
+ }
286
+ bitFields.passThroughBackground = value;
287
+ invalidateTransform();
288
+ }
289
+
290
+ Point Layer::position() const {
291
+ if (bitFields.matrix3DIsAffine) {
292
+ return {_matrix3D.getRowColumn(0, 3), _matrix3D.getRowColumn(1, 3)};
293
+ }
294
+
295
+ auto result = matrix3D().mapPoint(Vec3(0, 0, 0));
296
+ return {result.x, result.y};
297
+ }
298
+
299
+ void Layer::setPosition(const Point& value) {
300
+ if (bitFields.matrix3DIsAffine) {
301
+ if (_matrix3D.getTranslateX() == value.x && _matrix3D.getTranslateY() == value.y) {
302
+ return;
303
+ }
304
+ _matrix3D.setRowColumn(0, 3, value.x);
305
+ _matrix3D.setRowColumn(1, 3, value.y);
306
+ } else {
307
+ auto curPos = _matrix3D.mapPoint(Vec3(0, 0, 0));
308
+ if (FloatNearlyEqual(curPos.x, value.x) && FloatNearlyEqual(curPos.y, value.y)) {
309
+ return;
310
+ }
311
+ _matrix3D.postTranslate(value.x - curPos.x, value.y - curPos.y, 0);
312
+ }
313
+ invalidateTransform();
314
+ }
315
+
316
+ Matrix Layer::matrix() const {
317
+ auto affineMatrix = Matrix::I();
318
+ if (!bitFields.matrix3DIsAffine) {
319
+ return Matrix::I();
320
+ }
321
+ affineMatrix.setAll(_matrix3D.getRowColumn(0, 0), _matrix3D.getRowColumn(0, 1),
322
+ _matrix3D.getRowColumn(0, 3), _matrix3D.getRowColumn(1, 0),
323
+ _matrix3D.getRowColumn(1, 1), _matrix3D.getRowColumn(1, 3));
324
+ return affineMatrix;
325
+ }
326
+
327
+ void Layer::setMatrix(const Matrix& value) {
328
+ const Matrix3D value3D(value);
329
+ if (value3D == _matrix3D) {
330
+ return;
331
+ }
332
+ _matrix3D = value3D;
333
+ bitFields.matrix3DIsAffine = true;
334
+ invalidateTransform();
335
+ }
336
+
337
+ void Layer::setMatrix3D(const Matrix3D& value) {
338
+ if (value == _matrix3D) {
339
+ return;
340
+ }
341
+ _matrix3D = value;
342
+ bitFields.matrix3DIsAffine = Matrix3DUtils::IsMatrix3DAffine(value);
343
+ invalidateTransform();
344
+ }
345
+
346
+ void Layer::setPreserve3D(bool value) {
347
+ if (_preserve3D == value) {
348
+ return;
349
+ }
350
+ _preserve3D = value;
351
+ // Changing preserve3D alters the meaning of the layer's transform, so invalidate it.
352
+ invalidateTransform();
353
+ }
354
+
355
+ void Layer::setVisible(bool value) {
356
+ if (bitFields.visible == value) {
357
+ return;
358
+ }
359
+ bitFields.visible = value;
360
+ invalidateTransform();
361
+ }
362
+
363
+ void Layer::setAllowsEdgeAntialiasing(bool value) {
364
+ if (bitFields.allowsEdgeAntialiasing == value) {
365
+ return;
366
+ }
367
+ bitFields.allowsEdgeAntialiasing = value;
368
+ invalidateTransform();
369
+ }
370
+
371
+ void Layer::setAllowsGroupOpacity(bool value) {
372
+ if (bitFields.allowsGroupOpacity == value) {
373
+ return;
374
+ }
375
+ bitFields.allowsGroupOpacity = value;
376
+ invalidateTransform();
377
+ }
378
+
379
+ void Layer::setFilters(const std::vector<std::shared_ptr<LayerFilter>>& value) {
380
+ if (_filters.size() == value.size() &&
381
+ std::equal(_filters.begin(), _filters.end(), value.begin())) {
382
+ return;
383
+ }
384
+ for (const auto& filter : _filters) {
385
+ DEBUG_ASSERT(filter != nullptr);
386
+ filter->detachFromLayer(this);
387
+ }
388
+ _filters.clear();
389
+ for (const auto& filter : value) {
390
+ if (filter == nullptr) {
391
+ continue;
392
+ }
393
+ filter->attachToLayer(this);
394
+ _filters.push_back(filter);
395
+ }
396
+ invalidateSubtree();
397
+ invalidateTransform();
398
+ }
399
+
400
+ void Layer::setMask(std::shared_ptr<Layer> value) {
401
+ if (value.get() == this) {
402
+ return;
403
+ }
404
+ if (_mask == value) {
405
+ return;
406
+ }
407
+ if (value && value->maskOwner) {
408
+ value->maskOwner->setMask(nullptr);
409
+ value->maskOwner = nullptr;
410
+ }
411
+ if (_mask) {
412
+ _mask->maskOwner = nullptr;
413
+ _mask->invalidateTransform();
414
+ }
415
+ _mask = std::move(value);
416
+ if (_mask) {
417
+ _mask->maskOwner = this;
418
+ _mask->invalidateTransform();
419
+ }
420
+ invalidateTransform();
421
+ }
422
+
423
+ void Layer::setMaskType(LayerMaskType value) {
424
+ uint8_t uValue = static_cast<uint8_t>(value);
425
+ if (bitFields.maskType == uValue) {
426
+ return;
427
+ }
428
+ bitFields.maskType = uValue;
429
+ if (_mask) {
430
+ invalidateTransform();
431
+ }
432
+ }
433
+
434
+ void Layer::setScrollRect(const Rect& rect) {
435
+ if ((_scrollRect && *_scrollRect == rect) || (!_scrollRect && rect.isEmpty())) {
436
+ return;
437
+ }
438
+ if (rect.isEmpty()) {
439
+ _scrollRect = nullptr;
440
+ } else {
441
+ _scrollRect = std::make_unique<Rect>(rect);
442
+ }
443
+ invalidateTransform();
444
+ }
445
+
446
+ Layer* Layer::root() const {
447
+ return _root;
448
+ }
449
+
450
+ void Layer::setLayerStyles(const std::vector<std::shared_ptr<LayerStyle>>& value) {
451
+ if (_layerStyles.size() == value.size() &&
452
+ std::equal(_layerStyles.begin(), _layerStyles.end(), value.begin())) {
453
+ return;
454
+ }
455
+ for (const auto& layerStyle : _layerStyles) {
456
+ DEBUG_ASSERT(layerStyle != nullptr);
457
+ layerStyle->detachFromLayer(this);
458
+ }
459
+ _layerStyles.clear();
460
+ for (const auto& layerStyle : value) {
461
+ if (layerStyle == nullptr) {
462
+ continue;
463
+ }
464
+ layerStyle->attachToLayer(this);
465
+ _layerStyles.push_back(layerStyle);
466
+ }
467
+ invalidateSubtree();
468
+ invalidateTransform();
469
+ }
470
+
471
+ bool Layer::addChild(std::shared_ptr<Layer> child) {
472
+ if (!child) {
473
+ return false;
474
+ }
475
+ auto index = _children.size();
476
+ if (child->_parent == this) {
477
+ index--;
478
+ }
479
+ return addChildAt(child, static_cast<int>(index));
480
+ }
481
+
482
+ bool Layer::addChildAt(std::shared_ptr<Layer> child, int index) {
483
+ if (!child) {
484
+ return false;
485
+ }
486
+ if (child.get() == this) {
487
+ LOGE("addChildAt() The child is the same as the parent.");
488
+ return false;
489
+ } else if (child->doContains(this)) {
490
+ LOGE("addChildAt() The child is already a parent of the parent.");
491
+ return false;
492
+ } else if (child->_root == child.get()) {
493
+ LOGE("A root layer cannot be added as a child to another layer.");
494
+ return false;
495
+ }
496
+ if (child->_parent == this) {
497
+ return setChildIndex(child, index);
498
+ }
499
+ child->removeFromParent();
500
+ _children.insert(_children.begin() + index, child);
501
+ child->_parent = this;
502
+ child->onAttachToRoot(_root);
503
+ child->invalidateTransform();
504
+ invalidateDescendents();
505
+ return true;
506
+ }
507
+
508
+ bool Layer::contains(std::shared_ptr<Layer> child) const {
509
+ return doContains(child.get());
510
+ }
511
+
512
+ std::shared_ptr<Layer> Layer::getChildByName(const std::string& name) {
513
+ for (const auto& child : _children) {
514
+ if (child->name() == name) {
515
+ return child;
516
+ }
517
+ }
518
+ return nullptr;
519
+ }
520
+
521
+ int Layer::getChildIndex(std::shared_ptr<Layer> child) const {
522
+ return doGetChildIndex(child.get());
523
+ }
524
+
525
+ std::vector<std::shared_ptr<Layer>> Layer::getLayersUnderPoint(float x, float y) {
526
+ std::vector<std::shared_ptr<Layer>> results;
527
+ getLayersUnderPointInternal(x, y, &results);
528
+ return results;
529
+ }
530
+
531
+ void Layer::removeFromParent() {
532
+ if (!_parent) {
533
+ return;
534
+ }
535
+ _parent->removeChildAt(_parent->doGetChildIndex(this));
536
+ }
537
+
538
+ std::shared_ptr<Layer> Layer::removeChildAt(int index) {
539
+ if (index < 0 || static_cast<size_t>(index) >= _children.size()) {
540
+ LOGE("The supplied index is out of bounds.");
541
+ return nullptr;
542
+ }
543
+ auto child = _children[static_cast<size_t>(index)];
544
+ child->_parent = nullptr;
545
+ child->onDetachFromRoot();
546
+ _children.erase(_children.begin() + index);
547
+ if (_root) {
548
+ _root->invalidateRect(child->renderBounds);
549
+ child->renderBounds = {};
550
+ }
551
+ invalidateDescendents();
552
+ return child;
553
+ }
554
+
555
+ void Layer::removeChildren(int beginIndex, int endIndex) {
556
+ if (_children.empty()) {
557
+ return;
558
+ }
559
+ if (beginIndex < 0 || static_cast<size_t>(beginIndex) >= _children.size()) {
560
+ LOGE("The supplied beginIndex is out of bounds.");
561
+ return;
562
+ }
563
+ if (endIndex < 0 || static_cast<size_t>(endIndex) >= _children.size()) {
564
+ endIndex = static_cast<int>(_children.size()) - 1;
565
+ }
566
+ for (int i = endIndex; i >= beginIndex; --i) {
567
+ removeChildAt(i);
568
+ }
569
+ }
570
+
571
+ bool Layer::setChildIndex(std::shared_ptr<Layer> child, int index) {
572
+ if (index < 0 || static_cast<size_t>(index) >= _children.size()) {
573
+ index = static_cast<int>(_children.size()) - 1;
574
+ }
575
+ auto oldIndex = getChildIndex(child);
576
+ if (oldIndex < 0) {
577
+ LOGE("The supplied layer must be a child layer of the caller.");
578
+ return false;
579
+ }
580
+ if (oldIndex == index) {
581
+ return true;
582
+ }
583
+ _children.erase(_children.begin() + oldIndex);
584
+ _children.insert(_children.begin() + index, child);
585
+ if (_root) {
586
+ // Immediately invalidate the old render bounds, as this may affect the background of the above
587
+ // layer styles.
588
+ _root->invalidateRect(child->renderBounds);
589
+ child->renderBounds = {};
590
+ }
591
+ child->invalidateTransform();
592
+ invalidateDescendents();
593
+ return true;
594
+ }
595
+
596
+ void Layer::setChildren(const std::vector<std::shared_ptr<Layer>>& children) {
597
+ std::vector<std::shared_ptr<Layer>> validChildren;
598
+ std::unordered_map<Layer*, size_t> newIndexMap;
599
+
600
+ for (const auto& child : children) {
601
+ if (child == nullptr || newIndexMap.find(child.get()) != newIndexMap.end()) {
602
+ continue;
603
+ }
604
+ if (child.get() == this) {
605
+ LOGE("setChildren() The child is the same as the parent.");
606
+ continue;
607
+ }
608
+ if (child->doContains(this)) {
609
+ LOGE("setChildren() The child is already a parent of the parent.");
610
+ continue;
611
+ }
612
+ if (child->_root == child.get()) {
613
+ LOGE("A root layer cannot be added as a child to another layer.");
614
+ continue;
615
+ }
616
+ newIndexMap[child.get()] = validChildren.size();
617
+ validChildren.push_back(child);
618
+ }
619
+
620
+ if (_children == validChildren) {
621
+ return;
622
+ }
623
+
624
+ auto oldChildren = _children;
625
+ std::vector<Layer*> nodesToMarkDirty;
626
+ std::vector<Layer*> retainedChildren;
627
+ std::vector<size_t> newPositions;
628
+ std::unordered_set<Layer*> oldChildrenSet;
629
+
630
+ for (const auto& child : oldChildren) {
631
+ auto* ptr = child.get();
632
+ oldChildrenSet.insert(ptr);
633
+ auto it = newIndexMap.find(ptr);
634
+ if (it == newIndexMap.end()) {
635
+ nodesToMarkDirty.push_back(ptr);
636
+ ptr->_parent = nullptr;
637
+ ptr->onDetachFromRoot();
638
+ if (_root) {
639
+ _root->invalidateRect(ptr->renderBounds);
640
+ ptr->renderBounds = {};
641
+ }
642
+ } else {
643
+ retainedChildren.push_back(ptr);
644
+ newPositions.push_back(it->second);
645
+ }
646
+ }
647
+
648
+ ComputeDirtyNodesForReordering(retainedChildren, newPositions, &nodesToMarkDirty);
649
+
650
+ std::vector<Layer*> addedChildren;
651
+ for (const auto& child : validChildren) {
652
+ if (oldChildrenSet.find(child.get()) == oldChildrenSet.end()) {
653
+ child->removeFromParent();
654
+ addedChildren.push_back(child.get());
655
+ }
656
+ }
657
+
658
+ _children = std::move(validChildren);
659
+
660
+ for (auto* child : addedChildren) {
661
+ nodesToMarkDirty.push_back(child);
662
+ child->_parent = this;
663
+ child->onAttachToRoot(_root);
664
+ }
665
+
666
+ for (auto* dirtyNode : nodesToMarkDirty) {
667
+ dirtyNode->invalidateTransform();
668
+ }
669
+
670
+ invalidateDescendents();
671
+ }
672
+
673
+ bool Layer::replaceChild(std::shared_ptr<Layer> oldChild, std::shared_ptr<Layer> newChild) {
674
+ auto index = getChildIndex(oldChild);
675
+ if (index < 0) {
676
+ LOGE("The supplied layer must be a child layer of the caller.");
677
+ return false;
678
+ }
679
+ if (!addChildAt(newChild, index)) {
680
+ return false;
681
+ }
682
+ oldChild->removeFromParent();
683
+ invalidateDescendents();
684
+ return true;
685
+ }
686
+
687
+ Rect Layer::getBounds(const Layer* targetCoordinateSpace, bool computeTightBounds) {
688
+ auto matrix = getRelativeMatrix3D(targetCoordinateSpace);
689
+ return getBoundsInternal(matrix, computeTightBounds);
690
+ }
691
+
692
+ Rect Layer::getBoundsInternal(const Matrix3D& coordinateMatrix, bool computeTightBounds) {
693
+ // Non-leaf nodes in a 3D rendering context layer tree must preserve the 3D state of their
694
+ // sublayers, and cannot reuse the localBounds cache that has been flattened to the layer's local
695
+ // coordinate system.
696
+ if (computeTightBounds || bitFields.dirtyDescendents || canPreserve3D()) {
697
+ return computeBounds(coordinateMatrix, computeTightBounds);
698
+ }
699
+ if (!localBounds) {
700
+ localBounds = std::make_unique<Rect>(computeBounds(Matrix3D::I(), computeTightBounds));
701
+ }
702
+ return coordinateMatrix.mapRect(*localBounds);
703
+ }
704
+
705
+ static Rect ComputeContentBounds(const LayerContent& content, const Rect& contentBounds,
706
+ const Matrix3D& coordinateMatrix, bool applyMatrixAtEnd,
707
+ bool computeTightBounds) {
708
+ auto contentMatrix = applyMatrixAtEnd ? Matrix3D::I() : coordinateMatrix;
709
+ if (!computeTightBounds) {
710
+ return contentMatrix.mapRect(contentBounds);
711
+ }
712
+
713
+ if (Matrix3DUtils::IsMatrix3DAffine(contentMatrix)) {
714
+ return content.getTightBounds(Matrix3DUtils::GetMayLossyAffineMatrix(contentMatrix));
715
+ }
716
+ auto bounds = content.getTightBounds(Matrix::I());
717
+ return contentMatrix.mapRect(bounds);
718
+ }
719
+
720
+ Rect Layer::computeBounds(const Matrix3D& coordinateMatrix, bool computeTightBounds,
721
+ bool excludeEffects) {
722
+ auto canPreserve3D = this->canPreserve3D();
723
+ bool hasEffects = !excludeEffects && (!_layerStyles.empty() || !_filters.empty());
724
+ // When preserving 3D, the matrix must be passed down to preserve 3D state.
725
+ // Otherwise, when has effects, compute in local coordinates first, then apply matrix at end.
726
+ bool isAffine = Matrix3DUtils::IsMatrix3DAffine(coordinateMatrix);
727
+ bool applyMatrixAtEnd = !canPreserve3D && (hasEffects || !isAffine);
728
+
729
+ Rect bounds = {};
730
+ if (auto content = getContent()) {
731
+ auto contentBounds = content->getBounds();
732
+ bool behindCamera =
733
+ !isAffine && Matrix3DUtils::IsRectBehindCamera(contentBounds, coordinateMatrix);
734
+ if (!behindCamera) {
735
+ auto computedBounds = ComputeContentBounds(*content, contentBounds, coordinateMatrix,
736
+ applyMatrixAtEnd, computeTightBounds);
737
+ bounds.join(computedBounds);
738
+ }
739
+ }
740
+
741
+ for (const auto& child : _children) {
742
+ // Alpha does not need to be checked; alpha == 0 is still valid.
743
+ if (!child->visible() || child->maskOwner) {
744
+ continue;
745
+ }
746
+ auto childMatrix = child->getMatrixWithScrollRect();
747
+ if (!canPreserve3D) {
748
+ childMatrix.setRow(2, {0, 0, 1, 0});
749
+ }
750
+ childMatrix.postConcat(applyMatrixAtEnd ? Matrix3D::I() : coordinateMatrix);
751
+ auto childBounds = child->getBoundsInternal(childMatrix, computeTightBounds);
752
+ if (child->_scrollRect) {
753
+ auto relativeScrollRect = childMatrix.mapRect(*child->_scrollRect);
754
+ if (!childBounds.intersect(relativeScrollRect)) {
755
+ continue;
756
+ }
757
+ }
758
+ if (child->hasValidMask()) {
759
+ auto maskRelativeMatrix = child->_mask->getRelativeMatrix3D(child.get());
760
+ maskRelativeMatrix.postConcat(childMatrix);
761
+ auto maskBounds = child->_mask->getBoundsInternal(maskRelativeMatrix, computeTightBounds);
762
+ if (!childBounds.intersect(maskBounds)) {
763
+ continue;
764
+ }
765
+ }
766
+ bounds.join(childBounds);
767
+ }
768
+
769
+ if (hasEffects) {
770
+ // Filters and styles disable 3D context ability, so this block is unreachable for 3D context.
771
+ DEBUG_ASSERT(!canPreserve3D);
772
+ auto layerBounds = bounds;
773
+ for (auto& layerStyle : _layerStyles) {
774
+ DEBUG_ASSERT(layerStyle != nullptr);
775
+ auto styleBounds = layerStyle->filterBounds(layerBounds, 1.0f);
776
+ bounds.join(styleBounds);
777
+ }
778
+ for (auto& filter : _filters) {
779
+ DEBUG_ASSERT(filter != nullptr);
780
+ bounds = filter->filterBounds(bounds, 1.0f);
781
+ }
782
+ }
783
+
784
+ if (applyMatrixAtEnd) {
785
+ if (!isAffine && Matrix3DUtils::IsRectBehindCamera(bounds, coordinateMatrix)) {
786
+ return {};
787
+ }
788
+ bounds = coordinateMatrix.mapRect(bounds);
789
+ }
790
+ return bounds;
791
+ }
792
+
793
+ Point Layer::globalToLocal(const Point& globalPoint) const {
794
+ auto matrix = getGlobalMatrix().asMatrix();
795
+ Matrix inversedMatrix;
796
+ if (!matrix.invert(&inversedMatrix)) {
797
+ DEBUG_ASSERT(false);
798
+ return Point::Make(0, 0);
799
+ }
800
+ Point result = globalPoint;
801
+ inversedMatrix.mapPoints(&result, 1);
802
+ return result;
803
+ }
804
+
805
+ Point Layer::localToGlobal(const Point& localPoint) const {
806
+ auto globalMatrix = getGlobalMatrix();
807
+ auto result = globalMatrix.mapPoint({localPoint.x, localPoint.y, 0});
808
+ return {result.x, result.y};
809
+ }
810
+
811
+ Matrix Layer::getRelativeMatrix(const Layer* target) const {
812
+ return getRelativeMatrix3D(target).asMatrix();
813
+ }
814
+
815
+ Matrix3D Layer::getRelativeMatrix3D(const Layer* target) const {
816
+ if (target == nullptr || target == this) {
817
+ return {};
818
+ }
819
+ auto targetMatrix = target->getGlobalMatrix();
820
+ Matrix3D targetInverseMatrix = {};
821
+ if (!targetMatrix.invert(&targetInverseMatrix)) {
822
+ return {};
823
+ }
824
+ Matrix3D matrix = getGlobalMatrix();
825
+ matrix.postConcat(targetInverseMatrix);
826
+ return matrix;
827
+ }
828
+
829
+ bool Layer::hitTestPoint(float x, float y, bool shapeHitTest) {
830
+ if (auto content = getContent()) {
831
+ Point localPoint = globalToLocal(Point::Make(x, y));
832
+ if (shapeHitTest) {
833
+ if (content->hitTestPoint(localPoint.x, localPoint.y)) {
834
+ return true;
835
+ }
836
+ } else {
837
+ if (content->getBounds().contains(localPoint.x, localPoint.y)) {
838
+ return true;
839
+ }
840
+ }
841
+ }
842
+
843
+ for (const auto& childLayer : _children) {
844
+ // Alpha does not need to be checked; alpha == 0 is still valid.
845
+ if (!childLayer->visible() || childLayer->maskOwner) {
846
+ continue;
847
+ }
848
+
849
+ if (nullptr != childLayer->_scrollRect) {
850
+ auto pointInChildSpace = childLayer->globalToLocal(Point::Make(x, y));
851
+ if (!childLayer->_scrollRect->contains(pointInChildSpace.x, pointInChildSpace.y)) {
852
+ continue;
853
+ }
854
+ }
855
+
856
+ if (nullptr != childLayer->_mask) {
857
+ if (!childLayer->_mask->hitTestPoint(x, y, shapeHitTest)) {
858
+ continue;
859
+ }
860
+ }
861
+
862
+ if (childLayer->hitTestPoint(x, y, shapeHitTest)) {
863
+ return true;
864
+ }
865
+ }
866
+
867
+ return false;
868
+ }
869
+
870
+ static Rect GetClippedBounds(const Rect& bounds, const Canvas* canvas) {
871
+ DEBUG_ASSERT(canvas != nullptr);
872
+ auto clippedBounds = bounds;
873
+ auto clipRect = GetClipBounds(canvas);
874
+ if (!clipRect.has_value()) {
875
+ return clippedBounds;
876
+ }
877
+ if (!clippedBounds.intersect(*clipRect)) {
878
+ return Rect::MakeEmpty();
879
+ }
880
+ clippedBounds.roundOut();
881
+ return clippedBounds;
882
+ }
883
+
884
+ void Layer::draw(Canvas* canvas, float alpha, BlendMode blendMode) {
885
+ if (canvas == nullptr || alpha <= 0) {
886
+ return;
887
+ }
888
+
889
+ auto surface = canvas->getSurface();
890
+ DrawArgs args = {};
891
+ Context* context = nullptr;
892
+
893
+ auto bounds = getBounds();
894
+ auto clippedBounds = GetClippedBounds(bounds, canvas);
895
+ if (clippedBounds.isEmpty()) {
896
+ return;
897
+ }
898
+ auto localToGlobalMatrix = getGlobalMatrix();
899
+ auto globalToLocalMatrix = Matrix3D::I();
900
+ bool canInvert = localToGlobalMatrix.invert(&globalToLocalMatrix);
901
+
902
+ Rect renderRect = {};
903
+ std::vector<Rect> renderRectsVec = {};
904
+ if (_root && canInvert) {
905
+ _root->updateRenderBounds();
906
+ renderRect = localToGlobalMatrix.mapRect(clippedBounds);
907
+ renderRectsVec = {renderRect};
908
+ args.renderRects = &renderRectsVec;
909
+ }
910
+
911
+ if (surface) {
912
+ args.dstColorSpace = surface->colorSpace();
913
+ context = surface->getContext();
914
+ if (!(surface->renderFlags() & RenderFlags::DisableCache)) {
915
+ args.context = context;
916
+ }
917
+ }
918
+
919
+ // Capture pass — only when this layer or descendants have Background-sourced styles. Disabled
920
+ // in 3D subtrees. Requires a GPU context; on picture-canvas paths the capture is skipped and
921
+ // the consumer falls back to on-the-fly synthesis (signalled by passing a null snapshot map).
922
+ BackgroundSnapshotMap snapshotMap = {};
923
+ BackgroundSnapshotMap* snapshotsPtr = nullptr;
924
+ bool needBackground = canInvert && !canPreserve3D() && hasBackgroundStyle();
925
+ if (needBackground && context != nullptr) {
926
+ auto rectForDraw = maxBackgroundOutset > 0.0f ? clippedBounds : bounds;
927
+ Matrix backgroundMatrix = canvas->getMatrix();
928
+ Rect drawRect = backgroundMatrix.mapRect(rectForDraw);
929
+ if (_root != nullptr) {
930
+ // Capture replays from _root, so bgCanvas accumulates globalMatrix when reaching this
931
+ // layer. But Layer::draw() itself paints via drawLayer without concatenating globalMatrix,
932
+ // so the device position is just outerCanvas * self-local. Compose the viewMatrix as
933
+ // outerCanvas * invert(globalMatrix) so that surfaceMatrix * globalMatrix collapses back
934
+ // to outerCanvas, aligning capture and consume in the same device-pixel space.
935
+ // drawRect stays at outerCanvas.mapRect(rectForDraw) (the device-pixel layer rect)
936
+ // computed above, since BackgroundSource uses it to size the surface.
937
+ backgroundMatrix.preConcat(globalToLocalMatrix.asMatrix());
938
+ }
939
+ if (auto bgSource = createBackgroundSource(context, drawRect, backgroundMatrix,
940
+ rectForDraw == bounds, args.dstColorSpace)) {
941
+ // Replay from _root so ancestor matrices apply; orphan layers replay from themselves.
942
+ // The capture rect is in the captureRoot's local coordinate space: world (root-local) when
943
+ // rooted, or this layer's local bounds when orphan.
944
+ Layer* captureRoot = _root ? _root : this;
945
+ Rect captureRect = _root ? renderRect : clippedBounds;
946
+ BackgroundCapturer::Run(captureRoot, args, std::move(bgSource), &snapshotMap, {captureRect});
947
+ snapshotsPtr = &snapshotMap;
948
+ }
949
+ }
950
+
951
+ // Consume pass — normal render. NoOp when there's no background style so stray ones silently
952
+ // skip (same as contour / 3D subtrees). A null snapshot map signals the picture-canvas path,
953
+ // which makes the consumer synthesize backdrops on the fly via PictureRecorder.
954
+ AutoCanvasRestore autoRestore(canvas);
955
+ BackgroundConsumer consumer(snapshotsPtr);
956
+ BackgroundHandler* handler =
957
+ needBackground ? static_cast<BackgroundHandler*>(&consumer) : BackgroundHandler::NoOp();
958
+ DrawArgs drawArgs = args;
959
+ drawArgs.backgroundHandler = handler;
960
+ // Check if the current layer needs to start a 3D context. Since Layer::draw is called directly
961
+ // without going through a parent layer's drawChildren, 3D context handling must be done here.
962
+ if (canPreserve3D()) {
963
+ drawByStarting3DContext(drawArgs, canvas, getMatrixWithScrollRect(), &Layer::drawLayer, alpha);
964
+ } else {
965
+ drawLayer(drawArgs, canvas, alpha, blendMode);
966
+ }
967
+ }
968
+
969
+ void Layer::invalidateContent() {
970
+ if (bitFields.dirtyContent) {
971
+ return;
972
+ }
973
+ bitFields.dirtyContent = true;
974
+ bitFields.dirtyContentBounds = true;
975
+ invalidateDescendents();
976
+ }
977
+
978
+ void Layer::invalidateTransform() {
979
+ if (bitFields.dirtyTransform) {
980
+ return;
981
+ }
982
+ bitFields.dirtyTransform = true;
983
+ invalidate();
984
+ }
985
+
986
+ void Layer::invalidateDescendents() {
987
+ if (bitFields.dirtyDescendents) {
988
+ return;
989
+ }
990
+ bitFields.dirtyDescendents = true;
991
+ invalidateSubtree();
992
+ invalidate();
993
+ }
994
+
995
+ void Layer::invalidate() {
996
+ if (_parent) {
997
+ _parent->invalidateDescendents();
998
+ }
999
+ if (maskOwner) {
1000
+ maskOwner->invalidateTransform();
1001
+ }
1002
+ }
1003
+
1004
+ void Layer::onUpdateContent(LayerRecorder*) {
1005
+ }
1006
+
1007
+ void Layer::attachProperty(LayerProperty* property) {
1008
+ if (property) {
1009
+ property->attachToLayer(this);
1010
+ }
1011
+ }
1012
+
1013
+ void Layer::detachProperty(LayerProperty* property) {
1014
+ if (property) {
1015
+ property->detachFromLayer(this);
1016
+ }
1017
+ }
1018
+
1019
+ std::optional<StyledShape> Layer::onGetContentShape() {
1020
+ auto* content = getContent();
1021
+ if (content == nullptr) {
1022
+ return std::nullopt;
1023
+ }
1024
+ auto bounds = content->getTightBounds(Matrix::I());
1025
+ if (bounds.isEmpty()) {
1026
+ return std::nullopt;
1027
+ }
1028
+ Path path = {};
1029
+ path.addRect(bounds);
1030
+ return StyledShape::Make(Shape::MakeFrom(path), StyledShapeType::Fill, 0, StrokeAlign::Center);
1031
+ }
1032
+
1033
+ void Layer::onAttachToRoot(RootLayer* rootLayer) {
1034
+ _root = rootLayer;
1035
+ for (auto& child : _children) {
1036
+ child->onAttachToRoot(rootLayer);
1037
+ }
1038
+ }
1039
+
1040
+ void Layer::onDetachFromRoot() {
1041
+ _root = nullptr;
1042
+ for (auto& child : _children) {
1043
+ child->onDetachFromRoot();
1044
+ }
1045
+ }
1046
+
1047
+ int Layer::doGetChildIndex(const Layer* child) const {
1048
+ int index = 0;
1049
+ for (auto& layer : _children) {
1050
+ if (layer.get() == child) {
1051
+ return index;
1052
+ }
1053
+ index++;
1054
+ }
1055
+ return -1;
1056
+ }
1057
+
1058
+ bool Layer::doContains(const Layer* child) const {
1059
+ auto target = child;
1060
+ while (target) {
1061
+ if (target == this) {
1062
+ return true;
1063
+ }
1064
+ target = target->_parent;
1065
+ }
1066
+ return false;
1067
+ }
1068
+
1069
+ Matrix3D Layer::getGlobalMatrix() const {
1070
+ // The global matrix transforms the layer's local coordinate space to the coordinate space of its
1071
+ // top-level parent layer. This means the top-level parent layer's own matrix is not included in
1072
+ // the global matrix.
1073
+ Matrix3D matrix = {};
1074
+ auto layer = this;
1075
+ while (layer->_parent) {
1076
+ // Check if the child layer is within a 3D rendering context. If not, adapt the matrix to
1077
+ // ensure the z-component of layer rect vertex coordinates remains unchanged, so the child layer
1078
+ // is projected onto the current layer first, then the accumulated matrix transformation is
1079
+ // applied. If within, directly concatenate the child layer matrix to preserve its 3D state.
1080
+ if (!layer->canPreserve3D()) {
1081
+ matrix.setRow(2, {0, 0, 1, 0});
1082
+ }
1083
+ matrix.postConcat(layer->getMatrixWithScrollRect());
1084
+ layer = layer->_parent;
1085
+ }
1086
+ return matrix;
1087
+ }
1088
+
1089
+ Matrix3D Layer::getMatrixWithScrollRect() const {
1090
+ auto matrix = _matrix3D;
1091
+ if (_scrollRect) {
1092
+ matrix.preTranslate(-_scrollRect->left, -_scrollRect->top, 0);
1093
+ }
1094
+ return matrix;
1095
+ }
1096
+
1097
+ LayerContent* Layer::getContent() {
1098
+ if (bitFields.dirtyContent) {
1099
+ LayerRecorder recorder = {};
1100
+ onUpdateContent(&recorder);
1101
+ layerContent = recorder.finishRecording();
1102
+ bitFields.dirtyContent = false;
1103
+ }
1104
+ return layerContent.get();
1105
+ }
1106
+
1107
+ std::shared_ptr<Image> Layer::applyFilters(std::shared_ptr<Image> image, float contentScale,
1108
+ const Rect& contentBounds, Point* offset) {
1109
+ if (!image || _filters.empty()) {
1110
+ return image;
1111
+ }
1112
+ // Each filter may shift the output image origin by filterOffset. Subsequent filters receive an
1113
+ // image in the shifted coordinate system, so contentBounds must be translated by -filterOffset
1114
+ // before being passed to the next filter, otherwise geometry-anchored filters would sample in a
1115
+ // stale coordinate system.
1116
+ Rect currentContentBounds = contentBounds;
1117
+ for (const auto& layerFilter : _filters) {
1118
+ DEBUG_ASSERT(layerFilter != nullptr);
1119
+ Point filterOffset = {};
1120
+ image = layerFilter->filterImage(std::move(image), contentScale, currentContentBounds,
1121
+ &filterOffset);
1122
+ if (!image) {
1123
+ return nullptr;
1124
+ }
1125
+ if (offset) {
1126
+ offset->offset(filterOffset.x, filterOffset.y);
1127
+ }
1128
+ currentContentBounds.offset(-filterOffset.x, -filterOffset.y);
1129
+ }
1130
+ return image;
1131
+ }
1132
+
1133
+ Rect Layer::mapContentBoundsToImage(float scale, const Rect& imageBounds) {
1134
+ auto layerBounds = computeBounds(Matrix3D::I(), false, /*excludeEffects=*/true);
1135
+ return Rect::MakeXYWH(layerBounds.left * scale - imageBounds.left,
1136
+ layerBounds.top * scale - imageBounds.top, layerBounds.width() * scale,
1137
+ layerBounds.height() * scale);
1138
+ }
1139
+
1140
+ Rect Layer::mapOutputBoundsToInput(const Rect& srcRect, float contentScale) {
1141
+ auto bounds = srcRect;
1142
+ for (auto it = _filters.rbegin(); it != _filters.rend(); ++it) {
1143
+ DEBUG_ASSERT(*it != nullptr);
1144
+ bounds = (*it)->filterBounds(bounds, contentScale, MapDirection::Reverse);
1145
+ }
1146
+ return bounds;
1147
+ }
1148
+
1149
+ bool Layer::drawLayer(const DrawArgs& args, Canvas* canvas, float alpha, BlendMode blendMode) {
1150
+ DEBUG_ASSERT(canvas != nullptr);
1151
+ auto contentScale = canvas->getMatrix().getMaxScale();
1152
+ if (FloatNearlyZero(contentScale)) {
1153
+ return true;
1154
+ }
1155
+ if (args.renderRects != nullptr && !args.renderRects->empty() && !renderBounds.isEmpty()) {
1156
+ bool anyHit = false;
1157
+ for (const auto& rect : *args.renderRects) {
1158
+ if (Rect::Intersects(rect, renderBounds)) {
1159
+ anyHit = true;
1160
+ break;
1161
+ }
1162
+ }
1163
+ if (!anyHit) {
1164
+ return true;
1165
+ }
1166
+ }
1167
+ std::shared_ptr<MaskFilter> maskFilter = nullptr;
1168
+ if (!prepareMask(args, canvas, &maskFilter)) {
1169
+ return true;
1170
+ }
1171
+ bool needsMaskFilter = maskFilter != nullptr;
1172
+ if (canUseSubtreeCache(args, blendMode) &&
1173
+ drawWithSubtreeCache(args, canvas, alpha, blendMode, maskFilter)) {
1174
+ return true;
1175
+ }
1176
+
1177
+ // For non-leaf layers in a 3D rendering context layer tree, direct rendering is always used.
1178
+ // Offscreen constraints (filters, styles, masks) are already checked by the parent layer at call
1179
+ // site. Group opacity, blend mode, and passThroughBackground have lower priority than enabling
1180
+ // 3D rendering context and are ignored during drawing.
1181
+ bool needsOffscreen = false;
1182
+ if (!canPreserve3D()) {
1183
+ needsOffscreen = blendMode != BlendMode::SrcOver || !bitFields.passThroughBackground ||
1184
+ (alpha < 1.0f && bitFields.allowsGroupOpacity) ||
1185
+ (!_filters.empty() && !args.excludeEffects) || needsMaskFilter;
1186
+ }
1187
+ if (needsOffscreen) {
1188
+ // Content and children are rendered together in an offscreen buffer.
1189
+ drawOffscreen(args, canvas, alpha, blendMode, maskFilter);
1190
+ } else {
1191
+ // Content and children are rendered independently.
1192
+ drawDirectly(args, canvas, alpha);
1193
+ }
1194
+ return true;
1195
+ }
1196
+
1197
+ bool Layer::prepareMask(const DrawArgs& args, Canvas* canvas,
1198
+ std::shared_ptr<MaskFilter>* maskFilter) {
1199
+ if (!hasValidMask()) {
1200
+ return true;
1201
+ }
1202
+ auto clipBounds = GetClipBounds(canvas);
1203
+ auto contentScale = canvas->getMatrix().getMaxScale();
1204
+ auto maskData = getMaskData(args, contentScale, clipBounds);
1205
+ if (maskData.maskFilter == nullptr) {
1206
+ if (maskData.clipPath.isEmpty() && !maskData.clipPath.isInverseFillType()) {
1207
+ return false;
1208
+ }
1209
+ canvas->clipPath(maskData.clipPath, _mask->bitFields.allowsEdgeAntialiasing);
1210
+ return true;
1211
+ }
1212
+ if (maskFilter) {
1213
+ *maskFilter = maskData.maskFilter;
1214
+ }
1215
+ return true;
1216
+ }
1217
+
1218
+ std::shared_ptr<Picture> Layer::getMaskPicture(const DrawArgs& args, bool isContourMode,
1219
+ float scale, const Matrix3D& relativeMatrix3D) {
1220
+ // Note: Does not use layerClipBounds here. Using clipBounds may cause PathOp errors when
1221
+ // extracting maskPath from the picture, resulting in incorrect clip regions.
1222
+ DrawArgs maskArgs = args;
1223
+ maskArgs.excludeEffects |= isContourMode;
1224
+ maskArgs.backgroundHandler = BackgroundHandler::NoOp();
1225
+ auto maskCanPreserve3D = _mask->canPreserve3D();
1226
+ // When mask enables 3D context, the full 3D relative matrix is handled by the 3D context.
1227
+ // Otherwise, use the 2D projection of the relative matrix on canvas.
1228
+ auto canvasMatrix = relativeMatrix3D.asMatrix();
1229
+ if (isContourMode) {
1230
+ OpaqueContext opaqueContext;
1231
+ auto* contourCanvas = opaqueContext.beginRecording();
1232
+ contourCanvas->scale(scale, scale);
1233
+ maskArgs.opaqueContext = &opaqueContext;
1234
+ if (maskCanPreserve3D) {
1235
+ _mask->drawByStarting3DContext(maskArgs, contourCanvas, relativeMatrix3D, &Layer::drawContour,
1236
+ _mask->_alpha);
1237
+ } else {
1238
+ contourCanvas->concat(canvasMatrix);
1239
+ _mask->drawContour(maskArgs, contourCanvas, _mask->_alpha, BlendMode::SrcOver);
1240
+ }
1241
+ return opaqueContext.finishRecordingAsPicture();
1242
+ }
1243
+ PictureRecorder recorder = {};
1244
+ auto* recordingCanvas = recorder.beginRecording();
1245
+ recordingCanvas->scale(scale, scale);
1246
+ if (maskCanPreserve3D) {
1247
+ _mask->drawByStarting3DContext(maskArgs, recordingCanvas, relativeMatrix3D, &Layer::drawLayer,
1248
+ _mask->_alpha);
1249
+ } else {
1250
+ recordingCanvas->concat(canvasMatrix);
1251
+ _mask->drawLayer(maskArgs, recordingCanvas, _mask->_alpha, BlendMode::SrcOver);
1252
+ }
1253
+ return recorder.finishRecordingAsPicture();
1254
+ }
1255
+
1256
+ MaskData Layer::getMaskData(const DrawArgs& args, float scale,
1257
+ const std::optional<Rect>& layerClipBounds) {
1258
+ DEBUG_ASSERT(_mask != nullptr);
1259
+ DEBUG_ASSERT(args.render3DContext == nullptr);
1260
+ auto maskType = static_cast<LayerMaskType>(bitFields.maskType);
1261
+ auto isContourMode = maskType == LayerMaskType::Contour;
1262
+
1263
+ auto relativeMatrix3D = _mask->getRelativeMatrix3D(this);
1264
+ auto maskPicture = getMaskPicture(args, isContourMode, scale, relativeMatrix3D);
1265
+ if (maskPicture == nullptr) {
1266
+ return {};
1267
+ }
1268
+
1269
+ bool needLuminance = maskType == LayerMaskType::Luminance;
1270
+ if (!needLuminance) {
1271
+ Path maskPath = {};
1272
+ if (MaskContext::GetMaskPath(maskPicture, &maskPath)) {
1273
+ maskPath.transform(Matrix::MakeScale(1.0f / scale, 1.0f / scale));
1274
+ return {std::move(maskPath), nullptr};
1275
+ }
1276
+ }
1277
+
1278
+ Rect maskBounds = maskPicture->getBounds();
1279
+ if (layerClipBounds.has_value()) {
1280
+ auto scaledClipBounds = *layerClipBounds;
1281
+ scaledClipBounds.scale(scale, scale);
1282
+ if (!maskBounds.intersect(scaledClipBounds)) {
1283
+ return {};
1284
+ }
1285
+ }
1286
+ Point maskImageOffset = {};
1287
+ auto maskContentImage =
1288
+ ToImageWithOffset(std::move(maskPicture), &maskImageOffset, &maskBounds, args.dstColorSpace);
1289
+ if (maskContentImage == nullptr) {
1290
+ return {};
1291
+ }
1292
+ if (needLuminance) {
1293
+ maskContentImage =
1294
+ maskContentImage->makeWithFilter(ImageFilter::ColorFilter(ColorFilter::Luma()));
1295
+ }
1296
+ auto maskMatrix = Matrix::MakeScale(1.0f / scale, 1.0f / scale);
1297
+ maskMatrix.preTranslate(maskImageOffset.x, maskImageOffset.y);
1298
+
1299
+ auto shader = Shader::MakeImageShader(maskContentImage, TileMode::Decal, TileMode::Decal);
1300
+ if (shader) {
1301
+ shader = shader->makeWithMatrix(maskMatrix);
1302
+ }
1303
+ return {{}, MaskFilter::MakeShader(shader)};
1304
+ }
1305
+
1306
+ std::shared_ptr<Image> Layer::getContentContourImage(const DrawArgs& args, float contentScale,
1307
+ Point* offset, bool* contourMatchesContent) {
1308
+ if (FloatNearlyZero(contentScale)) {
1309
+ return nullptr;
1310
+ }
1311
+ bool allMatch = true;
1312
+ OpaqueContext opaqueContext;
1313
+ auto* contourCanvas = opaqueContext.beginRecording();
1314
+ contourCanvas->scale(contentScale, contentScale);
1315
+ auto contourArgs = args;
1316
+ contourArgs.opaqueContext = &opaqueContext;
1317
+ // Contour recording is an intermediate artifact — skip background capture / consume.
1318
+ contourArgs.backgroundHandler = BackgroundHandler::NoOp();
1319
+ // Detach from any active 3D rendering context: the contour image we are about to record is the
1320
+ // merged self + descendants outline used as a layerStyle / mask source, not a node within the
1321
+ // 3D BSP. Without this clear, drawContourInternal's "skip children when rasterizing a
1322
+ // preserve3D middle node" guard would prune descendants and produce an incomplete contour.
1323
+ contourArgs.render3DContext = nullptr;
1324
+ if (!drawContourInternal(contourArgs, contourCanvas, true)) {
1325
+ allMatch = false;
1326
+ }
1327
+ auto picture = opaqueContext.finishRecordingAsPicture();
1328
+ auto imageOffset = Point::Zero();
1329
+ auto image = ToImageWithOffset(std::move(picture), &imageOffset, nullptr, args.dstColorSpace);
1330
+ if (offset) {
1331
+ *offset = imageOffset;
1332
+ }
1333
+ if (contourMatchesContent) {
1334
+ *contourMatchesContent = allMatch;
1335
+ }
1336
+ return image;
1337
+ }
1338
+
1339
+ bool Layer::shouldPassThroughBackground(BlendMode blendMode) const {
1340
+ // Pass-through background is only possible when:
1341
+ // 1. The feature is enabled
1342
+ if (!bitFields.passThroughBackground) {
1343
+ return false;
1344
+ }
1345
+
1346
+ // 2. Subtree has blend modes that need background information
1347
+ if (!bitFields.hasBlendMode) {
1348
+ return false;
1349
+ }
1350
+
1351
+ // 3. No offscreen rendering is required
1352
+ // (Offscreen rendering happens when: non-SrcOver blend mode OR has filters)
1353
+ if (blendMode != BlendMode::SrcOver || !_filters.empty()) {
1354
+ return false;
1355
+ }
1356
+
1357
+ // 4. Layer does not start or extend a 3D context
1358
+ // (When starting or extending a 3D context, child layers need to maintain independent 3D states,
1359
+ // so pass-through background is not supported)
1360
+ if (canPreserve3D()) {
1361
+ return false;
1362
+ }
1363
+
1364
+ return true;
1365
+ }
1366
+
1367
+ bool Layer::canUseSubtreeCache(const DrawArgs& args, BlendMode blendMode) {
1368
+ if (canPreserve3D()) {
1369
+ return false;
1370
+ }
1371
+ if (args.excludeEffects) {
1372
+ return false;
1373
+ }
1374
+ if (args.subtreeCacheMaxSize <= 0) {
1375
+ return false;
1376
+ }
1377
+ if (subtreeCache) {
1378
+ if (subtreeCache->maxSize() != args.subtreeCacheMaxSize) {
1379
+ subtreeCache = std::make_unique<SubtreeCache>(args.subtreeCacheMaxSize);
1380
+ }
1381
+ return true;
1382
+ }
1383
+ if (shouldPassThroughBackground(blendMode) || hasBackgroundStyle()) {
1384
+ return false;
1385
+ }
1386
+ if (!bitFields.staticSubtree) {
1387
+ return false;
1388
+ }
1389
+ // Skip caching for leaf nodes with basic shapes (Rect, RRect) that have no filters or layer
1390
+ // styles, as they can be efficiently merged during rendering.
1391
+ if (_children.empty() && _layerStyles.empty() && _filters.empty()) {
1392
+ auto content = getContent();
1393
+ if (content == nullptr) {
1394
+ return false;
1395
+ }
1396
+ auto contentType = Types::Get(content);
1397
+ if (contentType == Types::LayerContentType::Rect ||
1398
+ contentType == Types::LayerContentType::RRect) {
1399
+ return false;
1400
+ }
1401
+ }
1402
+ subtreeCache = std::make_unique<SubtreeCache>(args.subtreeCacheMaxSize);
1403
+ return true;
1404
+ }
1405
+
1406
+ std::shared_ptr<Image> Layer::createSubtreeCacheImage(const DrawArgs& args, float contentScale,
1407
+ const Rect& layerBounds,
1408
+ Matrix* drawingMatrix) {
1409
+ DEBUG_ASSERT(drawingMatrix != nullptr);
1410
+ if (FloatNearlyZero(contentScale)) {
1411
+ return nullptr;
1412
+ }
1413
+
1414
+ auto drawArgs = args;
1415
+ drawArgs.renderFlags |= RenderFlags::DisableCache;
1416
+ drawArgs.renderRects = nullptr;
1417
+ // Cache content should be rendered to a regular texture, not to 3D compositor.
1418
+ drawArgs.render3DContext = nullptr;
1419
+ drawArgs.backgroundHandler = BackgroundHandler::NoOp();
1420
+
1421
+ auto pictureBounds = layerBounds;
1422
+ pictureBounds.scale(contentScale, contentScale);
1423
+ if (!_filters.empty()) {
1424
+ auto reverseBounds = mapOutputBoundsToInput(pictureBounds, contentScale);
1425
+ pictureBounds.intersect(reverseBounds);
1426
+ }
1427
+ PictureRecorder recorder = {};
1428
+ auto* recordingCanvas = recorder.beginRecording();
1429
+ recordingCanvas->scale(contentScale, contentScale);
1430
+ drawDirectly(drawArgs, recordingCanvas, 1.0f);
1431
+ auto picture = recorder.finishRecordingAsPicture();
1432
+ if (!picture) {
1433
+ return nullptr;
1434
+ }
1435
+
1436
+ Point offset = {};
1437
+ auto image =
1438
+ ToImageWithOffset(std::move(picture), &offset, &pictureBounds, args.dstColorSpace, false);
1439
+ if (image == nullptr) {
1440
+ return nullptr;
1441
+ }
1442
+
1443
+ if (!_filters.empty()) {
1444
+ Point filterOffset = {};
1445
+ auto contentBounds = mapContentBoundsToImage(contentScale, pictureBounds);
1446
+ contentBounds.offset(-(contentBounds.left + pictureBounds.left),
1447
+ -(contentBounds.top + pictureBounds.top));
1448
+ image = applyFilters(std::move(image), contentScale, contentBounds, &filterOffset);
1449
+ offset += filterOffset;
1450
+ }
1451
+
1452
+ drawingMatrix->setScale(1.0f / contentScale, 1.0f / contentScale);
1453
+ drawingMatrix->preTranslate(offset.x, offset.y);
1454
+
1455
+ return image->makeTextureImage(args.context);
1456
+ }
1457
+
1458
+ SubtreeCache* Layer::getValidSubtreeCache(const DrawArgs& args, int longEdge,
1459
+ const Rect& layerBounds) {
1460
+ if (subtreeCache->hasCache(args.context, longEdge)) {
1461
+ return subtreeCache.get();
1462
+ }
1463
+ if (args.renderFlags & RenderFlags::DisableCache || longEdge > args.subtreeCacheMaxSize) {
1464
+ return nullptr;
1465
+ }
1466
+ auto maxBoundsSize = std::max(layerBounds.width(), layerBounds.height());
1467
+ if (FloatNearlyZero(maxBoundsSize)) {
1468
+ return nullptr;
1469
+ }
1470
+ auto cacheScale = static_cast<float>(longEdge) / maxBoundsSize;
1471
+ auto imageMatrix = Matrix::I();
1472
+ auto image = createSubtreeCacheImage(args, cacheScale, layerBounds, &imageMatrix);
1473
+ if (image == nullptr) {
1474
+ return nullptr;
1475
+ }
1476
+ auto textureProxy = std::static_pointer_cast<TextureImage>(image)->getTextureProxy();
1477
+ subtreeCache->addCache(args.context, longEdge, textureProxy, imageMatrix, args.dstColorSpace);
1478
+ return subtreeCache.get();
1479
+ }
1480
+
1481
+ bool Layer::drawWithSubtreeCache(const DrawArgs& args, Canvas* canvas, float alpha,
1482
+ BlendMode blendMode,
1483
+ const std::shared_ptr<MaskFilter>& maskFilter) {
1484
+ // Non-leaf nodes in 3D rendering context layer tree have caching disabled.
1485
+ DEBUG_ASSERT(!canPreserve3D());
1486
+ auto layerBounds = getBounds();
1487
+ auto contentScale = canvas->getMatrix().getMaxScale();
1488
+ auto longEdge = GetMipmapCacheLongEdge(args.subtreeCacheMaxSize, contentScale, layerBounds);
1489
+ auto cache = getValidSubtreeCache(args, longEdge, layerBounds);
1490
+ if (cache == nullptr) {
1491
+ return false;
1492
+ }
1493
+ Paint paint = {};
1494
+ if (maskFilter) {
1495
+ paint.setMaskFilter(maskFilter);
1496
+ }
1497
+ paint.setAntiAlias(bitFields.allowsEdgeAntialiasing);
1498
+ paint.setAlpha(alpha);
1499
+ paint.setBlendMode(blendMode);
1500
+ cache->draw(args.context, longEdge, canvas, paint);
1501
+ return true;
1502
+ }
1503
+
1504
+ void Layer::drawOffscreen(const DrawArgs& args, Canvas* canvas, float alpha, BlendMode blendMode,
1505
+ const std::shared_ptr<MaskFilter>& maskFilter) {
1506
+ // preserve3D layers never require offscreen rendering; their effects (filters, group opacity,
1507
+ // mask filter, non-SrcOver blend) are intentionally not supported because each preserve3D
1508
+ // middle node is rasterized as a flat quad before BSP compositing. Non-preserve3D leaves may
1509
+ // still invoke this path inside a 3D context — that's fine, render3DContext is irrelevant here.
1510
+ DEBUG_ASSERT(!canPreserve3D());
1511
+
1512
+ auto clipBounds = GetClipBounds(canvas);
1513
+ auto result = OffscreenResult{};
1514
+
1515
+ if (shouldPassThroughBackground(blendMode) && canvas->getSurface()) {
1516
+ result = OffscreenRenderer::RenderPassThrough(this, args, canvas, clipBounds);
1517
+ } else {
1518
+ result = OffscreenRenderer::RenderContent(this, args, canvas->getMatrix(), clipBounds);
1519
+ }
1520
+
1521
+ auto invertImageMatrix = Matrix::I();
1522
+ if (result.isEmpty() || !result.imageMatrix.invert(&invertImageMatrix)) {
1523
+ return;
1524
+ }
1525
+
1526
+ Paint paint = {};
1527
+ paint.setAntiAlias(false);
1528
+ paint.setAlpha(alpha);
1529
+ paint.setBlendMode(blendMode);
1530
+
1531
+ if (maskFilter) {
1532
+ paint.setMaskFilter(maskFilter->makeWithMatrix(invertImageMatrix));
1533
+ }
1534
+
1535
+ canvas->concat(result.imageMatrix);
1536
+ auto filterMode =
1537
+ !args.excludeEffects && !_filters.empty() ? FilterMode::Linear : FilterMode::Nearest;
1538
+ auto sampling = SamplingOptions{filterMode, MipmapMode::None};
1539
+ canvas->drawImage(result.image, 0.f, 0.f, sampling, &paint);
1540
+ }
1541
+
1542
+ std::optional<Rect> Layer::computeContentBounds(const std::optional<Rect>& clipBounds,
1543
+ bool excludeEffects) {
1544
+ auto inputBounds = getBounds();
1545
+ if (clipBounds.has_value()) {
1546
+ auto mappedClipBounds = *clipBounds;
1547
+ if (!excludeEffects && !_filters.empty()) {
1548
+ mappedClipBounds = mapOutputBoundsToInput(mappedClipBounds, 1.0f);
1549
+ }
1550
+ if (!inputBounds.intersect(mappedClipBounds)) {
1551
+ return std::nullopt;
1552
+ }
1553
+ }
1554
+ inputBounds.roundOut();
1555
+ return inputBounds;
1556
+ }
1557
+
1558
+ void Layer::drawDirectly(const DrawArgs& args, Canvas* canvas, float alpha) {
1559
+ // Capture and consume passes share the same per-layer LayerStyleSource via the active handler,
1560
+ // so the content/contour intermediate renders happen once per frame instead of twice.
1561
+ const LayerStyleSource* sourcePtr = nullptr;
1562
+ if (args.backgroundHandler != nullptr) {
1563
+ sourcePtr = args.backgroundHandler->getCachedLayerStyleSource(this);
1564
+ }
1565
+ std::unique_ptr<LayerStyleSource> ownedSource;
1566
+ if (sourcePtr == nullptr) {
1567
+ ownedSource = getLayerStyleSource(args, canvas->getMatrix());
1568
+ if (ownedSource != nullptr && args.backgroundHandler != nullptr &&
1569
+ args.backgroundHandler->canCacheLayerStyleSource(this)) {
1570
+ sourcePtr = args.backgroundHandler->cacheLayerStyleSource(this, std::move(ownedSource));
1571
+ }
1572
+ if (sourcePtr == nullptr) {
1573
+ sourcePtr = ownedSource.get();
1574
+ }
1575
+ }
1576
+ drawContents(args, canvas, alpha, sourcePtr);
1577
+ }
1578
+
1579
+ void Layer::drawContents(const DrawArgs& args, Canvas* canvas, float alpha,
1580
+ const LayerStyleSource* layerStyleSource, const Layer* stopChild) {
1581
+ if (layerStyleSource) {
1582
+ drawLayerStyles(args, canvas, alpha, layerStyleSource, LayerStylePosition::Below);
1583
+ }
1584
+ auto content = getContent();
1585
+ bool hasForeground = false;
1586
+ if (content) {
1587
+ hasForeground = content->drawDefault(canvas, alpha, bitFields.allowsEdgeAntialiasing);
1588
+ }
1589
+ if (!drawChildren(args, canvas, alpha, stopChild)) {
1590
+ return;
1591
+ }
1592
+ if (stopChild != nullptr) {
1593
+ // Background-walk path: skip Above styles and foreground for this layer; the caller is only
1594
+ // interested in the portion that contributes to the synthesized backdrop.
1595
+ return;
1596
+ }
1597
+ if (layerStyleSource) {
1598
+ drawLayerStyles(args, canvas, alpha, layerStyleSource, LayerStylePosition::Above);
1599
+ }
1600
+ if (hasForeground) {
1601
+ content->drawForeground(canvas, alpha, bitFields.allowsEdgeAntialiasing);
1602
+ }
1603
+ }
1604
+
1605
+ bool Layer::drawContour(const DrawArgs& args, Canvas* canvas, float, BlendMode) {
1606
+ return drawContourInternal(args, canvas, false);
1607
+ }
1608
+
1609
+ bool Layer::drawContourInternal(const DrawArgs& args, Canvas* canvas, bool contentOnly) {
1610
+ auto* opaqueContext = args.opaqueContext;
1611
+ // Check if this layer is completely covered by opaque bounds
1612
+ auto bounds = getBounds();
1613
+ auto globalBounds = canvas->getMatrix().mapRect(bounds);
1614
+ if (opaqueContext && opaqueContext->containsOpaqueBounds(globalBounds)) {
1615
+ return true;
1616
+ }
1617
+
1618
+ // Check effects for child layers (not contentOnly)
1619
+ bool allMatch = true;
1620
+ if (!contentOnly && !args.excludeEffects && (!_filters.empty() || !_layerStyles.empty())) {
1621
+ allMatch = false;
1622
+ }
1623
+
1624
+ // Apply mask for child layers (not contentOnly)
1625
+ std::shared_ptr<MaskFilter> maskFilter = nullptr;
1626
+ if (!contentOnly && hasValidMask()) {
1627
+ auto contentScale = canvas->getMatrix().getMaxScale();
1628
+ auto clipBounds = GetClipBounds(canvas);
1629
+ auto maskData = getMaskData(args, contentScale, clipBounds);
1630
+ if (maskData.maskFilter == nullptr) {
1631
+ if (maskData.clipPath.isEmpty() && !maskData.clipPath.isInverseFillType()) {
1632
+ return allMatch;
1633
+ }
1634
+ canvas->clipPath(maskData.clipPath, _mask->bitFields.allowsEdgeAntialiasing);
1635
+ } else {
1636
+ maskFilter = maskData.maskFilter;
1637
+ }
1638
+ }
1639
+
1640
+ // Handle offscreen rendering for mask filter
1641
+ if (maskFilter) {
1642
+ auto contentScale = canvas->getMatrix().getMaxScale();
1643
+ auto offset = Point::Zero();
1644
+ bool contourMatchesContent = true;
1645
+ auto image = getContentContourImage(args, contentScale, &offset, &contourMatchesContent);
1646
+ if (image == nullptr) {
1647
+ return allMatch;
1648
+ }
1649
+ if (!contourMatchesContent) {
1650
+ allMatch = false;
1651
+ }
1652
+ auto imageMatrix = Matrix::MakeScale(1.0f / contentScale, 1.0f / contentScale);
1653
+ imageMatrix.preTranslate(offset.x, offset.y);
1654
+ auto invertImageMatrix = Matrix::I();
1655
+ if (imageMatrix.invert(&invertImageMatrix)) {
1656
+ Paint paint = {};
1657
+ paint.setMaskFilter(maskFilter->makeWithMatrix(invertImageMatrix));
1658
+ AutoCanvasRestore restore(canvas);
1659
+ canvas->concat(imageMatrix);
1660
+ canvas->drawImage(std::move(image), 0, 0, &paint);
1661
+ }
1662
+ return allMatch;
1663
+ }
1664
+
1665
+ // Draw content's contour
1666
+ auto content = getContent();
1667
+ if (content) {
1668
+ if (!content->contourEqualsOpaqueContent()) {
1669
+ allMatch = false;
1670
+ }
1671
+ content->drawContour(canvas, bitFields.allowsEdgeAntialiasing);
1672
+ }
1673
+
1674
+ // 3D middle node: descendants are independently registered with the active Layer3DContext, so
1675
+ // we must not recurse into them here. Same gate as drawChildren below.
1676
+ if (canPreserve3D() && args.render3DContext != nullptr) {
1677
+ return allMatch;
1678
+ }
1679
+
1680
+ // Draw children's contour directly (not using drawChildren to avoid background logic)
1681
+ for (auto& child : _children) {
1682
+ if (child->maskOwner || !child->visible() || child->_alpha <= 0) {
1683
+ continue;
1684
+ }
1685
+ if (!drawChild(args, canvas, child.get(), 1.0f, &Layer::drawContour)) {
1686
+ allMatch = false;
1687
+ }
1688
+ }
1689
+ return allMatch;
1690
+ }
1691
+
1692
+ bool Layer::drawChildren(const DrawArgs& args, Canvas* canvas, float alpha,
1693
+ const Layer* stopChild) {
1694
+ // 3D middle node: descendants are independently registered with the active Layer3DContext and
1695
+ // composited via BSP. Do not recurse here, otherwise we would double-draw them.
1696
+ if (canPreserve3D() && args.render3DContext != nullptr) {
1697
+ return true;
1698
+ }
1699
+ auto childCount = static_cast<int>(_children.size());
1700
+ int maxIndex = childCount - 1;
1701
+ if (args.backgroundHandler != nullptr) {
1702
+ int lastCaptureIndex = args.backgroundHandler->lastCaptureChildIndex(this);
1703
+ if (lastCaptureIndex < 0) {
1704
+ return true;
1705
+ }
1706
+ if (lastCaptureIndex < maxIndex) {
1707
+ maxIndex = lastCaptureIndex;
1708
+ }
1709
+ }
1710
+ for (int i = 0; i <= maxIndex; ++i) {
1711
+ auto& child = _children[static_cast<size_t>(i)];
1712
+ if (stopChild != nullptr && child.get() == stopChild) {
1713
+ // Background-walk truncation: the caller only wants prior siblings of stopChild.
1714
+ break;
1715
+ }
1716
+ if (child->maskOwner || !child->visible() || child->_alpha <= 0) {
1717
+ continue;
1718
+ }
1719
+ if (args.backgroundHandler != nullptr && i < maxIndex) {
1720
+ args.backgroundHandler->beginForceDrawChildren();
1721
+ drawChild(args, canvas, child.get(), alpha, &Layer::drawLayer);
1722
+ args.backgroundHandler->endForceDrawChildren();
1723
+ } else {
1724
+ drawChild(args, canvas, child.get(), alpha, &Layer::drawLayer);
1725
+ }
1726
+ }
1727
+ return true;
1728
+ }
1729
+
1730
+ void Layer::drawByStarting3DContext(const DrawArgs& args, Canvas* canvas, const Matrix3D& matrix3D,
1731
+ LayerDrawFunc drawFunc, float alpha) {
1732
+ DEBUG_ASSERT(canPreserve3D());
1733
+ // args.render3DContext may be non-null when this preserve3D layer is nested inside a
1734
+ // non-preserve3D leaf that is being rasterized in an outer 3D context. The nested context is
1735
+ // independent from the outer one — it builds and composites on its own surface.
1736
+
1737
+ const auto bounds = getBoundsInternal(matrix3D, false);
1738
+ const auto newContext = Create3DContext(args, canvas, bounds);
1739
+ if (newContext == nullptr) {
1740
+ return;
1741
+ }
1742
+
1743
+ newContext->addLayer(this, matrix3D, alpha, drawFunc);
1744
+ newContext->finishAndDrawTo(args, canvas);
1745
+ }
1746
+
1747
+ bool Layer::drawChild(const DrawArgs& args, Canvas* canvas, Layer* child, float alpha,
1748
+ LayerDrawFunc drawFunc) {
1749
+ // 2D → 3D switch: hand off to drawByStarting3DContext, which expands the 3D subtree internally.
1750
+ if (child->canPreserve3D()) {
1751
+ auto matrix3D = child->getMatrixWithScrollRect();
1752
+ child->drawByStarting3DContext(args, canvas, matrix3D, drawFunc, child->_alpha * alpha);
1753
+ return true;
1754
+ }
1755
+
1756
+ AutoCanvasRestore autoRestore(canvas);
1757
+ canvas->concat(child->getMatrixWithScrollRect().asMatrix());
1758
+ ClipScrollRect(canvas, child->_scrollRect.get(), nullptr,
1759
+ child->bitFields.allowsEdgeAntialiasing);
1760
+ auto blendMode = static_cast<BlendMode>(child->bitFields.blendMode);
1761
+ return (child->*drawFunc)(args, canvas, child->_alpha * alpha, blendMode);
1762
+ }
1763
+
1764
+ std::unique_ptr<LayerStyleSource> Layer::getLayerStyleSource(const DrawArgs& args,
1765
+ const Matrix& matrix) {
1766
+ if (_layerStyles.empty() || args.excludeEffects) {
1767
+ return nullptr;
1768
+ }
1769
+ auto contentScale = matrix.getMaxScale();
1770
+ if (FloatNearlyZero(contentScale)) {
1771
+ return nullptr;
1772
+ }
1773
+
1774
+ // Collect which excludeChildEffects values need content and/or contour.
1775
+ bool needContent[2] = {false, false};
1776
+ bool needContour[2] = {false, false};
1777
+ for (const auto& layerStyle : _layerStyles) {
1778
+ auto index = static_cast<int>(layerStyle->excludeChildEffects());
1779
+ needContent[index] = true;
1780
+ if (layerStyle->extraSourceType() == LayerStyleExtraSourceType::Contour) {
1781
+ needContour[index] = true;
1782
+ }
1783
+ }
1784
+
1785
+ auto source = std::make_unique<LayerStyleSource>();
1786
+ source->contentScale = contentScale;
1787
+
1788
+ DrawArgs drawArgs = args;
1789
+ drawArgs.render3DContext = nullptr;
1790
+ // Layer style source content is an intermediate artifact — skip background capture / consume.
1791
+ drawArgs.backgroundHandler = BackgroundHandler::NoOp();
1792
+
1793
+ for (int i = 0; i < 2; i++) {
1794
+ if (!needContent[i] && !needContour[i]) {
1795
+ continue;
1796
+ }
1797
+ drawArgs.excludeEffects = static_cast<bool>(i);
1798
+ auto group = std::make_unique<LayerStyleSourceGroup>();
1799
+
1800
+ bool allContourMatch = false;
1801
+ if (needContour[i]) {
1802
+ LayerStyleSourceEntry contourEntry = {};
1803
+ contourEntry.image =
1804
+ getContentContourImage(drawArgs, contentScale, &contourEntry.offset, &allContourMatch);
1805
+ if (contourEntry.image == nullptr) {
1806
+ return nullptr;
1807
+ }
1808
+ if (allContourMatch) {
1809
+ group->content = contourEntry;
1810
+ needContent[i] = false;
1811
+ }
1812
+ group->contour = std::move(contourEntry);
1813
+ }
1814
+
1815
+ if (needContent[i]) {
1816
+ OpaqueContext opaqueContext;
1817
+ auto* contourCanvas = opaqueContext.beginRecording();
1818
+ contourCanvas->scale(contentScale, contentScale);
1819
+ drawContents(drawArgs, contourCanvas, 1.0f);
1820
+ auto picture = opaqueContext.finishRecordingAsPicture();
1821
+ group->content.image = ToImageWithOffset(std::move(picture), &group->content.offset, nullptr,
1822
+ args.dstColorSpace);
1823
+ if (group->content.image == nullptr) {
1824
+ return nullptr;
1825
+ }
1826
+ }
1827
+
1828
+ source->groups[i] = std::move(group);
1829
+ }
1830
+
1831
+ if (needContour[0] || needContour[1]) {
1832
+ // TODO: The contour shape should have the same semantics as the contour image,
1833
+ // covering the entire subtree content. Contour should be encapsulated as a composite
1834
+ // class that records Picture data containing draw instructions, with a new interface
1835
+ // to parse Shape from the Picture data. This ensures the Image and Shape inside
1836
+ // Contour have consistent semantics. The layer's clip region should also be stored
1837
+ // within Contour.
1838
+ source->contentShape = getContentShape();
1839
+ }
1840
+
1841
+ return source;
1842
+ }
1843
+
1844
+ void Layer::drawLayerStyles(const DrawArgs& args, Canvas* canvas, float alpha,
1845
+ const LayerStyleSource* source, LayerStylePosition position) {
1846
+ DEBUG_ASSERT(source != nullptr && !FloatNearlyZero(source->contentScale));
1847
+ for (const auto& layerStyle : _layerStyles) {
1848
+ DEBUG_ASSERT(layerStyle != nullptr);
1849
+ if (layerStyle->position() != position) {
1850
+ continue;
1851
+ }
1852
+ if (layerStyle->extraSourceType() == LayerStyleExtraSourceType::Background) {
1853
+ BackgroundHandler::DispatchOrSkip(args, canvas, this, alpha, layerStyle.get(), source);
1854
+ continue;
1855
+ }
1856
+ drawLayerStyleDefault(args, canvas, alpha, layerStyle.get(), source);
1857
+ }
1858
+ }
1859
+
1860
+ float Layer::drawBackgroundLayers(const DrawArgs& args, Canvas* canvas) {
1861
+ if (!_parent) {
1862
+ return _alpha;
1863
+ }
1864
+ // Bottom-up recursion grounds at the root, then unwinds painting in this order per frame:
1865
+ // parent's background -> parent's Below styles -> parent content -> siblings of `this` that
1866
+ // come before `this`. The current frame's `this` is the parent's stopChild, so siblings at or
1867
+ // after `this` are skipped.
1868
+ auto currentAlpha = _parent->drawBackgroundLayers(args, canvas);
1869
+ auto parentSource = _parent->getLayerStyleSource(args, canvas->getMatrix());
1870
+ _parent->drawContents(args, canvas, currentAlpha, parentSource.get(), this);
1871
+ canvas->concat(getMatrixWithScrollRect().asMatrix());
1872
+ if (_scrollRect) {
1873
+ canvas->clipRect(*_scrollRect, bitFields.allowsEdgeAntialiasing);
1874
+ }
1875
+ return currentAlpha * _alpha;
1876
+ }
1877
+
1878
+ std::shared_ptr<Image> Layer::synthesizeBackgroundImage(const DrawArgs& args, float contentScale,
1879
+ Point* offset) {
1880
+ if (FloatNearlyZero(contentScale)) {
1881
+ return nullptr;
1882
+ }
1883
+ auto bounds = getBounds();
1884
+ bounds.scale(contentScale, contentScale);
1885
+ bounds.roundOut();
1886
+ if (bounds.isEmpty()) {
1887
+ return nullptr;
1888
+ }
1889
+ auto localToGlobalMatrix = getGlobalMatrix().asMatrix();
1890
+ Matrix globalToLocalMatrix = Matrix::I();
1891
+ if (!localToGlobalMatrix.invert(&globalToLocalMatrix)) {
1892
+ return nullptr;
1893
+ }
1894
+
1895
+ PictureRecorder recorder = {};
1896
+ auto* recordingCanvas = recorder.beginRecording();
1897
+ recordingCanvas->scale(contentScale, contentScale);
1898
+ recordingCanvas->concat(globalToLocalMatrix);
1899
+
1900
+ // Sub-walk must not re-enter the consumer's fallback (which would recurse forever on layers
1901
+ // with their own background-sourced styles up the chain). Hand it a NoOp handler instead — that
1902
+ // also short-circuits Below style dispatch for backdrop styles encountered along the way, which
1903
+ // matches the semantics of drawing pure backdrop content.
1904
+ DrawArgs subArgs = args;
1905
+ subArgs.backgroundHandler = BackgroundHandler::NoOp();
1906
+ subArgs.excludeEffects = false;
1907
+
1908
+ auto currentAlpha = drawBackgroundLayers(subArgs, recordingCanvas);
1909
+ auto belowSource = getLayerStyleSource(subArgs, recordingCanvas->getMatrix());
1910
+ if (belowSource) {
1911
+ drawLayerStyles(subArgs, recordingCanvas, currentAlpha, belowSource.get(),
1912
+ LayerStylePosition::Below);
1913
+ }
1914
+
1915
+ auto picture = recorder.finishRecordingAsPicture();
1916
+ if (picture == nullptr) {
1917
+ return nullptr;
1918
+ }
1919
+ return ToImageWithOffset(std::move(picture), offset, &bounds, args.dstColorSpace);
1920
+ }
1921
+
1922
+ void Layer::drawLayerStyleDefault(const DrawArgs& /*args*/, Canvas* canvas, float alpha,
1923
+ LayerStyle* layerStyle, const LayerStyleSource* source) {
1924
+ DEBUG_ASSERT(source != nullptr && !FloatNearlyZero(source->contentScale));
1925
+ DEBUG_ASSERT(layerStyle->extraSourceType() != LayerStyleExtraSourceType::Background);
1926
+ auto groupIndex = static_cast<int>(layerStyle->excludeChildEffects());
1927
+ auto* group = source->groups[groupIndex].get();
1928
+ if (group == nullptr) {
1929
+ return;
1930
+ }
1931
+
1932
+ auto& contentEntry = group->content;
1933
+ // Apply the content transform matrix to canvas so that rendering happens at the final scale,
1934
+ // avoiding blurry results that would come from baking contentScale into a picture recording.
1935
+ AutoCanvasRestore restoreCanvas(canvas);
1936
+ auto matrix = Matrix::MakeScale(1.f / source->contentScale, 1.f / source->contentScale);
1937
+ matrix.preTranslate(contentEntry.offset.x, contentEntry.offset.y);
1938
+ canvas->concat(matrix);
1939
+ LayerStyleInput styleInput = {};
1940
+ styleInput.content = contentEntry.image;
1941
+ styleInput.contentOffset = contentEntry.offset;
1942
+ styleInput.contentScale = source->contentScale;
1943
+ if (layerStyle->extraSourceType() == LayerStyleExtraSourceType::Contour) {
1944
+ auto contourImage = group->contour.has_value() ? group->contour->image : nullptr;
1945
+ auto contourOffset =
1946
+ contourImage ? group->contour->offset - contentEntry.offset : Point::Zero();
1947
+ // contour shape may be nullopt when the layer has no simple vector content (e.g. a group
1948
+ // layer with only children).
1949
+ styleInput.extraSource = std::make_shared<ContourInputSource>(
1950
+ std::move(contourImage), contourOffset, source->contentShape);
1951
+ }
1952
+ layerStyle->draw(canvas, styleInput, alpha);
1953
+ }
1954
+
1955
+ bool Layer::getLayersUnderPointInternal(float x, float y,
1956
+ std::vector<std::shared_ptr<Layer>>* results) {
1957
+ bool hasLayerUnderPoint = false;
1958
+ for (auto item = _children.rbegin(); item != _children.rend(); ++item) {
1959
+ const auto& childLayer = *item;
1960
+ if (!childLayer->visible()) {
1961
+ continue;
1962
+ }
1963
+
1964
+ if (nullptr != childLayer->_scrollRect) {
1965
+ auto pointInChildSpace = childLayer->globalToLocal(Point::Make(x, y));
1966
+ if (!childLayer->_scrollRect->contains(pointInChildSpace.x, pointInChildSpace.y)) {
1967
+ continue;
1968
+ }
1969
+ }
1970
+
1971
+ if (nullptr != childLayer->_mask) {
1972
+ if (!childLayer->_mask->hitTestPoint(x, y)) {
1973
+ continue;
1974
+ }
1975
+ }
1976
+
1977
+ if (childLayer->getLayersUnderPointInternal(x, y, results)) {
1978
+ hasLayerUnderPoint = true;
1979
+ }
1980
+ }
1981
+
1982
+ if (hasLayerUnderPoint) {
1983
+ results->push_back(shared_from_this());
1984
+ } else {
1985
+ auto content = getContent();
1986
+ if (nullptr != content) {
1987
+ auto layerBoundsRect = content->getBounds();
1988
+ auto localPoint = globalToLocal(Point::Make(x, y));
1989
+ if (layerBoundsRect.contains(localPoint.x, localPoint.y)) {
1990
+ results->push_back(shared_from_this());
1991
+ hasLayerUnderPoint = true;
1992
+ }
1993
+ }
1994
+ }
1995
+
1996
+ return hasLayerUnderPoint;
1997
+ }
1998
+
1999
+ bool Layer::hasValidMask() const {
2000
+ return _mask && _mask->root() == root() && _mask->bitFields.visible;
2001
+ }
2002
+
2003
+ void Layer::updateRenderBounds(std::shared_ptr<RegionTransformer> transformer, bool forceDirty) {
2004
+ if (!forceDirty && !bitFields.dirtyDescendents) {
2005
+ if (maxBackgroundOutset > 0 || bitFields.hasBlendMode) {
2006
+ propagateLayerState();
2007
+ if (_root->hasDirtyRegions()) {
2008
+ checkBackgroundStyles(transformer);
2009
+ }
2010
+ }
2011
+ return;
2012
+ }
2013
+ maxBackgroundOutset = 0;
2014
+ minBackgroundOutset = std::numeric_limits<float>::max();
2015
+ auto contentScale = 1.0f;
2016
+ if (!_layerStyles.empty() || !_filters.empty()) {
2017
+ // Filters and styles interrupt 3D rendering context, so non-root layers inside 3D rendering
2018
+ // context can ignore parent filters and styles when calculating dirty regions.
2019
+ DEBUG_ASSERT(!canPreserve3D());
2020
+ if (transformer) {
2021
+ contentScale = transformer->getMaxScale();
2022
+ }
2023
+ transformer = RegionTransformer::MakeFromFilters(_filters, 1.0f, std::move(transformer));
2024
+ transformer = RegionTransformer::MakeFromStyles(_layerStyles, 1.0f, std::move(transformer));
2025
+ }
2026
+ // Snapshot the root dirty list before touching this layer's own content or descending into
2027
+ // children. Only rects that existed before this layer's subtree ran contribute to this layer's
2028
+ // background-blur sampling input; anything produced below (this layer's own content or its
2029
+ // descendants) paints above the blur result and must not participate in blur dirty expansion.
2030
+ // The snapshot costs O(MAX_DIRTY_REGIONS) = O(1) per blur-capable layer.
2031
+ std::vector<Rect> backgroundSourceRects = {};
2032
+ for (const auto& style : _layerStyles) {
2033
+ if (style && style->extraSourceType() == LayerStyleExtraSourceType::Background) {
2034
+ backgroundSourceRects = _root->currentDirtyRects();
2035
+ break;
2036
+ }
2037
+ }
2038
+ auto content = getContent();
2039
+ if (bitFields.dirtyContentBounds || (forceDirty && content)) {
2040
+ if (contentBounds) {
2041
+ _root->invalidateRect(*contentBounds);
2042
+ } else {
2043
+ contentBounds = new Rect();
2044
+ }
2045
+ if (content) {
2046
+ *contentBounds = content->getBounds();
2047
+ if (transformer) {
2048
+ transformer->transform(contentBounds);
2049
+ }
2050
+ _root->invalidateRect(*contentBounds);
2051
+ } else {
2052
+ contentBounds->setEmpty();
2053
+ }
2054
+ bitFields.dirtyContentBounds = false;
2055
+ }
2056
+ if (contentBounds) {
2057
+ renderBounds = *contentBounds;
2058
+ } else {
2059
+ renderBounds.setEmpty();
2060
+ }
2061
+ for (auto& child : _children) {
2062
+ if (!child->bitFields.visible || child->_alpha <= 0) {
2063
+ if (child->bitFields.dirtyTransform) {
2064
+ _root->invalidateRect(child->renderBounds);
2065
+ child->renderBounds = {};
2066
+ }
2067
+ child->bitFields.dirtyTransform = false;
2068
+ continue;
2069
+ }
2070
+ auto childMatrix = child->getMatrixWithScrollRect();
2071
+ std::shared_ptr<RegionTransformer> childTransformer = nullptr;
2072
+ if (canPreserve3D() || child->canPreserve3D()) {
2073
+ // Child is inside a 3D rendering context - allow combining matrices.
2074
+ childTransformer = RegionTransformer::MakeFromMatrix3D(childMatrix, transformer, true);
2075
+ } else {
2076
+ // Child is outside 3D context - project to 2D plane.
2077
+ childTransformer = RegionTransformer::MakeFromMatrix(childMatrix.asMatrix(), transformer);
2078
+ }
2079
+ std::optional<Rect> clipRect = std::nullopt;
2080
+ if (child->_scrollRect) {
2081
+ clipRect = *child->_scrollRect;
2082
+ }
2083
+ if (child->hasValidMask()) {
2084
+ auto maskBounds = child->_mask->getBounds(child.get());
2085
+ if (clipRect.has_value()) {
2086
+ if (!clipRect->intersect(maskBounds)) {
2087
+ if (child->bitFields.dirtyTransform) {
2088
+ _root->invalidateRect(child->renderBounds);
2089
+ child->renderBounds = {};
2090
+ }
2091
+ child->bitFields.dirtyTransform = false;
2092
+ continue;
2093
+ }
2094
+ } else {
2095
+ clipRect = maskBounds;
2096
+ }
2097
+ }
2098
+ if (clipRect.has_value()) {
2099
+ childTransformer = RegionTransformer::MakeFromClip(*clipRect, std::move(childTransformer));
2100
+ }
2101
+ auto childForceDirty = forceDirty || child->bitFields.dirtyTransform;
2102
+ child->updateRenderBounds(std::move(childTransformer), childForceDirty);
2103
+ child->bitFields.dirtyTransform = false;
2104
+ if (!child->maskOwner) {
2105
+ renderBounds.join(child->renderBounds);
2106
+ }
2107
+ }
2108
+ auto backOutset = 0.f;
2109
+ if (!renderBounds.isEmpty()) {
2110
+ for (auto& style : _layerStyles) {
2111
+ DEBUG_ASSERT(style != nullptr);
2112
+ if (style->extraSourceType() != LayerStyleExtraSourceType::Background) {
2113
+ continue;
2114
+ }
2115
+ auto outset = style->filterBackground(Rect::MakeEmpty(), contentScale);
2116
+ backOutset = std::max(backOutset, outset.right);
2117
+ backOutset = std::max(backOutset, outset.bottom);
2118
+ }
2119
+ // When a layer has both background styles and filters, the outer filter needs to sample
2120
+ // beyond the background content area. Expand the background outset to include the filter's
2121
+ // sampling range. Use Reverse direction to calculate required input bounds.
2122
+ if (backOutset > 0 && !_filters.empty()) {
2123
+ auto baseBounds = mapOutputBoundsToInput(Rect::MakeEmpty(), contentScale);
2124
+ if (!baseBounds.isEmpty()) {
2125
+ auto maxOutset =
2126
+ std::max({-baseBounds.left, -baseBounds.top, baseBounds.right, baseBounds.bottom});
2127
+ backOutset += maxOutset;
2128
+ }
2129
+ }
2130
+ }
2131
+ if (backOutset > 0) {
2132
+ maxBackgroundOutset = std::max(backOutset, maxBackgroundOutset);
2133
+ minBackgroundOutset = std::min(backOutset, minBackgroundOutset);
2134
+ updateBackgroundBounds(contentScale, backgroundSourceRects);
2135
+ }
2136
+ if (bitFields.blendMode != static_cast<uint8_t>(BlendMode::SrcOver) ||
2137
+ (content && content->hasBlendMode())) {
2138
+ bitFields.hasBlendMode = true;
2139
+ }
2140
+ propagateLayerState();
2141
+ bitFields.dirtyDescendents = false;
2142
+ }
2143
+
2144
+ void Layer::checkBackgroundStyles(std::shared_ptr<RegionTransformer> transformer) {
2145
+ for (auto& child : _children) {
2146
+ if (child->maxBackgroundOutset <= 0 || !child->bitFields.visible || child->_alpha <= 0) {
2147
+ continue;
2148
+ }
2149
+ auto childMatrix = child->getMatrixWithScrollRect();
2150
+ auto childTransformer = RegionTransformer::MakeFromMatrix(childMatrix.asMatrix(), transformer);
2151
+ child->checkBackgroundStyles(childTransformer);
2152
+ }
2153
+ // Fast path: this layer's subtree did not change, so every current dirty rect originates from
2154
+ // outside this subtree and is a legitimate blur input candidate. Passing the live list is safe
2155
+ // because invalidateBackground collects all expanded rects locally before re-appending them.
2156
+ updateBackgroundBounds(transformer ? transformer->getMaxScale() : 1.0f,
2157
+ _root->currentDirtyRects());
2158
+ }
2159
+
2160
+ void Layer::updateBackgroundBounds(float contentScale, const std::vector<Rect>& sourceRects) {
2161
+ for (auto& style : _layerStyles) {
2162
+ DEBUG_ASSERT(style != nullptr);
2163
+ if (style->extraSourceType() == LayerStyleExtraSourceType::Background) {
2164
+ _root->invalidateBackground(renderBounds, style.get(), contentScale, sourceRects);
2165
+ }
2166
+ }
2167
+ if (bitFields.hasBlendMode) {
2168
+ _root->invalidateBackground(renderBounds, nullptr, contentScale, sourceRects);
2169
+ }
2170
+ }
2171
+
2172
+ void Layer::propagateLayerState() {
2173
+ auto layer = _parent;
2174
+ while (layer) {
2175
+ bool change = false;
2176
+ if (layer->maxBackgroundOutset < maxBackgroundOutset) {
2177
+ layer->maxBackgroundOutset = maxBackgroundOutset;
2178
+ change = true;
2179
+ }
2180
+ if (layer->minBackgroundOutset > minBackgroundOutset) {
2181
+ layer->minBackgroundOutset = minBackgroundOutset;
2182
+ change = true;
2183
+ }
2184
+ // Only propagate hasBlendMode if this layer actually has a blend mode
2185
+ if (bitFields.hasBlendMode && !layer->bitFields.hasBlendMode) {
2186
+ layer->bitFields.hasBlendMode = true;
2187
+ change = true;
2188
+ }
2189
+ if (!change) {
2190
+ break;
2191
+ }
2192
+ layer = layer->_parent;
2193
+ }
2194
+ }
2195
+
2196
+ bool Layer::hasBackgroundStyle() {
2197
+ if (!bitFields.dirtyDescendents) {
2198
+ return maxBackgroundOutset > 0;
2199
+ }
2200
+ for (const auto& style : _layerStyles) {
2201
+ DEBUG_ASSERT(style != nullptr);
2202
+ if (style->extraSourceType() == LayerStyleExtraSourceType::Background) {
2203
+ return true;
2204
+ }
2205
+ }
2206
+ return hasDescendantBackgroundStyle();
2207
+ }
2208
+
2209
+ bool Layer::hasDescendantBackgroundStyle() {
2210
+ for (const auto& child : _children) {
2211
+ if (child->hasBackgroundStyle()) {
2212
+ return true;
2213
+ }
2214
+ }
2215
+ return false;
2216
+ }
2217
+
2218
+ std::shared_ptr<BackgroundSource> Layer::createBackgroundSource(
2219
+ Context* context, const Rect& drawRect, const Matrix& viewMatrix, bool fullLayer,
2220
+ std::shared_ptr<ColorSpace> colorSpace) const {
2221
+ if (fullLayer) {
2222
+ return BackgroundSource::Make(context, drawRect, 0, 0, viewMatrix, colorSpace);
2223
+ }
2224
+ if (maxBackgroundOutset <= 0.0f) {
2225
+ return nullptr;
2226
+ }
2227
+ auto scale = viewMatrix.getMaxScale();
2228
+ return BackgroundSource::Make(context, drawRect, maxBackgroundOutset * scale,
2229
+ minBackgroundOutset * scale, viewMatrix, colorSpace);
2230
+ }
2231
+
2232
+ bool Layer::canPreserve3D() const {
2233
+ return _preserve3D && _filters.empty() && _layerStyles.empty() && !hasValidMask() &&
2234
+ _scrollRect == nullptr;
2235
+ }
2236
+
2237
+ void Layer::invalidateSubtree() {
2238
+ bitFields.staticSubtree = false;
2239
+ subtreeCache = nullptr;
2240
+ localBounds = nullptr;
2241
+ }
2242
+
2243
+ void Layer::updateStaticSubtreeFlags() {
2244
+ if (bitFields.staticSubtree) {
2245
+ return;
2246
+ }
2247
+ bitFields.staticSubtree = true;
2248
+ for (const auto& child : _children) {
2249
+ child->updateStaticSubtreeFlags();
2250
+ }
2251
+ }
2252
+
2253
+ std::optional<StyledShape> Layer::getContentShape() {
2254
+ return onGetContentShape();
2255
+ }
2256
+
2257
+ } // namespace tgfx