@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
@@ -16,6 +16,7 @@
16
16
  #include "SkColorSpace.h"
17
17
  #include "SkSurface.h"
18
18
  #include "include/gpu/GrDirectContext.h"
19
+ #include "include/gpu/ganesh/gl/GrGLDirectContext.h"
19
20
  #include "include/gpu/gl/GrGLInterface.h"
20
21
 
21
22
  #pragma clang diagnostic pop
@@ -270,10 +271,10 @@ public:
270
271
 
271
272
  // Create the Skia context
272
273
  auto backendInterface = GrGLMakeNativeInterface();
273
- context->directContext = GrDirectContext::MakeGL(backendInterface);
274
+ context->directContext = GrDirectContexts::MakeGL(backendInterface);
274
275
 
275
276
  if (context->directContext == nullptr) {
276
- RNSkLogger::logToConsole("GrDirectContext::MakeGL failed");
277
+ RNSkLogger::logToConsole("GrDirectContexts::MakeGL failed");
277
278
  return false;
278
279
  }
279
280
  }
@@ -1,6 +1,13 @@
1
1
  #include "SkiaOpenGLHelper.h"
2
2
  #include <SkiaOpenGLSurfaceFactory.h>
3
3
 
4
+ #pragma clang diagnostic push
5
+ #pragma clang diagnostic ignored "-Wdocumentation"
6
+
7
+ #include "include/gpu/ganesh/gl/GrGLBackendSurface.h"
8
+
9
+ #pragma clang diagnostic pop
10
+
4
11
  namespace RNSkia {
5
12
 
6
13
  thread_local SkiaOpenGLContext ThreadContextHolder::ThreadSkiaOpenGLContext;
@@ -103,8 +110,8 @@ sk_sp<SkSurface> WindowSurfaceHolder::getSurface() {
103
110
  samples = maxSamples;
104
111
  }
105
112
 
106
- GrBackendRenderTarget renderTarget(_width, _height, samples, stencil,
107
- fboInfo);
113
+ auto renderTarget = GrBackendRenderTargets::MakeGL(_width, _height, samples,
114
+ stencil, fboInfo);
108
115
 
109
116
  SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
110
117
 
@@ -14,6 +14,7 @@
14
14
  #pragma clang diagnostic ignored "-Wdocumentation"
15
15
 
16
16
  #include "SkSurface.h"
17
+ #include "include/gpu/GrDirectContext.h"
17
18
 
18
19
  #pragma clang diagnostic pop
19
20
 
@@ -37,7 +38,9 @@ public:
37
38
  }
38
39
 
39
40
  JSI_HOST_FUNCTION(flush) {
40
- getObject()->flush();
41
+ if (auto dContext = GrAsDirectContext(getObject()->recordingContext())) {
42
+ dContext->flushAndSubmit();
43
+ }
41
44
  return jsi::Value::undefined();
42
45
  }
43
46
 
@@ -0,0 +1,99 @@
1
+ /*
2
+ * Copyright 2019 Google Inc.
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 GrAHardwareBufferUtils_DEFINED
8
+ #define GrAHardwareBufferUtils_DEFINED
9
+
10
+ #include "include/core/SkTypes.h"
11
+
12
+ #if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
13
+
14
+ #include "include/gpu/GrBackendSurface.h"
15
+ #include "include/gpu/GrTypes.h"
16
+
17
+ class GrDirectContext;
18
+
19
+ extern "C" {
20
+ typedef struct AHardwareBuffer AHardwareBuffer;
21
+ }
22
+
23
+ namespace GrAHardwareBufferUtils {
24
+
25
+ SkColorType GetSkColorTypeFromBufferFormat(uint32_t bufferFormat);
26
+
27
+ #if !defined(SK_DISABLE_LEGACY_ANDROID_HW_UTILS)
28
+ GrBackendFormat GetBackendFormat(GrDirectContext* dContext, AHardwareBuffer* hardwareBuffer,
29
+ uint32_t bufferFormat, bool requireKnownFormat);
30
+ #endif
31
+
32
+ GrBackendFormat GetGLBackendFormat(GrDirectContext* dContext, uint32_t bufferFormat,
33
+ bool requireKnownFormat);
34
+ GrBackendFormat GetVulkanBackendFormat(GrDirectContext* dContext, AHardwareBuffer* hardwareBuffer,
35
+ uint32_t bufferFormat, bool requireKnownFormat);
36
+
37
+ typedef void* TexImageCtx;
38
+ typedef void (*DeleteImageProc)(TexImageCtx);
39
+ typedef void (*UpdateImageProc)(TexImageCtx, GrDirectContext*);
40
+
41
+ /**
42
+ * Create a GrBackendTexture from AHardwareBuffer
43
+ *
44
+ * @param context GPU context
45
+ * @param hardwareBuffer AHB
46
+ * @param width texture width
47
+ * @param height texture height
48
+ * @param deleteProc returns a function that deletes the texture and
49
+ * other GPU resources. Must be invoked on the same
50
+ * thread as MakeBackendTexture
51
+ * @param updateProc returns a function, that needs to be invoked, when
52
+ * AHB buffer content has changed. Must be invoked on
53
+ * the same thread as MakeBackendTexture
54
+ * @param imageCtx returns an opaque image context, that is passed as
55
+ * first argument to deleteProc and updateProc
56
+ * @param isProtectedContent if true, GL backend uses EXT_protected_content
57
+ * @param backendFormat backend format, usually created with helper
58
+ * function GetBackendFormat
59
+ * @param isRenderable true if GrBackendTexture can be used as a color
60
+ * attachment
61
+ * @return valid GrBackendTexture object on success
62
+ */
63
+ #if !defined(SK_DISABLE_LEGACY_ANDROID_HW_UTILS)
64
+ GrBackendTexture MakeBackendTexture(GrDirectContext* dContext, AHardwareBuffer* hardwareBuffer,
65
+ int width, int height,
66
+ DeleteImageProc* deleteProc,
67
+ UpdateImageProc* updateProc,
68
+ TexImageCtx* imageCtx,
69
+ bool isProtectedContent,
70
+ const GrBackendFormat& backendFormat,
71
+ bool isRenderable,
72
+ bool fromAndroidWindow = false);
73
+ #endif
74
+
75
+ GrBackendTexture MakeGLBackendTexture(GrDirectContext* dContext,
76
+ AHardwareBuffer* hardwareBuffer,
77
+ int width, int height,
78
+ DeleteImageProc* deleteProc,
79
+ UpdateImageProc* updateProc,
80
+ TexImageCtx* imageCtx,
81
+ bool isProtectedContent,
82
+ const GrBackendFormat& backendFormat,
83
+ bool isRenderable);
84
+
85
+ GrBackendTexture MakeVulkanBackendTexture(GrDirectContext* dContext,
86
+ AHardwareBuffer* hardwareBuffer,
87
+ int width, int height,
88
+ DeleteImageProc* deleteProc,
89
+ UpdateImageProc* updateProc,
90
+ TexImageCtx* imageCtx,
91
+ bool isProtectedContent,
92
+ const GrBackendFormat& backendFormat,
93
+ bool isRenderable,
94
+ bool fromAndroidWindow = false);
95
+
96
+ } // namespace GrAHardwareBufferUtils
97
+
98
+ #endif
99
+ #endif
@@ -15,15 +15,20 @@ class SkStream;
15
15
 
16
16
  #include <memory>
17
17
 
18
+ // This codec depends on heif libraries that are only part of the Android framework.
19
+ // It will not work on other platforms currently.
20
+ //
21
+ // For historical reasons, this codec also decodes AVIF images.
22
+ // There is a newer, dedicated SkAvifDecoder which could be used instead.
18
23
  namespace SkHeifDecoder {
19
24
 
20
- /** Returns true if this data claims to be a HEIF image. */
25
+ /** Returns true if this data claims to be a HEIF (or AVIF) image. */
21
26
  SK_API bool IsHeif(const void*, size_t);
22
27
 
23
28
  /**
24
- * Attempts to decode the given bytes as a HEIF.
29
+ * Attempts to decode the given bytes as a HEIF (or AVIF).
25
30
  *
26
- * If the bytes are not a HEIF, returns nullptr.
31
+ * If the bytes are not a HEIF (or AVIF), returns nullptr.
27
32
  *
28
33
  * DecodeContext is treated as a SkCodec::SelectionPolicy*
29
34
  */
@@ -34,6 +39,8 @@ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
39
  SkCodec::Result*,
35
40
  SkCodecs::DecodeContext = nullptr);
36
41
 
42
+ // Do not register this codec using "avif" as the key (even though it can handle that type).
43
+ // Doing so would cause internal codec sniffing to choose the wrong sampler.
37
44
  inline SkCodecs::Decoder Decoder() {
38
45
  return { "heif", IsHeif, Decode };
39
46
  }
@@ -9,6 +9,7 @@
9
9
 
10
10
  #include "include/codec/SkCodec.h"
11
11
  #include "include/core/SkRefCnt.h"
12
+ #include "include/private/base/SkAPI.h"
12
13
 
13
14
  class SkData;
14
15
  class SkStream;
@@ -9,6 +9,7 @@
9
9
 
10
10
  #include "include/codec/SkCodec.h"
11
11
  #include "include/core/SkRefCnt.h"
12
+ #include "include/private/base/SkAPI.h"
12
13
 
13
14
  class SkData;
14
15
  class SkStream;
@@ -821,7 +821,7 @@ protected:
821
821
  * This is called by getPixels(), getYUV8Planes(), startIncrementalDecode() and
822
822
  * startScanlineDecode(). Subclasses may call if they need to rewind at another time.
823
823
  */
824
- bool SK_WARN_UNUSED_RESULT rewindIfNeeded();
824
+ [[nodiscard]] bool rewindIfNeeded();
825
825
 
826
826
  /**
827
827
  * Called by rewindIfNeeded, if the stream needed to be rewound.
@@ -1008,6 +1008,7 @@ private:
1008
1008
  virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; }
1009
1009
 
1010
1010
  friend class DM::CodecSrc; // for fillIncompleteImage
1011
+ friend class PNGCodecGM; // for fillIncompleteImage
1011
1012
  friend class SkSampledCodec;
1012
1013
  friend class SkIcoCodec;
1013
1014
  friend class SkAndroidCodec; // for fEncodedInfo
@@ -1021,7 +1022,7 @@ using MakeFromStreamCallback = std::unique_ptr<SkCodec> (*)(std::unique_ptr<SkSt
1021
1022
  SkCodec::Result*,
1022
1023
  DecodeContext);
1023
1024
 
1024
- struct Decoder {
1025
+ struct SK_API Decoder {
1025
1026
  // By convention, we use all lowercase letters and go with the primary filename extension.
1026
1027
  // For example "png", "jpg", "ico", "webp", etc
1027
1028
  std::string id;
@@ -1033,7 +1034,7 @@ struct Decoder {
1033
1034
  // SkCodec::MakeFromStream. If a decoder with the same id already exists, this new decoder
1034
1035
  // will replace the existing one (in the same position). This is not thread-safe, so make sure all
1035
1036
  // initialization is done before the first call.
1036
- void Register(Decoder d);
1037
+ void SK_API Register(Decoder d);
1037
1038
  }
1038
1039
 
1039
1040
  #endif // SkCodec_DEFINED
@@ -14,9 +14,6 @@
14
14
  * Enum describing format of encoded data.
15
15
  */
16
16
  enum class SkEncodedImageFormat {
17
- #ifdef SK_BUILD_FOR_GOOGLE3
18
- kUnknown,
19
- #endif
20
17
  kBMP,
21
18
  kGIF,
22
19
  kICO,
@@ -9,6 +9,7 @@
9
9
 
10
10
  #include "include/codec/SkCodec.h"
11
11
  #include "include/core/SkRefCnt.h"
12
+ #include "include/private/base/SkAPI.h"
12
13
 
13
14
  class SkData;
14
15
  class SkStream;
@@ -9,6 +9,7 @@
9
9
 
10
10
  #include "include/codec/SkCodec.h"
11
11
  #include "include/core/SkRefCnt.h"
12
+ #include "include/private/base/SkAPI.h"
12
13
 
13
14
  class SkData;
14
15
  class SkStream;
@@ -9,6 +9,7 @@
9
9
 
10
10
  #include "include/codec/SkCodec.h"
11
11
  #include "include/core/SkRefCnt.h"
12
+ #include "include/private/base/SkAPI.h"
12
13
 
13
14
  class SkData;
14
15
  class SkStream;
@@ -9,6 +9,7 @@
9
9
 
10
10
  #include "include/codec/SkCodec.h"
11
11
  #include "include/core/SkRefCnt.h"
12
+ #include "include/private/base/SkAPI.h"
12
13
 
13
14
  class SkData;
14
15
  class SkStream;
@@ -9,6 +9,7 @@
9
9
 
10
10
  #include "include/codec/SkCodec.h"
11
11
  #include "include/core/SkRefCnt.h"
12
+ #include "include/private/base/SkAPI.h"
12
13
 
13
14
  class SkData;
14
15
  class SkStream;
@@ -9,6 +9,7 @@
9
9
 
10
10
  #include "include/codec/SkCodec.h"
11
11
  #include "include/core/SkRefCnt.h"
12
+ #include "include/private/base/SkAPI.h"
12
13
 
13
14
  class SkData;
14
15
  class SkStream;
@@ -9,6 +9,7 @@
9
9
 
10
10
  #include "include/codec/SkCodec.h"
11
11
  #include "include/core/SkRefCnt.h"
12
+ #include "include/private/base/SkAPI.h"
12
13
 
13
14
  class SkData;
14
15
  class SkStream;
@@ -9,6 +9,7 @@
9
9
 
10
10
  #include "include/codec/SkCodec.h"
11
11
  #include "include/core/SkRefCnt.h"
12
+ #include "include/private/base/SkAPI.h"
12
13
 
13
14
  class SkData;
14
15
  class SkStream;
@@ -99,8 +99,6 @@
99
99
  Skia consumers can provide their own definitions of these macros to
100
100
  integrate with their own compilers and build system.
101
101
  */
102
- //#define SK_UNUSED [[maybe_unused]]
103
- //#define SK_WARN_UNUSED_RESULT [[nodiscard]]
104
102
  //#define SK_ALWAYS_INLINE inline __attribute__((always_inline))
105
103
  //#define SK_NEVER_INLINE __attribute__((noinline))
106
104
  //#define SK_PRINTF_LIKE(A, B) __attribute__((format(printf, (A), (B))))
@@ -33,7 +33,7 @@ class SkPixelRef;
33
33
  class SkShader;
34
34
  enum SkColorType : int;
35
35
  enum class SkTileMode;
36
- struct SkMask;
36
+ struct SkMaskBuilder;
37
37
 
38
38
  /** \class SkBitmap
39
39
  SkBitmap describes a two-dimensional raster pixel array. SkBitmap is built on
@@ -440,7 +440,7 @@ public:
440
440
  @param flags kZeroPixels_AllocFlag, or zero
441
441
  @return true if pixels allocation is successful
442
442
  */
443
- bool SK_WARN_UNUSED_RESULT tryAllocPixelsFlags(const SkImageInfo& info, uint32_t flags);
443
+ [[nodiscard]] bool tryAllocPixelsFlags(const SkImageInfo& info, uint32_t flags);
444
444
 
445
445
  /** Sets SkImageInfo to info following the rules in setInfo() and allocates pixel
446
446
  memory. Memory is zeroed.
@@ -478,7 +478,7 @@ public:
478
478
  @param rowBytes size of pixel row or larger; may be zero
479
479
  @return true if pixel storage is allocated
480
480
  */
481
- bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo& info, size_t rowBytes);
481
+ [[nodiscard]] bool tryAllocPixels(const SkImageInfo& info, size_t rowBytes);
482
482
 
483
483
  /** Sets SkImageInfo to info following the rules in setInfo() and allocates pixel
484
484
  memory. rowBytes must equal or exceed info.width() times info.bytesPerPixel(),
@@ -514,7 +514,7 @@ public:
514
514
  @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace
515
515
  @return true if pixel storage is allocated
516
516
  */
517
- bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo& info) {
517
+ [[nodiscard]] bool tryAllocPixels(const SkImageInfo& info) {
518
518
  return this->tryAllocPixels(info, info.minRowBytes());
519
519
  }
520
520
 
@@ -553,7 +553,7 @@ public:
553
553
  @param isOpaque true if pixels do not have transparency
554
554
  @return true if pixel storage is allocated
555
555
  */
556
- bool SK_WARN_UNUSED_RESULT tryAllocN32Pixels(int width, int height, bool isOpaque = false);
556
+ [[nodiscard]] bool tryAllocN32Pixels(int width, int height, bool isOpaque = false);
557
557
 
558
558
  /** Sets SkImageInfo to width, height, and the native color type; and allocates
559
559
  pixel memory. If isOpaque is true, sets SkImageInfo to kOpaque_SkAlphaType;
@@ -637,7 +637,7 @@ public:
637
637
 
638
638
  /** Deprecated.
639
639
  */
640
- bool installMaskPixels(const SkMask& mask);
640
+ bool installMaskPixels(SkMaskBuilder& mask);
641
641
 
642
642
  /** Replaces SkPixelRef with pixels, preserving SkImageInfo and rowBytes().
643
643
  Sets SkPixelRef origin to (0, 0).
@@ -661,7 +661,7 @@ public:
661
661
 
662
662
  @return true if the allocation succeeds
663
663
  */
664
- bool SK_WARN_UNUSED_RESULT tryAllocPixels() {
664
+ [[nodiscard]] bool tryAllocPixels() {
665
665
  return this->tryAllocPixels((Allocator*)nullptr);
666
666
  }
667
667
 
@@ -685,7 +685,7 @@ public:
685
685
  @param allocator instance of SkBitmap::Allocator instantiation
686
686
  @return true if custom allocator reports success
687
687
  */
688
- bool SK_WARN_UNUSED_RESULT tryAllocPixels(Allocator* allocator);
688
+ [[nodiscard]] bool tryAllocPixels(Allocator* allocator);
689
689
 
690
690
  /** Allocates pixel memory with allocator, and replaces existing SkPixelRef.
691
691
  The allocation size is determined by SkImageInfo width, height, and SkColorType.