@shopify/react-native-skia 0.1.213 → 0.1.215
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +3 -2
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +9 -2
- package/cpp/api/JsiSkMatrix.h +31 -0
- package/cpp/api/JsiSkPath.h +15 -7
- package/cpp/api/JsiSkSurface.h +4 -1
- package/cpp/skia/include/android/GrAHardwareBufferUtils.h +99 -0
- package/cpp/skia/include/android/SkHeifDecoder.h +10 -3
- package/cpp/skia/include/codec/SkAvifDecoder.h +1 -0
- package/cpp/skia/include/codec/SkBmpDecoder.h +1 -0
- package/cpp/skia/include/codec/SkCodec.h +4 -3
- package/cpp/skia/include/codec/SkEncodedImageFormat.h +0 -3
- package/cpp/skia/include/codec/SkGifDecoder.h +1 -0
- package/cpp/skia/include/codec/SkIcoDecoder.h +1 -0
- package/cpp/skia/include/codec/SkJpegDecoder.h +1 -0
- package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -0
- package/cpp/skia/include/codec/SkPngDecoder.h +1 -0
- package/cpp/skia/include/codec/SkRawDecoder.h +1 -0
- package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -0
- package/cpp/skia/include/codec/SkWebpDecoder.h +1 -0
- package/cpp/skia/include/config/SkUserConfig.h +0 -2
- package/cpp/skia/include/core/SkBitmap.h +8 -8
- package/cpp/skia/include/core/SkCanvas.h +37 -50
- package/cpp/skia/include/core/SkCapabilities.h +2 -7
- package/cpp/skia/include/core/SkColor.h +1 -1
- package/cpp/skia/include/core/SkColorFilter.h +6 -0
- package/cpp/skia/include/core/SkColorTable.h +3 -0
- package/cpp/skia/include/core/SkColorType.h +2 -0
- package/cpp/skia/include/core/SkContourMeasure.h +12 -8
- package/cpp/skia/include/core/SkDocument.h +1 -0
- package/cpp/skia/include/core/SkFont.h +11 -2
- package/cpp/skia/include/core/SkFontMgr.h +2 -3
- package/cpp/skia/include/core/SkGraphics.h +3 -13
- package/cpp/skia/include/core/SkImage.h +57 -111
- package/cpp/skia/include/core/SkImageFilter.h +6 -1
- package/cpp/skia/include/core/SkImageGenerator.h +8 -0
- package/cpp/skia/include/core/SkImageInfo.h +0 -2
- package/cpp/skia/include/core/SkM44.h +7 -3
- package/cpp/skia/include/core/SkMallocPixelRef.h +4 -1
- package/cpp/skia/include/core/SkMatrix.h +17 -17
- package/cpp/skia/include/core/SkMesh.h +71 -61
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOverdrawCanvas.h +25 -0
- package/cpp/skia/include/core/SkPaint.h +1 -1
- package/cpp/skia/include/core/SkPath.h +12 -4
- package/cpp/skia/include/core/SkPathMeasure.h +3 -4
- package/cpp/skia/include/core/SkPicture.h +19 -6
- package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
- package/cpp/skia/include/core/SkPixmap.h +2 -3
- package/cpp/skia/include/core/SkRRect.h +1 -1
- package/cpp/skia/include/core/SkRect.h +107 -110
- package/cpp/skia/include/core/SkRefCnt.h +1 -1
- package/cpp/skia/include/core/SkRegion.h +7 -1
- package/cpp/skia/include/core/SkSerialProcs.h +14 -0
- package/cpp/skia/include/core/SkShader.h +9 -0
- package/cpp/skia/include/core/SkStream.h +9 -9
- package/cpp/skia/include/core/SkString.h +1 -1
- package/cpp/skia/include/core/SkSurface.h +14 -25
- package/cpp/skia/include/core/SkTextBlob.h +17 -4
- package/cpp/skia/include/core/SkTiledImageUtils.h +28 -0
- package/cpp/skia/include/core/SkTypeface.h +7 -2
- package/cpp/skia/include/core/SkTypes.h +4 -12
- package/cpp/skia/include/docs/SkPDFDocument.h +17 -3
- package/cpp/skia/include/effects/SkImageFilters.h +73 -24
- package/cpp/skia/include/effects/SkRuntimeEffect.h +20 -51
- package/cpp/skia/include/gpu/GpuTypes.h +13 -0
- package/cpp/skia/include/gpu/GrBackendSurface.h +95 -262
- package/cpp/skia/include/gpu/GrContextOptions.h +7 -1
- package/cpp/skia/include/gpu/GrDirectContext.h +138 -128
- package/cpp/skia/include/gpu/GrRecordingContext.h +9 -4
- package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -24
- package/cpp/skia/include/gpu/GrTypes.h +16 -1
- package/cpp/skia/include/gpu/GrYUVABackendTextures.h +4 -4
- package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -2
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +44 -12
- package/cpp/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
- package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +2 -1
- package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +58 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +29 -0
- package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +1 -1
- package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +67 -0
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +14 -3
- package/cpp/skia/include/gpu/graphite/Context.h +93 -13
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +19 -8
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +23 -0
- package/cpp/skia/include/gpu/graphite/Image.h +56 -0
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +5 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +26 -9
- package/cpp/skia/include/gpu/graphite/Recording.h +7 -5
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +8 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +2 -2
- package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +4 -3
- package/cpp/skia/include/ports/SkCFObject.h +1 -1
- package/cpp/skia/include/private/SkGainmapInfo.h +4 -13
- package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -24
- package/cpp/skia/include/private/SkWeakRefCnt.h +1 -1
- package/cpp/skia/include/private/base/SkAnySubclass.h +73 -0
- package/cpp/skia/include/private/base/SkAssert.h +106 -12
- package/cpp/skia/include/private/base/SkAttributes.h +0 -12
- package/cpp/skia/include/private/base/SkFeatures.h +0 -3
- package/cpp/skia/include/private/base/SkFloatingPoint.h +58 -105
- package/cpp/skia/include/private/base/SkSpan_impl.h +18 -12
- package/cpp/skia/include/private/base/SkTArray.h +22 -17
- package/cpp/skia/include/private/base/SkTDArray.h +5 -6
- package/cpp/skia/include/private/base/SkTemplates.h +50 -30
- package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +5 -2
- package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +2 -2
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +13 -8
- package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +1 -1
- package/cpp/skia/include/private/chromium/SkImageChromium.h +16 -3
- package/cpp/skia/include/private/chromium/Slug.h +11 -4
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +6 -9
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +29 -13
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -28
- package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +34 -0
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +6 -0
- package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +8 -0
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +10 -0
- package/cpp/skia/include/utils/SkBase64.h +2 -2
- package/cpp/skia/include/utils/SkNWayCanvas.h +1 -11
- package/cpp/skia/include/utils/SkNoDrawCanvas.h +0 -2
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -2
- package/cpp/skia/include/utils/SkShadowUtils.h +15 -1
- package/cpp/skia/include/utils/SkTextUtils.h +1 -1
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +107 -1
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +3 -2
- package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +4 -0
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +5 -3
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +4 -0
- package/cpp/skia/src/core/SkChecksum.h +2 -1
- package/cpp/skia/src/core/SkPathPriv.h +1 -1
- package/cpp/skia/src/core/SkTHash.h +19 -9
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
- package/lib/commonjs/animation/functions/interpolatePaths.d.ts +1 -1
- package/lib/commonjs/animation/functions/interpolatePaths.js +4 -4
- package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/commonjs/external/reanimated/index.d.ts +3 -1
- package/lib/commonjs/external/reanimated/index.js +30 -4
- package/lib/commonjs/external/reanimated/index.js.map +1 -1
- package/lib/commonjs/external/reanimated/interpolators.d.ts +9 -0
- package/lib/commonjs/external/reanimated/interpolators.js +56 -0
- package/lib/commonjs/external/reanimated/interpolators.js.map +1 -0
- package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +8 -6
- package/lib/commonjs/external/reanimated/moduleWrapper.js +8 -18
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js +46 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.d.ts +2 -0
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +53 -0
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -0
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +1 -0
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +27 -0
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -0
- package/lib/commonjs/mock/index.js +8 -0
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +5 -5
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/skia/core/AnimatedImage.d.ts +0 -1
- package/lib/commonjs/skia/core/AnimatedImage.js +1 -45
- package/lib/commonjs/skia/core/AnimatedImage.js.map +1 -1
- package/lib/commonjs/skia/types/MaskFilter.js +4 -0
- package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix.d.ts +4 -0
- package/lib/commonjs/skia/types/Matrix.js.map +1 -1
- package/lib/commonjs/skia/types/Path/Path.d.ts +10 -9
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +6 -0
- package/lib/commonjs/skia/web/JsiSkMatrix.js +33 -5
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.d.ts +9 -9
- package/lib/commonjs/skia/web/JsiSkPath.js +15 -2
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +2 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/types.js +3 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/animation/functions/interpolatePaths.d.ts +1 -1
- package/lib/module/animation/functions/interpolatePaths.js +4 -4
- package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/external/reanimated/index.d.ts +3 -1
- package/lib/module/external/reanimated/index.js +3 -1
- package/lib/module/external/reanimated/index.js.map +1 -1
- package/lib/module/external/reanimated/interpolators.d.ts +9 -0
- package/lib/module/external/reanimated/interpolators.js +34 -0
- package/lib/module/external/reanimated/interpolators.js.map +1 -0
- package/lib/module/external/reanimated/moduleWrapper.d.ts +8 -6
- package/lib/module/external/reanimated/moduleWrapper.js +5 -16
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.js +48 -2
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.d.ts +2 -0
- package/lib/module/external/reanimated/useAnimatedImageValue.js +41 -0
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -0
- package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +1 -0
- package/lib/module/external/reanimated/useDerivedValueOnJS.js +16 -0
- package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -0
- package/lib/module/mock/index.js +8 -0
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +1 -1
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/skia/core/AnimatedImage.d.ts +0 -1
- package/lib/module/skia/core/AnimatedImage.js +0 -40
- package/lib/module/skia/core/AnimatedImage.js.map +1 -1
- package/lib/module/skia/types/MaskFilter.js +3 -0
- package/lib/module/skia/types/MaskFilter.js.map +1 -1
- package/lib/module/skia/types/Matrix.d.ts +4 -0
- package/lib/module/skia/types/Matrix.js.map +1 -1
- package/lib/module/skia/types/Path/Path.d.ts +10 -9
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.d.ts +6 -0
- package/lib/module/skia/web/JsiSkMatrix.js +33 -5
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.d.ts +9 -9
- package/lib/module/skia/web/JsiSkPath.js +15 -2
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/views/types.js +3 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/jestEnv.d.mts +5 -0
- package/lib/typescript/jestSetup.d.mts +1 -0
- package/lib/typescript/src/animation/functions/interpolatePaths.d.ts +1 -1
- package/lib/typescript/src/external/reanimated/index.d.ts +3 -1
- package/lib/typescript/src/external/reanimated/interpolators.d.ts +9 -0
- package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +8 -6
- package/lib/typescript/src/external/reanimated/useAnimatedImageValue.d.ts +2 -0
- package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +1 -0
- package/lib/typescript/src/skia/core/AnimatedImage.d.ts +0 -1
- package/lib/typescript/src/skia/types/Matrix.d.ts +4 -0
- package/lib/typescript/src/skia/types/Path/Path.d.ts +10 -9
- package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +6 -0
- package/lib/typescript/src/skia/web/JsiSkPath.d.ts +9 -9
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libskparagraph.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libskunicode.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libskparagraph.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libskunicode.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libskparagraph.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libskunicode.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/Info.plist +5 -5
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode.xcframework/Info.plist +5 -5
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +4 -3
- package/react-native-skia.podspec +1 -1
- package/src/animation/functions/interpolatePaths.ts +7 -4
- package/src/dom/nodes/datatypes/Rect.ts +6 -2
- package/src/external/reanimated/index.ts +3 -1
- package/src/external/reanimated/interpolators.ts +89 -0
- package/src/external/reanimated/moduleWrapper.ts +38 -25
- package/src/external/reanimated/renderHelpers.ts +42 -2
- package/src/external/reanimated/useAnimatedImageValue.ts +51 -0
- package/src/external/reanimated/useDerivedValueOnJS.ts +25 -0
- package/src/mock/index.ts +5 -0
- package/src/renderer/HostConfig.ts +1 -1
- package/src/skia/core/AnimatedImage.ts +0 -47
- package/src/skia/types/Matrix.ts +4 -0
- package/src/skia/types/Path/Path.ts +10 -9
- package/src/skia/web/JsiSkMatrix.ts +33 -27
- package/src/skia/web/JsiSkPath.ts +15 -2
- package/cpp/skia/include/core/SkDeferredDisplayList.h +0 -15
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +0 -15
- package/cpp/skia/include/core/SkPromiseImageTexture.h +0 -20
- package/cpp/skia/include/core/SkSurfaceCharacterization.h +0 -15
- package/cpp/skia/include/core/SkTime.h +0 -63
- package/cpp/skia/include/effects/SkOpPathEffect.h +0 -43
- package/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +0 -28
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +0 -32
- package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +0 -95
- package/cpp/skia/include/private/SkBitmaskEnum.h +0 -59
- package/cpp/skia/include/private/SkSLDefines.h +0 -64
- package/cpp/skia/include/private/SkShadowFlags.h +0 -27
- package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +0 -26
- package/globalJestSetup.js +0 -6
- package/lib/commonjs/external/reanimated/useSharedValueEffect.d.ts +0 -8
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js +0 -52
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +0 -1
- package/lib/module/external/reanimated/useSharedValueEffect.d.ts +0 -8
- package/lib/module/external/reanimated/useSharedValueEffect.js +0 -42
- package/lib/module/external/reanimated/useSharedValueEffect.js.map +0 -1
- package/lib/typescript/globalJestSetup.d.ts +0 -2
- package/lib/typescript/src/external/reanimated/useSharedValueEffect.d.ts +0 -8
- package/src/external/reanimated/useSharedValueEffect.ts +0 -58
- /package/cpp/skia/{include/private/base → src/core}/SkPathEnums.h +0 -0
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#include "include/core/SkImage.h"
|
|
12
12
|
#include "include/core/SkRefCnt.h"
|
|
13
13
|
#include "include/core/SkSpan.h"
|
|
14
|
+
#include "include/gpu/GpuTypes.h"
|
|
14
15
|
|
|
15
16
|
class SkYUVAInfo;
|
|
16
17
|
class SkYUVAPixmaps;
|
|
@@ -58,8 +59,19 @@ using GraphitePromiseTextureReleaseProc = void (*)(GraphitePromiseTextureRelease
|
|
|
58
59
|
backend texture is linear, then the colorSpace should include
|
|
59
60
|
a description of the transfer function as
|
|
60
61
|
well (e.g., SkColorSpace::MakeSRGB()).
|
|
62
|
+
@param origin Whether the Texture logically treats the origin as TopLeft or
|
|
63
|
+
BottomLeft
|
|
61
64
|
@return created SkImage, or nullptr
|
|
62
65
|
*/
|
|
66
|
+
SK_API sk_sp<SkImage> AdoptTextureFrom(skgpu::graphite::Recorder*,
|
|
67
|
+
const skgpu::graphite::BackendTexture&,
|
|
68
|
+
SkColorType colorType,
|
|
69
|
+
SkAlphaType alphaType,
|
|
70
|
+
sk_sp<SkColorSpace> colorSpace,
|
|
71
|
+
skgpu::Origin origin,
|
|
72
|
+
TextureReleaseProc = nullptr,
|
|
73
|
+
ReleaseContext = nullptr);
|
|
74
|
+
|
|
63
75
|
SK_API sk_sp<SkImage> AdoptTextureFrom(skgpu::graphite::Recorder*,
|
|
64
76
|
const skgpu::graphite::BackendTexture&,
|
|
65
77
|
SkColorType colorType,
|
|
@@ -107,6 +119,7 @@ SK_API sk_sp<SkImage> AdoptTextureFrom(skgpu::graphite::Recorder*,
|
|
|
107
119
|
@param dimensions width & height of promised gpu texture
|
|
108
120
|
@param textureInfo structural information for the promised gpu texture
|
|
109
121
|
@param colorInfo color type, alpha type and colorSpace information for the image
|
|
122
|
+
@param origin Whether the Texture logically treats the origin as TopLeft or BottomLeft
|
|
110
123
|
@param isVolatile volatility of the promise image
|
|
111
124
|
@param fulfill function called to get the actual backend texture,
|
|
112
125
|
and the instance for the GraphitePromiseTextureReleaseProc
|
|
@@ -115,6 +128,17 @@ SK_API sk_sp<SkImage> AdoptTextureFrom(skgpu::graphite::Recorder*,
|
|
|
115
128
|
@param imageContext state passed to fulfill and imageRelease
|
|
116
129
|
@return created SkImage, or nullptr
|
|
117
130
|
*/
|
|
131
|
+
SK_API sk_sp<SkImage> PromiseTextureFrom(skgpu::graphite::Recorder*,
|
|
132
|
+
SkISize dimensions,
|
|
133
|
+
const skgpu::graphite::TextureInfo&,
|
|
134
|
+
const SkColorInfo&,
|
|
135
|
+
skgpu::Origin origin,
|
|
136
|
+
skgpu::graphite::Volatile,
|
|
137
|
+
GraphitePromiseImageFulfillProc,
|
|
138
|
+
GraphitePromiseImageReleaseProc,
|
|
139
|
+
GraphitePromiseTextureReleaseProc,
|
|
140
|
+
GraphitePromiseImageContext);
|
|
141
|
+
|
|
118
142
|
SK_API sk_sp<SkImage> PromiseTextureFrom(skgpu::graphite::Recorder*,
|
|
119
143
|
SkISize dimensions,
|
|
120
144
|
const skgpu::graphite::TextureInfo&,
|
|
@@ -271,6 +295,38 @@ SK_API sk_sp<SkImage> SubsetTextureFrom(skgpu::graphite::Recorder* recorder,
|
|
|
271
295
|
const SkImage* img,
|
|
272
296
|
const SkIRect& subset,
|
|
273
297
|
SkImage::RequiredProperties props = {});
|
|
298
|
+
|
|
299
|
+
/** Creates a filtered SkImage on the GPU. filter processes the src image, potentially changing
|
|
300
|
+
color, position, and size. subset is the bounds of src that are processed
|
|
301
|
+
by filter. clipBounds is the expected bounds of the filtered SkImage. outSubset
|
|
302
|
+
is required storage for the actual bounds of the filtered SkImage. offset is
|
|
303
|
+
required storage for translation of returned SkImage.
|
|
304
|
+
|
|
305
|
+
Returns nullptr if SkImage could not be created. If nullptr is returned, outSubset
|
|
306
|
+
and offset are undefined.
|
|
307
|
+
|
|
308
|
+
Useful for animation of SkImageFilter that varies size from frame to frame.
|
|
309
|
+
Returned SkImage is created larger than required by filter so that GPU texture
|
|
310
|
+
can be reused with different sized effects. outSubset describes the valid bounds
|
|
311
|
+
of GPU texture returned. offset translates the returned SkImage to keep subsequent
|
|
312
|
+
animation frames aligned with respect to each other.
|
|
313
|
+
|
|
314
|
+
@param recorder the recorder in which the filtering operation is to be performed
|
|
315
|
+
@param filter how SkImage is sampled when transformed
|
|
316
|
+
@param subset bounds of SkImage processed by filter
|
|
317
|
+
@param clipBounds expected bounds of filtered SkImage
|
|
318
|
+
@param outSubset storage for returned SkImage bounds
|
|
319
|
+
@param offset storage for returned SkImage translation
|
|
320
|
+
@return filtered SkImage, or nullptr
|
|
321
|
+
*/
|
|
322
|
+
SK_API sk_sp<SkImage> MakeWithFilter(skgpu::graphite::Recorder* recorder,
|
|
323
|
+
sk_sp<SkImage> src,
|
|
324
|
+
const SkImageFilter* filter,
|
|
325
|
+
const SkIRect& subset,
|
|
326
|
+
const SkIRect& clipBounds,
|
|
327
|
+
SkIRect* outSubset,
|
|
328
|
+
SkIPoint* offset);
|
|
329
|
+
|
|
274
330
|
} // namespace SkImages
|
|
275
331
|
|
|
276
332
|
|
|
@@ -33,6 +33,11 @@ class Recorder;
|
|
|
33
33
|
* If the requirements are not met by the returned image (modulo the flexibility wrt mipmapping)
|
|
34
34
|
* Graphite will drop the draw.
|
|
35
35
|
*
|
|
36
|
+
* All returned images must be backed by textures that have a TopLeft origin. If Skia is used to
|
|
37
|
+
* create the texture (e.g. using makeTextureImage) then this is always guaranteed. If the client
|
|
38
|
+
* returns a texture they created themselves and wrapped in Skia, they must ensure that texture has
|
|
39
|
+
* a TopLeft origin.
|
|
40
|
+
*
|
|
36
41
|
* Note: by default, Graphite will not perform any caching of images
|
|
37
42
|
*
|
|
38
43
|
* Threading concerns:
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
#include "include/private/base/SingleOwner.h"
|
|
16
16
|
#include "include/private/base/SkTArray.h"
|
|
17
17
|
|
|
18
|
+
#include <chrono>
|
|
18
19
|
#include <vector>
|
|
19
20
|
|
|
20
21
|
class SkCanvas;
|
|
@@ -33,7 +34,7 @@ class TextBlobRedrawCoordinator;
|
|
|
33
34
|
|
|
34
35
|
namespace skgpu::graphite {
|
|
35
36
|
|
|
36
|
-
class
|
|
37
|
+
class AtlasProvider;
|
|
37
38
|
class BackendTexture;
|
|
38
39
|
class Caps;
|
|
39
40
|
class Context;
|
|
@@ -63,6 +64,10 @@ struct SK_API RecorderOptions final {
|
|
|
63
64
|
~RecorderOptions();
|
|
64
65
|
|
|
65
66
|
sk_sp<ImageProvider> fImageProvider;
|
|
67
|
+
|
|
68
|
+
const size_t kDefaultRecorderBudget = 256 * (1 << 20);
|
|
69
|
+
// What is the budget for GPU resources allocated and held by this Recorder.
|
|
70
|
+
size_t fGpuBudgetInBytes = kDefaultRecorderBudget;
|
|
66
71
|
};
|
|
67
72
|
|
|
68
73
|
class SK_API Recorder final {
|
|
@@ -120,7 +125,7 @@ public:
|
|
|
120
125
|
* Otherwise this will delete/release the backend object that is wrapped in the BackendTexture.
|
|
121
126
|
* The BackendTexture will be reset to an invalid state and should not be used again.
|
|
122
127
|
*/
|
|
123
|
-
void deleteBackendTexture(BackendTexture&);
|
|
128
|
+
void deleteBackendTexture(const BackendTexture&);
|
|
124
129
|
|
|
125
130
|
// Adds a proc that will be moved to the Recording upon snap, subsequently attached to the
|
|
126
131
|
// CommandBuffer when the Recording is added, and called when that CommandBuffer is submitted
|
|
@@ -134,14 +139,25 @@ public:
|
|
|
134
139
|
// Recording snap, at which point it is deleted.
|
|
135
140
|
SkCanvas* makeDeferredCanvas(const SkImageInfo&, const TextureInfo&);
|
|
136
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Frees GPU resources created and held by the Recorder. Can be called to reduce GPU memory
|
|
144
|
+
* pressure. Any resources that are still in use (e.g. being used by work submitted to the GPU)
|
|
145
|
+
* will not be deleted by this call. If the caller wants to make sure all resources are freed,
|
|
146
|
+
* then they should first make sure to submit and wait on any outstanding work.
|
|
147
|
+
*/
|
|
148
|
+
void freeGpuResources();
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Purge GPU resources on the Recorder that haven't been used in the past 'msNotUsed'
|
|
152
|
+
* milliseconds or are otherwise marked for deletion, regardless of whether the context is under
|
|
153
|
+
* budget.
|
|
154
|
+
*/
|
|
155
|
+
void performDeferredCleanup(std::chrono::milliseconds msNotUsed);
|
|
156
|
+
|
|
137
157
|
// Provides access to functions that aren't part of the public API.
|
|
138
158
|
RecorderPriv priv();
|
|
139
159
|
const RecorderPriv priv() const; // NOLINT(readability-const-return-type)
|
|
140
160
|
|
|
141
|
-
#if GRAPHITE_TEST_UTILS
|
|
142
|
-
bool deviceIsRegistered(Device*);
|
|
143
|
-
#endif
|
|
144
|
-
|
|
145
161
|
private:
|
|
146
162
|
friend class Context; // For ctor
|
|
147
163
|
friend class Device; // For registering and deregistering Devices;
|
|
@@ -184,8 +200,9 @@ private:
|
|
|
184
200
|
std::unique_ptr<UploadBufferManager> fUploadBufferManager;
|
|
185
201
|
std::vector<Device*> fTrackedDevices;
|
|
186
202
|
|
|
187
|
-
uint32_t
|
|
188
|
-
|
|
203
|
+
uint32_t fUniqueID; // Needed for MessageBox handling for text
|
|
204
|
+
uint32_t fNextRecordingID = 1;
|
|
205
|
+
std::unique_ptr<AtlasProvider> fAtlasProvider;
|
|
189
206
|
std::unique_ptr<TokenTracker> fTokenTracker;
|
|
190
207
|
std::unique_ptr<sktext::gpu::StrikeCache> fStrikeCache;
|
|
191
208
|
std::unique_ptr<sktext::gpu::TextBlobRedrawCoordinator> fTextBlobCache;
|
|
@@ -202,7 +219,7 @@ private:
|
|
|
202
219
|
|
|
203
220
|
skia_private::TArray<sk_sp<RefCntedCallback>> fFinishedProcs;
|
|
204
221
|
|
|
205
|
-
#if GRAPHITE_TEST_UTILS
|
|
222
|
+
#if defined(GRAPHITE_TEST_UTILS)
|
|
206
223
|
// For testing use only -- the Context used to create this Recorder
|
|
207
224
|
Context* fContext = nullptr;
|
|
208
225
|
#endif
|
|
@@ -36,10 +36,6 @@ public:
|
|
|
36
36
|
|
|
37
37
|
RecordingPriv priv();
|
|
38
38
|
|
|
39
|
-
#if GRAPHITE_TEST_UTILS
|
|
40
|
-
bool isTargetProxyInstantiated() const;
|
|
41
|
-
#endif
|
|
42
|
-
|
|
43
39
|
private:
|
|
44
40
|
friend class Recorder; // for ctor and LazyProxyData
|
|
45
41
|
friend class RecordingPriv;
|
|
@@ -64,7 +60,9 @@ private:
|
|
|
64
60
|
std::size_t operator()(const sk_sp<TextureProxy>& proxy) const;
|
|
65
61
|
};
|
|
66
62
|
|
|
67
|
-
Recording(
|
|
63
|
+
Recording(uint32_t uniqueID,
|
|
64
|
+
uint32_t recorderID,
|
|
65
|
+
std::unique_ptr<TaskGraph>,
|
|
68
66
|
std::unordered_set<sk_sp<TextureProxy>, ProxyHash>&& nonVolatileLazyProxies,
|
|
69
67
|
std::unordered_set<sk_sp<TextureProxy>, ProxyHash>&& volatileLazyProxies,
|
|
70
68
|
std::unique_ptr<LazyProxyData> targetProxyData,
|
|
@@ -73,6 +71,10 @@ private:
|
|
|
73
71
|
bool addCommands(CommandBuffer*, ResourceProvider*);
|
|
74
72
|
void addResourceRef(sk_sp<Resource>);
|
|
75
73
|
|
|
74
|
+
// Used to verify ordering
|
|
75
|
+
uint32_t fUniqueID;
|
|
76
|
+
uint32_t fRecorderID;
|
|
77
|
+
|
|
76
78
|
std::unique_ptr<TaskGraph> fGraph;
|
|
77
79
|
// We don't always take refs to all resources used by specific Tasks (e.g. a common buffer used
|
|
78
80
|
// for uploads). Instead we'll just hold onto one ref for those Resources outside the Tasks.
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
#include "include/private/gpu/graphite/VulkanGraphiteTypesPriv.h"
|
|
24
24
|
#endif
|
|
25
25
|
|
|
26
|
+
struct SkISize;
|
|
27
|
+
|
|
26
28
|
namespace skgpu::graphite {
|
|
27
29
|
|
|
28
30
|
class SK_API TextureInfo {
|
|
@@ -100,12 +102,18 @@ public:
|
|
|
100
102
|
}
|
|
101
103
|
#endif
|
|
102
104
|
|
|
105
|
+
bool isCompatible(const TextureInfo& that) const;
|
|
103
106
|
SkString toString() const;
|
|
104
107
|
|
|
105
108
|
private:
|
|
109
|
+
friend size_t ComputeSize(SkISize dimensions, const TextureInfo&); // for bytesPerPixel
|
|
110
|
+
|
|
111
|
+
size_t bytesPerPixel() const;
|
|
112
|
+
|
|
106
113
|
#ifdef SK_DAWN
|
|
107
114
|
friend class DawnCaps;
|
|
108
115
|
friend class DawnCommandBuffer;
|
|
116
|
+
friend class DawnComputePipeline;
|
|
109
117
|
friend class DawnGraphicsPipeline;
|
|
110
118
|
friend class DawnResourceProvider;
|
|
111
119
|
friend class DawnTexture;
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
#include <TargetConditionals.h>
|
|
20
20
|
|
|
21
21
|
#if TARGET_OS_SIMULATOR
|
|
22
|
-
#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0))
|
|
22
|
+
#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0), tvos(13.0))
|
|
23
23
|
#else // TARGET_OS_SIMULATOR
|
|
24
|
-
#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0))
|
|
24
|
+
#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0), tvos(9.0))
|
|
25
25
|
#endif // TARGET_OS_SIMULATOR
|
|
26
26
|
|
|
27
27
|
#endif // __APPLE__
|
|
@@ -26,9 +26,9 @@ using GrMTLHandle = const void*;
|
|
|
26
26
|
#include <TargetConditionals.h>
|
|
27
27
|
|
|
28
28
|
#if TARGET_OS_SIMULATOR
|
|
29
|
-
#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0))
|
|
29
|
+
#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0), tvos(13.0))
|
|
30
30
|
#else // TARGET_OS_SIMULATOR
|
|
31
|
-
#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0))
|
|
31
|
+
#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0), tvos(9.0))
|
|
32
32
|
#endif // TARGET_OS_SIMULATOR
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -34,7 +34,10 @@ struct GrVkYcbcrConversionInfo {
|
|
|
34
34
|
}
|
|
35
35
|
bool operator!=(const GrVkYcbcrConversionInfo& that) const { return !(*this == that); }
|
|
36
36
|
|
|
37
|
-
bool isValid() const {
|
|
37
|
+
bool isValid() const {
|
|
38
|
+
return fYcbcrModel != VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY ||
|
|
39
|
+
fExternalFormat != 0;
|
|
40
|
+
}
|
|
38
41
|
|
|
39
42
|
// Format of the source image. Must be set to VK_FORMAT_UNDEFINED for external images or
|
|
40
43
|
// a valid image format otherwise.
|
|
@@ -79,7 +82,6 @@ struct GrVkImageInfo {
|
|
|
79
82
|
bool fPartOfSwapchainOrAndroidWindow = false;
|
|
80
83
|
#endif
|
|
81
84
|
|
|
82
|
-
#if GR_TEST_UTILS
|
|
83
85
|
bool operator==(const GrVkImageInfo& that) const {
|
|
84
86
|
bool equal = fImage == that.fImage && fAlloc == that.fAlloc &&
|
|
85
87
|
fImageTiling == that.fImageTiling &&
|
|
@@ -97,7 +99,6 @@ struct GrVkImageInfo {
|
|
|
97
99
|
#endif
|
|
98
100
|
return equal;
|
|
99
101
|
}
|
|
100
|
-
#endif
|
|
101
102
|
};
|
|
102
103
|
|
|
103
104
|
using GrVkGetProc = skgpu::VulkanGetProc;
|
|
@@ -130,7 +130,7 @@ public:
|
|
|
130
130
|
* The caller must assume ownership of the object, and manage its reference count directly.
|
|
131
131
|
* No call to CFRelease() will be made.
|
|
132
132
|
*/
|
|
133
|
-
T
|
|
133
|
+
[[nodiscard]] T release() {
|
|
134
134
|
T obj = fObject;
|
|
135
135
|
fObject = nil;
|
|
136
136
|
return obj;
|
|
@@ -71,29 +71,20 @@ struct SkGainmapInfo {
|
|
|
71
71
|
};
|
|
72
72
|
BaseImageType fBaseImageType = BaseImageType::kSDR;
|
|
73
73
|
|
|
74
|
-
inline bool operator==(const SkGainmapInfo& other) {
|
|
74
|
+
inline bool operator==(const SkGainmapInfo& other) const {
|
|
75
75
|
return fGainmapRatioMin == other.fGainmapRatioMin &&
|
|
76
76
|
fGainmapRatioMax == other.fGainmapRatioMax && fGainmapGamma == other.fGainmapGamma &&
|
|
77
77
|
fEpsilonSdr == other.fEpsilonSdr && fEpsilonHdr == other.fEpsilonHdr &&
|
|
78
78
|
fDisplayRatioSdr == other.fDisplayRatioSdr &&
|
|
79
79
|
fDisplayRatioHdr == other.fDisplayRatioHdr && fBaseImageType == other.fBaseImageType;
|
|
80
80
|
}
|
|
81
|
-
inline bool operator!=(const SkGainmapInfo& other) { return !(*this == other); }
|
|
81
|
+
inline bool operator!=(const SkGainmapInfo& other) const { return !(*this == other); }
|
|
82
82
|
|
|
83
83
|
// TODO(ccameron): Remove these parameters once we are certain they are not used in Android.
|
|
84
84
|
enum class Type {
|
|
85
|
-
|
|
86
|
-
kMultiPicture,
|
|
87
|
-
kJpegR_Linear,
|
|
88
|
-
kJpegR_HLG,
|
|
89
|
-
kJpegR_PQ,
|
|
90
|
-
kHDRGM,
|
|
85
|
+
kDefault,
|
|
91
86
|
};
|
|
92
|
-
|
|
93
|
-
SkColor4f fLogRatioMax = {1.f, 1.f, 1.f, 1.0};
|
|
94
|
-
float fHdrRatioMin = 1.f;
|
|
95
|
-
float fHdrRatioMax = 50.f;
|
|
96
|
-
Type fType = Type::kUnknown;
|
|
87
|
+
Type fType = Type::kDefault;
|
|
97
88
|
};
|
|
98
89
|
|
|
99
90
|
#endif
|
|
@@ -17,30 +17,7 @@ struct SkGainmapInfo;
|
|
|
17
17
|
class SK_API SkJpegGainmapEncoder {
|
|
18
18
|
public:
|
|
19
19
|
/**
|
|
20
|
-
* Encode
|
|
21
|
-
*
|
|
22
|
-
* The base image is specified by |base|, and |baseOptions| controls the encoding behavior for
|
|
23
|
-
* the base image.
|
|
24
|
-
*
|
|
25
|
-
* The gainmap image is specified by |gainmap|, and |gainmapOptions| controls the encoding
|
|
26
|
-
* behavior for the gainmap image.
|
|
27
|
-
*
|
|
28
|
-
* The rendering behavior of the gainmap image is provided in |gainmapInfo|. Not all gainmap
|
|
29
|
-
* based images are compatible with JpegR. If the image is not compatible with JpegR, then
|
|
30
|
-
* convert the gainmap to a format that is capable with JpegR. This conversion may result in
|
|
31
|
-
* less precise quantization of the gainmap image.
|
|
32
|
-
*
|
|
33
|
-
* Returns true on success. Returns false on an invalid or unsupported |src|.
|
|
34
|
-
*/
|
|
35
|
-
static bool EncodeJpegR(SkWStream* dst,
|
|
36
|
-
const SkPixmap& base,
|
|
37
|
-
const SkJpegEncoder::Options& baseOptions,
|
|
38
|
-
const SkPixmap& gainmap,
|
|
39
|
-
const SkJpegEncoder::Options& gainmapOptions,
|
|
40
|
-
const SkGainmapInfo& gainmapInfo);
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Encode an HDRGM image to |dst|.
|
|
20
|
+
* Encode an UltraHDR image to |dst|.
|
|
44
21
|
*
|
|
45
22
|
* The base image is specified by |base|, and |baseOptions| controls the encoding behavior for
|
|
46
23
|
* the base image.
|
|
@@ -100,7 +100,7 @@ public:
|
|
|
100
100
|
returns false, no strong reference could be created and the owner's
|
|
101
101
|
reference is in the same state as before the call.
|
|
102
102
|
*/
|
|
103
|
-
bool
|
|
103
|
+
[[nodiscard]] bool try_ref() const {
|
|
104
104
|
if (atomic_conditional_acquire_strong_ref() != 0) {
|
|
105
105
|
// Acquire barrier (L/SL), if not provided above.
|
|
106
106
|
// Prevents subsequent code from happening before the increment.
|
|
@@ -0,0 +1,73 @@
|
|
|
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 SkAnySubclass_DEFINED
|
|
9
|
+
#define SkAnySubclass_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/private/base/SkAssert.h"
|
|
12
|
+
|
|
13
|
+
#include <cstddef>
|
|
14
|
+
#include <new>
|
|
15
|
+
#include <type_traits> // IWYU pragma: keep
|
|
16
|
+
#include <utility>
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Stores any subclass `T` of `Base`, where sizeof(T) <= `Size`, without using the heap.
|
|
20
|
+
* Doesn't need advance knowledge of T, so it's particularly suited to platform or backend
|
|
21
|
+
* implementations of a generic interface, where the set of possible subclasses is finite and
|
|
22
|
+
* known, but can't be made available at compile-time.
|
|
23
|
+
*/
|
|
24
|
+
template <typename Base, size_t Size>
|
|
25
|
+
class SkAnySubclass {
|
|
26
|
+
public:
|
|
27
|
+
SkAnySubclass() = default;
|
|
28
|
+
~SkAnySubclass() {
|
|
29
|
+
this->reset();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
SkAnySubclass(const SkAnySubclass&) = delete;
|
|
33
|
+
SkAnySubclass& operator=(const SkAnySubclass&) = delete;
|
|
34
|
+
SkAnySubclass(SkAnySubclass&&) = delete;
|
|
35
|
+
SkAnySubclass& operator=(SkAnySubclass&&) = delete;
|
|
36
|
+
|
|
37
|
+
template <typename T, typename... Args>
|
|
38
|
+
void emplace(Args&&... args) {
|
|
39
|
+
static_assert(std::is_base_of_v<Base, T>);
|
|
40
|
+
static_assert(sizeof(T) <= Size);
|
|
41
|
+
// We're going to clean up our stored object by calling ~Base:
|
|
42
|
+
static_assert(std::has_virtual_destructor_v<Base> || std::is_trivially_destructible_v<T>);
|
|
43
|
+
SkASSERT(!fValid);
|
|
44
|
+
new (fData) T(std::forward<Args>(args)...);
|
|
45
|
+
fValid = true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void reset() {
|
|
49
|
+
if (fValid) {
|
|
50
|
+
this->get()->~Base();
|
|
51
|
+
}
|
|
52
|
+
fValid = false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const Base* get() const {
|
|
56
|
+
SkASSERT(fValid);
|
|
57
|
+
return std::launder(reinterpret_cast<const Base*>(fData));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
Base* get() {
|
|
61
|
+
SkASSERT(fValid);
|
|
62
|
+
return std::launder(reinterpret_cast<Base*>(fData));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
Base* operator->() { return this->get(); }
|
|
66
|
+
const Base* operator->() const { return this->get(); }
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
alignas(8) std::byte fData[Size];
|
|
70
|
+
bool fValid = false;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
#endif // SkAnySubclass_DEFINED
|
|
@@ -9,8 +9,25 @@
|
|
|
9
9
|
#define SkAssert_DEFINED
|
|
10
10
|
|
|
11
11
|
#include "include/private/base/SkAPI.h"
|
|
12
|
+
#include "include/private/base/SkAttributes.h"
|
|
12
13
|
#include "include/private/base/SkDebug.h" // IWYU pragma: keep
|
|
13
14
|
|
|
15
|
+
#include <cstddef>
|
|
16
|
+
#include <limits>
|
|
17
|
+
|
|
18
|
+
#if defined(__clang__) && defined(__has_attribute)
|
|
19
|
+
#if __has_attribute(likely)
|
|
20
|
+
#define SK_LIKELY [[likely]]
|
|
21
|
+
#define SK_UNLIKELY [[unlikely]]
|
|
22
|
+
#else
|
|
23
|
+
#define SK_LIKELY
|
|
24
|
+
#define SK_UNLIKELY
|
|
25
|
+
#endif
|
|
26
|
+
#else
|
|
27
|
+
#define SK_LIKELY
|
|
28
|
+
#define SK_UNLIKELY
|
|
29
|
+
#endif
|
|
30
|
+
|
|
14
31
|
/** Called internally if we hit an unrecoverable error.
|
|
15
32
|
The platform implementation must not return, but should either throw
|
|
16
33
|
an exception or otherwise exit.
|
|
@@ -43,7 +60,7 @@
|
|
|
43
60
|
} while (false)
|
|
44
61
|
#endif
|
|
45
62
|
|
|
46
|
-
// SkASSERT, SkASSERTF and SkASSERT_RELEASE can be used as
|
|
63
|
+
// SkASSERT, SkASSERTF and SkASSERT_RELEASE can be used as standalone assertion expressions, e.g.
|
|
47
64
|
// uint32_t foo(int x) {
|
|
48
65
|
// SkASSERT(x > 4);
|
|
49
66
|
// return x - 4;
|
|
@@ -53,18 +70,32 @@
|
|
|
53
70
|
// return SkASSERT(x > 4),
|
|
54
71
|
// x - 4;
|
|
55
72
|
// }
|
|
73
|
+
#if defined(__clang__)
|
|
74
|
+
#define SkASSERT_RELEASE(cond) \
|
|
75
|
+
static_cast<void>( __builtin_expect(static_cast<bool>(cond), 1) \
|
|
76
|
+
? static_cast<void>(0) \
|
|
77
|
+
: []{ SK_ABORT("check(%s)", #cond); }() )
|
|
78
|
+
|
|
79
|
+
#define SkASSERTF_RELEASE(cond, fmt, ...) \
|
|
80
|
+
static_cast<void>( __builtin_expect(static_cast<bool>(cond), 1) \
|
|
81
|
+
? static_cast<void>(0) \
|
|
82
|
+
: [&]{ SK_ABORT("assertf(%s): " fmt, #cond, ##__VA_ARGS__); }() )
|
|
83
|
+
#else
|
|
56
84
|
#define SkASSERT_RELEASE(cond) \
|
|
57
|
-
|
|
85
|
+
static_cast<void>( (cond) ? static_cast<void>(0) : []{ SK_ABORT("check(%s)", #cond); }() )
|
|
86
|
+
|
|
87
|
+
#define SkASSERTF_RELEASE(cond, fmt, ...) \
|
|
88
|
+
static_cast<void>( (cond) \
|
|
89
|
+
? static_cast<void>(0) \
|
|
90
|
+
: [&]{ SK_ABORT("assertf(%s): " fmt, #cond, ##__VA_ARGS__); }() )
|
|
91
|
+
#endif
|
|
58
92
|
|
|
59
93
|
#if defined(SK_DEBUG)
|
|
60
|
-
#define SkASSERT(cond)
|
|
61
|
-
#define SkASSERTF(cond, fmt, ...)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
#define SkDEBUGFAIL(message) SK_ABORT("%s", message)
|
|
66
|
-
#define SkDEBUGFAILF(fmt, ...) SK_ABORT(fmt, ##__VA_ARGS__)
|
|
67
|
-
#define SkAssertResult(cond) SkASSERT(cond)
|
|
94
|
+
#define SkASSERT(cond) SkASSERT_RELEASE(cond)
|
|
95
|
+
#define SkASSERTF(cond, fmt, ...) SkASSERTF_RELEASE(cond, fmt, ##__VA_ARGS__)
|
|
96
|
+
#define SkDEBUGFAIL(message) SK_ABORT("%s", message)
|
|
97
|
+
#define SkDEBUGFAILF(fmt, ...) SK_ABORT(fmt, ##__VA_ARGS__)
|
|
98
|
+
#define SkAssertResult(cond) SkASSERT(cond)
|
|
68
99
|
#else
|
|
69
100
|
#define SkASSERT(cond) static_cast<void>(0)
|
|
70
101
|
#define SkASSERTF(cond, fmt, ...) static_cast<void>(0)
|
|
@@ -72,7 +103,7 @@
|
|
|
72
103
|
#define SkDEBUGFAILF(fmt, ...)
|
|
73
104
|
|
|
74
105
|
// unlike SkASSERT, this macro executes its condition in the non-debug build.
|
|
75
|
-
// The if is present so that this can be used with functions marked
|
|
106
|
+
// The if is present so that this can be used with functions marked [[nodiscard]].
|
|
76
107
|
#define SkAssertResult(cond) if (cond) {} do {} while(false)
|
|
77
108
|
#endif
|
|
78
109
|
|
|
@@ -89,4 +120,67 @@
|
|
|
89
120
|
# endif
|
|
90
121
|
#endif
|
|
91
122
|
|
|
92
|
-
|
|
123
|
+
[[noreturn]] SK_API inline void sk_print_index_out_of_bounds(size_t i, size_t size) {
|
|
124
|
+
SK_ABORT("Index (%zu) out of bounds for size %zu.\n", i, size);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
template <typename T> SK_API inline T sk_collection_check_bounds(T i, T size) {
|
|
128
|
+
if (0 <= i && i < size) SK_LIKELY {
|
|
129
|
+
return i;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
SK_UNLIKELY {
|
|
133
|
+
#if defined(SK_DEBUG)
|
|
134
|
+
sk_print_index_out_of_bounds(static_cast<size_t>(i), static_cast<size_t>(size));
|
|
135
|
+
#else
|
|
136
|
+
SkUNREACHABLE;
|
|
137
|
+
#endif
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
[[noreturn]] SK_API inline void sk_print_length_too_big(size_t i, size_t size) {
|
|
142
|
+
SK_ABORT("Length (%zu) is too big for size %zu.\n", i, size);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
template <typename T> SK_API inline T sk_collection_check_length(T i, T size) {
|
|
146
|
+
if (0 <= i && i <= size) SK_LIKELY {
|
|
147
|
+
return i;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
SK_UNLIKELY {
|
|
151
|
+
#if defined(SK_DEBUG)
|
|
152
|
+
sk_print_length_too_big(static_cast<size_t>(i), static_cast<size_t>(size));
|
|
153
|
+
#else
|
|
154
|
+
SkUNREACHABLE;
|
|
155
|
+
#endif
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
SK_API inline void sk_collection_not_empty(bool empty) {
|
|
160
|
+
if (empty) SK_UNLIKELY {
|
|
161
|
+
#if defined(SK_DEBUG)
|
|
162
|
+
SK_ABORT("Collection is empty.\n");
|
|
163
|
+
#else
|
|
164
|
+
SkUNREACHABLE;
|
|
165
|
+
#endif
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
[[noreturn]] SK_API inline void sk_print_size_too_big(size_t size, size_t maxSize) {
|
|
170
|
+
SK_ABORT("Size (%zu) can't be represented in bytes. Max size is %zu.\n", size, maxSize);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
template <typename T>
|
|
174
|
+
SK_ALWAYS_INLINE size_t check_size_bytes_too_big(size_t size) {
|
|
175
|
+
const size_t kMaxSize = std::numeric_limits<size_t>::max() / sizeof(T);
|
|
176
|
+
if (size > kMaxSize) {
|
|
177
|
+
#if defined(SK_DEBUG)
|
|
178
|
+
sk_print_size_too_big(size, kMaxSize);
|
|
179
|
+
#else
|
|
180
|
+
SkUNREACHABLE;
|
|
181
|
+
#endif
|
|
182
|
+
}
|
|
183
|
+
return size;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
#endif // SkAssert_DEFINED
|
|
@@ -17,18 +17,6 @@
|
|
|
17
17
|
# define SK_ATTRIBUTE(attr)
|
|
18
18
|
#endif
|
|
19
19
|
|
|
20
|
-
#if !defined(SK_UNUSED)
|
|
21
|
-
# if !defined(__clang__) && defined(_MSC_VER)
|
|
22
|
-
# define SK_UNUSED __pragma(warning(suppress:4189))
|
|
23
|
-
# else
|
|
24
|
-
# define SK_UNUSED SK_ATTRIBUTE(unused)
|
|
25
|
-
# endif
|
|
26
|
-
#endif
|
|
27
|
-
|
|
28
|
-
#if !defined(SK_WARN_UNUSED_RESULT)
|
|
29
|
-
#define SK_WARN_UNUSED_RESULT SK_ATTRIBUTE(warn_unused_result)
|
|
30
|
-
#endif
|
|
31
|
-
|
|
32
20
|
/**
|
|
33
21
|
* If your judgment is better than the compiler's (i.e. you've profiled it),
|
|
34
22
|
* you can use SK_ALWAYS_INLINE to force inlining. E.g.
|