@shopify/react-native-skia 1.3.13 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +9 -4
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +6 -0
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +81 -0
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +40 -0
- package/cpp/api/JsiSkApi.h +2 -0
- package/cpp/api/JsiSkPath.h +29 -19
- package/cpp/api/JsiSkRuntimeEffect.h +7 -0
- package/cpp/api/JsiSkiaContext.h +79 -0
- package/cpp/rnskia/RNSkPlatformContext.h +4 -0
- package/cpp/rnskia/SkiaContext.h +22 -0
- package/cpp/skia/include/android/GrAHardwareBufferUtils.h +2 -2
- package/cpp/skia/include/android/SkImageAndroid.h +1 -1
- package/cpp/skia/include/android/SkSurfaceAndroid.h +1 -1
- package/cpp/skia/include/codec/SkAndroidCodec.h +13 -9
- package/cpp/skia/include/codec/SkCodec.h +28 -5
- package/cpp/skia/include/core/SkArc.h +69 -0
- package/cpp/skia/include/core/SkBitmap.h +10 -0
- package/cpp/skia/include/core/SkBlender.h +2 -3
- package/cpp/skia/include/core/SkCanvas.h +86 -16
- package/cpp/skia/include/core/SkCapabilities.h +0 -4
- package/cpp/skia/include/core/SkColorFilter.h +4 -4
- package/cpp/skia/include/core/SkColorPriv.h +5 -7
- package/cpp/skia/include/core/SkColorType.h +2 -0
- package/cpp/skia/include/core/SkFlattenable.h +1 -1
- package/cpp/skia/include/core/SkFontArguments.h +3 -1
- package/cpp/skia/include/core/SkFontParameters.h +3 -2
- package/cpp/skia/include/core/SkFourByteTag.h +19 -0
- package/cpp/skia/include/core/SkImage.h +41 -1
- package/cpp/skia/include/core/SkImageGenerator.h +0 -5
- package/cpp/skia/include/core/SkImageInfo.h +20 -0
- package/cpp/skia/include/core/SkM44.h +1 -1
- package/cpp/skia/include/core/SkMatrix.h +2 -1
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPaint.h +1 -1
- package/cpp/skia/include/core/SkPath.h +20 -6
- package/cpp/skia/include/core/SkPathMeasure.h +1 -0
- package/cpp/skia/include/core/SkPicture.h +5 -5
- package/cpp/skia/include/core/SkPoint3.h +2 -12
- package/cpp/skia/include/core/SkRRect.h +5 -0
- package/cpp/skia/include/core/SkRect.h +5 -16
- package/cpp/skia/include/core/SkRefCnt.h +2 -0
- package/cpp/skia/include/core/SkScalar.h +20 -32
- package/cpp/skia/include/core/SkShader.h +17 -0
- package/cpp/skia/include/core/SkSize.h +2 -1
- package/cpp/skia/include/core/SkStream.h +2 -3
- package/cpp/skia/include/core/SkStrokeRec.h +6 -1
- package/cpp/skia/include/core/SkSurface.h +13 -4
- package/cpp/skia/include/core/SkSurfaceProps.h +5 -0
- package/cpp/skia/include/core/SkSwizzle.h +3 -1
- package/cpp/skia/include/core/SkTypeface.h +1 -0
- package/cpp/skia/include/core/SkTypes.h +1 -19
- package/cpp/skia/include/core/SkUnPreMultiply.h +4 -5
- package/cpp/skia/include/core/SkVertices.h +4 -2
- package/cpp/skia/include/docs/SkPDFDocument.h +11 -14
- package/cpp/skia/include/effects/SkHighContrastFilter.h +6 -6
- package/cpp/skia/include/effects/SkImageFilters.h +49 -23
- package/cpp/skia/include/effects/SkRuntimeEffect.h +51 -70
- package/cpp/skia/include/effects/SkShaderMaskFilter.h +2 -0
- package/cpp/skia/include/effects/SkTableMaskFilter.h +2 -0
- package/cpp/skia/include/gpu/GrBackendSemaphore.h +2 -120
- package/cpp/skia/include/gpu/GrBackendSurface.h +2 -466
- package/cpp/skia/include/gpu/GrContextOptions.h +2 -368
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +2 -179
- package/cpp/skia/include/gpu/GrDirectContext.h +2 -1011
- package/cpp/skia/include/gpu/GrDriverBugWorkarounds.h +2 -47
- package/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h +2 -41
- package/cpp/skia/include/gpu/GrRecordingContext.h +2 -279
- package/cpp/skia/include/gpu/GrTypes.h +2 -238
- package/cpp/skia/include/gpu/GrYUVABackendTextures.h +2 -118
- package/cpp/skia/include/gpu/d3d/GrD3DBackendContext.h +2 -29
- package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -242
- package/cpp/skia/include/gpu/ganesh/GrBackendSemaphore.h +80 -0
- package/cpp/skia/include/gpu/ganesh/GrBackendSurface.h +412 -0
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +386 -0
- package/cpp/skia/include/gpu/ganesh/GrContextThreadSafeProxy.h +175 -0
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +993 -0
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +53 -0
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h +45 -0
- package/cpp/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrRecordingContext.h +285 -0
- package/cpp/skia/include/gpu/ganesh/GrTypes.h +177 -0
- package/cpp/skia/include/gpu/ganesh/GrYUVABackendTextures.h +130 -0
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +1 -1
- package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +1 -1
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DBackendContext.h +35 -0
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DTypes.h +248 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLAssembleHelpers.h +17 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLAssembleInterface.h +45 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +1 -1
- package/cpp/skia/include/gpu/ganesh/gl/GrGLConfig.h +69 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLExtensions.h +79 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLFunctions.h +306 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLInterface.h +338 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLMakeWebGLInterface.h +19 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLTypes.h +219 -0
- package/cpp/skia/include/gpu/{gl → ganesh/gl}/egl/GrGLMakeEGLInterface.h +2 -2
- package/cpp/skia/include/gpu/ganesh/gl/epoxy/GrGLMakeEpoxyEGLInterface.h +20 -0
- package/cpp/skia/include/gpu/ganesh/gl/ios/GrGLMakeIOSInterface.h +20 -0
- package/cpp/skia/include/gpu/ganesh/gl/mac/GrGLMakeMacInterface.h +20 -0
- package/cpp/skia/include/gpu/ganesh/gl/win/GrGLMakeWinInterface.h +20 -0
- package/cpp/skia/include/gpu/ganesh/mock/GrMockTypes.h +166 -0
- package/cpp/skia/include/gpu/{mtl → ganesh/mtl}/GrMtlBackendContext.h +2 -2
- package/cpp/skia/include/gpu/ganesh/mtl/GrMtlBackendSemaphore.h +23 -0
- package/cpp/skia/include/gpu/ganesh/mtl/GrMtlBackendSurface.h +44 -0
- package/cpp/skia/include/gpu/ganesh/mtl/GrMtlDirectContext.h +30 -0
- package/cpp/skia/include/gpu/{mtl → ganesh/mtl}/GrMtlTypes.h +1 -3
- package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +2 -2
- package/cpp/skia/include/gpu/ganesh/vk/GrBackendDrawableInfo.h +2 -2
- package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSemaphore.h +1 -1
- package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +7 -3
- package/cpp/skia/include/gpu/ganesh/vk/GrVkDirectContext.h +6 -3
- package/cpp/skia/include/gpu/ganesh/vk/GrVkTypes.h +101 -0
- package/cpp/skia/include/gpu/gl/GrGLAssembleHelpers.h +2 -9
- package/cpp/skia/include/gpu/gl/GrGLAssembleInterface.h +2 -38
- package/cpp/skia/include/gpu/gl/GrGLConfig.h +2 -73
- package/cpp/skia/include/gpu/gl/GrGLExtensions.h +2 -72
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +2 -301
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -332
- package/cpp/skia/include/gpu/gl/GrGLTypes.h +2 -213
- package/cpp/skia/include/gpu/graphite/BackendSemaphore.h +20 -41
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +18 -118
- package/cpp/skia/include/gpu/graphite/Context.h +122 -44
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +30 -3
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +45 -17
- package/cpp/skia/include/gpu/graphite/Image.h +56 -54
- package/cpp/skia/include/gpu/graphite/Recorder.h +68 -14
- package/cpp/skia/include/gpu/graphite/Recording.h +3 -3
- package/cpp/skia/include/gpu/graphite/Surface.h +6 -2
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +36 -117
- package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +108 -6
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +4 -1
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +41 -25
- package/cpp/skia/include/gpu/graphite/precompile/PaintOptions.h +197 -0
- package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +48 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileBase.h +84 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileBlender.h +56 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileColorFilter.h +85 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileImageFilter.h +119 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileMaskFilter.h +51 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileRuntimeEffect.h +47 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +170 -0
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +24 -2
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +2 -157
- package/cpp/skia/include/gpu/mtl/MtlMemoryAllocator.h +2 -0
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +2 -101
- package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +13 -8
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +9 -3
- package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +4 -1
- package/cpp/skia/include/gpu/vk/VulkanTypes.h +25 -8
- package/cpp/skia/include/ports/SkFontMgr_Fontations.h +20 -0
- package/cpp/skia/include/ports/SkFontMgr_android.h +7 -0
- package/cpp/skia/include/ports/SkImageGeneratorCG.h +3 -1
- package/cpp/skia/include/ports/SkTypeface_win.h +0 -17
- package/cpp/skia/include/private/SkEncodedInfo.h +8 -2
- package/cpp/skia/include/private/SkExif.h +28 -75
- package/cpp/skia/include/private/SkGainmapInfo.h +47 -7
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +12 -0
- package/cpp/skia/include/private/SkPathRef.h +52 -44
- package/cpp/skia/include/private/SkXmp.h +13 -4
- package/cpp/skia/include/private/base/SkASAN.h +56 -0
- package/cpp/skia/include/private/base/SkAlign.h +5 -0
- package/cpp/skia/include/private/base/SkContainers.h +10 -2
- package/cpp/skia/include/private/base/SkFeatures.h +22 -1
- package/cpp/skia/include/private/base/SkFloatingPoint.h +51 -65
- package/cpp/skia/include/private/base/SkMacros.h +67 -0
- package/cpp/skia/include/private/base/SkMalloc.h +8 -0
- package/cpp/skia/include/private/base/SkPoint_impl.h +2 -11
- package/cpp/skia/include/private/base/SkTArray.h +108 -23
- package/cpp/skia/include/private/base/SkTFitsIn.h +1 -12
- package/cpp/skia/include/private/chromium/GrDeferredDisplayList.h +1 -1
- package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +0 -39
- package/cpp/skia/include/private/chromium/GrPromiseImageTexture.h +1 -1
- package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +3 -3
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +1 -4
- package/cpp/skia/include/private/chromium/Slug.h +5 -11
- package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +2 -2
- package/cpp/skia/include/private/gpu/ganesh/GrTextureGenerator.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +21 -93
- package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +2 -2
- package/cpp/skia/include/utils/SkCustomTypeface.h +1 -0
- package/cpp/skia/include/utils/SkNWayCanvas.h +1 -1
- package/cpp/skia/include/utils/SkParse.h +0 -1
- package/cpp/skia/modules/skcms/src/Transform_inl.h +59 -56
- package/cpp/skia/modules/skcms/src/skcms_Transform.h +3 -0
- package/cpp/skia/modules/skcms/src/skcms_internals.h +2 -0
- package/cpp/skia/modules/skcms/src/skcms_public.h +46 -14
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +15 -1
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +2 -2
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +2 -4
- package/cpp/skia/modules/skresources/include/SkResources.h +1 -1
- package/cpp/skia/modules/skshaper/include/SkShaper.h +316 -0
- package/cpp/skia/modules/skshaper/include/SkShaper_coretext.h +19 -0
- package/cpp/skia/modules/skshaper/include/SkShaper_factory.h +41 -0
- package/cpp/skia/modules/skshaper/include/SkShaper_harfbuzz.h +39 -0
- package/cpp/skia/modules/skshaper/include/SkShaper_skunicode.h +28 -0
- package/cpp/skia/modules/skunicode/include/SkUnicode.h +6 -23
- package/cpp/skia/modules/svg/include/SkSVGAttribute.h +0 -3
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +12 -2
- package/cpp/skia/modules/svg/include/SkSVGCircle.h +13 -0
- package/cpp/skia/modules/svg/include/SkSVGClipPath.h +6 -0
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +17 -1
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +25 -15
- package/cpp/skia/modules/svg/include/SkSVGEllipse.h +13 -2
- package/cpp/skia/modules/svg/include/SkSVGFe.h +11 -2
- package/cpp/skia/modules/svg/include/SkSVGFeBlend.h +9 -0
- package/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h +9 -0
- package/cpp/skia/modules/svg/include/SkSVGFeComponentTransfer.h +82 -0
- package/cpp/skia/modules/svg/include/SkSVGFeComposite.h +10 -1
- package/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h +10 -0
- package/cpp/skia/modules/svg/include/SkSVGFeFlood.h +10 -0
- package/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h +9 -0
- package/cpp/skia/modules/svg/include/SkSVGFeImage.h +9 -0
- package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +5 -0
- package/cpp/skia/modules/svg/include/SkSVGFeLighting.h +11 -0
- package/cpp/skia/modules/svg/include/SkSVGFeMerge.h +63 -0
- package/cpp/skia/modules/svg/include/SkSVGFeMorphology.h +8 -0
- package/cpp/skia/modules/svg/include/SkSVGFeOffset.h +9 -0
- package/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h +9 -0
- package/cpp/skia/modules/svg/include/SkSVGFilter.h +9 -0
- package/cpp/skia/modules/svg/include/SkSVGFilterContext.h +3 -3
- package/cpp/skia/modules/svg/include/SkSVGGradient.h +10 -2
- package/cpp/skia/modules/svg/include/SkSVGImage.h +9 -0
- package/cpp/skia/modules/svg/include/SkSVGLine.h +11 -0
- package/cpp/skia/modules/svg/include/SkSVGLinearGradient.h +10 -0
- package/cpp/skia/modules/svg/include/SkSVGMask.h +6 -0
- package/cpp/skia/modules/svg/include/SkSVGNode.h +13 -2
- package/cpp/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h +5 -0
- package/cpp/skia/modules/svg/include/SkSVGPath.h +10 -0
- package/cpp/skia/modules/svg/include/SkSVGPattern.h +5 -0
- package/cpp/skia/modules/svg/include/SkSVGPoly.h +11 -0
- package/cpp/skia/modules/svg/include/SkSVGRadialGradient.h +11 -0
- package/cpp/skia/modules/svg/include/SkSVGRect.h +11 -0
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +43 -7
- package/cpp/skia/modules/svg/include/SkSVGSVG.h +7 -0
- package/cpp/skia/modules/svg/include/SkSVGShape.h +8 -2
- package/cpp/skia/modules/svg/include/SkSVGStop.h +5 -3
- package/cpp/skia/modules/svg/include/SkSVGText.h +8 -2
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +8 -0
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +9 -0
- package/cpp/skia/modules/svg/include/SkSVGUse.h +7 -0
- package/cpp/skia/src/base/SkMathPriv.h +337 -0
- package/cpp/skia/src/base/SkTLazy.h +208 -0
- package/cpp/skia/src/core/SkTHash.h +58 -7
- package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +3 -0
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +3 -0
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +7 -0
- package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +7 -2
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +78 -0
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +20 -4
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/skia/types/Paragraph/TextStyle.d.ts +2 -2
- package/lib/commonjs/skia/types/Paragraph/TextStyle.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +6 -1
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +4 -1
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/web/WithSkiaWeb.d.ts +11 -4
- package/lib/commonjs/web/WithSkiaWeb.js +3 -2
- package/lib/commonjs/web/WithSkiaWeb.js.map +1 -1
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/skia/types/Paragraph/TextStyle.d.ts +2 -2
- package/lib/module/skia/types/Paragraph/TextStyle.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +6 -1
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +4 -1
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/web/WithSkiaWeb.d.ts +11 -4
- package/lib/module/web/WithSkiaWeb.js +3 -2
- package/lib/module/web/WithSkiaWeb.js.map +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +1 -0
- package/lib/typescript/lib/commonjs/web/WithSkiaWeb.d.ts +2 -1
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +1 -0
- package/lib/typescript/lib/module/web/WithSkiaWeb.d.ts +2 -1
- package/lib/typescript/src/skia/types/Paragraph/TextStyle.d.ts +2 -2
- package/lib/typescript/src/skia/types/Skia.d.ts +6 -1
- package/lib/typescript/src/web/WithSkiaWeb.d.ts +11 -4
- 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_core.a +0 -0
- package/libs/android/arm64-v8a/libskunicode_icu.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_core.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode_icu.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_core.a +0 -0
- package/libs/android/x86/libskunicode_icu.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_core.a +0 -0
- package/libs/android/x86_64/libskunicode_icu.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/Info.plist +5 -5
- 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/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/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 +3 -5
- package/react-native-skia.podspec +2 -1
- package/src/renderer/HostConfig.ts +5 -1
- package/src/renderer/__tests__/e2e/ImageFilters.spec.tsx +5 -2
- package/src/renderer/__tests__/e2e/Paths.spec.tsx +12 -5
- package/src/renderer/__tests__/e2e/SDF.spec.tsx +1 -1
- package/src/renderer/__tests__/e2e/Snapshot.spec.tsx +1 -1
- package/src/skia/types/Paragraph/TextStyle.ts +2 -2
- package/src/skia/types/Skia.ts +7 -1
- package/src/skia/web/JsiSkia.ts +3 -0
- package/src/web/WithSkiaWeb.tsx +17 -6
- package/cpp/skia/include/core/SkDrawLooper.h +0 -135
- package/cpp/skia/include/effects/SkBlurDrawLooper.h +0 -26
- package/cpp/skia/include/effects/SkLayerDrawLooper.h +0 -161
- package/cpp/skia/include/gpu/gl/GrGLConfig_chrome.h +0 -14
- package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +0 -84
- package/cpp/skia/include/gpu/vk/GrVkExtensions.h +0 -15
- package/cpp/skia/include/gpu/vk/GrVkMemoryAllocator.h +0 -15
- package/cpp/skia/include/ports/SkFontMgr_indirect.h +0 -102
- package/cpp/skia/include/ports/SkRemotableFontMgr.h +0 -139
- package/cpp/skia/include/private/base/SkFloatBits.h +0 -90
- package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +0 -69
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +0 -54
- package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +0 -95
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +0 -83
- package/cpp/skia/src/core/SkPathEnums.h +0 -25
- package/cpp/skia/src/core/SkPathPriv.h +0 -540
- package/libs/android/arm64-v8a/libskunicode.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode.a +0 -0
- package/libs/android/x86/libskunicode.a +0 -0
- package/libs/android/x86_64/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/Info.plist +0 -46
- 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/cpp/skia/include/gpu/{gl → ganesh/gl}/glx/GrGLMakeGLXInterface.h +0 -0
package/android/CMakeLists.txt
CHANGED
|
@@ -10,7 +10,8 @@ set (SKIA_LIB "skia")
|
|
|
10
10
|
set (SKIA_SVG_LIB "svg")
|
|
11
11
|
set (SKIA_SKSHAPER_LIB "skshaper")
|
|
12
12
|
set (SKIA_SKPARAGRAPH_LIB "skparagraph")
|
|
13
|
-
set (
|
|
13
|
+
set (SKIA_SKUNICODE_CORE_LIB "skunicode_core")
|
|
14
|
+
set (SKIA_SKUNICODE_ICU_LIB "skunicode_icu")
|
|
14
15
|
|
|
15
16
|
# Clear some variables
|
|
16
17
|
unset(LIBRN_DIR CACHE)
|
|
@@ -116,8 +117,11 @@ set_property(TARGET skshaper PROPERTY IMPORTED_LOCATION "${SKIA_LIBS_PATH}/libsk
|
|
|
116
117
|
add_library(skparagraph STATIC IMPORTED)
|
|
117
118
|
set_property(TARGET skparagraph PROPERTY IMPORTED_LOCATION "${SKIA_LIBS_PATH}/libskparagraph.a")
|
|
118
119
|
|
|
119
|
-
add_library(
|
|
120
|
-
set_property(TARGET
|
|
120
|
+
add_library(skunicode_core STATIC IMPORTED)
|
|
121
|
+
set_property(TARGET skunicode_core PROPERTY IMPORTED_LOCATION "${SKIA_LIBS_PATH}/libskunicode_core.a")
|
|
122
|
+
|
|
123
|
+
add_library(skunicode_icu STATIC IMPORTED)
|
|
124
|
+
set_property(TARGET skunicode_icu PROPERTY IMPORTED_LOCATION "${SKIA_LIBS_PATH}/libskunicode_icu.a")
|
|
121
125
|
|
|
122
126
|
|
|
123
127
|
find_library(
|
|
@@ -235,7 +239,8 @@ target_link_libraries(
|
|
|
235
239
|
${SKIA_SVG_LIB}
|
|
236
240
|
${SKIA_SKSHAPER_LIB}
|
|
237
241
|
${SKIA_SKPARAGRAPH_LIB}
|
|
238
|
-
${
|
|
242
|
+
${SKIA_SKUNICODE_CORE_LIB}
|
|
243
|
+
${SKIA_SKUNICODE_ICU_LIB}
|
|
239
244
|
${SKIA_LIB}
|
|
240
245
|
-ljnigraphics
|
|
241
246
|
-lGLESv2
|
|
@@ -54,6 +54,12 @@ public:
|
|
|
54
54
|
return SkiaOpenGLSurfaceFactory::makeOffscreenSurface(width, height);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
std::shared_ptr<SkiaContext>
|
|
58
|
+
makeContextFromNativeSurface(void *surface, int width, int height) override {
|
|
59
|
+
return SkiaOpenGLSurfaceFactory::makeContext(
|
|
60
|
+
reinterpret_cast<ANativeWindow *>(surface), width, height);
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
sk_sp<SkImage> makeImageFromNativeBuffer(void *buffer) override {
|
|
58
64
|
return SkiaOpenGLSurfaceFactory::makeImageFromHardwareBuffer(buffer);
|
|
59
65
|
}
|
|
@@ -218,4 +218,85 @@ sk_sp<SkSurface> WindowSurfaceHolder::getSurface() {
|
|
|
218
218
|
return _skSurface;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
+
sk_sp<SkSurface> AndroidSkiaContext::getSurface() {
|
|
222
|
+
if (_skSurface == nullptr) {
|
|
223
|
+
|
|
224
|
+
// Setup OpenGL and Skia
|
|
225
|
+
if (!SkiaOpenGLHelper::createSkiaDirectContextIfNecessary(
|
|
226
|
+
&ThreadContextHolder::ThreadSkiaOpenGLContext)) {
|
|
227
|
+
RNSkLogger::logToConsole(
|
|
228
|
+
"Could not create Skia Surface from native window / surface. "
|
|
229
|
+
"Failed creating Skia Direct Context");
|
|
230
|
+
return nullptr;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Now we can create a surface
|
|
234
|
+
_glSurface = SkiaOpenGLHelper::createWindowedSurface(_window);
|
|
235
|
+
if (_glSurface == EGL_NO_SURFACE) {
|
|
236
|
+
RNSkLogger::logToConsole(
|
|
237
|
+
"Could not create EGL Surface from native window / surface.");
|
|
238
|
+
return nullptr;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Now make this one current
|
|
242
|
+
if (!SkiaOpenGLHelper::makeCurrent(
|
|
243
|
+
&ThreadContextHolder::ThreadSkiaOpenGLContext, _glSurface)) {
|
|
244
|
+
RNSkLogger::logToConsole(
|
|
245
|
+
"Could not create EGL Surface from native window / surface. Could "
|
|
246
|
+
"not set new surface as current surface.");
|
|
247
|
+
return nullptr;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Set up parameters for the render target so that it
|
|
251
|
+
// matches the underlying OpenGL context.
|
|
252
|
+
GrGLFramebufferInfo fboInfo;
|
|
253
|
+
|
|
254
|
+
// We pass 0 as the framebuffer id, since the
|
|
255
|
+
// underlying Skia GrGlGpu will read this when wrapping the context in the
|
|
256
|
+
// render target and the GrGlGpu object.
|
|
257
|
+
fboInfo.fFBOID = 0;
|
|
258
|
+
fboInfo.fFormat = 0x8058; // GL_RGBA8
|
|
259
|
+
|
|
260
|
+
GLint stencil;
|
|
261
|
+
glGetIntegerv(GL_STENCIL_BITS, &stencil);
|
|
262
|
+
|
|
263
|
+
GLint samples;
|
|
264
|
+
glGetIntegerv(GL_SAMPLES, &samples);
|
|
265
|
+
|
|
266
|
+
auto colorType = kN32_SkColorType;
|
|
267
|
+
|
|
268
|
+
auto maxSamples =
|
|
269
|
+
ThreadContextHolder::ThreadSkiaOpenGLContext.directContext
|
|
270
|
+
->maxSurfaceSampleCountForColorType(colorType);
|
|
271
|
+
|
|
272
|
+
if (samples > maxSamples) {
|
|
273
|
+
samples = maxSamples;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
auto renderTarget = GrBackendRenderTargets::MakeGL(_width, _height, samples,
|
|
277
|
+
stencil, fboInfo);
|
|
278
|
+
|
|
279
|
+
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
|
|
280
|
+
|
|
281
|
+
struct ReleaseContext {
|
|
282
|
+
EGLSurface glSurface;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
auto releaseCtx = new ReleaseContext({_glSurface});
|
|
286
|
+
|
|
287
|
+
// Create surface object
|
|
288
|
+
_skSurface = SkSurfaces::WrapBackendRenderTarget(
|
|
289
|
+
ThreadContextHolder::ThreadSkiaOpenGLContext.directContext.get(),
|
|
290
|
+
renderTarget, kBottomLeft_GrSurfaceOrigin, colorType, nullptr, &props,
|
|
291
|
+
[](void *addr) {
|
|
292
|
+
auto releaseCtx = reinterpret_cast<ReleaseContext *>(addr);
|
|
293
|
+
SkiaOpenGLHelper::destroySurface(releaseCtx->glSurface);
|
|
294
|
+
delete releaseCtx;
|
|
295
|
+
},
|
|
296
|
+
reinterpret_cast<void *>(releaseCtx));
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return _skSurface;
|
|
300
|
+
}
|
|
301
|
+
|
|
221
302
|
} // namespace RNSkia
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#include <thread>
|
|
14
14
|
#include <unordered_map>
|
|
15
15
|
|
|
16
|
+
#include "SkiaContext.h"
|
|
16
17
|
#include "SkiaOpenGLHelper.h"
|
|
17
18
|
|
|
18
19
|
#pragma clang diagnostic push
|
|
@@ -139,6 +140,40 @@ private:
|
|
|
139
140
|
int _height = 0;
|
|
140
141
|
};
|
|
141
142
|
|
|
143
|
+
class AndroidSkiaContext : public SkiaContext {
|
|
144
|
+
public:
|
|
145
|
+
AndroidSkiaContext(ANativeWindow *window, int width, int height)
|
|
146
|
+
: _window(window), _width(width), _height(height) {}
|
|
147
|
+
|
|
148
|
+
~AndroidSkiaContext() {}
|
|
149
|
+
|
|
150
|
+
sk_sp<SkSurface> getSurface() override;
|
|
151
|
+
|
|
152
|
+
void present() override {
|
|
153
|
+
if (!SkiaOpenGLHelper::makeCurrent(
|
|
154
|
+
&ThreadContextHolder::ThreadSkiaOpenGLContext, _glSurface)) {
|
|
155
|
+
RNSkLogger::logToConsole(
|
|
156
|
+
"Could not create EGL Surface from native window / surface. Could "
|
|
157
|
+
"not set new surface as current surface.");
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
// Flush and submit the direct context
|
|
161
|
+
ThreadContextHolder::ThreadSkiaOpenGLContext.directContext
|
|
162
|
+
->flushAndSubmit();
|
|
163
|
+
|
|
164
|
+
// Swap buffers
|
|
165
|
+
SkiaOpenGLHelper::swapBuffers(&ThreadContextHolder::ThreadSkiaOpenGLContext,
|
|
166
|
+
_glSurface);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
private:
|
|
170
|
+
ANativeWindow *_window;
|
|
171
|
+
sk_sp<SkSurface> _skSurface = nullptr;
|
|
172
|
+
EGLSurface _glSurface = EGL_NO_SURFACE;
|
|
173
|
+
int _width = 0;
|
|
174
|
+
int _height = 0;
|
|
175
|
+
};
|
|
176
|
+
|
|
142
177
|
class SkiaOpenGLSurfaceFactory {
|
|
143
178
|
public:
|
|
144
179
|
/**
|
|
@@ -152,6 +187,11 @@ public:
|
|
|
152
187
|
static sk_sp<SkImage>
|
|
153
188
|
makeImageFromHardwareBuffer(void *buffer, bool requireKnownFormat = false);
|
|
154
189
|
|
|
190
|
+
static std::shared_ptr<AndroidSkiaContext>
|
|
191
|
+
makeContext(ANativeWindow *surface, int width, int height) {
|
|
192
|
+
return std::make_shared<AndroidSkiaContext>(surface, width, height);
|
|
193
|
+
}
|
|
194
|
+
|
|
155
195
|
/**
|
|
156
196
|
* Creates a windowed Skia Surface holder.
|
|
157
197
|
* @param width Initial width of surface
|
package/cpp/api/JsiSkApi.h
CHANGED
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
#include "JsiSkTypefaceFactory.h"
|
|
51
51
|
#include "JsiSkTypefaceFontProviderFactory.h"
|
|
52
52
|
#include "JsiSkVertices.h"
|
|
53
|
+
#include "JsiSkiaContext.h"
|
|
53
54
|
#include "JsiVideo.h"
|
|
54
55
|
|
|
55
56
|
namespace RNSkia {
|
|
@@ -69,6 +70,7 @@ public:
|
|
|
69
70
|
// slow to do it on demand
|
|
70
71
|
JsiSkFontMgrFactory::getFontMgr(getContext());
|
|
71
72
|
installFunction("Video", JsiVideo::createCtor(context));
|
|
73
|
+
installFunction("Context", JsiSkiaContext::createCtor(context));
|
|
72
74
|
installFunction("Font", JsiSkFont::createCtor(context));
|
|
73
75
|
installFunction("Paint", JsiSkPaint::createCtor(context));
|
|
74
76
|
installFunction("RSXform", JsiSkRSXform::createCtor(context));
|
package/cpp/api/JsiSkPath.h
CHANGED
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
#include "include/pathops/SkPathOps.h"
|
|
28
28
|
#include "include/utils/SkParsePath.h"
|
|
29
29
|
#include "include/utils/SkTextUtils.h"
|
|
30
|
-
#include "src/core/SkPathPriv.h"
|
|
31
30
|
|
|
32
31
|
#pragma clang diagnostic pop
|
|
33
32
|
|
|
@@ -510,51 +509,54 @@ public:
|
|
|
510
509
|
return jsi::Object::createFromHostObject(
|
|
511
510
|
runtime, std::make_shared<JsiSkPath>(getContext(), std::move(result)));
|
|
512
511
|
}
|
|
513
|
-
|
|
514
512
|
JSI_HOST_FUNCTION(toCmds) {
|
|
515
513
|
auto path = *getObject();
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
514
|
+
std::vector<jsi::Array> cmdList;
|
|
515
|
+
SkPoint pts[4];
|
|
516
|
+
SkPath::Iter iter(path, false);
|
|
517
|
+
SkPath::Verb verb;
|
|
518
|
+
|
|
519
|
+
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
|
|
519
520
|
switch (verb) {
|
|
520
|
-
case
|
|
521
|
+
case SkPath::kMove_Verb: {
|
|
521
522
|
auto cmd = jsi::Array(runtime, 3);
|
|
522
523
|
cmd.setValueAtIndex(runtime, 0, static_cast<double>(MOVE));
|
|
523
524
|
cmd.setValueAtIndex(runtime, 1, static_cast<double>(pts[0].x()));
|
|
524
525
|
cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[0].y()));
|
|
525
|
-
|
|
526
|
+
cmdList.push_back(std::move(cmd));
|
|
526
527
|
break;
|
|
527
528
|
}
|
|
528
|
-
case
|
|
529
|
+
case SkPath::kLine_Verb: {
|
|
529
530
|
auto cmd = jsi::Array(runtime, 3);
|
|
530
531
|
cmd.setValueAtIndex(runtime, 0, static_cast<double>(LINE));
|
|
531
532
|
cmd.setValueAtIndex(runtime, 1, static_cast<double>(pts[1].x()));
|
|
532
533
|
cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[1].y()));
|
|
533
|
-
|
|
534
|
+
cmdList.push_back(std::move(cmd));
|
|
534
535
|
break;
|
|
535
536
|
}
|
|
536
|
-
case
|
|
537
|
+
case SkPath::kQuad_Verb: {
|
|
537
538
|
auto cmd = jsi::Array(runtime, 5);
|
|
538
539
|
cmd.setValueAtIndex(runtime, 0, static_cast<double>(QUAD));
|
|
539
540
|
cmd.setValueAtIndex(runtime, 1, static_cast<double>(pts[1].x()));
|
|
540
541
|
cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[1].y()));
|
|
541
542
|
cmd.setValueAtIndex(runtime, 3, static_cast<double>(pts[2].x()));
|
|
542
543
|
cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
|
|
543
|
-
|
|
544
|
+
cmdList.push_back(std::move(cmd));
|
|
544
545
|
break;
|
|
545
546
|
}
|
|
546
|
-
case
|
|
547
|
+
case SkPath::kConic_Verb: {
|
|
547
548
|
auto cmd = jsi::Array(runtime, 6);
|
|
548
549
|
cmd.setValueAtIndex(runtime, 0, static_cast<double>(CONIC));
|
|
549
550
|
cmd.setValueAtIndex(runtime, 1, static_cast<double>(pts[1].x()));
|
|
550
551
|
cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[1].y()));
|
|
551
552
|
cmd.setValueAtIndex(runtime, 3, static_cast<double>(pts[2].x()));
|
|
552
553
|
cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
|
|
553
|
-
cmd.setValueAtIndex(runtime, 5,
|
|
554
|
-
|
|
554
|
+
cmd.setValueAtIndex(runtime, 5,
|
|
555
|
+
static_cast<double>(iter.conicWeight()));
|
|
556
|
+
cmdList.push_back(std::move(cmd));
|
|
555
557
|
break;
|
|
556
558
|
}
|
|
557
|
-
case
|
|
559
|
+
case SkPath::kCubic_Verb: {
|
|
558
560
|
auto cmd = jsi::Array(runtime, 7);
|
|
559
561
|
cmd.setValueAtIndex(runtime, 0, static_cast<double>(CUBIC));
|
|
560
562
|
cmd.setValueAtIndex(runtime, 1, static_cast<double>(pts[1].x()));
|
|
@@ -563,18 +565,26 @@ public:
|
|
|
563
565
|
cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
|
|
564
566
|
cmd.setValueAtIndex(runtime, 5, static_cast<double>(pts[3].x()));
|
|
565
567
|
cmd.setValueAtIndex(runtime, 6, static_cast<double>(pts[3].y()));
|
|
566
|
-
|
|
568
|
+
cmdList.push_back(std::move(cmd));
|
|
567
569
|
break;
|
|
568
570
|
}
|
|
569
|
-
case
|
|
571
|
+
case SkPath::kClose_Verb: {
|
|
570
572
|
auto cmd = jsi::Array(runtime, 1);
|
|
571
573
|
cmd.setValueAtIndex(runtime, 0, static_cast<double>(CLOSE));
|
|
572
|
-
|
|
574
|
+
cmdList.push_back(std::move(cmd));
|
|
573
575
|
break;
|
|
574
576
|
}
|
|
577
|
+
default:
|
|
578
|
+
break;
|
|
575
579
|
}
|
|
576
|
-
j++;
|
|
577
580
|
}
|
|
581
|
+
|
|
582
|
+
// Create the jsi::Array with the exact size
|
|
583
|
+
auto cmds = jsi::Array(runtime, cmdList.size());
|
|
584
|
+
for (size_t i = 0; i < cmdList.size(); ++i) {
|
|
585
|
+
cmds.setValueAtIndex(runtime, i, cmdList[i]);
|
|
586
|
+
}
|
|
587
|
+
|
|
578
588
|
return cmds;
|
|
579
589
|
}
|
|
580
590
|
|
|
@@ -22,6 +22,13 @@ namespace RNSkia {
|
|
|
22
22
|
|
|
23
23
|
namespace jsi = facebook::jsi;
|
|
24
24
|
|
|
25
|
+
// Helper to see a bit pattern as a float (w/o aliasing warnings)
|
|
26
|
+
static inline float SkBits2Float(uint32_t bits) {
|
|
27
|
+
float value;
|
|
28
|
+
memcpy(&value, &bits, sizeof(float));
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
struct RuntimeEffectUniform {
|
|
26
33
|
int columns;
|
|
27
34
|
int rows;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <numeric>
|
|
5
|
+
#include <utility>
|
|
6
|
+
#include <vector>
|
|
7
|
+
|
|
8
|
+
#include "JsiSkHostObjects.h"
|
|
9
|
+
#include "RNSkLog.h"
|
|
10
|
+
#include <jsi/jsi.h>
|
|
11
|
+
|
|
12
|
+
#include "JsiSkPaint.h"
|
|
13
|
+
#include "JsiSkPoint.h"
|
|
14
|
+
#include "JsiSkRect.h"
|
|
15
|
+
#include "JsiSkTypeface.h"
|
|
16
|
+
|
|
17
|
+
#include "SkiaContext.h"
|
|
18
|
+
|
|
19
|
+
#pragma clang diagnostic push
|
|
20
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
21
|
+
|
|
22
|
+
#include "include/core/SkFont.h"
|
|
23
|
+
#include "include/core/SkFontMetrics.h"
|
|
24
|
+
|
|
25
|
+
#pragma clang diagnostic pop
|
|
26
|
+
|
|
27
|
+
namespace RNSkia {
|
|
28
|
+
|
|
29
|
+
namespace jsi = facebook::jsi;
|
|
30
|
+
|
|
31
|
+
class JsiSkiaContext : public JsiSkWrappingSharedPtrHostObject<SkiaContext> {
|
|
32
|
+
public:
|
|
33
|
+
EXPORT_JSI_API_TYPENAME(JsiSkiaContext, SkiaContext)
|
|
34
|
+
|
|
35
|
+
JSI_HOST_FUNCTION(getSurface) {
|
|
36
|
+
auto surface = getObject()->getSurface();
|
|
37
|
+
return jsi::Object::createFromHostObject(
|
|
38
|
+
runtime,
|
|
39
|
+
std::make_shared<JsiSkSurface>(getContext(), std::move(surface)));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
JSI_HOST_FUNCTION(present) {
|
|
43
|
+
getObject()->present();
|
|
44
|
+
return jsi::Value::undefined();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkiaContext, getSurface),
|
|
48
|
+
JSI_EXPORT_FUNC(JsiSkiaContext, present))
|
|
49
|
+
|
|
50
|
+
JsiSkiaContext(std::shared_ptr<RNSkPlatformContext> context,
|
|
51
|
+
std::shared_ptr<SkiaContext> ctx)
|
|
52
|
+
: JsiSkWrappingSharedPtrHostObject(std::move(context), std::move(ctx)) {}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Creates the function for construction a new instance of the SkFont
|
|
56
|
+
* wrapper
|
|
57
|
+
* @param context Platform context
|
|
58
|
+
* @return A function for creating a new host object wrapper for the SkFont
|
|
59
|
+
* class
|
|
60
|
+
*/
|
|
61
|
+
static const jsi::HostFunctionType
|
|
62
|
+
createCtor(std::shared_ptr<RNSkPlatformContext> context) {
|
|
63
|
+
return JSI_HOST_FUNCTION_LAMBDA {
|
|
64
|
+
jsi::BigInt pointer = arguments[0].asBigInt(runtime);
|
|
65
|
+
const uintptr_t nativeBufferPointer = pointer.asUint64(runtime);
|
|
66
|
+
void *surface = reinterpret_cast<void *>(nativeBufferPointer);
|
|
67
|
+
auto width = static_cast<int>(arguments[1].asNumber());
|
|
68
|
+
auto height = static_cast<int>(arguments[2].asNumber());
|
|
69
|
+
auto result =
|
|
70
|
+
context->makeContextFromNativeSurface(surface, width, height);
|
|
71
|
+
// Return the newly constructed object
|
|
72
|
+
return jsi::Object::createFromHostObject(
|
|
73
|
+
runtime, std::make_shared<JsiSkiaContext>(std::move(context),
|
|
74
|
+
std::move(result)));
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
} // namespace RNSkia
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
#include "RNSkDispatchQueue.h"
|
|
13
13
|
#include "RNSkVideo.h"
|
|
14
|
+
#include "SkiaContext.h"
|
|
14
15
|
|
|
15
16
|
#pragma clang diagnostic push
|
|
16
17
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
@@ -134,6 +135,9 @@ public:
|
|
|
134
135
|
*/
|
|
135
136
|
virtual sk_sp<SkSurface> makeOffscreenSurface(int width, int height) = 0;
|
|
136
137
|
|
|
138
|
+
virtual std::shared_ptr<SkiaContext>
|
|
139
|
+
makeContextFromNativeSurface(void *surface, int width, int height) = 0;
|
|
140
|
+
|
|
137
141
|
/**
|
|
138
142
|
* Creates an image from a native buffer.
|
|
139
143
|
* - On iOS, this is a `CVPixelBufferRef`
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <string>
|
|
4
|
+
|
|
5
|
+
#pragma clang diagnostic push
|
|
6
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
7
|
+
|
|
8
|
+
#include "include/core/SkImage.h"
|
|
9
|
+
#include "include/core/SkSurface.h"
|
|
10
|
+
|
|
11
|
+
#pragma clang diagnostic pop
|
|
12
|
+
|
|
13
|
+
namespace RNSkia {
|
|
14
|
+
|
|
15
|
+
class SkiaContext {
|
|
16
|
+
public:
|
|
17
|
+
virtual ~SkiaContext() = default;
|
|
18
|
+
virtual sk_sp<SkSurface> getSurface() = 0;
|
|
19
|
+
virtual void present() = 0;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
} // namespace RNSkia
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
|
|
13
13
|
|
|
14
|
-
#include "include/gpu/GrBackendSurface.h"
|
|
15
|
-
#include "include/gpu/GrTypes.h"
|
|
14
|
+
#include "include/gpu/ganesh/GrBackendSurface.h"
|
|
15
|
+
#include "include/gpu/ganesh/GrTypes.h"
|
|
16
16
|
|
|
17
17
|
class GrDirectContext;
|
|
18
18
|
|
|
@@ -264,19 +264,23 @@ public:
|
|
|
264
264
|
SkCodec* codec() const { return fCodec.get(); }
|
|
265
265
|
|
|
266
266
|
/**
|
|
267
|
-
* Retrieve the gainmap for an image.
|
|
267
|
+
* Retrieve the gainmap codec for an image.
|
|
268
268
|
*
|
|
269
|
-
* @param outInfo
|
|
270
|
-
*
|
|
269
|
+
* @param outInfo On success, this is populated with the parameters for
|
|
270
|
+
* rendering this gainmap. This parameter must be non-nullptr.
|
|
271
271
|
*
|
|
272
|
-
* @param
|
|
273
|
-
*
|
|
274
|
-
*
|
|
272
|
+
* @param outGainmapCodec On success, this is populated with a codec from which the
|
|
273
|
+
* gainmap image may be decoded. This parameter is optional, and
|
|
274
|
+
* may be set to nullptr.
|
|
275
275
|
*
|
|
276
|
-
* @return
|
|
277
|
-
*
|
|
278
|
-
*
|
|
276
|
+
* @return If this has a gainmap image and that gainmap image was
|
|
277
|
+
* successfully extracted then return true. Otherwise return
|
|
278
|
+
* false.
|
|
279
279
|
*/
|
|
280
|
+
bool getGainmapAndroidCodec(SkGainmapInfo* outInfo, std::unique_ptr<SkAndroidCodec>* outCodec);
|
|
281
|
+
|
|
282
|
+
// TODO(issues.skia.org/363544350): This API only works for JPEG images. Remove this API once
|
|
283
|
+
// it is no longer used.
|
|
280
284
|
bool getAndroidGainmap(SkGainmapInfo* outInfo,
|
|
281
285
|
std::unique_ptr<SkStream>* outGainmapImageStream);
|
|
282
286
|
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
#include <cstddef>
|
|
25
25
|
#include <functional>
|
|
26
26
|
#include <memory>
|
|
27
|
+
#include <optional>
|
|
27
28
|
#include <string_view>
|
|
28
29
|
#include <tuple>
|
|
29
30
|
#include <vector>
|
|
@@ -290,6 +291,12 @@ public:
|
|
|
290
291
|
*/
|
|
291
292
|
SkEncodedImageFormat getEncodedFormat() const { return this->onGetEncodedFormat(); }
|
|
292
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Return the underlying encoded data stream. This may be nullptr if the original
|
|
296
|
+
* stream could not be duplicated.
|
|
297
|
+
*/
|
|
298
|
+
virtual std::unique_ptr<SkStream> getEncodedData() const;
|
|
299
|
+
|
|
293
300
|
/**
|
|
294
301
|
* Whether or not the memory passed to getPixels is zero initialized.
|
|
295
302
|
*/
|
|
@@ -642,11 +649,6 @@ public:
|
|
|
642
649
|
// is residing in dst's memory.
|
|
643
650
|
static constexpr int kNoFrame = -1;
|
|
644
651
|
|
|
645
|
-
// This transitional definition was added in August 2018, and will eventually be removed.
|
|
646
|
-
#ifdef SK_LEGACY_SKCODEC_NONE_ENUM
|
|
647
|
-
static constexpr int kNone = kNoFrame;
|
|
648
|
-
#endif
|
|
649
|
-
|
|
650
652
|
/**
|
|
651
653
|
* Information about individual frames in a multi-framed image.
|
|
652
654
|
*/
|
|
@@ -793,6 +795,10 @@ protected:
|
|
|
793
795
|
return fSrcXformFormat;
|
|
794
796
|
}
|
|
795
797
|
|
|
798
|
+
virtual bool onGetGainmapCodec(SkGainmapInfo*, std::unique_ptr<SkCodec>*) { return false; }
|
|
799
|
+
|
|
800
|
+
// TODO(issues.skia.org/363544350): This API only works for JPEG images. Remove this API once
|
|
801
|
+
// it is no longer used.
|
|
796
802
|
virtual bool onGetGainmapInfo(SkGainmapInfo*, std::unique_ptr<SkStream>*) { return false; }
|
|
797
803
|
|
|
798
804
|
virtual SkISize onGetScaledDimensions(float /*desiredScale*/) const {
|
|
@@ -1056,6 +1062,23 @@ struct SK_API Decoder {
|
|
|
1056
1062
|
// will replace the existing one (in the same position). This is not thread-safe, so make sure all
|
|
1057
1063
|
// initialization is done before the first call.
|
|
1058
1064
|
void SK_API Register(Decoder d);
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* Return a SkImage produced by the codec, but attempts to defer image allocation until the
|
|
1068
|
+
* image is actually used/drawn. This deferral allows the system to cache the result, either on the
|
|
1069
|
+
* CPU or on the GPU, depending on where the image is drawn. If memory is low, the cache may
|
|
1070
|
+
* be purged, causing the next draw of the image to have to re-decode.
|
|
1071
|
+
*
|
|
1072
|
+
* If alphaType is nullopt, the image's alpha type will be chosen automatically based on the
|
|
1073
|
+
* image format. Transparent images will default to kPremul_SkAlphaType. If alphaType contains
|
|
1074
|
+
* kPremul_SkAlphaType or kUnpremul_SkAlphaType, that alpha type will be used. Forcing opaque
|
|
1075
|
+
* (passing kOpaque_SkAlphaType) is not allowed, and will return nullptr.
|
|
1076
|
+
*
|
|
1077
|
+
* @param codec A non-null codec (e.g. from SkPngDecoder::Decode)
|
|
1078
|
+
* @return created SkImage, or nullptr
|
|
1079
|
+
*/
|
|
1080
|
+
SK_API sk_sp<SkImage> DeferredImage(std::unique_ptr<SkCodec> codec,
|
|
1081
|
+
std::optional<SkAlphaType> alphaType = std::nullopt);
|
|
1059
1082
|
}
|
|
1060
1083
|
|
|
1061
1084
|
#endif // SkCodec_DEFINED
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 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 SkArc_DEFINED
|
|
9
|
+
#define SkArc_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkRect.h"
|
|
12
|
+
#include "include/core/SkScalar.h"
|
|
13
|
+
|
|
14
|
+
// Represents an arc along an oval boundary, or a closed wedge of the oval.
|
|
15
|
+
struct SkArc {
|
|
16
|
+
enum class Type : bool {
|
|
17
|
+
kArc, // An arc along the perimeter of the oval
|
|
18
|
+
kWedge // A closed wedge that includes the oval's center
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
SkArc() = default;
|
|
22
|
+
SkArc(const SkArc& arc) = default;
|
|
23
|
+
SkArc& operator=(const SkArc& arc) = default;
|
|
24
|
+
|
|
25
|
+
const SkRect& oval() const { return fOval; }
|
|
26
|
+
SkScalar startAngle() const { return fStartAngle; }
|
|
27
|
+
SkScalar sweepAngle() const { return fSweepAngle; }
|
|
28
|
+
bool isWedge() const { return fType == Type::kWedge; }
|
|
29
|
+
|
|
30
|
+
friend bool operator==(const SkArc& a, const SkArc& b) {
|
|
31
|
+
return a.fOval == b.fOval && a.fStartAngle == b.fStartAngle &&
|
|
32
|
+
a.fSweepAngle == b.fSweepAngle && a.fType == b.fType;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
friend bool operator!=(const SkArc& a, const SkArc& b) { return !(a == b); }
|
|
36
|
+
|
|
37
|
+
// Preferred factory that explicitly states which type of arc
|
|
38
|
+
static SkArc Make(const SkRect& oval,
|
|
39
|
+
SkScalar startAngleDegrees,
|
|
40
|
+
SkScalar sweepAngleDegrees,
|
|
41
|
+
Type type) {
|
|
42
|
+
return SkArc(oval, startAngleDegrees, sweepAngleDegrees, type);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Deprecated factory to assist with legacy code based on `useCenter`
|
|
46
|
+
static SkArc Make(const SkRect& oval,
|
|
47
|
+
SkScalar startAngleDegrees,
|
|
48
|
+
SkScalar sweepAngleDegrees,
|
|
49
|
+
bool useCenter) {
|
|
50
|
+
return SkArc(
|
|
51
|
+
oval, startAngleDegrees, sweepAngleDegrees, useCenter ? Type::kWedge : Type::kArc);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Bounds of oval containing the arc.
|
|
55
|
+
SkRect fOval = SkRect::MakeEmpty();
|
|
56
|
+
|
|
57
|
+
// Angle in degrees where the arc begins. Zero means horizontally to the right.
|
|
58
|
+
SkScalar fStartAngle = 0;
|
|
59
|
+
// Sweep angle in degrees; positive is clockwise.
|
|
60
|
+
SkScalar fSweepAngle = 0;
|
|
61
|
+
|
|
62
|
+
Type fType = Type::kArc;
|
|
63
|
+
|
|
64
|
+
private:
|
|
65
|
+
SkArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, Type type)
|
|
66
|
+
: fOval(oval), fStartAngle(startAngle), fSweepAngle(sweepAngle), fType(type) {}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
#endif
|
|
@@ -266,6 +266,16 @@ public:
|
|
|
266
266
|
*/
|
|
267
267
|
bool setAlphaType(SkAlphaType alphaType);
|
|
268
268
|
|
|
269
|
+
/** Sets the SkColorSpace associated with this SkBitmap.
|
|
270
|
+
|
|
271
|
+
The raw pixel data is not altered by this call; no conversion is
|
|
272
|
+
performed.
|
|
273
|
+
|
|
274
|
+
This changes SkColorSpace in SkPixelRef; all bitmaps sharing SkPixelRef
|
|
275
|
+
are affected.
|
|
276
|
+
*/
|
|
277
|
+
void setColorSpace(sk_sp<SkColorSpace> colorSpace);
|
|
278
|
+
|
|
269
279
|
/** Returns pixel address, the base address corresponding to the pixel origin.
|
|
270
280
|
|
|
271
281
|
@return pixel address
|