@shopify/react-native-skia 0.1.213 → 0.1.214

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +3 -2
  2. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +9 -2
  3. package/cpp/api/JsiSkSurface.h +4 -1
  4. package/cpp/skia/include/android/GrAHardwareBufferUtils.h +99 -0
  5. package/cpp/skia/include/android/SkHeifDecoder.h +10 -3
  6. package/cpp/skia/include/codec/SkAvifDecoder.h +1 -0
  7. package/cpp/skia/include/codec/SkBmpDecoder.h +1 -0
  8. package/cpp/skia/include/codec/SkCodec.h +4 -3
  9. package/cpp/skia/include/codec/SkEncodedImageFormat.h +0 -3
  10. package/cpp/skia/include/codec/SkGifDecoder.h +1 -0
  11. package/cpp/skia/include/codec/SkIcoDecoder.h +1 -0
  12. package/cpp/skia/include/codec/SkJpegDecoder.h +1 -0
  13. package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -0
  14. package/cpp/skia/include/codec/SkPngDecoder.h +1 -0
  15. package/cpp/skia/include/codec/SkRawDecoder.h +1 -0
  16. package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -0
  17. package/cpp/skia/include/codec/SkWebpDecoder.h +1 -0
  18. package/cpp/skia/include/config/SkUserConfig.h +0 -2
  19. package/cpp/skia/include/core/SkBitmap.h +8 -8
  20. package/cpp/skia/include/core/SkCanvas.h +37 -50
  21. package/cpp/skia/include/core/SkCapabilities.h +2 -7
  22. package/cpp/skia/include/core/SkColor.h +1 -1
  23. package/cpp/skia/include/core/SkColorFilter.h +6 -0
  24. package/cpp/skia/include/core/SkColorTable.h +3 -0
  25. package/cpp/skia/include/core/SkColorType.h +2 -0
  26. package/cpp/skia/include/core/SkContourMeasure.h +12 -8
  27. package/cpp/skia/include/core/SkDocument.h +1 -0
  28. package/cpp/skia/include/core/SkFont.h +11 -2
  29. package/cpp/skia/include/core/SkFontMgr.h +2 -3
  30. package/cpp/skia/include/core/SkGraphics.h +3 -13
  31. package/cpp/skia/include/core/SkImage.h +57 -111
  32. package/cpp/skia/include/core/SkImageFilter.h +6 -1
  33. package/cpp/skia/include/core/SkImageGenerator.h +8 -0
  34. package/cpp/skia/include/core/SkImageInfo.h +0 -2
  35. package/cpp/skia/include/core/SkM44.h +7 -3
  36. package/cpp/skia/include/core/SkMallocPixelRef.h +4 -1
  37. package/cpp/skia/include/core/SkMatrix.h +17 -17
  38. package/cpp/skia/include/core/SkMesh.h +71 -61
  39. package/cpp/skia/include/core/SkMilestone.h +1 -1
  40. package/cpp/skia/include/core/SkOverdrawCanvas.h +25 -0
  41. package/cpp/skia/include/core/SkPaint.h +1 -1
  42. package/cpp/skia/include/core/SkPath.h +12 -4
  43. package/cpp/skia/include/core/SkPathMeasure.h +3 -4
  44. package/cpp/skia/include/core/SkPicture.h +19 -6
  45. package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
  46. package/cpp/skia/include/core/SkPixmap.h +2 -3
  47. package/cpp/skia/include/core/SkRRect.h +1 -1
  48. package/cpp/skia/include/core/SkRect.h +107 -110
  49. package/cpp/skia/include/core/SkRefCnt.h +1 -1
  50. package/cpp/skia/include/core/SkRegion.h +7 -1
  51. package/cpp/skia/include/core/SkSerialProcs.h +14 -0
  52. package/cpp/skia/include/core/SkShader.h +9 -0
  53. package/cpp/skia/include/core/SkStream.h +9 -9
  54. package/cpp/skia/include/core/SkString.h +1 -1
  55. package/cpp/skia/include/core/SkSurface.h +14 -25
  56. package/cpp/skia/include/core/SkTextBlob.h +17 -4
  57. package/cpp/skia/include/core/SkTiledImageUtils.h +28 -0
  58. package/cpp/skia/include/core/SkTypeface.h +7 -2
  59. package/cpp/skia/include/core/SkTypes.h +4 -12
  60. package/cpp/skia/include/docs/SkPDFDocument.h +17 -3
  61. package/cpp/skia/include/effects/SkImageFilters.h +73 -24
  62. package/cpp/skia/include/effects/SkRuntimeEffect.h +20 -51
  63. package/cpp/skia/include/gpu/GpuTypes.h +13 -0
  64. package/cpp/skia/include/gpu/GrBackendSurface.h +95 -262
  65. package/cpp/skia/include/gpu/GrContextOptions.h +7 -1
  66. package/cpp/skia/include/gpu/GrDirectContext.h +138 -128
  67. package/cpp/skia/include/gpu/GrRecordingContext.h +9 -4
  68. package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -24
  69. package/cpp/skia/include/gpu/GrTypes.h +16 -1
  70. package/cpp/skia/include/gpu/GrYUVABackendTextures.h +4 -4
  71. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -2
  72. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +44 -12
  73. package/cpp/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
  74. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +2 -1
  75. package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +58 -0
  76. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +29 -0
  77. package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +1 -1
  78. package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +67 -0
  79. package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
  80. package/cpp/skia/include/gpu/graphite/BackendTexture.h +14 -3
  81. package/cpp/skia/include/gpu/graphite/Context.h +93 -13
  82. package/cpp/skia/include/gpu/graphite/ContextOptions.h +19 -8
  83. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +23 -0
  84. package/cpp/skia/include/gpu/graphite/Image.h +56 -0
  85. package/cpp/skia/include/gpu/graphite/ImageProvider.h +5 -0
  86. package/cpp/skia/include/gpu/graphite/Recorder.h +26 -9
  87. package/cpp/skia/include/gpu/graphite/Recording.h +7 -5
  88. package/cpp/skia/include/gpu/graphite/TextureInfo.h +8 -0
  89. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +2 -2
  90. package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
  91. package/cpp/skia/include/gpu/vk/GrVkTypes.h +4 -3
  92. package/cpp/skia/include/ports/SkCFObject.h +1 -1
  93. package/cpp/skia/include/private/SkGainmapInfo.h +4 -13
  94. package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -24
  95. package/cpp/skia/include/private/SkWeakRefCnt.h +1 -1
  96. package/cpp/skia/include/private/base/SkAnySubclass.h +73 -0
  97. package/cpp/skia/include/private/base/SkAssert.h +106 -12
  98. package/cpp/skia/include/private/base/SkAttributes.h +0 -12
  99. package/cpp/skia/include/private/base/SkFeatures.h +0 -3
  100. package/cpp/skia/include/private/base/SkFloatingPoint.h +58 -105
  101. package/cpp/skia/include/private/base/SkSpan_impl.h +18 -12
  102. package/cpp/skia/include/private/base/SkTArray.h +22 -17
  103. package/cpp/skia/include/private/base/SkTDArray.h +5 -6
  104. package/cpp/skia/include/private/base/SkTemplates.h +50 -30
  105. package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +5 -2
  106. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +2 -2
  107. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +13 -8
  108. package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +1 -1
  109. package/cpp/skia/include/private/chromium/SkImageChromium.h +16 -3
  110. package/cpp/skia/include/private/chromium/Slug.h +11 -4
  111. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
  112. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +6 -9
  113. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +29 -13
  114. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -28
  115. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +34 -0
  116. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +6 -0
  117. package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +8 -0
  118. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +10 -0
  119. package/cpp/skia/include/utils/SkBase64.h +2 -2
  120. package/cpp/skia/include/utils/SkNWayCanvas.h +1 -11
  121. package/cpp/skia/include/utils/SkNoDrawCanvas.h +0 -2
  122. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -2
  123. package/cpp/skia/include/utils/SkShadowUtils.h +15 -1
  124. package/cpp/skia/include/utils/SkTextUtils.h +1 -1
  125. package/cpp/skia/modules/skparagraph/include/Paragraph.h +107 -1
  126. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +3 -2
  127. package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +4 -0
  128. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +5 -3
  129. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +4 -0
  130. package/cpp/skia/src/core/SkChecksum.h +2 -1
  131. package/cpp/skia/src/core/SkPathPriv.h +1 -1
  132. package/cpp/skia/src/core/SkTHash.h +19 -9
  133. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
  134. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
  135. package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
  136. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  137. package/lib/commonjs/external/reanimated/index.d.ts +1 -0
  138. package/lib/commonjs/external/reanimated/index.js +13 -0
  139. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  140. package/lib/commonjs/external/reanimated/moduleWrapper.js +3 -8
  141. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  142. package/lib/commonjs/external/reanimated/renderHelpers.js +46 -1
  143. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  144. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  145. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +26 -0
  146. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  147. package/lib/commonjs/external/reanimated/useSharedValueEffect.js +2 -5
  148. package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
  149. package/lib/commonjs/skia/types/MaskFilter.js +4 -0
  150. package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
  151. package/lib/commonjs/skia/web/JsiSkPicture.js +2 -1
  152. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  153. package/lib/commonjs/views/SkiaBaseWebView.js +1 -1
  154. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  155. package/lib/commonjs/views/types.js +3 -0
  156. package/lib/commonjs/views/types.js.map +1 -1
  157. package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
  158. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  159. package/lib/module/external/reanimated/index.d.ts +1 -0
  160. package/lib/module/external/reanimated/index.js +1 -0
  161. package/lib/module/external/reanimated/index.js.map +1 -1
  162. package/lib/module/external/reanimated/moduleWrapper.js +1 -9
  163. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  164. package/lib/module/external/reanimated/renderHelpers.js +48 -2
  165. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  166. package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  167. package/lib/module/external/reanimated/useDerivedValueOnJS.js +15 -0
  168. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  169. package/lib/module/external/reanimated/useSharedValueEffect.js +3 -6
  170. package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
  171. package/lib/module/skia/types/MaskFilter.js +3 -0
  172. package/lib/module/skia/types/MaskFilter.js.map +1 -1
  173. package/lib/module/views/types.js +3 -0
  174. package/lib/module/views/types.js.map +1 -1
  175. package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
  176. package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  177. package/libs/android/arm64-v8a/libskia.a +0 -0
  178. package/libs/android/arm64-v8a/libskottie.a +0 -0
  179. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  180. package/libs/android/arm64-v8a/libsksg.a +0 -0
  181. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  182. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  183. package/libs/android/arm64-v8a/libsvg.a +0 -0
  184. package/libs/android/armeabi-v7a/libskia.a +0 -0
  185. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  186. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  187. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  188. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  189. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  190. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  191. package/libs/android/x86/libskia.a +0 -0
  192. package/libs/android/x86/libskottie.a +0 -0
  193. package/libs/android/x86/libskparagraph.a +0 -0
  194. package/libs/android/x86/libsksg.a +0 -0
  195. package/libs/android/x86/libskshaper.a +0 -0
  196. package/libs/android/x86/libskunicode.a +0 -0
  197. package/libs/android/x86/libsvg.a +0 -0
  198. package/libs/android/x86_64/libskia.a +0 -0
  199. package/libs/android/x86_64/libskottie.a +0 -0
  200. package/libs/android/x86_64/libskparagraph.a +0 -0
  201. package/libs/android/x86_64/libsksg.a +0 -0
  202. package/libs/android/x86_64/libskshaper.a +0 -0
  203. package/libs/android/x86_64/libskunicode.a +0 -0
  204. package/libs/android/x86_64/libsvg.a +0 -0
  205. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  206. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  207. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  208. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  209. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  210. package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
  211. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  212. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  213. package/libs/ios/libsksg.xcframework/Info.plist +5 -5
  214. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  215. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  216. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  217. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  218. package/libs/ios/libskunicode.xcframework/Info.plist +5 -5
  219. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  220. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  221. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  222. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  223. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  224. package/package.json +1 -1
  225. package/react-native-skia.podspec +1 -1
  226. package/src/dom/nodes/datatypes/Rect.ts +6 -2
  227. package/src/external/reanimated/index.ts +1 -0
  228. package/src/external/reanimated/moduleWrapper.ts +6 -10
  229. package/src/external/reanimated/renderHelpers.ts +41 -1
  230. package/src/external/reanimated/useDerivedValueOnJS.ts +24 -0
  231. package/src/external/reanimated/useSharedValueEffect.ts +4 -7
  232. package/cpp/skia/include/core/SkDeferredDisplayList.h +0 -15
  233. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +0 -15
  234. package/cpp/skia/include/core/SkPromiseImageTexture.h +0 -20
  235. package/cpp/skia/include/core/SkSurfaceCharacterization.h +0 -15
  236. package/cpp/skia/include/core/SkTime.h +0 -63
  237. package/cpp/skia/include/effects/SkOpPathEffect.h +0 -43
  238. package/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +0 -28
  239. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +0 -32
  240. package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +0 -95
  241. package/cpp/skia/include/private/SkBitmaskEnum.h +0 -59
  242. package/cpp/skia/include/private/SkSLDefines.h +0 -64
  243. package/cpp/skia/include/private/SkShadowFlags.h +0 -27
  244. package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +0 -26
  245. /package/cpp/skia/{include/private/base → src/core}/SkPathEnums.h +0 -0
@@ -44,19 +44,6 @@ struct SkSamplingOptions;
44
44
 
45
45
  namespace skgpu::graphite { class Recorder; }
46
46
 
47
- #if !defined(SK_DISABLE_LEGACY_GRAPHITE_IMAGE_FACTORIES) && defined(SK_GRAPHITE)
48
- #include "include/gpu/graphite/GraphiteTypes.h"
49
-
50
- namespace skgpu { enum class Mipmapped : bool; }
51
- namespace skgpu::graphite {
52
- class BackendTexture;
53
- class Recorder;
54
- class TextureInfo;
55
- enum class Volatile : bool;
56
- class YUVABackendTextures;
57
- }
58
- #endif
59
-
60
47
  namespace SkImages {
61
48
 
62
49
  /** Caller data passed to RasterReleaseProc; may be nullptr. */
@@ -229,6 +216,34 @@ SK_API sk_sp<SkImage> RasterFromData(const SkImageInfo& info,
229
216
  sk_sp<SkData> pixels,
230
217
  size_t rowBytes);
231
218
 
219
+ /** Creates a filtered SkImage on the CPU. filter processes the src image, potentially changing
220
+ the color, position, and size. subset is the bounds of src that are processed
221
+ by filter. clipBounds is the expected bounds of the filtered SkImage. outSubset
222
+ is required storage for the actual bounds of the filtered SkImage. offset is
223
+ required storage for translation of returned SkImage.
224
+
225
+ Returns nullptr a filtered result could not be created. If nullptr is returned, outSubset
226
+ and offset are undefined.
227
+
228
+ Useful for animation of SkImageFilter that varies size from frame to frame.
229
+ outSubset describes the valid bounds of returned image. offset translates the returned SkImage
230
+ to keep subsequent animation frames aligned with respect to each other.
231
+
232
+ @param src the image to be filtered
233
+ @param filter the image filter to be applied
234
+ @param subset bounds of SkImage processed by filter
235
+ @param clipBounds expected bounds of filtered SkImage
236
+ @param outSubset storage for returned SkImage bounds
237
+ @param offset storage for returned SkImage translation
238
+ @return filtered SkImage, or nullptr
239
+ */
240
+ SK_API sk_sp<SkImage> MakeWithFilter(sk_sp<SkImage> src,
241
+ const SkImageFilter* filter,
242
+ const SkIRect& subset,
243
+ const SkIRect& clipBounds,
244
+ SkIRect* outSubset,
245
+ SkIPoint* offset);
246
+
232
247
  } // namespace SkImages
233
248
 
234
249
  /** \class SkImage
@@ -642,6 +657,20 @@ public:
642
657
  ReadPixelsCallback callback,
643
658
  ReadPixelsContext context) const;
644
659
 
660
+ /**
661
+ * Identical to asyncRescaleAndReadPixelsYUV420 but a fourth plane is returned in the
662
+ * AsyncReadResult passed to 'callback'. The fourth plane contains the alpha chanel at the
663
+ * same full resolution as the Y plane.
664
+ */
665
+ void asyncRescaleAndReadPixelsYUVA420(SkYUVColorSpace yuvColorSpace,
666
+ sk_sp<SkColorSpace> dstColorSpace,
667
+ const SkIRect& srcRect,
668
+ const SkISize& dstSize,
669
+ RescaleGamma rescaleGamma,
670
+ RescaleMode rescaleMode,
671
+ ReadPixelsCallback callback,
672
+ ReadPixelsContext context) const;
673
+
645
674
  /** Copies SkImage to dst, scaling pixels to fit dst.width() and dst.height(), and
646
675
  converting pixels to match dst.colorType() and dst.alphaType(). Returns true if
647
676
  pixels are copied. Returns false if dst.addr() is nullptr, or dst.rowBytes() is
@@ -696,14 +725,18 @@ public:
696
725
  */
697
726
  virtual sk_sp<SkImage> makeSubset(GrDirectContext* direct, const SkIRect& subset) const = 0;
698
727
 
699
- #if !defined(SK_DISABLE_LEGACY_IMAGE_SUBSET_METHODS)
700
- sk_sp<SkImage> makeSubset(const SkIRect& subset, GrDirectContext* direct = nullptr) const {
701
- return this->makeSubset(direct, subset);
702
- }
703
- #endif
704
-
705
728
  struct RequiredProperties {
706
729
  bool fMipmapped;
730
+
731
+ bool operator==(const RequiredProperties& other) const {
732
+ return fMipmapped == other.fMipmapped;
733
+ }
734
+
735
+ bool operator!=(const RequiredProperties& other) const { return !(*this == other); }
736
+
737
+ bool operator<(const RequiredProperties& other) const {
738
+ return fMipmapped < other.fMipmapped;
739
+ }
707
740
  };
708
741
 
709
742
  /** Returns subset of this image.
@@ -733,6 +766,11 @@ public:
733
766
  */
734
767
  bool hasMipmaps() const;
735
768
 
769
+ /**
770
+ * Returns true if the image holds protected content.
771
+ */
772
+ bool isProtected() const;
773
+
736
774
  /**
737
775
  * Returns an image with the same "base" pixels as the this image, but with mipmap levels
738
776
  * automatically generated and attached.
@@ -773,37 +811,6 @@ public:
773
811
  }
774
812
  #endif
775
813
 
776
- /** Creates filtered SkImage. filter processes original SkImage, potentially changing
777
- color, position, and size. subset is the bounds of original SkImage processed
778
- by filter. clipBounds is the expected bounds of the filtered SkImage. outSubset
779
- is required storage for the actual bounds of the filtered SkImage. offset is
780
- required storage for translation of returned SkImage.
781
-
782
- Returns nullptr if SkImage could not be created or if the recording context provided doesn't
783
- match the GPU context in which the image was created. If nullptr is returned, outSubset
784
- and offset are undefined.
785
-
786
- Useful for animation of SkImageFilter that varies size from frame to frame.
787
- Returned SkImage is created larger than required by filter so that GPU texture
788
- can be reused with different sized effects. outSubset describes the valid bounds
789
- of GPU texture returned. offset translates the returned SkImage to keep subsequent
790
- animation frames aligned with respect to each other.
791
-
792
- @param context the GrRecordingContext in play - if it exists
793
- @param filter how SkImage is sampled when transformed
794
- @param subset bounds of SkImage processed by filter
795
- @param clipBounds expected bounds of filtered SkImage
796
- @param outSubset storage for returned SkImage bounds
797
- @param offset storage for returned SkImage translation
798
- @return filtered SkImage, or nullptr
799
- */
800
- virtual sk_sp<SkImage> makeWithFilter(GrRecordingContext* context,
801
- const SkImageFilter* filter,
802
- const SkIRect& subset,
803
- const SkIRect& clipBounds,
804
- SkIRect* outSubset,
805
- SkIPoint* offset) const = 0;
806
-
807
814
  /** Deprecated.
808
815
  */
809
816
  enum LegacyBitmapMode {
@@ -852,11 +859,6 @@ public:
852
859
  virtual sk_sp<SkImage> makeColorSpace(GrDirectContext* direct,
853
860
  sk_sp<SkColorSpace> target) const = 0;
854
861
 
855
- #if !defined(SK_DISABLE_LEGACY_IMAGE_COLORSPACE_METHODS)
856
- sk_sp<SkImage> makeColorSpace(sk_sp<SkColorSpace> target,
857
- GrDirectContext* direct = nullptr) const;
858
- #endif
859
-
860
862
  /** Creates SkImage in target SkColorSpace.
861
863
  Returns nullptr if SkImage could not be created.
862
864
 
@@ -893,12 +895,6 @@ public:
893
895
  SkColorType targetColorType,
894
896
  sk_sp<SkColorSpace> targetCS) const = 0;
895
897
 
896
- #if !defined(SK_DISABLE_LEGACY_IMAGE_COLORSPACE_METHODS)
897
- sk_sp<SkImage> makeColorTypeAndColorSpace(SkColorType targetColorType,
898
- sk_sp<SkColorSpace> targetColorSpace,
899
- GrDirectContext* direct = nullptr) const;
900
- #endif
901
-
902
898
  /** Experimental.
903
899
  Creates SkImage in target SkColorType and SkColorSpace.
904
900
  Returns nullptr if SkImage could not be created.
@@ -938,56 +934,6 @@ private:
938
934
  sk_sp<SkImage> withMipmaps(sk_sp<SkMipmap>) const;
939
935
 
940
936
  using INHERITED = SkRefCnt;
941
-
942
- public:
943
- #if !defined(SK_DISABLE_LEGACY_IMAGE_RELEASE_PROCS)
944
- using ReleaseContext = SkImages::ReleaseContext;
945
- using TextureReleaseProc = void (*)(ReleaseContext);
946
- #endif
947
- #if !defined(SK_DISABLE_LEGACY_GRAPHITE_IMAGE_METHODS) && defined(SK_GRAPHITE)
948
- struct RequiredImageProperties {
949
- skgpu::Mipmapped fMipmapped;
950
- };
951
-
952
- sk_sp<SkImage> makeTextureImage(skgpu::graphite::Recorder*, RequiredImageProperties) const;
953
- #endif
954
- #if !defined(SK_DISABLE_LEGACY_GRAPHITE_IMAGE_FACTORIES) && defined(SK_GRAPHITE)
955
- // Passed to both fulfill and imageRelease
956
- using GraphitePromiseImageContext = void*;
957
- // Returned from fulfill and passed into textureRelease
958
- using GraphitePromiseTextureReleaseContext = void*;
959
-
960
- using GraphitePromiseImageFulfillProc =
961
- std::tuple<skgpu::graphite::BackendTexture, GraphitePromiseTextureReleaseContext>
962
- (*)(GraphitePromiseImageContext);
963
- using GraphitePromiseImageReleaseProc = void (*)(GraphitePromiseImageContext);
964
- using GraphitePromiseTextureReleaseProc = void (*)(GraphitePromiseTextureReleaseContext);
965
-
966
- static sk_sp<SkImage> MakeGraphitePromiseTexture(skgpu::graphite::Recorder*,
967
- SkISize,
968
- const skgpu::graphite::TextureInfo&,
969
- const SkColorInfo&,
970
- skgpu::graphite::Volatile,
971
- GraphitePromiseImageFulfillProc,
972
- GraphitePromiseImageReleaseProc,
973
- GraphitePromiseTextureReleaseProc,
974
- GraphitePromiseImageContext);
975
-
976
- static sk_sp<SkImage> MakeGraphiteFromBackendTexture(skgpu::graphite::Recorder*,
977
- const skgpu::graphite::BackendTexture&,
978
- SkColorType,
979
- SkAlphaType,
980
- sk_sp<SkColorSpace>,
981
- TextureReleaseProc = nullptr,
982
- ReleaseContext = nullptr);
983
-
984
- static sk_sp<SkImage> MakeGraphiteFromYUVABackendTextures(
985
- skgpu::graphite::Recorder*,
986
- const skgpu::graphite::YUVABackendTextures&,
987
- sk_sp<SkColorSpace>,
988
- TextureReleaseProc = nullptr,
989
- ReleaseContext = nullptr);
990
- #endif
991
937
  };
992
938
 
993
939
  #endif
@@ -9,10 +9,15 @@
9
9
  #define SkImageFilter_DEFINED
10
10
 
11
11
  #include "include/core/SkFlattenable.h"
12
- #include "include/core/SkMatrix.h"
13
12
  #include "include/core/SkRect.h"
13
+ #include "include/core/SkRefCnt.h"
14
+ #include "include/private/base/SkAPI.h"
15
+
16
+ #include <cstddef>
14
17
 
15
18
  class SkColorFilter;
19
+ class SkMatrix;
20
+ struct SkDeserialProcs;
16
21
 
17
22
  /**
18
23
  * Base class for image filters. If one is installed in the paint, then all drawing occurs as
@@ -59,6 +59,13 @@ public:
59
59
  return this->onIsValid(context);
60
60
  }
61
61
 
62
+ /**
63
+ * Will this generator produce protected content
64
+ */
65
+ bool isProtected() const {
66
+ return this->onIsProtected();
67
+ }
68
+
62
69
  /**
63
70
  * Decode into the given pixels, a block of memory of size at
64
71
  * least (info.fHeight - 1) * rowBytes + (info.fWidth *
@@ -122,6 +129,7 @@ protected:
122
129
  struct Options {};
123
130
  virtual bool onGetPixels(const SkImageInfo&, void*, size_t, const Options&) { return false; }
124
131
  virtual bool onIsValid(GrRecordingContext*) const { return true; }
132
+ virtual bool onIsProtected() const { return false; }
125
133
  virtual bool onQueryYUVAInfo(const SkYUVAPixmapInfo::SupportedDataTypes&,
126
134
  SkYUVAPixmapInfo*) const { return false; }
127
135
  virtual bool onGetYUVAPlanes(const SkYUVAPixmaps&) { return false; }
@@ -550,8 +550,6 @@ public:
550
550
 
551
551
  @param rowBytes size of pixel row or larger
552
552
  @return memory required by pixel buffer
553
-
554
- example: https://fiddle.skia.org/c/@ImageInfo_computeByteSize
555
553
  */
556
554
  size_t computeByteSize(size_t rowBytes) const;
557
555
 
@@ -9,8 +9,12 @@
9
9
  #define SkM44_DEFINED
10
10
 
11
11
  #include "include/core/SkMatrix.h"
12
- #include "include/core/SkRect.h"
13
12
  #include "include/core/SkScalar.h"
13
+ #include "include/core/SkTypes.h"
14
+
15
+ #include <cstring>
16
+
17
+ struct SkRect;
14
18
 
15
19
  struct SK_API SkV2 {
16
20
  float x, y;
@@ -376,9 +380,9 @@ public:
376
380
  /** If this is invertible, return that in inverse and return true. If it is
377
381
  * not invertible, return false and leave the inverse parameter unchanged.
378
382
  */
379
- bool SK_WARN_UNUSED_RESULT invert(SkM44* inverse) const;
383
+ [[nodiscard]] bool invert(SkM44* inverse) const;
380
384
 
381
- SkM44 SK_WARN_UNUSED_RESULT transpose() const;
385
+ [[nodiscard]] SkM44 transpose() const;
382
386
 
383
387
  void dump() const;
384
388
 
@@ -8,10 +8,13 @@
8
8
  #ifndef SkMallocPixelRef_DEFINED
9
9
  #define SkMallocPixelRef_DEFINED
10
10
 
11
- #include "include/core/SkPixelRef.h"
12
11
  #include "include/core/SkRefCnt.h"
13
12
  #include "include/core/SkTypes.h"
13
+
14
+ #include <cstddef>
15
+
14
16
  class SkData;
17
+ class SkPixelRef;
15
18
  struct SkImageInfo;
16
19
 
17
20
  /** We explicitly use the same allocator for our pixels that SkMask does,
@@ -71,7 +71,7 @@ public:
71
71
  @param sy vertical scale factor
72
72
  @return SkMatrix with scale
73
73
  */
74
- static SkMatrix SK_WARN_UNUSED_RESULT Scale(SkScalar sx, SkScalar sy) {
74
+ [[nodiscard]] static SkMatrix Scale(SkScalar sx, SkScalar sy) {
75
75
  SkMatrix m;
76
76
  m.setScale(sx, sy);
77
77
  return m;
@@ -87,30 +87,30 @@ public:
87
87
  @param dy vertical translation
88
88
  @return SkMatrix with translation
89
89
  */
90
- static SkMatrix SK_WARN_UNUSED_RESULT Translate(SkScalar dx, SkScalar dy) {
90
+ [[nodiscard]] static SkMatrix Translate(SkScalar dx, SkScalar dy) {
91
91
  SkMatrix m;
92
92
  m.setTranslate(dx, dy);
93
93
  return m;
94
94
  }
95
- static SkMatrix SK_WARN_UNUSED_RESULT Translate(SkVector t) { return Translate(t.x(), t.y()); }
96
- static SkMatrix SK_WARN_UNUSED_RESULT Translate(SkIVector t) { return Translate(t.x(), t.y()); }
95
+ [[nodiscard]] static SkMatrix Translate(SkVector t) { return Translate(t.x(), t.y()); }
96
+ [[nodiscard]] static SkMatrix Translate(SkIVector t) { return Translate(t.x(), t.y()); }
97
97
 
98
98
  /** Sets SkMatrix to rotate by |deg| about a pivot point at (0, 0).
99
99
 
100
100
  @param deg rotation angle in degrees (positive rotates clockwise)
101
101
  @return SkMatrix with rotation
102
102
  */
103
- static SkMatrix SK_WARN_UNUSED_RESULT RotateDeg(SkScalar deg) {
103
+ [[nodiscard]] static SkMatrix RotateDeg(SkScalar deg) {
104
104
  SkMatrix m;
105
105
  m.setRotate(deg);
106
106
  return m;
107
107
  }
108
- static SkMatrix SK_WARN_UNUSED_RESULT RotateDeg(SkScalar deg, SkPoint pt) {
108
+ [[nodiscard]] static SkMatrix RotateDeg(SkScalar deg, SkPoint pt) {
109
109
  SkMatrix m;
110
110
  m.setRotate(deg, pt.x(), pt.y());
111
111
  return m;
112
112
  }
113
- static SkMatrix SK_WARN_UNUSED_RESULT RotateRad(SkScalar rad) {
113
+ [[nodiscard]] static SkMatrix RotateRad(SkScalar rad) {
114
114
  return RotateDeg(SkRadiansToDegrees(rad));
115
115
  }
116
116
 
@@ -120,7 +120,7 @@ public:
120
120
  @param ky vertical skew factor
121
121
  @return SkMatrix with skew
122
122
  */
123
- static SkMatrix SK_WARN_UNUSED_RESULT Skew(SkScalar kx, SkScalar ky) {
123
+ [[nodiscard]] static SkMatrix Skew(SkScalar kx, SkScalar ky) {
124
124
  SkMatrix m;
125
125
  m.setSkew(kx, ky);
126
126
  return m;
@@ -153,8 +153,8 @@ public:
153
153
  @param mode How to handle the mapping
154
154
  @return SkMatrix mapping src to dst
155
155
  */
156
- static SkMatrix SK_WARN_UNUSED_RESULT RectToRect(const SkRect& src, const SkRect& dst,
157
- ScaleToFit mode = kFill_ScaleToFit) {
156
+ [[nodiscard]] static SkMatrix RectToRect(const SkRect& src, const SkRect& dst,
157
+ ScaleToFit mode = kFill_ScaleToFit) {
158
158
  return MakeRectToRect(src, dst, mode);
159
159
  }
160
160
 
@@ -175,9 +175,9 @@ public:
175
175
  @param pers2 perspective scale factor
176
176
  @return SkMatrix constructed from parameters
177
177
  */
178
- static SkMatrix SK_WARN_UNUSED_RESULT MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX,
179
- SkScalar skewY, SkScalar scaleY, SkScalar transY,
180
- SkScalar pers0, SkScalar pers1, SkScalar pers2) {
178
+ [[nodiscard]] static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX,
179
+ SkScalar skewY, SkScalar scaleY, SkScalar transY,
180
+ SkScalar pers0, SkScalar pers1, SkScalar pers2) {
181
181
  SkMatrix m;
182
182
  m.setAll(scaleX, skewX, transX, skewY, scaleY, transY, pers0, pers1, pers2);
183
183
  return m;
@@ -1202,7 +1202,7 @@ public:
1202
1202
  @param inverse storage for inverted SkMatrix; may be nullptr
1203
1203
  @return true if SkMatrix can be inverted
1204
1204
  */
1205
- bool SK_WARN_UNUSED_RESULT invert(SkMatrix* inverse) const {
1205
+ [[nodiscard]] bool invert(SkMatrix* inverse) const {
1206
1206
  // Allow the trivial case to be inlined.
1207
1207
  if (this->isIdentity()) {
1208
1208
  if (inverse) {
@@ -1237,7 +1237,7 @@ public:
1237
1237
  @param affine storage for 3 by 2 affine matrix; may be nullptr
1238
1238
  @return true if SkMatrix does not contain perspective
1239
1239
  */
1240
- bool SK_WARN_UNUSED_RESULT asAffine(SkScalar affine[6]) const;
1240
+ [[nodiscard]] bool asAffine(SkScalar affine[6]) const;
1241
1241
 
1242
1242
  /** Sets SkMatrix to affine values, passed in column major order. Given affine,
1243
1243
  column, then row, as:
@@ -1705,7 +1705,7 @@ public:
1705
1705
  @param scaleFactors storage for minimum and maximum scale factors
1706
1706
  @return true if scale factors were computed correctly
1707
1707
  */
1708
- bool SK_WARN_UNUSED_RESULT getMinMaxScales(SkScalar scaleFactors[2]) const;
1708
+ [[nodiscard]] bool getMinMaxScales(SkScalar scaleFactors[2]) const;
1709
1709
 
1710
1710
  /** Decomposes SkMatrix into scale components and whatever remains. Returns false if
1711
1711
  SkMatrix could not be decomposed.
@@ -1944,7 +1944,7 @@ private:
1944
1944
  return GetMapPtsProc(this->getType());
1945
1945
  }
1946
1946
 
1947
- bool SK_WARN_UNUSED_RESULT invertNonIdentity(SkMatrix* inverse) const;
1947
+ [[nodiscard]] bool invertNonIdentity(SkMatrix* inverse) const;
1948
1948
 
1949
1949
  static bool Poly2Proc(const SkPoint[], SkMatrix*);
1950
1950
  static bool Poly3Proc(const SkPoint[], SkMatrix*);