@shopify/react-native-skia 0.1.158 → 0.1.159
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +35 -11
- package/android/build.gradle +21 -25
- package/android/cpp/jni/JniLoad.cpp +2 -0
- package/android/cpp/jni/include/JniSkiaDomView.h +89 -0
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +4 -3
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +4 -3
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +2 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +45 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomViewManager.java +64 -0
- package/cpp/api/JsiSkHostObjects.h +6 -0
- package/cpp/api/JsiSkImageFilterFactory.h +1 -1
- package/cpp/api/JsiSkPaint.h +9 -2
- package/cpp/api/JsiSkPath.h +1 -0
- package/cpp/api/JsiSkRuntimeEffect.h +36 -36
- package/cpp/jsi/JsiHostObject.cpp +16 -28
- package/cpp/jsi/JsiHostObject.h +127 -7
- package/cpp/jsi/JsiValue.cpp +346 -0
- package/cpp/jsi/JsiValue.h +222 -0
- package/cpp/jsi/JsiValueWrapper.h +33 -5
- package/cpp/rnskia/RNSkDomView.cpp +220 -0
- package/cpp/rnskia/RNSkDomView.h +140 -0
- package/cpp/rnskia/RNSkJsView.cpp +0 -4
- package/cpp/rnskia/RNSkJsView.h +6 -4
- package/cpp/rnskia/RNSkManager.cpp +7 -0
- package/cpp/rnskia/RNSkPictureView.h +5 -8
- package/cpp/rnskia/RNSkView.h +113 -5
- package/cpp/rnskia/dom/JsiDomApi.h +167 -0
- package/cpp/rnskia/dom/base/BaseNodeProp.h +72 -0
- package/cpp/rnskia/dom/base/DerivedNodeProp.h +187 -0
- package/cpp/rnskia/dom/base/DrawingContext.cpp +227 -0
- package/cpp/rnskia/dom/base/DrawingContext.h +136 -0
- package/cpp/rnskia/dom/base/JsiDependencyManager.h +294 -0
- package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +176 -0
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +50 -0
- package/cpp/rnskia/dom/base/JsiDomNode.h +361 -0
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +267 -0
- package/cpp/rnskia/dom/base/NodeProp.h +130 -0
- package/cpp/rnskia/dom/base/NodePropsContainer.h +119 -0
- package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +38 -0
- package/cpp/rnskia/dom/nodes/JsiBlendNode.h +112 -0
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +78 -0
- package/cpp/rnskia/dom/nodes/JsiBoxNode.h +104 -0
- package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +33 -0
- package/cpp/rnskia/dom/nodes/JsiCircleNode.h +38 -0
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +192 -0
- package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +123 -0
- package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +42 -0
- package/cpp/rnskia/dom/nodes/JsiFillNode.h +22 -0
- package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +56 -0
- package/cpp/rnskia/dom/nodes/JsiGroupNode.h +26 -0
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +415 -0
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +44 -0
- package/cpp/rnskia/dom/nodes/JsiLayerNode.h +64 -0
- package/cpp/rnskia/dom/nodes/JsiLineNode.h +43 -0
- package/cpp/rnskia/dom/nodes/JsiOvalNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +77 -0
- package/cpp/rnskia/dom/nodes/JsiPatchNode.h +54 -0
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +315 -0
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +181 -0
- package/cpp/rnskia/dom/nodes/JsiPictureNode.h +32 -0
- package/cpp/rnskia/dom/nodes/JsiPointsNode.h +51 -0
- package/cpp/rnskia/dom/nodes/JsiRRectNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiRectNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +517 -0
- package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +47 -0
- package/cpp/rnskia/dom/nodes/JsiTextNode.h +54 -0
- package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +32 -0
- package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +43 -0
- package/cpp/rnskia/dom/props/BezierProps.h +63 -0
- package/cpp/rnskia/dom/props/BlendModeProp.h +101 -0
- package/cpp/rnskia/dom/props/BoxShadowProps.h +61 -0
- package/cpp/rnskia/dom/props/CircleProp.h +46 -0
- package/cpp/rnskia/dom/props/ClipProp.h +62 -0
- package/cpp/rnskia/dom/props/ColorProp.h +80 -0
- package/cpp/rnskia/dom/props/DrawingProp.h +33 -0
- package/cpp/rnskia/dom/props/FontProp.h +34 -0
- package/cpp/rnskia/dom/props/GlyphsProp.h +53 -0
- package/cpp/rnskia/dom/props/ImageProps.h +173 -0
- package/cpp/rnskia/dom/props/LayerProp.h +50 -0
- package/cpp/rnskia/dom/props/MatrixProp.h +33 -0
- package/cpp/rnskia/dom/props/NumbersProp.h +63 -0
- package/cpp/rnskia/dom/props/PaintProps.h +172 -0
- package/cpp/rnskia/dom/props/PathProp.h +55 -0
- package/cpp/rnskia/dom/props/PictureProp.h +38 -0
- package/cpp/rnskia/dom/props/PointProp.h +72 -0
- package/cpp/rnskia/dom/props/PointsProp.h +83 -0
- package/cpp/rnskia/dom/props/RRectProp.h +134 -0
- package/cpp/rnskia/dom/props/RadiusProp.h +43 -0
- package/cpp/rnskia/dom/props/RectProp.h +118 -0
- package/cpp/rnskia/dom/props/StrokeProps.h +75 -0
- package/cpp/rnskia/dom/props/SvgProp.h +37 -0
- package/cpp/rnskia/dom/props/TextBlobProp.h +128 -0
- package/cpp/rnskia/dom/props/TileModeProp.h +50 -0
- package/cpp/rnskia/dom/props/TransformProp.h +80 -0
- package/cpp/rnskia/dom/props/TransformsProps.h +68 -0
- package/cpp/rnskia/dom/props/UniformsProp.h +194 -0
- package/cpp/rnskia/dom/props/VertexModeProp.h +47 -0
- package/cpp/rnskia/dom/props/VerticesProps.h +67 -0
- package/cpp/rnskia/values/RNSkReadonlyValue.h +13 -4
- package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +35 -1
- package/cpp/skia/include/codec/SkAndroidCodec.h +17 -1
- package/cpp/skia/include/codec/SkCodec.h +8 -5
- package/cpp/skia/include/core/SkAnnotation.h +2 -0
- package/cpp/skia/include/core/SkBitmap.h +52 -1
- package/cpp/skia/include/core/SkBlendMode.h +2 -0
- package/cpp/skia/include/core/SkCanvas.h +52 -31
- package/cpp/skia/include/core/SkCapabilities.h +44 -0
- package/cpp/skia/include/core/SkColor.h +7 -0
- package/cpp/skia/include/core/SkColorFilter.h +37 -0
- package/cpp/skia/include/core/SkColorSpace.h +1 -1
- package/cpp/skia/include/core/SkFont.h +4 -0
- package/cpp/skia/include/core/SkFontMgr.h +3 -0
- package/cpp/skia/include/core/SkGraphics.h +9 -0
- package/cpp/skia/include/core/SkImage.h +77 -17
- package/cpp/skia/include/core/SkImageEncoder.h +5 -3
- package/cpp/skia/include/core/SkImageGenerator.h +27 -17
- package/cpp/skia/include/core/SkM44.h +1 -0
- package/cpp/skia/include/core/SkMesh.h +120 -34
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOverdrawCanvas.h +2 -1
- package/cpp/skia/include/core/SkPaint.h +15 -2
- package/cpp/skia/include/core/SkPath.h +4 -0
- package/cpp/skia/include/core/SkPathBuilder.h +1 -1
- package/cpp/skia/include/core/SkPicture.h +0 -3
- package/cpp/skia/include/core/SkPictureRecorder.h +0 -2
- package/cpp/skia/include/core/SkPixmap.h +19 -0
- package/cpp/skia/include/core/SkRasterHandleAllocator.h +3 -1
- package/cpp/skia/include/core/SkRect.h +11 -4
- package/cpp/skia/include/core/SkRefCnt.h +13 -1
- package/cpp/skia/include/core/SkRegion.h +6 -0
- package/cpp/skia/include/core/SkSamplingOptions.h +8 -6
- package/cpp/skia/include/core/SkScalar.h +6 -25
- package/cpp/skia/include/core/SkShader.h +20 -12
- package/cpp/skia/include/core/SkSpan.h +51 -19
- package/cpp/skia/include/core/SkStream.h +2 -2
- package/cpp/skia/include/core/SkString.h +11 -3
- package/cpp/skia/include/core/SkSurface.h +85 -8
- package/cpp/skia/include/core/SkTextBlob.h +5 -2
- package/cpp/skia/include/core/SkTypes.h +11 -10
- package/cpp/skia/include/docs/SkPDFDocument.h +0 -5
- package/cpp/skia/include/effects/Sk1DPathEffect.h +6 -1
- package/cpp/skia/include/effects/Sk2DPathEffect.h +4 -1
- package/cpp/skia/include/effects/SkColorMatrix.h +1 -0
- package/cpp/skia/include/effects/SkColorMatrixFilter.h +5 -8
- package/cpp/skia/include/effects/SkCornerPathEffect.h +5 -1
- package/cpp/skia/include/effects/SkDashPathEffect.h +5 -1
- package/cpp/skia/include/effects/SkGradientShader.h +68 -38
- package/cpp/skia/include/effects/SkHighContrastFilter.h +5 -1
- package/cpp/skia/include/effects/SkImageFilters.h +5 -4
- package/cpp/skia/include/effects/SkLumaColorFilter.h +4 -1
- package/cpp/skia/include/effects/SkOpPathEffect.h +6 -2
- package/cpp/skia/include/effects/SkOverdrawColorFilter.h +5 -2
- package/cpp/skia/include/effects/SkRuntimeEffect.h +54 -62
- package/cpp/skia/include/effects/SkShaderMaskFilter.h +3 -1
- package/cpp/skia/include/effects/SkTableColorFilter.h +8 -21
- package/cpp/skia/include/effects/SkTableMaskFilter.h +5 -1
- package/cpp/skia/include/effects/SkTrimPathEffect.h +5 -1
- package/cpp/skia/include/encode/SkEncoder.h +17 -0
- package/cpp/skia/include/encode/SkWebpEncoder.h +17 -0
- package/cpp/skia/include/gpu/GpuTypes.h +18 -0
- package/cpp/skia/include/gpu/GrBackendSurface.h +38 -17
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +6 -71
- package/cpp/skia/include/gpu/GrContextOptions.h +1 -1
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +10 -9
- package/cpp/skia/include/gpu/GrDirectContext.h +42 -22
- package/cpp/skia/include/gpu/GrRecordingContext.h +6 -3
- package/cpp/skia/include/gpu/GrTypes.h +11 -11
- package/cpp/skia/include/gpu/MutableTextureState.h +122 -0
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -0
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +1 -0
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +7 -0
- package/cpp/skia/include/gpu/graphite/CombinationBuilder.h +195 -0
- package/cpp/skia/include/gpu/graphite/Context.h +47 -55
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +85 -0
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +1 -17
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +61 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +87 -8
- package/cpp/skia/include/gpu/graphite/Recording.h +19 -9
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +40 -8
- package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +25 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +3 -2
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +69 -0
- package/cpp/skia/include/gpu/mtl/MtlMemoryAllocator.h +39 -0
- package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +21 -19
- package/cpp/skia/include/gpu/vk/GrVkExtensions.h +2 -50
- package/cpp/skia/include/gpu/vk/GrVkMemoryAllocator.h +2 -127
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +5 -43
- package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +46 -0
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +67 -0
- package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +116 -0
- package/cpp/skia/include/gpu/vk/VulkanTypes.h +59 -0
- package/cpp/skia/include/pathops/SkPathOps.h +1 -1
- package/cpp/skia/include/private/SkColorData.h +10 -40
- package/cpp/skia/include/private/SkEncodedInfo.h +9 -3
- package/cpp/skia/include/private/SkFloatingPoint.h +9 -6
- package/cpp/skia/include/private/SkHalf.h +5 -52
- package/cpp/skia/include/private/SkMacros.h +1 -1
- package/cpp/skia/include/private/SkMalloc.h +4 -0
- package/cpp/skia/include/private/SkPathRef.h +10 -10
- package/cpp/skia/include/private/SkSLModifiers.h +59 -23
- package/cpp/skia/include/private/SkSLProgramKind.h +1 -0
- package/cpp/skia/include/private/SkSLSymbol.h +7 -3
- package/cpp/skia/include/private/SkStringView.h +4 -0
- package/cpp/skia/include/private/SkTArray.h +21 -7
- package/cpp/skia/include/private/SkTDArray.h +173 -285
- package/cpp/skia/include/private/SkTHash.h +33 -32
- package/cpp/skia/include/private/SkTemplates.h +24 -26
- package/cpp/skia/include/private/SkVx.h +218 -135
- package/cpp/skia/include/private/chromium/GrSlug.h +3 -65
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +6 -3
- package/cpp/skia/include/private/chromium/Slug.h +76 -0
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +6 -1
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +5 -39
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +63 -0
- package/cpp/skia/include/{gpu/vk/GrVkVulkan.h → private/gpu/vk/SkiaVulkan.h} +2 -2
- package/cpp/skia/include/private/gpu/vk/VulkanTypesPriv.h +57 -0
- package/cpp/skia/include/sksl/DSL.h +0 -1
- package/cpp/skia/include/sksl/DSLBlock.h +4 -18
- package/cpp/skia/include/sksl/DSLCase.h +2 -8
- package/cpp/skia/include/sksl/DSLCore.h +8 -15
- package/cpp/skia/include/sksl/DSLExpression.h +51 -142
- package/cpp/skia/include/sksl/DSLFunction.h +7 -15
- package/cpp/skia/include/sksl/DSLModifiers.h +5 -2
- package/cpp/skia/include/sksl/DSLStatement.h +4 -39
- package/cpp/skia/include/sksl/DSLSymbols.h +1 -11
- package/cpp/skia/include/sksl/DSLType.h +20 -12
- package/cpp/skia/include/sksl/DSLVar.h +56 -146
- package/cpp/skia/include/sksl/SkSLErrorReporter.h +2 -15
- package/cpp/skia/include/sksl/SkSLOperator.h +62 -59
- package/cpp/skia/include/sksl/SkSLPosition.h +2 -0
- package/cpp/skia/include/sksl/SkSLVersion.h +27 -0
- package/cpp/skia/include/svg/SkSVGCanvas.h +1 -0
- package/cpp/skia/include/utils/SkAnimCodecPlayer.h +1 -1
- package/cpp/skia/include/utils/SkBase64.h +2 -0
- package/cpp/skia/include/utils/SkCustomTypeface.h +24 -11
- package/cpp/skia/include/utils/SkEventTracer.h +12 -1
- package/cpp/skia/include/utils/SkNWayCanvas.h +11 -4
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +9 -4
- package/cpp/skia/include/utils/SkParse.h +3 -0
- package/cpp/skia/include/utils/SkShadowUtils.h +2 -0
- package/cpp/skia/include/utils/SkTextUtils.h +2 -1
- package/cpp/skia/{include/third_party → modules}/skcms/skcms.h +10 -0
- package/cpp/skia/modules/skcms/skcms_internal.h +56 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +1609 -0
- package/cpp/skia/modules/skparagraph/include/DartTypes.h +153 -0
- package/cpp/skia/modules/skparagraph/include/FontArguments.h +46 -0
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +84 -0
- package/cpp/skia/modules/skparagraph/include/Metrics.h +98 -0
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +111 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +69 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +77 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +143 -0
- package/cpp/skia/modules/skparagraph/include/TextShadow.h +30 -0
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +352 -0
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +81 -0
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +3 -3
- package/cpp/skia/src/core/SkLRUCache.h +126 -0
- package/cpp/skia/src/core/SkTInternalLList.h +302 -0
- package/cpp/utils/RNSkTimingInfo.h +1 -0
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +15 -4
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +40 -54
- package/ios/RNSkia-iOS/SkiaDomViewManager.h +8 -0
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +51 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +56 -56
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.js +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +19 -63
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DependencyManager.js +0 -5
- package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/useCanvas.js +4 -18
- package/lib/commonjs/renderer/useCanvas.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +7 -0
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.js +152 -0
- package/lib/commonjs/views/SkiaDomView.js.map +1 -0
- package/lib/commonjs/views/SkiaDomView.web.js +55 -0
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -0
- package/lib/commonjs/views/SkiaPictureView.js +16 -2
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaView.js +17 -2
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/index.js +13 -0
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.js +56 -56
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/RenderNode.js +1 -1
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/renderer/Canvas.js +20 -64
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DependencyManager.js +0 -5
- package/lib/module/renderer/DependencyManager.js.map +1 -1
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/useCanvas.js +2 -13
- package/lib/module/renderer/useCanvas.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +7 -0
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.js +128 -0
- package/lib/module/views/SkiaDomView.js.map +1 -0
- package/lib/module/views/SkiaDomView.web.js +41 -0
- package/lib/module/views/SkiaDomView.web.js.map +1 -0
- package/lib/module/views/SkiaPictureView.js +14 -2
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaView.js +15 -2
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/index.js +1 -0
- package/lib/module/views/index.js.map +1 -1
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +57 -64
- package/lib/typescript/src/renderer/Canvas.d.ts +5 -8
- package/lib/typescript/src/renderer/DependencyManager.d.ts +0 -2
- package/lib/typescript/src/renderer/HostComponents.d.ts +66 -3
- package/lib/typescript/src/renderer/useCanvas.d.ts +0 -6
- package/lib/typescript/src/views/SkiaBaseWebView.d.ts +4 -0
- package/lib/typescript/src/views/SkiaDomView.d.ts +31 -0
- package/lib/typescript/src/views/SkiaDomView.web.d.ts +7 -0
- package/lib/typescript/src/views/index.d.ts +1 -0
- package/lib/typescript/src/views/types.d.ts +12 -2
- 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/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 +42 -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/libskunicode.xcframework/Info.plist +42 -0
- 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/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 +5 -3
- package/react-native-skia.podspec +3 -1
- package/src/dom/nodes/JsiSkDOM.ts +170 -56
- package/src/dom/nodes/RenderNode.ts +1 -1
- package/src/renderer/Canvas.tsx +32 -56
- package/src/renderer/DependencyManager.tsx +0 -5
- package/src/renderer/HostComponents.ts +152 -1
- package/src/renderer/useCanvas.ts +1 -15
- package/src/views/SkiaBaseWebView.tsx +4 -0
- package/src/views/SkiaDomView.tsx +120 -0
- package/src/views/SkiaDomView.web.tsx +37 -0
- package/src/views/SkiaPictureView.tsx +10 -2
- package/src/views/SkiaView.tsx +11 -3
- package/src/views/index.ts +1 -0
- package/src/views/types.ts +19 -2
- package/cpp/jsi/JsiSimpleValueWrapper.h +0 -99
- package/cpp/skia/include/c/sk_canvas.h +0 -159
- package/cpp/skia/include/c/sk_colorspace.h +0 -25
- package/cpp/skia/include/c/sk_data.h +0 -65
- package/cpp/skia/include/c/sk_image.h +0 -71
- package/cpp/skia/include/c/sk_imageinfo.h +0 -62
- package/cpp/skia/include/c/sk_maskfilter.h +0 -47
- package/cpp/skia/include/c/sk_matrix.h +0 -49
- package/cpp/skia/include/c/sk_paint.h +0 -145
- package/cpp/skia/include/c/sk_path.h +0 -102
- package/cpp/skia/include/c/sk_picture.h +0 -70
- package/cpp/skia/include/c/sk_shader.h +0 -143
- package/cpp/skia/include/c/sk_surface.h +0 -73
- package/cpp/skia/include/c/sk_types.h +0 -278
- package/cpp/skia/include/gpu/graphite/SkStuff.h +0 -47
- package/cpp/skia/include/private/SkNx.h +0 -430
- package/cpp/skia/include/private/SkNx_neon.h +0 -713
- package/cpp/skia/include/private/SkNx_sse.h +0 -823
- package/cpp/skia/include/sksl/DSLRuntimeEffects.h +0 -32
- package/cpp/skia/include/sksl/DSLWrapper.h +0 -77
@@ -149,6 +149,8 @@ struct alignas(N*sizeof(T)) Vec : public VecStorage<N,T> {
|
|
149
149
|
|
150
150
|
using VecStorage<N,T>::VecStorage;
|
151
151
|
|
152
|
+
// NOTE: Vec{x} produces x000..., whereas Vec(x) produces xxxx.... since this constructor fills
|
153
|
+
// unspecified lanes with 0s, whereas the single T constructor fills all lanes with the value.
|
152
154
|
SKVX_ALWAYS_INLINE Vec(std::initializer_list<T> xs) {
|
153
155
|
T vals[N] = {0};
|
154
156
|
memcpy(vals, xs.begin(), std::min(xs.size(), (size_t)N)*sizeof(T));
|
@@ -193,21 +195,14 @@ struct Vec<1,T> {
|
|
193
195
|
}
|
194
196
|
};
|
195
197
|
|
196
|
-
// Ideally we'd only use bit_pun(), but until this file is always built as C++17 with constexpr if,
|
197
|
-
// we'll sometimes find need to use unchecked_bit_pun(). Please do check the call sites yourself!
|
198
198
|
template <typename D, typename S>
|
199
|
-
SI D
|
199
|
+
SI D bit_pun(const S& s) {
|
200
|
+
static_assert(sizeof(D) == sizeof(S));
|
200
201
|
D d;
|
201
202
|
memcpy(&d, &s, sizeof(D));
|
202
203
|
return d;
|
203
204
|
}
|
204
205
|
|
205
|
-
template <typename D, typename S>
|
206
|
-
SI D bit_pun(const S& s) {
|
207
|
-
static_assert(sizeof(D) == sizeof(S), "");
|
208
|
-
return unchecked_bit_pun<D>(s);
|
209
|
-
}
|
210
|
-
|
211
206
|
// Translate from a value type T to its corresponding Mask, the result of a comparison.
|
212
207
|
template <typename T> struct Mask { using type = T; };
|
213
208
|
template <> struct Mask<float > { using type = int32_t; };
|
@@ -459,30 +454,29 @@ SIT Vec<1,T> if_then_else(const Vec<1,M<T>>& cond, const Vec<1,T>& t, const Vec<
|
|
459
454
|
}
|
460
455
|
SINT Vec<N,T> if_then_else(const Vec<N,M<T>>& cond, const Vec<N,T>& t, const Vec<N,T>& e) {
|
461
456
|
// Specializations inline here so they can generalize what types the apply to.
|
462
|
-
// (This header is used in C++14 contexts, so we have to kind of fake constexpr if.)
|
463
457
|
#if SKVX_USE_SIMD && defined(__AVX2__)
|
464
|
-
if
|
465
|
-
return
|
466
|
-
|
467
|
-
|
458
|
+
if constexpr (N*sizeof(T) == 32) {
|
459
|
+
return bit_pun<Vec<N,T>>(_mm256_blendv_epi8(bit_pun<__m256i>(e),
|
460
|
+
bit_pun<__m256i>(t),
|
461
|
+
bit_pun<__m256i>(cond)));
|
468
462
|
}
|
469
463
|
#endif
|
470
464
|
#if SKVX_USE_SIMD && defined(__SSE4_1__)
|
471
|
-
if
|
472
|
-
return
|
473
|
-
|
474
|
-
|
465
|
+
if constexpr (N*sizeof(T) == 16) {
|
466
|
+
return bit_pun<Vec<N,T>>(_mm_blendv_epi8(bit_pun<__m128i>(e),
|
467
|
+
bit_pun<__m128i>(t),
|
468
|
+
bit_pun<__m128i>(cond)));
|
475
469
|
}
|
476
470
|
#endif
|
477
471
|
#if SKVX_USE_SIMD && defined(__ARM_NEON)
|
478
|
-
if
|
479
|
-
return
|
480
|
-
|
481
|
-
|
472
|
+
if constexpr (N*sizeof(T) == 16) {
|
473
|
+
return bit_pun<Vec<N,T>>(vbslq_u8(bit_pun<uint8x16_t>(cond),
|
474
|
+
bit_pun<uint8x16_t>(t),
|
475
|
+
bit_pun<uint8x16_t>(e)));
|
482
476
|
}
|
483
477
|
#endif
|
484
478
|
// Recurse for large vectors to try to hit the specializations above.
|
485
|
-
if
|
479
|
+
if constexpr (N*sizeof(T) > 16) {
|
486
480
|
return join(if_then_else(cond.lo, t.lo, e.lo),
|
487
481
|
if_then_else(cond.hi, t.hi, e.hi));
|
488
482
|
}
|
@@ -492,9 +486,36 @@ SINT Vec<N,T> if_then_else(const Vec<N,M<T>>& cond, const Vec<N,T>& t, const Vec
|
|
492
486
|
|
493
487
|
SIT bool any(const Vec<1,T>& x) { return x.val != 0; }
|
494
488
|
SINT bool any(const Vec<N,T>& x) {
|
489
|
+
// For any(), the _mm_testz intrinsics are correct and don't require comparing 'x' to 0, so it's
|
490
|
+
// lower latency compared to _mm_movemask + _mm_compneq on plain SSE.
|
491
|
+
#if SKVX_USE_SIMD && defined(__AVX2__)
|
492
|
+
if constexpr (N*sizeof(T) == 32) {
|
493
|
+
return !_mm256_testz_si256(bit_pun<__m256i>(x), _mm256_set1_epi32(-1));
|
494
|
+
}
|
495
|
+
#endif
|
496
|
+
#if SKVX_USE_SIMD && defined(__SSE_4_1__)
|
497
|
+
if constexpr (N*sizeof(T) == 16) {
|
498
|
+
return !_mm_testz_si128(bit_pun<__m128i>(x), _mm_set1_epi32(-1));
|
499
|
+
}
|
500
|
+
#endif
|
501
|
+
#if SKVX_USE_SIMD && defined(__SSE__)
|
502
|
+
if constexpr (N*sizeof(T) == 16) {
|
503
|
+
// On SSE, movemask checks only the MSB in each lane, which is fine if the lanes were set
|
504
|
+
// directly from a comparison op (which sets all bits to 1 when true), but skvx::Vec<>
|
505
|
+
// treats any non-zero value as true, so we have to compare 'x' to 0 before calling movemask
|
506
|
+
return _mm_movemask_ps(_mm_cmpneq_ps(bit_pun<__m128>(x), _mm_set1_ps(0))) != 0b0000;
|
507
|
+
}
|
508
|
+
#endif
|
509
|
+
#if SKVX_USE_SIMD && defined(__aarch64__)
|
510
|
+
// On 64-bit NEON, take the max across lanes, which will be non-zero if any lane was true.
|
511
|
+
// The specific lane-size doesn't really matter in this case since it's really any set bit
|
512
|
+
// that we're looking for.
|
513
|
+
if constexpr (N*sizeof(T) == 8 ) { return vmaxv_u8 (bit_pun<uint8x8_t> (x)) > 0; }
|
514
|
+
if constexpr (N*sizeof(T) == 16) { return vmaxvq_u8(bit_pun<uint8x16_t>(x)) > 0; }
|
515
|
+
#endif
|
495
516
|
#if SKVX_USE_SIMD && defined(__wasm_simd128__)
|
496
517
|
if constexpr (N == 4 && sizeof(T) == 4) {
|
497
|
-
return wasm_i32x4_any_true(
|
518
|
+
return wasm_i32x4_any_true(bit_pun<VExt<4,int>>(x));
|
498
519
|
}
|
499
520
|
#endif
|
500
521
|
return any(x.lo)
|
@@ -503,21 +524,27 @@ SINT bool any(const Vec<N,T>& x) {
|
|
503
524
|
|
504
525
|
SIT bool all(const Vec<1,T>& x) { return x.val != 0; }
|
505
526
|
SINT bool all(const Vec<N,T>& x) {
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
527
|
+
// Unlike any(), we have to respect the lane layout, or we'll miss cases where a
|
528
|
+
// true lane has a mix of 0 and 1 bits.
|
529
|
+
#if SKVX_USE_SIMD && defined(__SSE__)
|
530
|
+
// Unfortunately, the _mm_testc intrinsics don't let us avoid the comparison to 0 for all()'s
|
531
|
+
// correctness, so always just use the plain SSE version.
|
532
|
+
if constexpr (N == 4 && sizeof(T) == 4) {
|
533
|
+
return _mm_movemask_ps(_mm_cmpneq_ps(bit_pun<__m128>(x), _mm_set1_ps(0))) == 0b1111;
|
510
534
|
}
|
511
535
|
#endif
|
512
|
-
#if SKVX_USE_SIMD && defined(
|
513
|
-
if
|
514
|
-
|
515
|
-
|
516
|
-
}
|
536
|
+
#if SKVX_USE_SIMD && defined(__aarch64__)
|
537
|
+
// On 64-bit NEON, take the min across the lanes, which will be non-zero if all lanes are != 0.
|
538
|
+
if constexpr (sizeof(T)==1 && N==8) {return vminv_u8 (bit_pun<uint8x8_t> (x)) > 0;}
|
539
|
+
if constexpr (sizeof(T)==1 && N==16) {return vminvq_u8 (bit_pun<uint8x16_t>(x)) > 0;}
|
540
|
+
if constexpr (sizeof(T)==2 && N==4) {return vminv_u16 (bit_pun<uint16x4_t>(x)) > 0;}
|
541
|
+
if constexpr (sizeof(T)==2 && N==8) {return vminvq_u16(bit_pun<uint16x8_t>(x)) > 0;}
|
542
|
+
if constexpr (sizeof(T)==4 && N==2) {return vminv_u32 (bit_pun<uint32x2_t>(x)) > 0;}
|
543
|
+
if constexpr (sizeof(T)==4 && N==4) {return vminvq_u32(bit_pun<uint32x4_t>(x)) > 0;}
|
517
544
|
#endif
|
518
545
|
#if SKVX_USE_SIMD && defined(__wasm_simd128__)
|
519
|
-
if
|
520
|
-
return wasm_i32x4_all_true(
|
546
|
+
if constexpr (N == 4 && sizeof(T) == 4) {
|
547
|
+
return wasm_i32x4_all_true(bit_pun<VExt<4,int>>(x));
|
521
548
|
}
|
522
549
|
#endif
|
523
550
|
return all(x.lo)
|
@@ -620,13 +647,13 @@ SI Vec<1,int> lrint(const Vec<1,float>& x) {
|
|
620
647
|
}
|
621
648
|
SIN Vec<N,int> lrint(const Vec<N,float>& x) {
|
622
649
|
#if SKVX_USE_SIMD && defined(__AVX__)
|
623
|
-
if
|
624
|
-
return
|
650
|
+
if constexpr (N == 8) {
|
651
|
+
return bit_pun<Vec<N,int>>(_mm256_cvtps_epi32(bit_pun<__m256>(x)));
|
625
652
|
}
|
626
653
|
#endif
|
627
654
|
#if SKVX_USE_SIMD && defined(__SSE__)
|
628
|
-
if
|
629
|
-
return
|
655
|
+
if constexpr (N == 4) {
|
656
|
+
return bit_pun<Vec<N,int>>(_mm_cvtps_epi32(bit_pun<__m128>(x)));
|
630
657
|
}
|
631
658
|
#endif
|
632
659
|
return join(lrint(x.lo),
|
@@ -635,8 +662,7 @@ SIN Vec<N,int> lrint(const Vec<N,float>& x) {
|
|
635
662
|
|
636
663
|
SIN Vec<N,float> fract(const Vec<N,float>& x) { return x - floor(x); }
|
637
664
|
|
638
|
-
//
|
639
|
-
// and assumes inputs are finite and treat/flush denorm half floats as/to zero.
|
665
|
+
// Assumes inputs are finite and treat/flush denorm half floats as/to zero.
|
640
666
|
// Key constants to watch for:
|
641
667
|
// - a float is 32-bit, 1-8-23 sign-exponent-mantissa, with 127 exponent bias;
|
642
668
|
// - a half is 16-bit, 1-5-10 sign-exponent-mantissa, with 15 exponent bias.
|
@@ -644,17 +670,17 @@ SIN Vec<N,uint16_t> to_half_finite_ftz(const Vec<N,float>& x) {
|
|
644
670
|
Vec<N,uint32_t> sem = bit_pun<Vec<N,uint32_t>>(x),
|
645
671
|
s = sem & 0x8000'0000,
|
646
672
|
em = sem ^ s,
|
647
|
-
|
648
|
-
|
649
|
-
|
673
|
+
is_norm = em > 0x387f'd000, // halfway between largest f16 denorm and smallest norm
|
674
|
+
norm = (em>>13) - ((127-15)<<10);
|
675
|
+
return cast<uint16_t>((s>>16) | (is_norm & norm));
|
650
676
|
}
|
651
677
|
SIN Vec<N,float> from_half_finite_ftz(const Vec<N,uint16_t>& x) {
|
652
678
|
Vec<N,uint32_t> wide = cast<uint32_t>(x),
|
653
679
|
s = wide & 0x8000,
|
654
|
-
em = wide ^ s
|
655
|
-
|
656
|
-
|
657
|
-
|
680
|
+
em = wide ^ s,
|
681
|
+
is_norm = em > 0x3ff,
|
682
|
+
norm = (em<<13) + ((127-15)<<23);
|
683
|
+
return bit_pun<Vec<N,float>>((s<<16) | (is_norm & norm));
|
658
684
|
}
|
659
685
|
|
660
686
|
// Like if_then_else(), these N=1 base cases won't actually be used unless explicitly called.
|
@@ -663,18 +689,18 @@ SI Vec<1,float> from_half(const Vec<1,uint16_t>& x) { return from_half_finite_f
|
|
663
689
|
|
664
690
|
SIN Vec<N,uint16_t> to_half(const Vec<N,float>& x) {
|
665
691
|
#if SKVX_USE_SIMD && defined(__F16C__)
|
666
|
-
if
|
667
|
-
return
|
668
|
-
|
692
|
+
if constexpr (N == 8) {
|
693
|
+
return bit_pun<Vec<N,uint16_t>>(_mm256_cvtps_ph(bit_pun<__m256>(x),
|
694
|
+
_MM_FROUND_TO_NEAREST_INT));
|
669
695
|
}
|
670
696
|
#endif
|
671
697
|
#if SKVX_USE_SIMD && defined(__aarch64__)
|
672
|
-
if
|
673
|
-
return
|
698
|
+
if constexpr (N == 4) {
|
699
|
+
return bit_pun<Vec<N,uint16_t>>(vcvt_f16_f32(bit_pun<float32x4_t>(x)));
|
674
700
|
|
675
701
|
}
|
676
702
|
#endif
|
677
|
-
if
|
703
|
+
if constexpr (N > 4) {
|
678
704
|
return join(to_half(x.lo),
|
679
705
|
to_half(x.hi));
|
680
706
|
}
|
@@ -683,16 +709,16 @@ SIN Vec<N,uint16_t> to_half(const Vec<N,float>& x) {
|
|
683
709
|
|
684
710
|
SIN Vec<N,float> from_half(const Vec<N,uint16_t>& x) {
|
685
711
|
#if SKVX_USE_SIMD && defined(__F16C__)
|
686
|
-
if
|
687
|
-
return
|
712
|
+
if constexpr (N == 8) {
|
713
|
+
return bit_pun<Vec<N,float>>(_mm256_cvtph_ps(bit_pun<__m128i>(x)));
|
688
714
|
}
|
689
715
|
#endif
|
690
716
|
#if SKVX_USE_SIMD && defined(__aarch64__)
|
691
|
-
if
|
692
|
-
return
|
717
|
+
if constexpr (N == 4) {
|
718
|
+
return bit_pun<Vec<N,float>>(vcvt_f32_f16(bit_pun<float16x4_t>(x)));
|
693
719
|
}
|
694
720
|
#endif
|
695
|
-
if
|
721
|
+
if constexpr (N > 4) {
|
696
722
|
return join(from_half(x.lo),
|
697
723
|
from_half(x.hi));
|
698
724
|
}
|
@@ -714,6 +740,29 @@ SIN Vec<N,uint8_t> approx_scale(const Vec<N,uint8_t>& x, const Vec<N,uint8_t>& y
|
|
714
740
|
return cast<uint8_t>( (X*Y+X)/256 );
|
715
741
|
}
|
716
742
|
|
743
|
+
// saturated_add(x,y) sums values and clamps to the maximum value instead of overflowing.
|
744
|
+
SINT std::enable_if_t<std::is_unsigned_v<T>, Vec<N,T>> saturated_add(const Vec<N,T>& x,
|
745
|
+
const Vec<N,T>& y) {
|
746
|
+
#if SKVX_USE_SIMD && (defined(__SSE__) || defined(__ARM_NEON))
|
747
|
+
// Both SSE and ARM have 16-lane saturated adds, so use intrinsics for those and recurse down
|
748
|
+
// or join up to take advantage.
|
749
|
+
if constexpr (N == 16 && sizeof(T) == 1) {
|
750
|
+
#if defined(__SSE__)
|
751
|
+
return bit_pun<Vec<N,T>>(_mm_adds_epu8(bit_pun<__m128i>(x), bit_pun<__m128i>(y)));
|
752
|
+
#else // __ARM_NEON
|
753
|
+
return bit_pun<Vec<N,T>>(vqaddq_u8(bit_pun<uint8x16_t>(x), bit_pun<uint8x16_t>(y)));
|
754
|
+
#endif
|
755
|
+
} else if constexpr (N < 16 && sizeof(T) == 1) {
|
756
|
+
return saturated_add(join(x,x), join(y,y)).lo;
|
757
|
+
} else if constexpr (sizeof(T) == 1) {
|
758
|
+
return join(saturated_add(x.lo, y.lo), saturated_add(x.hi, y.hi));
|
759
|
+
}
|
760
|
+
#endif
|
761
|
+
// Otherwise saturate manually
|
762
|
+
auto sum = x + y;
|
763
|
+
return if_then_else(sum < x, Vec<N,T>(std::numeric_limits<T>::max()), sum);
|
764
|
+
}
|
765
|
+
|
717
766
|
// The ScaledDividerU32 takes a divisor > 1, and creates a function divide(numerator) that
|
718
767
|
// calculates a numerator / denominator. For this to be rounded properly, numerator should have
|
719
768
|
// half added in:
|
@@ -758,105 +807,109 @@ private:
|
|
758
807
|
const uint32_t fHalf;
|
759
808
|
};
|
760
809
|
|
761
|
-
#if SKVX_USE_SIMD && defined(__ARM_NEON)
|
762
|
-
// With NEON we can do eight u8*u8 -> u16 in one instruction, vmull_u8 (read, mul-long).
|
763
|
-
SI Vec<8,uint16_t> mull(const Vec<8,uint8_t>& x,
|
764
|
-
const Vec<8,uint8_t>& y) {
|
765
|
-
return to_vec<8,uint16_t>(vmull_u8(to_vext(x),
|
766
|
-
to_vext(y)));
|
767
|
-
}
|
768
810
|
|
769
|
-
SIN
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
811
|
+
SIN Vec<N,uint16_t> mull(const Vec<N,uint8_t>& x,
|
812
|
+
const Vec<N,uint8_t>& y) {
|
813
|
+
#if SKVX_USE_SIMD && defined(__ARM_NEON)
|
814
|
+
// With NEON we can do eight u8*u8 -> u16 in one instruction, vmull_u8 (read, mul-long).
|
815
|
+
if constexpr (N == 8) {
|
816
|
+
return to_vec<8,uint16_t>(vmull_u8(to_vext(x), to_vext(y)));
|
817
|
+
} else if constexpr (N < 8) {
|
818
|
+
return mull(join(x,x), join(y,y)).lo;
|
819
|
+
} else { // N > 8
|
820
|
+
return join(mull(x.lo, y.lo), mull(x.hi, y.hi));
|
821
|
+
}
|
822
|
+
#else
|
823
|
+
return cast<uint16_t>(x) * cast<uint16_t>(y);
|
824
|
+
#endif
|
781
825
|
}
|
782
826
|
|
827
|
+
SIN Vec<N,uint32_t> mull(const Vec<N,uint16_t>& x,
|
828
|
+
const Vec<N,uint16_t>& y) {
|
829
|
+
#if SKVX_USE_SIMD && defined(__ARM_NEON)
|
830
|
+
// NEON can do four u16*u16 -> u32 in one instruction, vmull_u16
|
831
|
+
if constexpr (N == 4) {
|
832
|
+
return to_vec<4,uint32_t>(vmull_u16(to_vext(x), to_vext(y)));
|
833
|
+
} else if constexpr (N < 4) {
|
834
|
+
return mull(join(x,x), join(y,y)).lo;
|
835
|
+
} else { // N > 4
|
836
|
+
return join(mull(x.lo, y.lo), mull(x.hi, y.hi));
|
837
|
+
}
|
783
838
|
#else
|
784
|
-
|
785
|
-
// Nothing special when we don't have NEON... just cast up to 16-bit and multiply.
|
786
|
-
SIN Vec<N,uint16_t> mull(const Vec<N,uint8_t>& x,
|
787
|
-
const Vec<N,uint8_t>& y) {
|
788
|
-
return cast<uint16_t>(x)
|
789
|
-
* cast<uint16_t>(y);
|
790
|
-
}
|
839
|
+
return cast<uint32_t>(x) * cast<uint32_t>(y);
|
791
840
|
#endif
|
841
|
+
}
|
792
842
|
|
793
|
-
|
794
|
-
|
795
|
-
#if defined(
|
796
|
-
|
843
|
+
SIN Vec<N,uint16_t> mulhi(const Vec<N,uint16_t>& x,
|
844
|
+
const Vec<N,uint16_t>& y) {
|
845
|
+
#if SKVX_USE_SIMD && defined(__SSE__)
|
846
|
+
// Use _mm_mulhi_epu16 for 8xuint16_t and join or split to get there.
|
847
|
+
if constexpr (N == 8) {
|
848
|
+
return bit_pun<Vec<8,uint16_t>>(_mm_mulhi_epu16(bit_pun<__m128i>(x), bit_pun<__m128i>(y)));
|
849
|
+
} else if constexpr (N < 8) {
|
850
|
+
return mulhi(join(x,x), join(y,y)).lo;
|
851
|
+
} else { // N > 8
|
852
|
+
return join(mulhi(x.lo, y.lo), mulhi(x.hi, y.hi));
|
853
|
+
}
|
854
|
+
#else
|
855
|
+
return skvx::cast<uint16_t>(mull(x, y) >> 16);
|
797
856
|
#endif
|
857
|
+
}
|
798
858
|
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
constexpr static float b = 0.9217841528914573f;
|
813
|
-
constexpr static float c = -1.2845906244690837f;
|
814
|
-
constexpr static float d = 0.295624144969963174f;
|
815
|
-
constexpr static float pi_over_2 = 1.5707963267948966f;
|
816
|
-
auto xx = x*x;
|
817
|
-
auto numer = b*xx + a;
|
818
|
-
auto denom = xx*(d*xx + c) + 1;
|
819
|
-
return x * (numer/denom) + pi_over_2;
|
859
|
+
SINT T dot(const Vec<N, T>& a, const Vec<N, T>& b) {
|
860
|
+
auto ab = a*b;
|
861
|
+
if constexpr (N == 2) {
|
862
|
+
return ab[0] + ab[1];
|
863
|
+
} else if constexpr (N == 4) {
|
864
|
+
return ab[0] + ab[1] + ab[2] + ab[3];
|
865
|
+
} else {
|
866
|
+
T sum = ab[0];
|
867
|
+
for (int i = 1; i < N; ++i) {
|
868
|
+
sum += ab[i];
|
869
|
+
}
|
870
|
+
return sum;
|
871
|
+
}
|
820
872
|
}
|
821
873
|
|
822
|
-
|
823
|
-
|
824
|
-
|
874
|
+
SI float cross(const Vec<2, float>& a, const Vec<2, float>& b) {
|
875
|
+
auto x = a * shuffle<1,0>(b);
|
876
|
+
return x[0] - x[1];
|
877
|
+
}
|
825
878
|
|
826
879
|
// De-interleaving load of 4 vectors.
|
827
880
|
//
|
828
881
|
// WARNING: These are really only supported well on NEON. Consider restructuring your data before
|
829
882
|
// resorting to these methods.
|
830
883
|
SIT void strided_load4(const T* v,
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
884
|
+
Vec<1,T>& a,
|
885
|
+
Vec<1,T>& b,
|
886
|
+
Vec<1,T>& c,
|
887
|
+
Vec<1,T>& d) {
|
835
888
|
a.val = v[0];
|
836
889
|
b.val = v[1];
|
837
890
|
c.val = v[2];
|
838
891
|
d.val = v[3];
|
839
892
|
}
|
840
893
|
SINT void strided_load4(const T* v,
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
894
|
+
Vec<N,T>& a,
|
895
|
+
Vec<N,T>& b,
|
896
|
+
Vec<N,T>& c,
|
897
|
+
Vec<N,T>& d) {
|
845
898
|
strided_load4(v, a.lo, b.lo, c.lo, d.lo);
|
846
899
|
strided_load4(v + 4*(N/2), a.hi, b.hi, c.hi, d.hi);
|
847
900
|
}
|
848
901
|
#if SKVX_USE_SIMD && defined(__ARM_NEON)
|
849
902
|
#define IMPL_LOAD4_TRANSPOSED(N, T, VLD) \
|
850
903
|
SI void strided_load4(const T* v, \
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
904
|
+
Vec<N,T>& a, \
|
905
|
+
Vec<N,T>& b, \
|
906
|
+
Vec<N,T>& c, \
|
907
|
+
Vec<N,T>& d) { \
|
855
908
|
auto mat = VLD(v); \
|
856
|
-
a =
|
857
|
-
b =
|
858
|
-
c =
|
859
|
-
d =
|
909
|
+
a = bit_pun<Vec<N,T>>(mat.val[0]); \
|
910
|
+
b = bit_pun<Vec<N,T>>(mat.val[1]); \
|
911
|
+
c = bit_pun<Vec<N,T>>(mat.val[2]); \
|
912
|
+
d = bit_pun<Vec<N,T>>(mat.val[3]); \
|
860
913
|
}
|
861
914
|
IMPL_LOAD4_TRANSPOSED(2, uint32_t, vld4_u32)
|
862
915
|
IMPL_LOAD4_TRANSPOSED(4, uint16_t, vld4_u16)
|
@@ -881,7 +934,6 @@ SI void strided_load4(const float* v,
|
|
881
934
|
Vec<4,float>& b,
|
882
935
|
Vec<4,float>& c,
|
883
936
|
Vec<4,float>& d) {
|
884
|
-
using skvx::bit_pun;
|
885
937
|
__m128 a_ = _mm_loadu_ps(v);
|
886
938
|
__m128 b_ = _mm_loadu_ps(v+4);
|
887
939
|
__m128 c_ = _mm_loadu_ps(v+8);
|
@@ -898,20 +950,20 @@ SI void strided_load4(const float* v,
|
|
898
950
|
//
|
899
951
|
// WARNING: These are really only supported well on NEON. Consider restructuring your data before
|
900
952
|
// resorting to these methods.
|
901
|
-
SIT void strided_load2(const T* v,
|
953
|
+
SIT void strided_load2(const T* v, Vec<1,T>& a, Vec<1,T>& b) {
|
902
954
|
a.val = v[0];
|
903
955
|
b.val = v[1];
|
904
956
|
}
|
905
|
-
SINT void strided_load2(const T* v,
|
957
|
+
SINT void strided_load2(const T* v, Vec<N,T>& a, Vec<N,T>& b) {
|
906
958
|
strided_load2(v, a.lo, b.lo);
|
907
959
|
strided_load2(v + 2*(N/2), a.hi, b.hi);
|
908
960
|
}
|
909
961
|
#if SKVX_USE_SIMD && defined(__ARM_NEON)
|
910
962
|
#define IMPL_LOAD2_TRANSPOSED(N, T, VLD) \
|
911
|
-
SI void strided_load2(const T* v,
|
963
|
+
SI void strided_load2(const T* v, Vec<N,T>& a, Vec<N,T>& b) { \
|
912
964
|
auto mat = VLD(v); \
|
913
|
-
a =
|
914
|
-
b =
|
965
|
+
a = bit_pun<Vec<N,T>>(mat.val[0]); \
|
966
|
+
b = bit_pun<Vec<N,T>>(mat.val[1]); \
|
915
967
|
}
|
916
968
|
IMPL_LOAD2_TRANSPOSED(2, uint32_t, vld2_u32)
|
917
969
|
IMPL_LOAD2_TRANSPOSED(4, uint16_t, vld2_u16)
|
@@ -930,6 +982,37 @@ IMPL_LOAD2_TRANSPOSED(4, float, vld2q_f32)
|
|
930
982
|
#undef IMPL_LOAD2_TRANSPOSED
|
931
983
|
#endif
|
932
984
|
|
985
|
+
// Define commonly used aliases
|
986
|
+
using float2 = Vec< 2, float>;
|
987
|
+
using float4 = Vec< 4, float>;
|
988
|
+
using float8 = Vec< 8, float>;
|
989
|
+
|
990
|
+
using double2 = Vec< 2, double>;
|
991
|
+
using double4 = Vec< 4, double>;
|
992
|
+
using double8 = Vec< 8, double>;
|
993
|
+
|
994
|
+
using byte2 = Vec< 2, uint8_t>;
|
995
|
+
using byte4 = Vec< 4, uint8_t>;
|
996
|
+
using byte8 = Vec< 8, uint8_t>;
|
997
|
+
using byte16 = Vec<16, uint8_t>;
|
998
|
+
|
999
|
+
using int2 = Vec< 2, int32_t>;
|
1000
|
+
using int4 = Vec< 4, int32_t>;
|
1001
|
+
using int8 = Vec< 8, int32_t>;
|
1002
|
+
|
1003
|
+
using uint2 = Vec< 2, uint32_t>;
|
1004
|
+
using uint4 = Vec< 4, uint32_t>;
|
1005
|
+
using uint8 = Vec< 8, uint32_t>;
|
1006
|
+
|
1007
|
+
using long2 = Vec< 2, int64_t>;
|
1008
|
+
using long4 = Vec< 4, int64_t>;
|
1009
|
+
using long8 = Vec< 8, int64_t>;
|
1010
|
+
|
1011
|
+
// Use with from_half and to_half to convert between floatX, and use these for storage.
|
1012
|
+
using half2 = Vec< 2, uint16_t>;
|
1013
|
+
using half4 = Vec< 4, uint16_t>;
|
1014
|
+
using half8 = Vec< 8, uint16_t>;
|
1015
|
+
|
933
1016
|
} // namespace skvx
|
934
1017
|
|
935
1018
|
#undef SINTU
|
@@ -8,71 +8,9 @@
|
|
8
8
|
#ifndef GrSlug_DEFINED
|
9
9
|
#define GrSlug_DEFINED
|
10
10
|
|
11
|
-
#include "include/
|
12
|
-
#include "include/core/SkRect.h"
|
13
|
-
#include "include/core/SkRefCnt.h"
|
11
|
+
#include "include/private/chromium/Slug.h"
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
class SkPaint;
|
18
|
-
class SkTextBlob;
|
19
|
-
class SkReadBuffer;
|
20
|
-
class SkStrikeClient;
|
21
|
-
class SkWriteBuffer;
|
13
|
+
// TODO: Update Chrome to use sktext::gpu classes and remove these
|
14
|
+
using GrSlug = sktext::gpu::Slug;
|
22
15
|
|
23
|
-
// You can use GrSlug to simulate drawTextBlob by defining the following at compile time.
|
24
|
-
// SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG
|
25
|
-
// You can use GrSlug serialization to simulate drawTextBlob by defining the following:
|
26
|
-
// SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_SERIALIZE
|
27
|
-
// For Skia, add this to your args.gn file.
|
28
|
-
// extra_cflags = ["-D", "SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG"]
|
29
|
-
|
30
|
-
// Internal infrastructure for using SubRuns.
|
31
|
-
class SK_API GrTextReferenceFrame : public SkRefCnt {
|
32
|
-
public:
|
33
|
-
~GrTextReferenceFrame() override;
|
34
|
-
virtual const SkMatrix& initialPositionMatrix() const = 0;
|
35
|
-
};
|
36
|
-
|
37
|
-
// GrSlug encapsulates an SkTextBlob at a specific origin, using a specific paint. It can be
|
38
|
-
// manipulated using matrix and clip changes to the canvas. If the canvas is transformed, then
|
39
|
-
// the GrSlug will also transform with smaller glyphs using bi-linear interpolation to render. You
|
40
|
-
// can think of a GrSlug as making a rubber stamp out of a SkTextBlob.
|
41
|
-
class SK_API GrSlug : public GrTextReferenceFrame {
|
42
|
-
public:
|
43
|
-
~GrSlug() override;
|
44
|
-
// Return nullptr if the blob would not draw. This is not because of clipping, but because of
|
45
|
-
// some paint optimization. The GrSlug is captured as if drawn using drawTextBlob.
|
46
|
-
static sk_sp<GrSlug> ConvertBlob(
|
47
|
-
SkCanvas* canvas, const SkTextBlob& blob, SkPoint origin, const SkPaint& paint);
|
48
|
-
|
49
|
-
// Serialize the slug.
|
50
|
-
sk_sp<SkData> serialize() const;
|
51
|
-
size_t serialize(void* buffer, size_t size) const;
|
52
|
-
|
53
|
-
// Set the client parameter to the appropriate SkStrikeClient when typeface ID translation
|
54
|
-
// is needed.
|
55
|
-
static sk_sp<GrSlug> Deserialize(
|
56
|
-
const void* data, size_t size, const SkStrikeClient* client = nullptr);
|
57
|
-
static sk_sp<GrSlug> MakeFromBuffer(SkReadBuffer& buffer);
|
58
|
-
|
59
|
-
|
60
|
-
// Draw the GrSlug obeying the canvas's mapping and clipping.
|
61
|
-
void draw(SkCanvas* canvas) const;
|
62
|
-
|
63
|
-
virtual SkRect sourceBounds() const = 0;
|
64
|
-
|
65
|
-
// The paint passed into ConvertBlob; this paint is used instead of the paint resulting from
|
66
|
-
// the call to aboutToDraw because when we call draw(), the initial paint is needed to call
|
67
|
-
// aboutToDraw again to get the layer right.
|
68
|
-
virtual const SkPaint& initialPaint() const = 0;
|
69
|
-
|
70
|
-
virtual void doFlatten(SkWriteBuffer&) const = 0;
|
71
|
-
|
72
|
-
uint32_t uniqueID() const { return fUniqueID; }
|
73
|
-
|
74
|
-
private:
|
75
|
-
static uint32_t NextUniqueID();
|
76
|
-
const uint32_t fUniqueID{NextUniqueID()};
|
77
|
-
};
|
78
16
|
#endif // GrSlug_DEFINED
|
@@ -15,7 +15,6 @@
|
|
15
15
|
#include "include/core/SkRefCnt.h"
|
16
16
|
#include "include/utils/SkNoDrawCanvas.h"
|
17
17
|
|
18
|
-
class GrSlug;
|
19
18
|
struct SkPackedGlyphID;
|
20
19
|
class SkAutoDescriptor;
|
21
20
|
class SkStrikeCache;
|
@@ -23,6 +22,7 @@ class SkStrikeClientImpl;
|
|
23
22
|
class SkStrikeServer;
|
24
23
|
class SkStrikeServerImpl;
|
25
24
|
class SkTypeface;
|
25
|
+
namespace sktext::gpu { class Slug; }
|
26
26
|
|
27
27
|
using SkDiscardableHandleId = uint32_t;
|
28
28
|
// This class is not thread-safe.
|
@@ -59,7 +59,8 @@ public:
|
|
59
59
|
SK_API std::unique_ptr<SkCanvas> makeAnalysisCanvas(int width, int height,
|
60
60
|
const SkSurfaceProps& props,
|
61
61
|
sk_sp<SkColorSpace> colorSpace,
|
62
|
-
bool DFTSupport
|
62
|
+
bool DFTSupport,
|
63
|
+
bool DFTPerspSupport = true);
|
63
64
|
|
64
65
|
// Serializes the typeface to be transmitted using this server.
|
65
66
|
SK_SPI sk_sp<SkData> serializeTypeface(SkTypeface*);
|
@@ -107,6 +108,8 @@ public:
|
|
107
108
|
// successful, subsequent attempts to delete the same handle are invalid.
|
108
109
|
virtual bool deleteHandle(SkDiscardableHandleId) = 0;
|
109
110
|
|
111
|
+
virtual void assertHandleValid(SkDiscardableHandleId) {}
|
112
|
+
|
110
113
|
virtual void notifyCacheMiss(CacheMissType type, int fontSize) = 0;
|
111
114
|
|
112
115
|
struct ReadFailureData {
|
@@ -141,7 +144,7 @@ public:
|
|
141
144
|
|
142
145
|
// Given a buffer, unflatten into a slug making sure to do the typefaceID translation from
|
143
146
|
// renderer to GPU. Returns nullptr if there was a problem.
|
144
|
-
sk_sp<
|
147
|
+
sk_sp<sktext::gpu::Slug> deserializeSlug(const void* data, size_t size) const;
|
145
148
|
|
146
149
|
private:
|
147
150
|
std::unique_ptr<SkStrikeClientImpl> fImpl;
|