@shopify/react-native-skia 0.1.233 → 0.1.236

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. package/android/CMakeLists.txt +0 -1
  2. package/android/cpp/jni/JniSkiaManager.cpp +0 -1
  3. package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -1
  4. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +1 -1
  5. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +1 -2
  6. package/cpp/api/JsiSkTypefaceFactory.h +2 -1
  7. package/cpp/skia/include/android/AHardwareBufferUtils.h +23 -0
  8. package/cpp/skia/include/android/GrAHardwareBufferUtils.h +2 -0
  9. package/cpp/skia/include/android/graphite/SurfaceAndroid.h +59 -0
  10. package/cpp/skia/include/codec/SkAvifDecoder.h +1 -1
  11. package/cpp/skia/include/codec/SkBmpDecoder.h +1 -1
  12. package/cpp/skia/include/codec/SkCodec.h +21 -3
  13. package/cpp/skia/include/codec/SkGifDecoder.h +1 -1
  14. package/cpp/skia/include/codec/SkIcoDecoder.h +1 -1
  15. package/cpp/skia/include/codec/SkJpegDecoder.h +1 -1
  16. package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -1
  17. package/cpp/skia/include/codec/SkPngDecoder.h +1 -1
  18. package/cpp/skia/include/codec/SkRawDecoder.h +1 -1
  19. package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -1
  20. package/cpp/skia/include/codec/SkWebpDecoder.h +1 -1
  21. package/cpp/skia/include/config/SkUserConfig.h +3 -1
  22. package/cpp/skia/include/core/SkCanvas.h +66 -37
  23. package/cpp/skia/include/core/SkColorFilter.h +5 -2
  24. package/cpp/skia/include/core/SkContourMeasure.h +1 -0
  25. package/cpp/skia/include/core/SkDocument.h +1 -0
  26. package/cpp/skia/include/core/SkFont.h +14 -24
  27. package/cpp/skia/include/core/SkFontArguments.h +1 -1
  28. package/cpp/skia/include/core/SkFontMetrics.h +1 -1
  29. package/cpp/skia/include/core/SkFontMgr.h +0 -7
  30. package/cpp/skia/include/core/SkGraphics.h +13 -0
  31. package/cpp/skia/include/core/SkMesh.h +9 -13
  32. package/cpp/skia/include/core/SkMilestone.h +1 -1
  33. package/cpp/skia/include/core/SkPathMeasure.h +2 -0
  34. package/cpp/skia/include/core/SkSerialProcs.h +29 -11
  35. package/cpp/skia/include/core/SkSize.h +3 -3
  36. package/cpp/skia/include/core/SkStream.h +3 -13
  37. package/cpp/skia/include/core/SkSurface.h +6 -3
  38. package/cpp/skia/include/core/SkSurfaceProps.h +2 -4
  39. package/cpp/skia/include/core/SkTraceMemoryDump.h +15 -0
  40. package/cpp/skia/include/core/SkTypeface.h +8 -56
  41. package/cpp/skia/include/core/SkTypes.h +8 -0
  42. package/cpp/skia/include/core/SkVertices.h +1 -1
  43. package/cpp/skia/include/docs/SkMultiPictureDocument.h +53 -0
  44. package/cpp/skia/include/docs/SkPDFDocument.h +11 -0
  45. package/cpp/skia/include/effects/SkGradientShader.h +9 -0
  46. package/cpp/skia/include/effects/SkRuntimeEffect.h +3 -7
  47. package/cpp/skia/include/gpu/GrBackendSemaphore.h +33 -47
  48. package/cpp/skia/include/gpu/GrBackendSurface.h +2 -3
  49. package/cpp/skia/include/gpu/GrContextOptions.h +0 -6
  50. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +44 -28
  51. package/cpp/skia/include/gpu/GrDirectContext.h +12 -31
  52. package/cpp/skia/include/gpu/GrTypes.h +1 -16
  53. package/cpp/skia/include/gpu/MutableTextureState.h +35 -80
  54. package/cpp/skia/include/gpu/ShaderErrorHandler.h +11 -1
  55. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +2 -2
  56. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +1 -1
  57. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +3 -2
  58. package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSemaphore.h +20 -0
  59. package/cpp/skia/include/gpu/ganesh/vk/GrVkDirectContext.h +30 -0
  60. package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -1
  61. package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -0
  62. package/cpp/skia/include/gpu/gl/glx/GrGLMakeGLXInterface.h +6 -0
  63. package/cpp/skia/include/gpu/graphite/BackendSemaphore.h +3 -3
  64. package/cpp/skia/include/gpu/graphite/BackendTexture.h +39 -27
  65. package/cpp/skia/include/gpu/graphite/Context.h +39 -13
  66. package/cpp/skia/include/gpu/graphite/ContextOptions.h +2 -0
  67. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +2 -1
  68. package/cpp/skia/include/gpu/graphite/Image.h +106 -87
  69. package/cpp/skia/include/gpu/graphite/Recorder.h +24 -3
  70. package/cpp/skia/include/gpu/graphite/Surface.h +7 -2
  71. package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +41 -2
  72. package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +11 -6
  73. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -2
  74. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +6 -6
  75. package/cpp/skia/include/gpu/mock/GrMockTypes.h +1 -0
  76. package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +1 -1
  77. package/cpp/skia/include/gpu/vk/GrVkTypes.h +1 -44
  78. package/cpp/skia/include/gpu/vk/VulkanExtensions.h +1 -1
  79. package/cpp/skia/include/gpu/vk/VulkanMutableTextureState.h +25 -0
  80. package/cpp/skia/include/gpu/vk/VulkanTypes.h +44 -0
  81. package/cpp/skia/include/ports/SkFontConfigInterface.h +3 -6
  82. package/cpp/skia/include/private/SkEncodedInfo.h +5 -0
  83. package/cpp/skia/include/private/SkExif.h +102 -0
  84. package/cpp/skia/include/private/SkGainmapInfo.h +11 -1
  85. package/cpp/skia/include/private/base/SkAssert.h +16 -0
  86. package/cpp/skia/include/private/base/SkDeque.h +2 -7
  87. package/cpp/skia/include/private/base/SkLoadUserConfig.h +1 -1
  88. package/cpp/skia/include/private/base/SkTArray.h +69 -28
  89. package/cpp/skia/include/private/base/SkThreadAnnotations.h +18 -5
  90. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +26 -30
  91. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +4 -3
  92. package/cpp/skia/include/private/chromium/SkImageChromium.h +1 -1
  93. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +8 -6
  94. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +29 -0
  95. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +12 -9
  96. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +16 -11
  97. package/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h +2 -2
  98. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +312 -0
  99. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +77 -0
  100. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +446 -0
  101. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +67 -0
  102. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +36 -0
  103. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +9 -2
  104. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +31 -3
  105. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +10624 -5716
  106. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +2 -1
  107. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +2 -1
  108. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +28 -1
  109. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +2 -1
  110. package/cpp/skia/include/utils/mac/SkCGUtils.h +23 -11
  111. package/cpp/skia/modules/skcms/skcms.h +2 -410
  112. package/cpp/skia/modules/skcms/src/Transform_inl.h +831 -704
  113. package/cpp/skia/modules/skcms/src/skcms_Transform.h +161 -0
  114. package/cpp/skia/modules/skcms/src/skcms_internals.h +136 -0
  115. package/cpp/skia/modules/skcms/src/skcms_public.h +404 -0
  116. package/cpp/skia/modules/skparagraph/include/FontArguments.h +1 -1
  117. package/cpp/skia/modules/skparagraph/include/FontCollection.h +2 -0
  118. package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -2
  119. package/cpp/skia/modules/skparagraph/include/TextStyle.h +4 -3
  120. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +1 -3
  121. package/cpp/skia/modules/skresources/include/SkResources.h +28 -17
  122. package/cpp/skia/modules/skunicode/include/SkUnicode.h +12 -0
  123. package/cpp/skia/modules/svg/include/SkSVGDOM.h +4 -1
  124. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +4 -1
  125. package/cpp/skia/src/base/SkUTF.h +7 -0
  126. package/cpp/skia/src/core/SkTHash.h +20 -8
  127. package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +3 -2
  128. package/lib/commonjs/dom/nodes/JsiSkDOM.js +56 -57
  129. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  130. package/lib/commonjs/external/reanimated/index.d.ts +1 -0
  131. package/lib/commonjs/external/reanimated/index.js +13 -0
  132. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  133. package/lib/commonjs/external/reanimated/interpolators.js +16 -2
  134. package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
  135. package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +1 -0
  136. package/lib/commonjs/external/reanimated/moduleWrapper.js +5 -3
  137. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  138. package/lib/commonjs/external/reanimated/textures.d.ts +5 -0
  139. package/lib/commonjs/external/reanimated/textures.js +52 -0
  140. package/lib/commonjs/external/reanimated/textures.js.map +1 -0
  141. package/lib/commonjs/headless/index.js +1 -1
  142. package/lib/commonjs/headless/index.js.map +1 -1
  143. package/lib/commonjs/mock/index.js +3 -0
  144. package/lib/commonjs/mock/index.js.map +1 -1
  145. package/lib/commonjs/renderer/Canvas.js +6 -5
  146. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  147. package/lib/commonjs/renderer/Container.d.ts +1 -1
  148. package/lib/commonjs/renderer/Container.js +2 -1
  149. package/lib/commonjs/renderer/Container.js.map +1 -1
  150. package/lib/commonjs/renderer/Offscreen.d.ts +1 -0
  151. package/lib/commonjs/renderer/Offscreen.js +18 -5
  152. package/lib/commonjs/renderer/Offscreen.js.map +1 -1
  153. package/lib/commonjs/renderer/Reconciler.d.ts +1 -1
  154. package/lib/commonjs/renderer/Reconciler.js +7 -4
  155. package/lib/commonjs/renderer/Reconciler.js.map +1 -1
  156. package/lib/commonjs/skia/types/Matrix4.d.ts +2 -2
  157. package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
  158. package/lib/commonjs/skia/types/Shader/Shader.d.ts +1 -1
  159. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  160. package/lib/commonjs/skia/web/JsiSkPath.d.ts +2 -2
  161. package/lib/commonjs/skia/web/JsiSkPath.js +10 -2
  162. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  163. package/lib/commonjs/views/SkiaJSDomView.d.ts +31 -0
  164. package/lib/commonjs/views/SkiaJSDomView.js +161 -0
  165. package/lib/commonjs/views/SkiaJSDomView.js.map +1 -0
  166. package/lib/commonjs/views/SkiaJSDomView.web.d.ts +1 -0
  167. package/lib/commonjs/views/SkiaJSDomView.web.js +14 -0
  168. package/lib/commonjs/views/SkiaJSDomView.web.js.map +1 -0
  169. package/lib/module/dom/nodes/JsiSkDOM.d.ts +3 -2
  170. package/lib/module/dom/nodes/JsiSkDOM.js +56 -56
  171. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  172. package/lib/module/external/reanimated/index.d.ts +1 -0
  173. package/lib/module/external/reanimated/index.js +1 -0
  174. package/lib/module/external/reanimated/index.js.map +1 -1
  175. package/lib/module/external/reanimated/interpolators.js +15 -2
  176. package/lib/module/external/reanimated/interpolators.js.map +1 -1
  177. package/lib/module/external/reanimated/moduleWrapper.d.ts +1 -0
  178. package/lib/module/external/reanimated/moduleWrapper.js +3 -2
  179. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  180. package/lib/module/external/reanimated/textures.d.ts +5 -0
  181. package/lib/module/external/reanimated/textures.js +35 -0
  182. package/lib/module/external/reanimated/textures.js.map +1 -0
  183. package/lib/module/headless/index.js +1 -1
  184. package/lib/module/headless/index.js.map +1 -1
  185. package/lib/module/mock/index.js +3 -0
  186. package/lib/module/mock/index.js.map +1 -1
  187. package/lib/module/renderer/Canvas.js +5 -4
  188. package/lib/module/renderer/Canvas.js.map +1 -1
  189. package/lib/module/renderer/Container.d.ts +1 -1
  190. package/lib/module/renderer/Container.js +2 -1
  191. package/lib/module/renderer/Container.js.map +1 -1
  192. package/lib/module/renderer/Offscreen.d.ts +1 -0
  193. package/lib/module/renderer/Offscreen.js +11 -3
  194. package/lib/module/renderer/Offscreen.js.map +1 -1
  195. package/lib/module/renderer/Reconciler.d.ts +1 -1
  196. package/lib/module/renderer/Reconciler.js +7 -4
  197. package/lib/module/renderer/Reconciler.js.map +1 -1
  198. package/lib/module/skia/types/Matrix4.d.ts +2 -2
  199. package/lib/module/skia/types/Matrix4.js.map +1 -1
  200. package/lib/module/skia/types/Shader/Shader.d.ts +1 -1
  201. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  202. package/lib/module/skia/web/JsiSkPath.d.ts +2 -2
  203. package/lib/module/skia/web/JsiSkPath.js +10 -2
  204. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  205. package/lib/module/views/SkiaJSDomView.d.ts +31 -0
  206. package/lib/module/views/SkiaJSDomView.js +136 -0
  207. package/lib/module/views/SkiaJSDomView.js.map +1 -0
  208. package/lib/module/views/SkiaJSDomView.web.d.ts +1 -0
  209. package/lib/module/views/SkiaJSDomView.web.js +2 -0
  210. package/lib/module/views/SkiaJSDomView.web.js.map +1 -0
  211. package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +3 -2
  212. package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
  213. package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +1 -0
  214. package/lib/typescript/src/external/reanimated/textures.d.ts +5 -0
  215. package/lib/typescript/src/renderer/Container.d.ts +1 -1
  216. package/lib/typescript/src/renderer/Offscreen.d.ts +1 -0
  217. package/lib/typescript/src/renderer/Reconciler.d.ts +1 -1
  218. package/lib/typescript/src/skia/types/Matrix4.d.ts +2 -2
  219. package/lib/typescript/src/skia/types/Shader/Shader.d.ts +1 -1
  220. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +2 -2
  221. package/lib/typescript/src/views/SkiaJSDomView.d.ts +31 -0
  222. package/lib/typescript/src/views/SkiaJSDomView.web.d.ts +1 -0
  223. package/libs/android/arm64-v8a/libskia.a +0 -0
  224. package/libs/android/arm64-v8a/libskottie.a +0 -0
  225. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  226. package/libs/android/arm64-v8a/libsksg.a +0 -0
  227. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  228. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  229. package/libs/android/arm64-v8a/libsvg.a +0 -0
  230. package/libs/android/armeabi-v7a/libskia.a +0 -0
  231. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  232. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  233. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  234. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  235. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  236. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  237. package/libs/android/x86/libskia.a +0 -0
  238. package/libs/android/x86/libskottie.a +0 -0
  239. package/libs/android/x86/libskparagraph.a +0 -0
  240. package/libs/android/x86/libsksg.a +0 -0
  241. package/libs/android/x86/libskshaper.a +0 -0
  242. package/libs/android/x86/libskunicode.a +0 -0
  243. package/libs/android/x86/libsvg.a +0 -0
  244. package/libs/android/x86_64/libskia.a +0 -0
  245. package/libs/android/x86_64/libskottie.a +0 -0
  246. package/libs/android/x86_64/libskparagraph.a +0 -0
  247. package/libs/android/x86_64/libsksg.a +0 -0
  248. package/libs/android/x86_64/libskshaper.a +0 -0
  249. package/libs/android/x86_64/libskunicode.a +0 -0
  250. package/libs/android/x86_64/libsvg.a +0 -0
  251. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  252. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  253. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  254. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  255. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  256. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  257. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  258. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  259. package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
  260. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  261. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  262. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  263. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  264. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  265. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  266. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  267. package/package.json +1 -1
  268. package/src/dom/nodes/JsiSkDOM.ts +55 -56
  269. package/src/external/reanimated/index.ts +1 -0
  270. package/src/external/reanimated/interpolators.ts +17 -3
  271. package/src/external/reanimated/moduleWrapper.ts +1 -0
  272. package/src/external/reanimated/textures.tsx +50 -0
  273. package/src/headless/index.ts +1 -1
  274. package/src/mock/index.ts +3 -0
  275. package/src/renderer/Canvas.tsx +4 -3
  276. package/src/renderer/Container.tsx +3 -2
  277. package/src/renderer/Offscreen.tsx +12 -3
  278. package/src/renderer/Reconciler.tsx +5 -2
  279. package/src/skia/types/Matrix4.ts +2 -2
  280. package/src/skia/types/Shader/Shader.ts +6 -1
  281. package/src/skia/web/JsiSkPath.ts +23 -3
  282. package/src/views/SkiaJSDomView.tsx +126 -0
  283. package/src/views/SkiaJSDomView.web.tsx +1 -0
  284. package/android/cpp/jni/include/JniSkiaDrawView.h +0 -90
  285. package/cpp/rnskia/RNSkJsView.cpp +0 -236
  286. package/cpp/rnskia/RNSkJsView.h +0 -121
  287. package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -142
  288. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +0 -107
  289. package/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +0 -32
  290. package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +0 -83
  291. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +0 -47
  292. package/cpp/skia/include/private/gpu/vk/VulkanTypesPriv.h +0 -57
  293. package/cpp/skia/include/utils/SkBase64.h +0 -53
  294. package/cpp/skia/modules/skcms/skcms_internal.h +0 -56
@@ -54,7 +54,6 @@ add_library(
54
54
  "${PROJECT_SOURCE_DIR}/../cpp/jsi/JsiPromises.cpp"
55
55
 
56
56
  "${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkManager.cpp"
57
- "${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkJsView.cpp"
58
57
  "${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkDomView.cpp"
59
58
  "${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkDispatchQueue.cpp"
60
59
 
@@ -5,7 +5,6 @@
5
5
  #include <string>
6
6
  #include <utility>
7
7
 
8
- #include "JniSkiaDrawView.h"
9
8
  #include <RNSkManager.h>
10
9
 
11
10
  namespace RNSkia {
@@ -4,7 +4,6 @@
4
4
  #include <string>
5
5
  #include <vector>
6
6
 
7
- #include <RNSkJsView.h>
8
7
  #include <RNSkOpenGLCanvasProvider.h>
9
8
  #include <android/native_window.h>
10
9
 
@@ -1,4 +1,4 @@
1
- #include <RNSkOpenGLCanvasProvider.h>
1
+ #include "RNSkOpenGLCanvasProvider.h"
2
2
 
3
3
  #include <memory>
4
4
 
@@ -4,8 +4,7 @@
4
4
 
5
5
  #include <memory>
6
6
 
7
- #include <RNSkJsView.h>
8
-
7
+ #include "RNSkView.h"
9
8
  #include "SkiaOpenGLSurfaceFactory.h"
10
9
  #include <android/native_window.h>
11
10
 
@@ -17,7 +17,8 @@ class JsiSkTypefaceFactory : public JsiSkHostObject {
17
17
  public:
18
18
  JSI_HOST_FUNCTION(MakeFreeTypeFaceFromData) {
19
19
  auto data = JsiSkData::fromValue(runtime, arguments[0]);
20
- auto typeface = SkFontMgr::RefDefault()->makeFromData(std::move(data));
20
+ auto fontMgr = JsiSkFontMgrFactory::getFontMgr(getContext());
21
+ auto typeface = fontMgr->makeFromData(std::move(data));
21
22
  if (typeface == nullptr) {
22
23
  return jsi::Value::null();
23
24
  }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright 2023 Google LLC
3
+ *
4
+ * Use of this source code is governed by a BSD-style license that can be
5
+ * found in the LICENSE file.
6
+ */
7
+ #ifndef AHardwareBufferUtils_DEFINED
8
+ #define AHardwareBufferUtils_DEFINED
9
+
10
+ #include "include/core/SkColorType.h"
11
+ #include "include/core/SkTypes.h"
12
+
13
+ #if __ANDROID_API__ >= 26
14
+
15
+ namespace AHardwareBufferUtils {
16
+
17
+ SkColorType GetSkColorTypeFromBufferFormat(uint32_t bufferFormat);
18
+
19
+ } // namespace AHardwareBufferUtils
20
+
21
+ #endif
22
+
23
+ #endif // AHardwareBufferUtils_DEFINED
@@ -22,6 +22,8 @@ extern "C" {
22
22
 
23
23
  namespace GrAHardwareBufferUtils {
24
24
 
25
+ // TODO: remove this function once Android has been updated to call the AHardwareBufferUtils
26
+ // version
25
27
  SkColorType GetSkColorTypeFromBufferFormat(uint32_t bufferFormat);
26
28
 
27
29
  #if !defined(SK_DISABLE_LEGACY_ANDROID_HW_UTILS)
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Copyright 2023 Google LLC
3
+ *
4
+ * Use of this source code is governed by a BSD-style license that can be
5
+ * found in the LICENSE file.
6
+ */
7
+
8
+ #ifndef SurfaceAndroid_DEFINED
9
+ #define SurfaceAndroid_DEFINED
10
+
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ struct AHardwareBuffer;
14
+ class SkColorSpace;
15
+ class SkSurface;
16
+ class SkSurfaceProps;
17
+
18
+ namespace skgpu::graphite {
19
+ class Recorder;
20
+ }
21
+
22
+ namespace SkSurfaces {
23
+
24
+ using ReleaseContext = void*;
25
+ using BufferReleaseProc = void (*)(ReleaseContext);
26
+
27
+ /** Private; only to be used by Android Framework.
28
+ Creates an SkSurface from an Android hardware buffer.
29
+
30
+ Upon success bufferReleaseProc is called when it is safe to delete the buffer in the
31
+ backend API (accounting only for use of the buffer by this surface). If SkSurface creation
32
+ fails bufferReleaseProc is called before this function returns.
33
+
34
+ Currently this is only supported for buffers that can be textured as well as rendered to.
35
+ In other words the buffer must have both AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT and
36
+ AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE usage bits.
37
+
38
+ @param recorder the applicable Graphite recorder
39
+ @param hardwareBuffer an Android hardware buffer
40
+ @param colorSpace range of colors; may be nullptr
41
+ @param surfaceProps LCD striping orientation and setting for device independent
42
+ fonts; may be nullptr
43
+ @param bufferReleaseProc function called when the buffer can be released
44
+ @param ReleaseContext state passed to bufferReleaseProc
45
+ @param fromWindow Whether or not the AHardwareBuffer is part of an Android Window.
46
+ Currently only used with Vulkan backend.
47
+ @return created SkSurface, or nullptr
48
+ */
49
+ SK_API sk_sp<SkSurface> WrapAndroidHardwareBuffer(skgpu::graphite::Recorder* recorder,
50
+ AHardwareBuffer* hardwareBuffer,
51
+ sk_sp<SkColorSpace> colorSpace,
52
+ const SkSurfaceProps* surfaceProps,
53
+ BufferReleaseProc = nullptr,
54
+ ReleaseContext = nullptr,
55
+ bool fromWindow = false);
56
+
57
+ } // namespace SkSurfaces
58
+
59
+ #endif // SurfaceAndroid_DEFINED
@@ -35,7 +35,7 @@ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
35
35
  SkCodec::Result*,
36
36
  SkCodecs::DecodeContext = nullptr);
37
37
 
38
- inline SkCodecs::Decoder Decoder() {
38
+ inline constexpr SkCodecs::Decoder Decoder() {
39
39
  return { "avif", IsAvif, Decode };
40
40
  }
41
41
 
@@ -35,7 +35,7 @@ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
35
35
  SkCodec::Result*,
36
36
  SkCodecs::DecodeContext = nullptr);
37
37
 
38
- inline SkCodecs::Decoder Decoder() {
38
+ inline constexpr SkCodecs::Decoder Decoder() {
39
39
  return { "bmp", IsBmp, Decode };
40
40
  }
41
41
 
@@ -14,6 +14,7 @@
14
14
  #include "include/core/SkRect.h"
15
15
  #include "include/core/SkRefCnt.h"
16
16
  #include "include/core/SkSize.h"
17
+ #include "include/core/SkSpan.h"
17
18
  #include "include/core/SkTypes.h"
18
19
  #include "include/core/SkYUVAPixmaps.h"
19
20
  #include "include/private/SkEncodedInfo.h"
@@ -23,7 +24,7 @@
23
24
  #include <cstddef>
24
25
  #include <functional>
25
26
  #include <memory>
26
- #include <string>
27
+ #include <string_view>
27
28
  #include <tuple>
28
29
  #include <vector>
29
30
 
@@ -46,6 +47,10 @@ namespace DM {
46
47
  class CodecSrc;
47
48
  } // namespace DM
48
49
 
50
+ namespace SkCodecs {
51
+ struct Decoder;
52
+ }
53
+
49
54
  /**
50
55
  * Abstraction layer directly on top of an image codec.
51
56
  */
@@ -175,7 +180,15 @@ public:
175
180
  * SkCodec takes ownership of it, and will delete it when done with it.
176
181
  */
177
182
  static std::unique_ptr<SkCodec> MakeFromStream(
178
- std::unique_ptr<SkStream>, Result* = nullptr,
183
+ std::unique_ptr<SkStream>,
184
+ SkSpan<const SkCodecs::Decoder> decoders,
185
+ Result* = nullptr,
186
+ SkPngChunkReader* = nullptr,
187
+ SelectionPolicy selectionPolicy = SelectionPolicy::kPreferStillImage);
188
+ // deprecated
189
+ static std::unique_ptr<SkCodec> MakeFromStream(
190
+ std::unique_ptr<SkStream>,
191
+ Result* = nullptr,
179
192
  SkPngChunkReader* = nullptr,
180
193
  SelectionPolicy selectionPolicy = SelectionPolicy::kPreferStillImage);
181
194
 
@@ -195,6 +208,10 @@ public:
195
208
  * If the PNG does not contain unknown chunks, the SkPngChunkReader
196
209
  * will not be used or modified.
197
210
  */
211
+ static std::unique_ptr<SkCodec> MakeFromData(sk_sp<SkData>,
212
+ SkSpan<const SkCodecs::Decoder> decoders,
213
+ SkPngChunkReader* = nullptr);
214
+ // deprecated
198
215
  static std::unique_ptr<SkCodec> MakeFromData(sk_sp<SkData>, SkPngChunkReader* = nullptr);
199
216
 
200
217
  virtual ~SkCodec();
@@ -1012,6 +1029,7 @@ private:
1012
1029
  friend class SkSampledCodec;
1013
1030
  friend class SkIcoCodec;
1014
1031
  friend class SkAndroidCodec; // for fEncodedInfo
1032
+ friend class SkPDFBitmap; // for fEncodedInfo
1015
1033
  };
1016
1034
 
1017
1035
  namespace SkCodecs {
@@ -1025,7 +1043,7 @@ using MakeFromStreamCallback = std::unique_ptr<SkCodec> (*)(std::unique_ptr<SkSt
1025
1043
  struct SK_API Decoder {
1026
1044
  // By convention, we use all lowercase letters and go with the primary filename extension.
1027
1045
  // For example "png", "jpg", "ico", "webp", etc
1028
- std::string id;
1046
+ std::string_view id;
1029
1047
  IsFormatCallback isFormat;
1030
1048
  MakeFromStreamCallback makeFromStream;
1031
1049
  };
@@ -35,7 +35,7 @@ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
35
35
  SkCodec::Result*,
36
36
  SkCodecs::DecodeContext = nullptr);
37
37
 
38
- inline SkCodecs::Decoder Decoder() {
38
+ inline constexpr SkCodecs::Decoder Decoder() {
39
39
  return { "gif", IsGif, Decode };
40
40
  }
41
41
 
@@ -35,7 +35,7 @@ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
35
35
  SkCodec::Result*,
36
36
  SkCodecs::DecodeContext = nullptr);
37
37
 
38
- inline SkCodecs::Decoder Decoder() {
38
+ inline constexpr SkCodecs::Decoder Decoder() {
39
39
  return { "ico", IsIco, Decode };
40
40
  }
41
41
 
@@ -35,7 +35,7 @@ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
35
35
  SkCodec::Result*,
36
36
  SkCodecs::DecodeContext = nullptr);
37
37
 
38
- inline SkCodecs::Decoder Decoder() {
38
+ inline constexpr SkCodecs::Decoder Decoder() {
39
39
  return { "jpeg", IsJpeg, Decode };
40
40
  }
41
41
 
@@ -35,7 +35,7 @@ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
35
35
  SkCodec::Result*,
36
36
  SkCodecs::DecodeContext = nullptr);
37
37
 
38
- inline SkCodecs::Decoder Decoder() {
38
+ inline constexpr SkCodecs::Decoder Decoder() {
39
39
  return { "jpegxl", IsJpegxl, Decode };
40
40
  }
41
41
 
@@ -35,7 +35,7 @@ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
35
35
  SkCodec::Result*,
36
36
  SkCodecs::DecodeContext = nullptr);
37
37
 
38
- inline SkCodecs::Decoder Decoder() {
38
+ inline constexpr SkCodecs::Decoder Decoder() {
39
39
  return { "png", IsPng, Decode };
40
40
  }
41
41
 
@@ -41,7 +41,7 @@ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
41
41
  SkCodecs::DecodeContext = nullptr);
42
42
 
43
43
  // This decoder will always be checked last, no matter when it is registered.
44
- inline SkCodecs::Decoder Decoder() {
44
+ inline constexpr SkCodecs::Decoder Decoder() {
45
45
  return { "raw", IsRaw, Decode };
46
46
  }
47
47
 
@@ -35,7 +35,7 @@ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
35
35
  SkCodec::Result*,
36
36
  SkCodecs::DecodeContext = nullptr);
37
37
 
38
- inline SkCodecs::Decoder Decoder() {
38
+ inline constexpr SkCodecs::Decoder Decoder() {
39
39
  return { "wbmp", IsWbmp, Decode };
40
40
  }
41
41
 
@@ -35,7 +35,7 @@ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
35
35
  SkCodec::Result*,
36
36
  SkCodecs::DecodeContext = nullptr);
37
37
 
38
- inline SkCodecs::Decoder Decoder() {
38
+ inline constexpr SkCodecs::Decoder Decoder() {
39
39
  return { "webp", IsWebp, Decode };
40
40
  }
41
41
 
@@ -94,6 +94,9 @@
94
94
  //#define SK_HISTOGRAM_EXACT_LINEAR(name, sample, value_max)
95
95
  //#define SK_HISTOGRAM_MEMORY_KB(name, sample)
96
96
 
97
+ // To use smaller but slower mipmap builder
98
+ //#define SK_USE_DRAWING_MIPMAP_DOWNSAMPLER
99
+
97
100
  /* Skia tries to make use of some non-standard C++ language extensions.
98
101
  By default, Skia provides msvc and clang/gcc versions of these macros.
99
102
  Skia consumers can provide their own definitions of these macros to
@@ -115,5 +118,4 @@
115
118
  */
116
119
  //#define SK_API __declspec(dllexport)
117
120
 
118
-
119
121
  #endif
@@ -24,11 +24,13 @@
24
24
  #include "include/core/SkSamplingOptions.h"
25
25
  #include "include/core/SkScalar.h"
26
26
  #include "include/core/SkSize.h"
27
+ #include "include/core/SkSpan.h"
27
28
  #include "include/core/SkString.h"
28
29
  #include "include/core/SkSurfaceProps.h"
29
30
  #include "include/core/SkTypes.h"
30
31
  #include "include/private/base/SkCPUTypes.h"
31
32
  #include "include/private/base/SkDeque.h"
33
+ #include "include/private/base/SkTArray.h"
32
34
 
33
35
  #include <cstdint>
34
36
  #include <cstring>
@@ -70,6 +72,9 @@ class SkVertices;
70
72
  struct SkDrawShadowRec;
71
73
  struct SkRSXform;
72
74
 
75
+ template<typename E>
76
+ class SkEnumBitMask;
77
+
73
78
  namespace skgpu::graphite { class Recorder; }
74
79
  namespace sktext::gpu { class Slug; }
75
80
  namespace SkRecords { class Draw; }
@@ -667,7 +672,9 @@ public:
667
672
  kF16ColorType = 1 << 4,
668
673
  };
669
674
 
670
- typedef uint32_t SaveLayerFlags;
675
+ using SaveLayerFlags = uint32_t;
676
+ using FilterSpan = SkSpan<sk_sp<SkImageFilter>>;
677
+ static constexpr int kMaxFiltersPerLayer = 16;
671
678
 
672
679
  /** \struct SkCanvas::SaveLayerRec
673
680
  SaveLayerRec contains the state used to create the layer.
@@ -687,7 +694,7 @@ public:
687
694
  @return SaveLayerRec with empty fBackdrop
688
695
  */
689
696
  SaveLayerRec(const SkRect* bounds, const SkPaint* paint, SaveLayerFlags saveLayerFlags = 0)
690
- : SaveLayerRec(bounds, paint, nullptr, 1.f, saveLayerFlags) {}
697
+ : SaveLayerRec(bounds, paint, nullptr, 1.f, saveLayerFlags, /*filters=*/{}) {}
691
698
 
692
699
  /** Sets fBounds, fPaint, fBackdrop, and fSaveLayerFlags.
693
700
 
@@ -703,7 +710,7 @@ public:
703
710
  */
704
711
  SaveLayerRec(const SkRect* bounds, const SkPaint* paint, const SkImageFilter* backdrop,
705
712
  SaveLayerFlags saveLayerFlags)
706
- : SaveLayerRec(bounds, paint, backdrop, 1.f, saveLayerFlags) {}
713
+ : SaveLayerRec(bounds, paint, backdrop, 1.f, saveLayerFlags, /*filters=*/{}) {}
707
714
 
708
715
  /** hints at layer size limit */
709
716
  const SkRect* fBounds = nullptr;
@@ -711,6 +718,8 @@ public:
711
718
  /** modifies overlay */
712
719
  const SkPaint* fPaint = nullptr;
713
720
 
721
+ FilterSpan fFilters = {};
722
+
714
723
  /**
715
724
  * If not null, this triggers the same initialization behavior as setting
716
725
  * kInitWithPrevious_SaveLayerFlag on fSaveLayerFlags: the current layer is copied into
@@ -726,13 +735,23 @@ public:
726
735
  friend class SkCanvas;
727
736
  friend class SkCanvasPriv;
728
737
 
729
- SaveLayerRec(const SkRect* bounds, const SkPaint* paint, const SkImageFilter* backdrop,
730
- SkScalar backdropScale, SaveLayerFlags saveLayerFlags)
731
- : fBounds(bounds)
732
- , fPaint(paint)
733
- , fBackdrop(backdrop)
734
- , fSaveLayerFlags(saveLayerFlags)
735
- , fExperimentalBackdropScale(backdropScale) {}
738
+ SaveLayerRec(const SkRect* bounds,
739
+ const SkPaint* paint,
740
+ const SkImageFilter* backdrop,
741
+ SkScalar backdropScale,
742
+ SaveLayerFlags saveLayerFlags,
743
+ FilterSpan filters)
744
+ : fBounds(bounds)
745
+ , fPaint(paint)
746
+ , fFilters(filters)
747
+ , fBackdrop(backdrop)
748
+ , fSaveLayerFlags(saveLayerFlags)
749
+ , fExperimentalBackdropScale(backdropScale) {
750
+ // We only allow the paint's image filter or the side-car list of filters -- not both.
751
+ SkASSERT(fFilters.empty() || !paint || !paint->getImageFilter());
752
+ // To keep things reasonable (during deserialization), we limit filter list size.
753
+ SkASSERT(fFilters.size() <= kMaxFiltersPerLayer);
754
+ }
736
755
 
737
756
  // Relative scale factor that the image content used to initialize the layer when the
738
757
  // kInitFromPrevious flag or a backdrop filter is used.
@@ -2283,30 +2302,33 @@ protected:
2283
2302
  virtual void onDrawSlug(const sktext::gpu::Slug* slug);
2284
2303
 
2285
2304
  private:
2286
-
2287
- enum ShaderOverrideOpacity {
2288
- kNone_ShaderOverrideOpacity, //!< there is no overriding shader (bitmap or image)
2289
- kOpaque_ShaderOverrideOpacity, //!< the overriding shader is opaque
2290
- kNotOpaque_ShaderOverrideOpacity, //!< the overriding shader may not be opaque
2305
+ enum class PredrawFlags : unsigned {
2306
+ kNone = 0,
2307
+ kOpaqueShaderOverride = 1, // The paint's shader is overridden with an opaque image
2308
+ kNonOpaqueShaderOverride = 2, // The paint's shader is overridden but is not opaque
2309
+ kCheckForOverwrite = 4, // Check if the draw would overwrite the entire surface
2310
+ kSkipMaskFilterAutoLayer = 8, // Do not apply mask filters in the AutoLayer
2291
2311
  };
2312
+ // Inlined SK_DECL_BITMASK_OPS_FRIENDS to avoid including SkEnumBitMask.h
2313
+ friend constexpr SkEnumBitMask<PredrawFlags> operator|(PredrawFlags, PredrawFlags);
2314
+ friend constexpr SkEnumBitMask<PredrawFlags> operator&(PredrawFlags, PredrawFlags);
2315
+ friend constexpr SkEnumBitMask<PredrawFlags> operator^(PredrawFlags, PredrawFlags);
2316
+ friend constexpr SkEnumBitMask<PredrawFlags> operator~(PredrawFlags);
2292
2317
 
2293
2318
  // notify our surface (if we have one) that we are about to draw, so it
2294
2319
  // can perform copy-on-write or invalidate any cached images
2295
2320
  // returns false if the copy failed
2296
2321
  [[nodiscard]] bool predrawNotify(bool willOverwritesEntireSurface = false);
2297
- [[nodiscard]] bool predrawNotify(const SkRect*, const SkPaint*, ShaderOverrideOpacity);
2322
+ [[nodiscard]] bool predrawNotify(const SkRect*, const SkPaint*, SkEnumBitMask<PredrawFlags>);
2298
2323
 
2299
- enum class CheckForOverwrite : bool {
2300
- kNo = false,
2301
- kYes = true
2302
- };
2303
2324
  // call the appropriate predrawNotify and create a layer if needed.
2304
2325
  std::optional<AutoLayerForImageFilter> aboutToDraw(
2305
- SkCanvas* canvas,
2306
- const SkPaint& paint,
2307
- const SkRect* rawBounds = nullptr,
2308
- CheckForOverwrite = CheckForOverwrite::kNo,
2309
- ShaderOverrideOpacity = kNone_ShaderOverrideOpacity);
2326
+ const SkPaint& paint,
2327
+ const SkRect* rawBounds,
2328
+ SkEnumBitMask<PredrawFlags> flags);
2329
+ std::optional<AutoLayerForImageFilter> aboutToDraw(
2330
+ const SkPaint& paint,
2331
+ const SkRect* rawBounds = nullptr);
2310
2332
 
2311
2333
  // The bottom-most device in the stack, only changed by init(). Image properties and the final
2312
2334
  // canvas pixels are determined by this device.
@@ -2323,12 +2345,16 @@ private:
2323
2345
  // clip, and matrix commands. There is a layer per call to saveLayer() using the
2324
2346
  // kFullLayer_SaveLayerStrategy.
2325
2347
  struct Layer {
2326
- sk_sp<SkDevice> fDevice;
2327
- sk_sp<SkImageFilter> fImageFilter; // applied to layer *before* being drawn by paint
2328
- SkPaint fPaint;
2329
- bool fDiscard;
2330
-
2331
- Layer(sk_sp<SkDevice> device, sk_sp<SkImageFilter> imageFilter, const SkPaint& paint);
2348
+ sk_sp<SkDevice> fDevice;
2349
+ skia_private::STArray<1, sk_sp<SkImageFilter>> fImageFilters;
2350
+ SkPaint fPaint;
2351
+ bool fIsCoverage;
2352
+ bool fDiscard;
2353
+
2354
+ Layer(sk_sp<SkDevice> device,
2355
+ FilterSpan imageFilters,
2356
+ const SkPaint& paint,
2357
+ bool isCoverage);
2332
2358
  };
2333
2359
 
2334
2360
  // Encapsulate state needed to restore from saveBehind()
@@ -2364,8 +2390,9 @@ private:
2364
2390
  ~MCRec();
2365
2391
 
2366
2392
  void newLayer(sk_sp<SkDevice> layerDevice,
2367
- sk_sp<SkImageFilter> filter,
2368
- const SkPaint& restorePaint);
2393
+ FilterSpan filters,
2394
+ const SkPaint& restorePaint,
2395
+ bool layerIsCoverage);
2369
2396
 
2370
2397
  void reset(SkDevice* device);
2371
2398
  };
@@ -2470,7 +2497,7 @@ private:
2470
2497
  const SkMatrix* matrix = nullptr);
2471
2498
 
2472
2499
  void internalDrawPaint(const SkPaint& paint);
2473
- void internalSaveLayer(const SaveLayerRec&, SaveLayerStrategy);
2500
+ void internalSaveLayer(const SaveLayerRec&, SaveLayerStrategy, bool coverageOnly=false);
2474
2501
  void internalSaveBehind(const SkRect*);
2475
2502
 
2476
2503
  void internalConcat44(const SkM44&);
@@ -2499,16 +2526,18 @@ private:
2499
2526
  * relative transforms between the devices).
2500
2527
  */
2501
2528
  void internalDrawDeviceWithFilter(SkDevice* src, SkDevice* dst,
2502
- const SkImageFilter* filter, const SkPaint& paint,
2529
+ FilterSpan filters, const SkPaint& paint,
2503
2530
  DeviceCompatibleWithFilter compat,
2504
- SkScalar scaleFactor = 1.f);
2531
+ SkScalar scaleFactor = 1.f,
2532
+ bool srcIsCoverageLayer = false);
2505
2533
 
2506
2534
  /*
2507
2535
  * Returns true if drawing the specified rect (or all if it is null) with the specified
2508
2536
  * paint (or default if null) would overwrite the entire root device of the canvas
2509
2537
  * (i.e. the canvas' surface if it had one).
2510
2538
  */
2511
- bool wouldOverwriteEntireSurface(const SkRect*, const SkPaint*, ShaderOverrideOpacity) const;
2539
+ bool wouldOverwriteEntireSurface(const SkRect*, const SkPaint*,
2540
+ SkEnumBitMask<PredrawFlags>) const;
2512
2541
 
2513
2542
  /**
2514
2543
  * Returns true if the paint's imagefilter can be invoked directly, without needed a layer.
@@ -15,6 +15,7 @@
15
15
 
16
16
  #include <cstddef>
17
17
  #include <cstdint>
18
+ #include <utility>
18
19
 
19
20
  class SkColorMatrix;
20
21
  class SkColorSpace;
@@ -82,8 +83,10 @@ private:
82
83
 
83
84
  class SK_API SkColorFilters {
84
85
  public:
85
- static sk_sp<SkColorFilter> Compose(sk_sp<SkColorFilter> outer, sk_sp<SkColorFilter> inner) {
86
- return outer ? outer->makeComposed(inner) : inner;
86
+ static sk_sp<SkColorFilter> Compose(const sk_sp<SkColorFilter>& outer,
87
+ sk_sp<SkColorFilter> inner) {
88
+ return outer ? outer->makeComposed(std::move(inner))
89
+ : std::move(inner);
87
90
  }
88
91
 
89
92
  // Blends between the constant color (src) and input color (dst) based on the SkBlendMode.
@@ -90,6 +90,7 @@ private:
90
90
  const Segment* distanceToSegment(SkScalar distance, SkScalar* t) const;
91
91
 
92
92
  friend class SkContourMeasureIter;
93
+ friend class SkPathMeasurePriv;
93
94
  };
94
95
 
95
96
  class SK_API SkContourMeasureIter {
@@ -36,6 +36,7 @@ public:
36
36
  * Begin a new page for the document, returning the canvas that will draw
37
37
  * into the page. The document owns this canvas, and it will go out of
38
38
  * scope when endPage() or close() is called, or the document is deleted.
39
+ * This will call endPage() if there is a currently active page.
39
40
  */
40
41
  SkCanvas* beginPage(SkScalar width, SkScalar height, const SkRect* content = nullptr);
41
42
 
@@ -201,20 +201,14 @@ public:
201
201
  */
202
202
  SkFont makeWithSize(SkScalar size) const;
203
203
 
204
- /** Returns SkTypeface if set, or nullptr.
205
- Does not alter SkTypeface SkRefCnt.
204
+ /** Does not alter SkTypeface SkRefCnt.
206
205
 
207
- @return SkTypeface if previously set, nullptr otherwise
206
+ @return non-null SkTypeface
208
207
  */
209
- SkTypeface* getTypeface() const {return fTypeface.get(); }
210
-
211
- /** Returns SkTypeface if set, or the default typeface.
212
- Does not alter SkTypeface SkRefCnt.
213
-
214
- @return SkTypeface if previously set or, a pointer to the default typeface if not
215
- previously set.
216
- */
217
- SkTypeface* getTypefaceOrDefault() const;
208
+ SkTypeface* getTypeface() const {
209
+ SkASSERT(fTypeface);
210
+ return fTypeface.get();
211
+ }
218
212
 
219
213
  /** Returns text size in points.
220
214
 
@@ -238,24 +232,20 @@ public:
238
232
 
239
233
  /** Increases SkTypeface SkRefCnt by one.
240
234
 
241
- @return SkTypeface if previously set, nullptr otherwise
235
+ @return A non-null SkTypeface.
242
236
  */
243
- sk_sp<SkTypeface> refTypeface() const { return fTypeface; }
244
-
245
- /** Increases SkTypeface SkRefCnt by one.
246
-
247
- @return SkTypeface if previously set or, a pointer to the default typeface if not
248
- previously set.
249
- */
250
- sk_sp<SkTypeface> refTypefaceOrDefault() const;
237
+ sk_sp<SkTypeface> refTypeface() const {
238
+ SkASSERT(fTypeface);
239
+ return fTypeface;
240
+ }
251
241
 
252
242
  /** Sets SkTypeface to typeface, decreasing SkRefCnt of the previous SkTypeface.
253
- Pass nullptr to clear SkTypeface and use the default typeface. Increments
254
- tf SkRefCnt by one.
243
+ Pass nullptr to clear SkTypeface and use an empty typeface (which draws nothing).
244
+ Increments tf SkRefCnt by one.
255
245
 
256
246
  @param tf font and style used to draw text
257
247
  */
258
- void setTypeface(sk_sp<SkTypeface> tf) { fTypeface = tf; }
248
+ void setTypeface(sk_sp<SkTypeface> tf);
259
249
 
260
250
  /** Sets text size in points.
261
251
  Has no effect if textSize is not greater than or equal to zero.
@@ -32,7 +32,7 @@ struct SkFontArguments {
32
32
  */
33
33
  struct Palette {
34
34
  struct Override {
35
- int index;
35
+ uint16_t index;
36
36
  SkColor color;
37
37
  };
38
38
  int index;