@shopify/react-native-skia 0.1.157 → 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 +31 -30
- 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/JsiSkContourMeasure.h +7 -5
- 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/DrawingNode.js +1 -5
- package/lib/commonjs/dom/nodes/DrawingNode.js.map +1 -1
- 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 +3 -9
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Text.js +4 -9
- package/lib/commonjs/dom/nodes/drawings/Text.js.map +1 -1
- package/lib/commonjs/dom/types/Common.js.map +1 -1
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/mock/index.js +0 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +21 -57
- 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/components/Mask.js +1 -3
- package/lib/commonjs/renderer/components/Mask.js.map +1 -1
- package/lib/commonjs/renderer/components/Paint.js +5 -18
- package/lib/commonjs/renderer/components/Paint.js.map +1 -1
- package/lib/commonjs/renderer/useCanvas.js +8 -6
- package/lib/commonjs/renderer/useCanvas.js.map +1 -1
- package/lib/commonjs/skia/core/Picture.js +1 -24
- package/lib/commonjs/skia/core/Picture.js.map +1 -1
- package/lib/commonjs/skia/core/Rect.js +1 -1
- package/lib/commonjs/skia/core/Rect.js.map +1 -1
- package/lib/commonjs/skia/types/ContourMeasure.js.map +1 -1
- package/lib/commonjs/skia/types/Size.js +2 -0
- package/lib/commonjs/skia/types/Size.js.map +1 -0
- package/lib/commonjs/skia/types/index.js +13 -0
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColor.js +8 -0
- package/lib/commonjs/skia/web/JsiSkColor.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkContourMeasure.js +4 -7
- package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +4 -2
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +9 -2
- 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/DrawingNode.js +2 -6
- package/lib/module/dom/nodes/DrawingNode.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 +2 -5
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Text.js +4 -9
- package/lib/module/dom/nodes/drawings/Text.js.map +1 -1
- package/lib/module/dom/types/Common.js.map +1 -1
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/mock/index.js +0 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +22 -58
- 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/components/Mask.js +2 -4
- package/lib/module/renderer/components/Mask.js.map +1 -1
- package/lib/module/renderer/components/Paint.js +3 -14
- package/lib/module/renderer/components/Paint.js.map +1 -1
- package/lib/module/renderer/useCanvas.js +6 -4
- package/lib/module/renderer/useCanvas.js.map +1 -1
- package/lib/module/skia/core/Picture.js +0 -18
- package/lib/module/skia/core/Picture.js.map +1 -1
- package/lib/module/skia/core/Rect.js +1 -1
- package/lib/module/skia/core/Rect.js.map +1 -1
- package/lib/module/skia/types/ContourMeasure.js.map +1 -1
- package/lib/module/skia/types/Size.js +2 -0
- package/lib/module/skia/types/Size.js.map +1 -0
- package/lib/module/skia/types/index.js +1 -0
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/JsiSkColor.js +8 -0
- package/lib/module/skia/web/JsiSkColor.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasure.js +3 -7
- package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.js +4 -2
- package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +9 -2
- 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/dom/nodes/RenderNode.d.ts +1 -3
- package/lib/typescript/src/dom/types/Common.d.ts +2 -3
- package/lib/typescript/src/dom/types/Drawings.d.ts +1 -3
- package/lib/typescript/src/renderer/Canvas.d.ts +5 -5
- package/lib/typescript/src/renderer/DependencyManager.d.ts +0 -2
- package/lib/typescript/src/renderer/HostComponents.d.ts +67 -8
- package/lib/typescript/src/renderer/components/Paint.d.ts +3 -4
- package/lib/typescript/src/renderer/useCanvas.d.ts +1 -6
- package/lib/typescript/src/skia/core/Picture.d.ts +0 -8
- package/lib/typescript/src/skia/types/ContourMeasure.d.ts +3 -2
- package/lib/typescript/src/skia/types/Size.d.ts +4 -0
- package/lib/typescript/src/skia/types/index.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkContourMeasure.d.ts +2 -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 +6 -4
- package/react-native-skia.podspec +3 -1
- package/src/dom/nodes/DrawingNode.ts +2 -4
- package/src/dom/nodes/JsiSkDOM.ts +170 -56
- package/src/dom/nodes/RenderNode.ts +2 -14
- package/src/dom/nodes/drawings/Text.ts +4 -4
- package/src/dom/types/Common.ts +2 -4
- package/src/dom/types/Drawings.ts +1 -4
- package/src/mock/index.ts +0 -1
- package/src/renderer/Canvas.tsx +32 -51
- package/src/renderer/DependencyManager.tsx +0 -5
- package/src/renderer/HostComponents.ts +153 -5
- package/src/renderer/components/Mask.tsx +2 -2
- package/src/renderer/components/Paint.tsx +3 -14
- package/src/renderer/useCanvas.ts +5 -5
- package/src/skia/core/Picture.ts +0 -24
- package/src/skia/core/Rect.ts +1 -1
- package/src/skia/types/ContourMeasure.tsx +3 -2
- package/src/skia/types/Size.ts +4 -0
- package/src/skia/types/index.ts +1 -0
- package/src/skia/web/JsiSkColor.ts +11 -0
- package/src/skia/web/JsiSkContourMeasure.ts +7 -3
- package/src/values/web/RNSkReadonlyValue.ts +4 -2
- package/src/views/SkiaBaseWebView.tsx +6 -2
- 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
@@ -0,0 +1,122 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2022 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 skgpu_MutableTextureState_DEFINED
|
9
|
+
#define skgpu_MutableTextureState_DEFINED
|
10
|
+
|
11
|
+
#include "include/gpu/GpuTypes.h"
|
12
|
+
|
13
|
+
#ifdef SK_VULKAN
|
14
|
+
#include "include/private/gpu/vk/VulkanTypesPriv.h"
|
15
|
+
#endif
|
16
|
+
|
17
|
+
#include <new>
|
18
|
+
|
19
|
+
class GrVkGpu;
|
20
|
+
|
21
|
+
namespace skgpu {
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Since Skia and clients can both modify gpu textures and their connected state, Skia needs a way
|
25
|
+
* for clients to inform us if they have modifiend any of this state. In order to not need setters
|
26
|
+
* for every single API and state, we use this class to be a generic wrapper around all the mutable
|
27
|
+
* state. This class is used for calls that inform Skia of these texture/image state changes by the
|
28
|
+
* client as well as for requesting state changes to be done by Skia. The backend specific state
|
29
|
+
* that is wrapped by this class are:
|
30
|
+
*
|
31
|
+
* Vulkan: VkImageLayout and QueueFamilyIndex
|
32
|
+
*/
|
33
|
+
class SK_API MutableTextureState {
|
34
|
+
public:
|
35
|
+
MutableTextureState() {}
|
36
|
+
|
37
|
+
#ifdef SK_VULKAN
|
38
|
+
MutableTextureState(VkImageLayout layout, uint32_t queueFamilyIndex)
|
39
|
+
: fVkState(layout, queueFamilyIndex)
|
40
|
+
, fBackend(BackendApi::kVulkan)
|
41
|
+
, fIsValid(true) {}
|
42
|
+
#endif
|
43
|
+
|
44
|
+
MutableTextureState(const MutableTextureState& that)
|
45
|
+
: fBackend(that.fBackend), fIsValid(that.fIsValid) {
|
46
|
+
if (!fIsValid) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
switch (fBackend) {
|
50
|
+
case BackendApi::kVulkan:
|
51
|
+
#ifdef SK_VULKAN
|
52
|
+
SkASSERT(that.fBackend == BackendApi::kVulkan);
|
53
|
+
fVkState = that.fVkState;
|
54
|
+
#endif
|
55
|
+
break;
|
56
|
+
default:
|
57
|
+
(void)that;
|
58
|
+
SkUNREACHABLE;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
MutableTextureState& operator=(const MutableTextureState& that) {
|
63
|
+
if (this != &that) {
|
64
|
+
this->~MutableTextureState();
|
65
|
+
new (this) MutableTextureState(that);
|
66
|
+
}
|
67
|
+
return *this;
|
68
|
+
}
|
69
|
+
|
70
|
+
#ifdef SK_VULKAN
|
71
|
+
// If this class is not Vulkan backed it will return value of VK_IMAGE_LAYOUT_UNDEFINED.
|
72
|
+
// Otherwise it will return the VkImageLayout.
|
73
|
+
VkImageLayout getVkImageLayout() const {
|
74
|
+
if (this->isValid() && fBackend != BackendApi::kVulkan) {
|
75
|
+
return VK_IMAGE_LAYOUT_UNDEFINED;
|
76
|
+
}
|
77
|
+
return fVkState.getImageLayout();
|
78
|
+
}
|
79
|
+
|
80
|
+
// If this class is not Vulkan backed it will return value of VK_QUEUE_FAMILY_IGNORED.
|
81
|
+
// Otherwise it will return the VkImageLayout.
|
82
|
+
uint32_t getQueueFamilyIndex() const {
|
83
|
+
if (this->isValid() && fBackend != BackendApi::kVulkan) {
|
84
|
+
return VK_QUEUE_FAMILY_IGNORED;
|
85
|
+
}
|
86
|
+
return fVkState.getQueueFamilyIndex();
|
87
|
+
}
|
88
|
+
#endif
|
89
|
+
|
90
|
+
BackendApi backend() const { return fBackend; }
|
91
|
+
|
92
|
+
// Returns true if the backend mutable state has been initialized.
|
93
|
+
bool isValid() const { return fIsValid; }
|
94
|
+
|
95
|
+
private:
|
96
|
+
friend class MutableTextureStateRef;
|
97
|
+
friend class ::GrVkGpu;
|
98
|
+
|
99
|
+
#ifdef SK_VULKAN
|
100
|
+
void setVulkanState(VkImageLayout layout, uint32_t queueFamilyIndex) {
|
101
|
+
SkASSERT(!this->isValid() || fBackend == BackendApi::kVulkan);
|
102
|
+
fVkState.setImageLayout(layout);
|
103
|
+
fVkState.setQueueFamilyIndex(queueFamilyIndex);
|
104
|
+
fBackend = BackendApi::kVulkan;
|
105
|
+
fIsValid = true;
|
106
|
+
}
|
107
|
+
#endif
|
108
|
+
|
109
|
+
union {
|
110
|
+
char fPlaceholder;
|
111
|
+
#ifdef SK_VULKAN
|
112
|
+
VulkanMutableTextureState fVkState;
|
113
|
+
#endif
|
114
|
+
};
|
115
|
+
|
116
|
+
BackendApi fBackend = BackendApi::kMock;
|
117
|
+
bool fIsValid = false;
|
118
|
+
};
|
119
|
+
|
120
|
+
} // namespace skgpu
|
121
|
+
|
122
|
+
#endif // skgpu_MutableTextureState_DEFINED
|
@@ -47,6 +47,7 @@ using GrGLColorMaskFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLboolean red, GrGLboolea
|
|
47
47
|
using GrGLCompileShaderFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint shader);
|
48
48
|
using GrGLCompressedTexImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data);
|
49
49
|
using GrGLCompressedTexSubImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLsizei imageSize, const GrGLvoid* data);
|
50
|
+
using GrGLCopyBufferSubDataFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum readTargt, GrGLenum writeTarget, GrGLintptr readOffset, GrGLintptr writeOffset, GrGLsizeiptr size);
|
50
51
|
using GrGLCopyTexSubImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
|
51
52
|
using GrGLCreateProgramFn = GrGLuint GR_GL_FUNCTION_TYPE();
|
52
53
|
using GrGLCreateShaderFn = GrGLuint GR_GL_FUNCTION_TYPE(GrGLenum type);
|
@@ -119,6 +119,7 @@ public:
|
|
119
119
|
GrGLFunction<GrGLCompileShaderFn> fCompileShader;
|
120
120
|
GrGLFunction<GrGLCompressedTexImage2DFn> fCompressedTexImage2D;
|
121
121
|
GrGLFunction<GrGLCompressedTexSubImage2DFn> fCompressedTexSubImage2D;
|
122
|
+
GrGLFunction<GrGLCopyBufferSubDataFn> fCopyBufferSubData;
|
122
123
|
GrGLFunction<GrGLCopyTexSubImage2DFn> fCopyTexSubImage2D;
|
123
124
|
GrGLFunction<GrGLCreateProgramFn> fCreateProgram;
|
124
125
|
GrGLFunction<GrGLCreateShaderFn> fCreateShader;
|
@@ -16,6 +16,10 @@
|
|
16
16
|
#include "include/gpu/graphite/mtl/MtlTypes.h"
|
17
17
|
#endif
|
18
18
|
|
19
|
+
#ifdef SK_VULKAN
|
20
|
+
#include "include/private/gpu/vk/SkiaVulkan.h"
|
21
|
+
#endif
|
22
|
+
|
19
23
|
namespace skgpu::graphite {
|
20
24
|
|
21
25
|
class BackendTexture {
|
@@ -54,6 +58,9 @@ private:
|
|
54
58
|
union {
|
55
59
|
#ifdef SK_METAL
|
56
60
|
MtlHandle fMtlTexture;
|
61
|
+
#endif
|
62
|
+
#ifdef SK_VULKAN
|
63
|
+
VkImage fVkImage;
|
57
64
|
#endif
|
58
65
|
};
|
59
66
|
};
|
@@ -0,0 +1,195 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2022 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 skgpu_graphite_CombinationBuilder_DEFINED
|
9
|
+
#define skgpu_graphite_CombinationBuilder_DEFINED
|
10
|
+
|
11
|
+
#include "include/core/SkTypes.h"
|
12
|
+
|
13
|
+
#ifdef SK_ENABLE_PRECOMPILE
|
14
|
+
|
15
|
+
#include <functional>
|
16
|
+
#include <memory>
|
17
|
+
#include <vector>
|
18
|
+
#include "include/core/SkBlendMode.h"
|
19
|
+
#include "include/core/SkSpan.h"
|
20
|
+
#include "include/core/SkTileMode.h"
|
21
|
+
#include "include/private/SkTArray.h"
|
22
|
+
#include "include/private/SkTHash.h"
|
23
|
+
|
24
|
+
class SkArenaAllocWithReset;
|
25
|
+
class SkKeyContext;
|
26
|
+
class SkPaintParamsKeyBuilder;
|
27
|
+
class SkShaderCodeDictionary;
|
28
|
+
class SkUniquePaintParamsID;
|
29
|
+
|
30
|
+
namespace skgpu::graphite {
|
31
|
+
|
32
|
+
class CombinationBuilder;
|
33
|
+
class CombinationBuilderTestAccess;
|
34
|
+
class Context;
|
35
|
+
class Option;
|
36
|
+
|
37
|
+
enum class ShaderType : uint32_t {
|
38
|
+
kSolidColor,
|
39
|
+
|
40
|
+
kLinearGradient,
|
41
|
+
kRadialGradient,
|
42
|
+
kSweepGradient,
|
43
|
+
kConicalGradient,
|
44
|
+
|
45
|
+
kLocalMatrix,
|
46
|
+
kImage,
|
47
|
+
kPorterDuffBlendShader,
|
48
|
+
kBlendShader,
|
49
|
+
|
50
|
+
kLast = kBlendShader
|
51
|
+
};
|
52
|
+
|
53
|
+
static constexpr int kShaderTypeCount = static_cast<int>(ShaderType::kLast) + 1;
|
54
|
+
|
55
|
+
struct TileModePair {
|
56
|
+
SkTileMode fX;
|
57
|
+
SkTileMode fY;
|
58
|
+
|
59
|
+
bool operator==(const TileModePair& other) const { return fX == other.fX && fY == other.fY; }
|
60
|
+
bool operator!=(const TileModePair& other) const { return !(*this == other); }
|
61
|
+
};
|
62
|
+
|
63
|
+
// TODO: add ShaderID and ColorFilterID too
|
64
|
+
class BlenderID {
|
65
|
+
public:
|
66
|
+
BlenderID() : fID(0) {} // 0 is an invalid blender ID
|
67
|
+
BlenderID(const BlenderID& src) : fID(src.fID) {}
|
68
|
+
|
69
|
+
bool isValid() const { return fID > 0; }
|
70
|
+
|
71
|
+
bool operator==(const BlenderID& other) const { return fID == other.fID; }
|
72
|
+
|
73
|
+
BlenderID& operator=(const BlenderID& src) {
|
74
|
+
fID = src.fID;
|
75
|
+
return *this;
|
76
|
+
}
|
77
|
+
|
78
|
+
private:
|
79
|
+
friend class ::SkShaderCodeDictionary; // for ctor and asUInt access
|
80
|
+
friend class CombinationBuilder; // for asUInt access
|
81
|
+
|
82
|
+
BlenderID(uint32_t id) : fID(id) {}
|
83
|
+
|
84
|
+
uint32_t asUInt() const { return fID; }
|
85
|
+
|
86
|
+
uint32_t fID;
|
87
|
+
};
|
88
|
+
|
89
|
+
// When combination options are added to the combination builder an CombinationOption
|
90
|
+
// object is frequently returned. This allows options to be added, recursively, to the
|
91
|
+
// previously added options.
|
92
|
+
// Note: CombinationOptions are stable memory-wise so, once returned, they are valid
|
93
|
+
// until CombinationBuilder::reset is called.
|
94
|
+
class CombinationOption {
|
95
|
+
public:
|
96
|
+
CombinationOption addChildOption(int childIndex, ShaderType);
|
97
|
+
|
98
|
+
CombinationOption addChildOption(int childIndex, ShaderType,
|
99
|
+
int minNumStops, int maxNumStops);
|
100
|
+
|
101
|
+
CombinationOption addChildOption(int childIndex, ShaderType,
|
102
|
+
SkSpan<TileModePair> tileModes);
|
103
|
+
|
104
|
+
bool isValid() const { return fDataInArena; }
|
105
|
+
|
106
|
+
private:
|
107
|
+
friend class CombinationBuilder; // for ctor
|
108
|
+
friend class CombinationBuilderTestAccess;
|
109
|
+
|
110
|
+
CombinationOption(CombinationBuilder* builder, Option* dataInArena)
|
111
|
+
: fBuilder(builder)
|
112
|
+
, fDataInArena(dataInArena) {}
|
113
|
+
|
114
|
+
ShaderType type() const;
|
115
|
+
int numChildSlots() const;
|
116
|
+
SkDEBUGCODE(int epoch() const;)
|
117
|
+
|
118
|
+
CombinationBuilder* fBuilder;
|
119
|
+
Option* fDataInArena;
|
120
|
+
};
|
121
|
+
|
122
|
+
class CombinationBuilder {
|
123
|
+
public:
|
124
|
+
enum class BlendModeGroup {
|
125
|
+
kPorterDuff, // [ kClear .. kScreen ]
|
126
|
+
kAdvanced, // [ kOverlay .. kMultiply ]
|
127
|
+
kColorAware, // [ kHue .. kLuminosity ]
|
128
|
+
kAll
|
129
|
+
};
|
130
|
+
|
131
|
+
CombinationBuilder(SkShaderCodeDictionary*);
|
132
|
+
~CombinationBuilder();
|
133
|
+
|
134
|
+
// Blend Modes
|
135
|
+
void addOption(SkBlendMode);
|
136
|
+
void addOption(SkBlendMode rangeStart, SkBlendMode rangeEnd); // inclusive
|
137
|
+
void addOption(BlendModeGroup);
|
138
|
+
|
139
|
+
// TODO: have this variant return an CombinationOption object
|
140
|
+
void addOption(BlenderID);
|
141
|
+
|
142
|
+
// Shaders
|
143
|
+
CombinationOption addOption(ShaderType);
|
144
|
+
CombinationOption addOption(ShaderType, int minNumStops, int maxNumStops); // inclusive
|
145
|
+
CombinationOption addOption(ShaderType, SkSpan<TileModePair> tileModes);
|
146
|
+
|
147
|
+
void reset();
|
148
|
+
|
149
|
+
private:
|
150
|
+
friend class Context; // for access to 'buildCombinations'
|
151
|
+
friend class CombinationOption; // for 'addOptionInternal' and 'arena'
|
152
|
+
friend class CombinationBuilderTestAccess; // for 'num*Combinations' and 'epoch'
|
153
|
+
|
154
|
+
int numShaderCombinations() const;
|
155
|
+
int numBlendModeCombinations() const;
|
156
|
+
int numCombinations() {
|
157
|
+
return this->numShaderCombinations() * this->numBlendModeCombinations();
|
158
|
+
}
|
159
|
+
|
160
|
+
// 'desiredCombination' must be less than numCombinations
|
161
|
+
void createKey(const SkKeyContext&, int desiredCombination, SkPaintParamsKeyBuilder*);
|
162
|
+
|
163
|
+
#ifdef SK_DEBUG
|
164
|
+
void dump() const;
|
165
|
+
int epoch() const { return fEpoch; }
|
166
|
+
#endif
|
167
|
+
|
168
|
+
SkArenaAllocWithReset* arena() { return fArena.get(); }
|
169
|
+
|
170
|
+
template<typename T, typename... Args>
|
171
|
+
Option* allocInArena(Args&&... args);
|
172
|
+
|
173
|
+
Option* addOptionInternal(ShaderType);
|
174
|
+
Option* addOptionInternal(ShaderType, int minNumStops, int maxNumStops);
|
175
|
+
Option* addOptionInternal(ShaderType, SkSpan<TileModePair> tileModes);
|
176
|
+
|
177
|
+
void buildCombinations(SkShaderCodeDictionary*,
|
178
|
+
const std::function<void(SkUniquePaintParamsID)>&);
|
179
|
+
|
180
|
+
SkShaderCodeDictionary* fDictionary;
|
181
|
+
std::unique_ptr<SkArenaAllocWithReset> fArena;
|
182
|
+
SkTArray<Option*> fShaderOptions;
|
183
|
+
|
184
|
+
uint32_t fBlendModes;
|
185
|
+
// TODO: store the SkBlender-based blenders in the arena
|
186
|
+
SkTHashSet<BlenderID> fBlenders;
|
187
|
+
|
188
|
+
SkDEBUGCODE(int fEpoch = 0;)
|
189
|
+
};
|
190
|
+
|
191
|
+
} // namespace skgpu::graphite
|
192
|
+
|
193
|
+
#endif // SK_ENABLE_PRECOMPILE
|
194
|
+
|
195
|
+
#endif // skgpu_graphite_CombinationBuilder_DEFINED
|
@@ -8,53 +8,38 @@
|
|
8
8
|
#ifndef skgpu_graphite_Context_DEFINED
|
9
9
|
#define skgpu_graphite_Context_DEFINED
|
10
10
|
|
11
|
-
#include <vector>
|
12
|
-
#include "include/core/SkBlendMode.h"
|
13
11
|
#include "include/core/SkRefCnt.h"
|
14
12
|
#include "include/core/SkShader.h"
|
15
|
-
#include "include/
|
16
|
-
#include "include/private/SkNoncopyable.h"
|
17
|
-
|
13
|
+
#include "include/gpu/graphite/ContextOptions.h"
|
18
14
|
#include "include/gpu/graphite/GraphiteTypes.h"
|
15
|
+
#include "include/gpu/graphite/Recorder.h"
|
16
|
+
#include "include/private/SingleOwner.h"
|
17
|
+
|
18
|
+
#include <memory>
|
19
|
+
|
20
|
+
class SkRuntimeEffect;
|
21
|
+
|
22
|
+
namespace skgpu { struct VulkanBackendContext; }
|
19
23
|
|
20
24
|
namespace skgpu::graphite {
|
21
25
|
|
22
26
|
class BackendTexture;
|
23
|
-
class
|
27
|
+
class Context;
|
24
28
|
class ContextPriv;
|
29
|
+
struct DawnBackendContext;
|
25
30
|
class GlobalCache;
|
26
|
-
class Gpu;
|
27
31
|
struct MtlBackendContext;
|
28
|
-
class
|
32
|
+
class QueueManager;
|
29
33
|
class Recording;
|
30
|
-
class
|
31
|
-
|
32
|
-
struct ShaderCombo {
|
33
|
-
enum class ShaderType {
|
34
|
-
kNone, // does not modify color buffer, e.g. depth and/or stencil only
|
35
|
-
kSolidColor,
|
36
|
-
kLinearGradient,
|
37
|
-
kRadialGradient,
|
38
|
-
kSweepGradient,
|
39
|
-
kConicalGradient
|
40
|
-
};
|
41
|
-
|
42
|
-
ShaderCombo() {}
|
43
|
-
ShaderCombo(std::vector<ShaderType> types,
|
44
|
-
std::vector<SkTileMode> tileModes)
|
45
|
-
: fTypes(std::move(types))
|
46
|
-
, fTileModes(std::move(tileModes)) {
|
47
|
-
}
|
48
|
-
std::vector<ShaderType> fTypes;
|
49
|
-
std::vector<SkTileMode> fTileModes;
|
50
|
-
};
|
34
|
+
class ResourceProvider;
|
35
|
+
class SharedContext;
|
51
36
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
37
|
+
#ifdef SK_ENABLE_PRECOMPILE
|
38
|
+
class BlenderID;
|
39
|
+
class CombinationBuilder;
|
40
|
+
#endif
|
56
41
|
|
57
|
-
class Context final {
|
42
|
+
class SK_API Context final {
|
58
43
|
public:
|
59
44
|
Context(const Context&) = delete;
|
60
45
|
Context(Context&&) = delete;
|
@@ -63,13 +48,20 @@ public:
|
|
63
48
|
|
64
49
|
~Context();
|
65
50
|
|
51
|
+
#ifdef SK_DAWN
|
52
|
+
static std::unique_ptr<Context> MakeDawn(const DawnBackendContext&, const ContextOptions&);
|
53
|
+
#endif
|
66
54
|
#ifdef SK_METAL
|
67
|
-
static std::unique_ptr<Context> MakeMetal(const
|
55
|
+
static std::unique_ptr<Context> MakeMetal(const MtlBackendContext&, const ContextOptions&);
|
68
56
|
#endif
|
69
57
|
|
70
|
-
|
58
|
+
#ifdef SK_VULKAN
|
59
|
+
static std::unique_ptr<Context> MakeVulkan(const VulkanBackendContext&, const ContextOptions&);
|
60
|
+
#endif
|
61
|
+
|
62
|
+
BackendApi backend() const;
|
71
63
|
|
72
|
-
std::unique_ptr<Recorder> makeRecorder();
|
64
|
+
std::unique_ptr<Recorder> makeRecorder(const RecorderOptions& = {});
|
73
65
|
|
74
66
|
void insertRecording(const InsertRecordingInfo&);
|
75
67
|
void submit(SyncToCpu = SyncToCpu::kNo);
|
@@ -79,23 +71,19 @@ public:
|
|
79
71
|
*/
|
80
72
|
void checkAsyncWorkCompletion();
|
81
73
|
|
82
|
-
|
74
|
+
#ifdef SK_ENABLE_PRECOMPILE
|
75
|
+
// TODO: add "ShaderID addUserDefinedShader(sk_sp<SkRuntimeEffect>)" here
|
76
|
+
// TODO: add "ColorFilterID addUserDefinedColorFilter(sk_sp<SkRuntimeEffect>)" here
|
77
|
+
BlenderID addUserDefinedBlender(sk_sp<SkRuntimeEffect>);
|
83
78
|
|
84
|
-
|
85
|
-
|
86
|
-
* TextureInfo or a TextureInfo Skia can't support is passed in, this will return an invalid
|
87
|
-
* BackendTexture. Thus the client should check isValid on the returned BackendTexture to know
|
88
|
-
* if it succeeded or not.
|
89
|
-
*
|
90
|
-
* If this does return a valid BackendTexture, the caller is required to use
|
91
|
-
* Context::deleteBackendTexture to delete that texture.
|
92
|
-
*/
|
93
|
-
BackendTexture createBackendTexture(SkISize dimensions, const TextureInfo&);
|
79
|
+
void precompile(CombinationBuilder*);
|
80
|
+
#endif
|
94
81
|
|
95
82
|
/**
|
96
83
|
* Called to delete the passed in BackendTexture. This should only be called if the
|
97
|
-
* BackendTexture was created by calling
|
98
|
-
* not valid or does not match the BackendApi of the
|
84
|
+
* BackendTexture was created by calling Recorder::createBackendTexture on a Recorder created
|
85
|
+
* from this Context. If the BackendTexture is not valid or does not match the BackendApi of the
|
86
|
+
* Context then nothing happens.
|
99
87
|
*
|
100
88
|
* Otherwise this will delete/release the backend object that is wrapped in the BackendTexture.
|
101
89
|
* The BackendTexture will be reset to an invalid state and should not be used again.
|
@@ -107,16 +95,20 @@ public:
|
|
107
95
|
const ContextPriv priv() const; // NOLINT(readability-const-return-type)
|
108
96
|
|
109
97
|
protected:
|
110
|
-
Context(sk_sp<
|
98
|
+
Context(sk_sp<SharedContext>, std::unique_ptr<QueueManager>);
|
111
99
|
|
112
100
|
private:
|
113
101
|
friend class ContextPriv;
|
114
102
|
|
115
|
-
|
103
|
+
SingleOwner* singleOwner() const { return &fSingleOwner; }
|
104
|
+
|
105
|
+
sk_sp<SharedContext> fSharedContext;
|
106
|
+
std::unique_ptr<ResourceProvider> fResourceProvider;
|
107
|
+
std::unique_ptr<QueueManager> fQueueManager;
|
116
108
|
|
117
|
-
|
118
|
-
|
119
|
-
|
109
|
+
// In debug builds we guard against improper thread handling. This guard is passed to the
|
110
|
+
// ResourceCache for the Context.
|
111
|
+
mutable SingleOwner fSingleOwner;
|
120
112
|
};
|
121
113
|
|
122
114
|
} // namespace skgpu::graphite
|
@@ -0,0 +1,85 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2022 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 skgpu_graphite_ContextOptions_DEFINED
|
9
|
+
#define skgpu_graphite_ContextOptions_DEFINED
|
10
|
+
|
11
|
+
namespace skgpu { class ShaderErrorHandler; }
|
12
|
+
|
13
|
+
namespace skgpu::graphite {
|
14
|
+
|
15
|
+
struct SK_API ContextOptions {
|
16
|
+
ContextOptions() {}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* If present, use this object to report shader compilation failures. If not, report failures
|
20
|
+
* via SkDebugf and assert.
|
21
|
+
*/
|
22
|
+
skgpu::ShaderErrorHandler* fShaderErrorHandler = nullptr;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Will the client make sure to only ever be executing one thread that uses the Context and all
|
26
|
+
* derived classes (e.g. Recorders, Recordings, etc.) at a time. If so we can possibly make some
|
27
|
+
* objects (e.g. VulkanMemoryAllocator) not thread safe to improve single thread performance.
|
28
|
+
*/
|
29
|
+
bool fClientWillExternallySynchronizeAllThreads = false;
|
30
|
+
|
31
|
+
/**
|
32
|
+
* The maximum size of cache textures used for Skia's Glyph cache.
|
33
|
+
*/
|
34
|
+
size_t fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4;
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Below this threshold size in device space distance field fonts won't be used. Distance field
|
38
|
+
* fonts don't support hinting which is more important at smaller sizes.
|
39
|
+
*/
|
40
|
+
float fMinDistanceFieldFontSize = 18;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Above this threshold size in device space glyphs are drawn as individual paths.
|
44
|
+
*/
|
45
|
+
#if defined(SK_BUILD_FOR_ANDROID)
|
46
|
+
float fGlyphsAsPathsFontSize = 384;
|
47
|
+
#elif defined(SK_BUILD_FOR_MAC)
|
48
|
+
float fGlyphsAsPathsFontSize = 256;
|
49
|
+
#else
|
50
|
+
float fGlyphsAsPathsFontSize = 324;
|
51
|
+
#endif
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Can the glyph atlas use multiple textures. If allowed, the each texture's size is bound by
|
55
|
+
* fGlypheCacheTextureMaximumBytes.
|
56
|
+
*/
|
57
|
+
bool fAllowMultipleGlyphCacheTextures = true;
|
58
|
+
|
59
|
+
/**
|
60
|
+
* If true, then add 1 pixel padding to all glyph masks in the atlas to support bi-lerp
|
61
|
+
* rendering of all glyphs. This must be set to true to use Slugs.
|
62
|
+
*/
|
63
|
+
#if defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG) || \
|
64
|
+
defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_SERIALIZE) || \
|
65
|
+
defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_STRIKE_SERIALIZE)
|
66
|
+
bool fSupportBilerpFromGlyphAtlas = true;
|
67
|
+
#else
|
68
|
+
bool fSupportBilerpFromGlyphAtlas = false;
|
69
|
+
#endif
|
70
|
+
|
71
|
+
#if GRAPHITE_TEST_UTILS
|
72
|
+
/**
|
73
|
+
* Private options that are only meant for testing within Skia's tools.
|
74
|
+
*/
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Maximum width and height of internal texture atlases.
|
78
|
+
*/
|
79
|
+
int fMaxTextureAtlasSize = 2048;
|
80
|
+
#endif
|
81
|
+
};
|
82
|
+
|
83
|
+
} // namespace skgpu::graphite
|
84
|
+
|
85
|
+
#endif // skgpu_graphite_ContextOptions
|
@@ -42,26 +42,10 @@ enum class SyncToCpu : bool {
|
|
42
42
|
kNo = false
|
43
43
|
};
|
44
44
|
|
45
|
-
/**
|
46
|
-
* Possible 3D APIs that may be used by Graphite.
|
47
|
-
*/
|
48
|
-
enum class BackendApi : unsigned {
|
49
|
-
kMetal,
|
50
|
-
kMock,
|
51
|
-
};
|
52
|
-
|
53
45
|
/**
|
54
46
|
* Is the texture mipmapped or not
|
55
47
|
*/
|
56
|
-
enum class Mipmapped: bool {
|
57
|
-
kNo = false,
|
58
|
-
kYes = true,
|
59
|
-
};
|
60
|
-
|
61
|
-
/**
|
62
|
-
* Is the data protected on the GPU or not.
|
63
|
-
*/
|
64
|
-
enum class Protected : bool {
|
48
|
+
enum class Mipmapped : bool {
|
65
49
|
kNo = false,
|
66
50
|
kYes = true,
|
67
51
|
};
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2022 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 skgpu_graphite_ImageProvider_DEFINED
|
9
|
+
#define skgpu_graphite_ImageProvider_DEFINED
|
10
|
+
|
11
|
+
#include "include/core/SkImage.h"
|
12
|
+
#include "include/core/SkRefCnt.h"
|
13
|
+
|
14
|
+
namespace skgpu::graphite {
|
15
|
+
|
16
|
+
enum class Mipmapped : bool;
|
17
|
+
class Recorder;
|
18
|
+
|
19
|
+
/*
|
20
|
+
* This class provides a centralized location for clients to perform any caching of images
|
21
|
+
* they desire. Whenever Graphite encounters an SkImage which is not Graphite-backed
|
22
|
+
* it will call ImageProvider::findOrCreate. The client's derived version of this class should
|
23
|
+
* return a Graphite-backed version of the provided SkImage that meets the specified
|
24
|
+
* requirements.
|
25
|
+
*
|
26
|
+
* Skia requires that 'findOrCreate' return a Graphite-backed image that preserves the dimensions,
|
27
|
+
* number of channels and alpha type of the original image. The bit depth of the
|
28
|
+
* individual channels can change (e.g., 4444 -> 8888 is allowed).
|
29
|
+
* Wrt mipmapping, the returned image can have different mipmap settings than requested. If
|
30
|
+
* mipmapping was requested but not returned, the sampling level will be reduced to linear.
|
31
|
+
* If the requirements are not met by the returned image (modulo the flexibility wrt mipmapping)
|
32
|
+
* Graphite will drop the draw.
|
33
|
+
*
|
34
|
+
* Note: by default, Graphite will not perform any caching of images
|
35
|
+
*
|
36
|
+
* Threading concerns:
|
37
|
+
* If the same ImageProvider is given to multiple Recorders it is up to the
|
38
|
+
* client to handle any required thread synchronization. This is not limited to just
|
39
|
+
* restricting access to whatever map a derived class may have but extends to ensuring
|
40
|
+
* that an image created on one Recorder has had its creation work submitted before it
|
41
|
+
* is used by any work submitted by another Recording. Please note, this requirement
|
42
|
+
* (re the submission of creation work and image usage on different threads) is common to all
|
43
|
+
* graphite SkImages and isn't unique to SkImages returned by the ImageProvider.
|
44
|
+
*
|
45
|
+
* TODO(b/240996632): add documentation re shutdown order.
|
46
|
+
* TODO(b/240997067): add unit tests
|
47
|
+
*/
|
48
|
+
class SK_API ImageProvider : public SkRefCnt {
|
49
|
+
public:
|
50
|
+
// If the client's derived class already has a Graphite-backed image that has the same
|
51
|
+
// contents as 'image' and meets the requirements, then it can be returned.
|
52
|
+
// makeTextureImage can always be called to create an acceptable Graphite-backed image
|
53
|
+
// which could then be cached.
|
54
|
+
virtual sk_sp<SkImage> findOrCreate(Recorder* recorder,
|
55
|
+
const SkImage* image,
|
56
|
+
SkImage::RequiredImageProperties) = 0;
|
57
|
+
};
|
58
|
+
|
59
|
+
} // namespace skgpu::graphite
|
60
|
+
|
61
|
+
#endif // skgpu_graphite_ImageProvider_DEFINED
|