@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
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "include/core/SkColor.h"
|
13
13
|
#include "include/core/SkImage.h"
|
14
14
|
#include "include/core/SkImageInfo.h"
|
15
|
+
#include "include/core/SkSurfaceProps.h"
|
15
16
|
#include "include/core/SkYUVAPixmaps.h"
|
16
17
|
|
17
18
|
#include <optional>
|
@@ -27,6 +28,13 @@ class SkPicture;
|
|
27
28
|
|
28
29
|
enum class GrImageTexGenPolicy : int;
|
29
30
|
|
31
|
+
#if SK_GRAPHITE_ENABLED
|
32
|
+
namespace skgpu::graphite {
|
33
|
+
enum class Mipmapped : bool;
|
34
|
+
class Recorder;
|
35
|
+
}
|
36
|
+
#endif
|
37
|
+
|
30
38
|
class SK_API SkImageGenerator {
|
31
39
|
public:
|
32
40
|
/**
|
@@ -118,25 +126,13 @@ public:
|
|
118
126
|
* If the generator can natively/efficiently return its pixels as a GPU image (backed by a
|
119
127
|
* texture) this will return that image. If not, this will return NULL.
|
120
128
|
*
|
121
|
-
* This routine also supports retrieving only a subset of the pixels. That subset is specified
|
122
|
-
* by the following rectangle:
|
123
|
-
*
|
124
|
-
* subset = SkIRect::MakeXYWH(origin.x(), origin.y(), info.width(), info.height())
|
125
|
-
*
|
126
|
-
* If subset is not contained inside the generator's bounds, this returns false.
|
127
|
-
*
|
128
|
-
* whole = SkIRect::MakeWH(getInfo().width(), getInfo().height())
|
129
|
-
* if (!whole.contains(subset)) {
|
130
|
-
* return false;
|
131
|
-
* }
|
132
|
-
*
|
133
129
|
* Regarding the GrRecordingContext parameter:
|
134
130
|
*
|
135
131
|
* It must be non-NULL. The generator should only succeed if:
|
136
132
|
* - its internal context is the same
|
137
133
|
* - it can somehow convert its texture into one that is valid for the provided context.
|
138
134
|
*
|
139
|
-
* If the
|
135
|
+
* If the mipmapped parameter is kYes, the generator should try to create a TextureProxy that
|
140
136
|
* at least has the mip levels allocated and the base layer filled in. If this is not possible,
|
141
137
|
* the generator is allowed to return a non mipped proxy, but this will have some additional
|
142
138
|
* overhead in later allocating mips and copying of the base layer.
|
@@ -145,9 +141,16 @@ public:
|
|
145
141
|
* status) or whether this may (but is not required to) return a pre-existing texture that is
|
146
142
|
* retained by the generator (kDraw).
|
147
143
|
*/
|
148
|
-
GrSurfaceProxyView generateTexture(GrRecordingContext*,
|
149
|
-
const
|
144
|
+
GrSurfaceProxyView generateTexture(GrRecordingContext*,
|
145
|
+
const SkImageInfo& info,
|
146
|
+
GrMipmapped mipmapped,
|
147
|
+
GrImageTexGenPolicy);
|
148
|
+
#endif
|
150
149
|
|
150
|
+
#if SK_GRAPHITE_ENABLED
|
151
|
+
sk_sp<SkImage> makeTextureImage(skgpu::graphite::Recorder*,
|
152
|
+
const SkImageInfo&,
|
153
|
+
skgpu::graphite::Mipmapped);
|
151
154
|
#endif
|
152
155
|
|
153
156
|
/**
|
@@ -169,7 +172,8 @@ public:
|
|
169
172
|
static std::unique_ptr<SkImageGenerator> MakeFromPicture(const SkISize&, sk_sp<SkPicture>,
|
170
173
|
const SkMatrix*, const SkPaint*,
|
171
174
|
SkImage::BitDepth,
|
172
|
-
sk_sp<SkColorSpace
|
175
|
+
sk_sp<SkColorSpace>,
|
176
|
+
SkSurfaceProps props = {});
|
173
177
|
|
174
178
|
protected:
|
175
179
|
static constexpr int kNeedNewImageUniqueID = 0;
|
@@ -186,7 +190,7 @@ protected:
|
|
186
190
|
#if SK_SUPPORT_GPU
|
187
191
|
// returns nullptr
|
188
192
|
virtual GrSurfaceProxyView onGenerateTexture(GrRecordingContext*, const SkImageInfo&,
|
189
|
-
|
193
|
+
GrMipmapped, GrImageTexGenPolicy);
|
190
194
|
|
191
195
|
// Most internal SkImageGenerators produce textures and views that use kTopLeft_GrSurfaceOrigin.
|
192
196
|
// If the generator may produce textures with different origins (e.g.
|
@@ -195,6 +199,12 @@ protected:
|
|
195
199
|
virtual GrSurfaceOrigin origin() const { return kTopLeft_GrSurfaceOrigin; }
|
196
200
|
#endif
|
197
201
|
|
202
|
+
#if SK_GRAPHITE_ENABLED
|
203
|
+
virtual sk_sp<SkImage> onMakeTextureImage(skgpu::graphite::Recorder*,
|
204
|
+
const SkImageInfo&,
|
205
|
+
skgpu::graphite::Mipmapped);
|
206
|
+
#endif
|
207
|
+
|
198
208
|
private:
|
199
209
|
const SkImageInfo fInfo;
|
200
210
|
const uint32_t fUniqueID;
|
@@ -30,6 +30,7 @@ struct SK_API SkV2 {
|
|
30
30
|
friend SkV2 operator*(SkV2 v, SkScalar s) { return {v.x*s, v.y*s}; }
|
31
31
|
friend SkV2 operator*(SkScalar s, SkV2 v) { return {v.x*s, v.y*s}; }
|
32
32
|
friend SkV2 operator/(SkV2 v, SkScalar s) { return {v.x/s, v.y/s}; }
|
33
|
+
friend SkV2 operator/(SkScalar s, SkV2 v) { return {s/v.x, s/v.y}; }
|
33
34
|
|
34
35
|
void operator+=(SkV2 v) { *this = *this + v; }
|
35
36
|
void operator-=(SkV2 v) { *this = *this - v; }
|
@@ -16,6 +16,7 @@
|
|
16
16
|
#include "include/core/SkRefCnt.h"
|
17
17
|
#include "include/core/SkSpan.h"
|
18
18
|
#include "include/core/SkString.h"
|
19
|
+
#include "include/effects/SkRuntimeEffect.h"
|
19
20
|
|
20
21
|
#include <memory>
|
21
22
|
#include <vector>
|
@@ -44,6 +45,10 @@ namespace SkSL { struct Program; }
|
|
44
45
|
* return type is void then the interpolated position from vertex shader return is used as the local
|
45
46
|
* coordinate. If the color variant is used it will be blended with SkShader (or SkPaint color in
|
46
47
|
* absence of a shader) using the SkBlender provided to the SkCanvas draw call.
|
48
|
+
*
|
49
|
+
* The vertex and fragment programs may both contain uniforms. Uniforms with the same name are
|
50
|
+
* assumed to be shared between stages. It is an error to specify uniforms in the vertex and
|
51
|
+
* fragment program with the same name but different types, dimensionality, or layouts.
|
47
52
|
*/
|
48
53
|
class SkMeshSpecification : public SkNVRefCnt<SkMeshSpecification> {
|
49
54
|
public:
|
@@ -86,6 +91,8 @@ public:
|
|
86
91
|
SkString name;
|
87
92
|
};
|
88
93
|
|
94
|
+
using Uniform = SkRuntimeEffect::Uniform;
|
95
|
+
|
89
96
|
~SkMeshSpecification();
|
90
97
|
|
91
98
|
struct Result {
|
@@ -134,7 +141,29 @@ public:
|
|
134
141
|
sk_sp<SkColorSpace> cs,
|
135
142
|
SkAlphaType at);
|
136
143
|
|
137
|
-
SkSpan<const Attribute> attributes() const { return
|
144
|
+
SkSpan<const Attribute> attributes() const { return SkSpan(fAttributes); }
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Combined size of all 'uniform' variables. When creating a SkMesh with this specification
|
148
|
+
* provide an SkData of this size, containing values for all of those variables. Use uniforms()
|
149
|
+
* to get the offset of each uniform within the SkData.
|
150
|
+
*/
|
151
|
+
size_t uniformSize() const;
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Provides info about individual uniforms including the offset into an SkData where each
|
155
|
+
* uniform value should be placed.
|
156
|
+
*/
|
157
|
+
SkSpan<const Uniform> uniforms() const { return SkSpan(fUniforms); }
|
158
|
+
|
159
|
+
/** Returns pointer to the named uniform variable's description, or nullptr if not found. */
|
160
|
+
const Uniform* findUniform(std::string_view name) const;
|
161
|
+
|
162
|
+
/** Returns pointer to the named attribute, or nullptr if not found. */
|
163
|
+
const Attribute* findAttribute(std::string_view name) const;
|
164
|
+
|
165
|
+
/** Returns pointer to the named varying, or nullptr if not found. */
|
166
|
+
const Varying* findVarying(std::string_view name) const;
|
138
167
|
|
139
168
|
size_t stride() const { return fStride; }
|
140
169
|
|
@@ -158,8 +187,9 @@ private:
|
|
158
187
|
SkMeshSpecification(SkSpan<const Attribute>,
|
159
188
|
size_t,
|
160
189
|
SkSpan<const Varying>,
|
161
|
-
std::
|
162
|
-
std::unique_ptr<SkSL::Program>,
|
190
|
+
std::vector<Uniform> uniforms,
|
191
|
+
std::unique_ptr<const SkSL::Program>,
|
192
|
+
std::unique_ptr<const SkSL::Program>,
|
163
193
|
ColorType,
|
164
194
|
bool hasLocalCoords,
|
165
195
|
sk_sp<SkColorSpace>,
|
@@ -171,16 +201,17 @@ private:
|
|
171
201
|
SkMeshSpecification& operator=(const SkMeshSpecification&) = delete;
|
172
202
|
SkMeshSpecification& operator=(SkMeshSpecification&&) = delete;
|
173
203
|
|
174
|
-
const std::vector<Attribute>
|
175
|
-
const std::vector<Varying>
|
176
|
-
std::
|
177
|
-
std::unique_ptr<SkSL::Program>
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
204
|
+
const std::vector<Attribute> fAttributes;
|
205
|
+
const std::vector<Varying> fVaryings;
|
206
|
+
const std::vector<Uniform> fUniforms;
|
207
|
+
const std::unique_ptr<const SkSL::Program> fVS;
|
208
|
+
const std::unique_ptr<const SkSL::Program> fFS;
|
209
|
+
const size_t fStride;
|
210
|
+
uint32_t fHash;
|
211
|
+
const ColorType fColorType;
|
212
|
+
const bool fHasLocalCoords;
|
213
|
+
const sk_sp<SkColorSpace> fColorSpace;
|
214
|
+
const SkAlphaType fAlphaType;
|
184
215
|
};
|
185
216
|
|
186
217
|
/**
|
@@ -199,11 +230,46 @@ private:
|
|
199
230
|
*
|
200
231
|
* If Make() is used the implicit index sequence is 0, 1, 2, 3, ... and vertexCount must be at least
|
201
232
|
* 3.
|
233
|
+
*
|
234
|
+
* Both Make() and MakeIndexed() take a SkData with the uniform values. See
|
235
|
+
* SkMeshSpecification::uniformSize() and SkMeshSpecification::uniforms() for sizing and packing
|
236
|
+
* uniforms into the SkData.
|
202
237
|
*/
|
203
238
|
class SkMesh {
|
204
239
|
public:
|
205
|
-
class IndexBuffer : public SkRefCnt {
|
206
|
-
|
240
|
+
class IndexBuffer : public SkRefCnt {
|
241
|
+
public:
|
242
|
+
virtual size_t size() const = 0;
|
243
|
+
|
244
|
+
/**
|
245
|
+
* Modifies the data in the IndexBuffer by copying size bytes from data into the buffer
|
246
|
+
* at offset. Fails if offset + size > this->size() or if either offset or size is not
|
247
|
+
* aligned to 4 bytes. The GrDirectContext* must match that used to create the buffer. We
|
248
|
+
* take it as a parameter to emphasize that the context must be used to update the data and
|
249
|
+
* thus the context must be valid for the current thread.
|
250
|
+
*/
|
251
|
+
bool update(GrDirectContext*, const void* data, size_t offset, size_t size);
|
252
|
+
|
253
|
+
private:
|
254
|
+
virtual bool onUpdate(GrDirectContext*, const void* data, size_t offset, size_t size) = 0;
|
255
|
+
};
|
256
|
+
|
257
|
+
class VertexBuffer : public SkRefCnt {
|
258
|
+
public:
|
259
|
+
virtual size_t size() const = 0;
|
260
|
+
|
261
|
+
/**
|
262
|
+
* Modifies the data in the IndexBuffer by copying size bytes from data into the buffer
|
263
|
+
* at offset. Fails if offset + size > this->size() or if either offset or size is not
|
264
|
+
* aligned to 4 bytes. The GrDirectContext* must match that used to create the buffer. We
|
265
|
+
* take it as a parameter to emphasize that the context must be used to update the data and
|
266
|
+
* thus the context must be valid for the current thread.
|
267
|
+
*/
|
268
|
+
bool update(GrDirectContext*, const void* data, size_t offset, size_t size);
|
269
|
+
|
270
|
+
private:
|
271
|
+
virtual bool onUpdate(GrDirectContext*, const void* data, size_t offset, size_t size) = 0;
|
272
|
+
};
|
207
273
|
|
208
274
|
SkMesh();
|
209
275
|
~SkMesh();
|
@@ -215,29 +281,39 @@ public:
|
|
215
281
|
SkMesh& operator=(SkMesh&&);
|
216
282
|
|
217
283
|
/**
|
218
|
-
* Makes an index buffer to be used with SkMeshes. The
|
219
|
-
*
|
220
|
-
* GrDirectContext* is nullptr.
|
284
|
+
* Makes an index buffer to be used with SkMeshes. The buffer may be CPU- or GPU-backed
|
285
|
+
* depending on whether GrDirectContext* is nullptr.
|
221
286
|
*
|
222
|
-
* @param GrDirectContext*
|
223
|
-
*
|
224
|
-
*
|
225
|
-
*
|
226
|
-
* @param
|
287
|
+
* @param GrDirectContext* If nullptr a CPU-backed object is returned. Otherwise, the data is
|
288
|
+
* uploaded to the GPU and a GPU-backed buffer is returned. It may
|
289
|
+
* only be used to draw into SkSurfaces that are backed by the passed
|
290
|
+
* GrDirectContext.
|
291
|
+
* @param data The data used to populate the buffer, or nullptr to create a zero-
|
292
|
+
* initialized buffer.
|
293
|
+
* @param size Both the size of the data in 'data' and the size of the resulting
|
294
|
+
* buffer.
|
227
295
|
*/
|
296
|
+
static sk_sp<IndexBuffer> MakeIndexBuffer(GrDirectContext*, const void* data, size_t size);
|
297
|
+
|
298
|
+
/** Deprecated in favor of const void* and size_t version above. */
|
228
299
|
static sk_sp<IndexBuffer> MakeIndexBuffer(GrDirectContext*, sk_sp<const SkData>);
|
229
300
|
|
230
301
|
/**
|
231
|
-
* Makes a vertex buffer to be used with SkMeshes. The
|
232
|
-
*
|
233
|
-
* GrDirectContext* is nullptr.
|
302
|
+
* Makes a vertex buffer to be used with SkMeshes. The buffer may be CPU- or GPU-backed
|
303
|
+
* depending on whether GrDirectContext* is nullptr.
|
234
304
|
*
|
235
|
-
* @param GrDirectContext*
|
236
|
-
*
|
237
|
-
*
|
238
|
-
*
|
239
|
-
* @param
|
305
|
+
* @param GrDirectContext* If nullptr a CPU-backed object is returned. Otherwise, the data is
|
306
|
+
* uploaded to the GPU and a GPU-backed buffer is returned. It may
|
307
|
+
* only be used to draw into SkSurfaces that are backed by the passed
|
308
|
+
* GrDirectContext.
|
309
|
+
* @param data The data used to populate the buffer, or nullptr to create a zero-
|
310
|
+
* initialized buffer.
|
311
|
+
* @param size Both the size of the data in 'data' and the size of the resulting
|
312
|
+
* buffer.
|
240
313
|
*/
|
314
|
+
static sk_sp<VertexBuffer> MakeVertexBuffer(GrDirectContext*, const void*, size_t size);
|
315
|
+
|
316
|
+
/** Deprecated in favor of const void* and size_t version above. */
|
241
317
|
static sk_sp<VertexBuffer> MakeVertexBuffer(GrDirectContext*, sk_sp<const SkData>);
|
242
318
|
|
243
319
|
enum class Mode { kTriangles, kTriangleStrip };
|
@@ -247,6 +323,7 @@ public:
|
|
247
323
|
sk_sp<VertexBuffer>,
|
248
324
|
size_t vertexCount,
|
249
325
|
size_t vertexOffset,
|
326
|
+
sk_sp<const SkData> uniforms,
|
250
327
|
const SkRect& bounds);
|
251
328
|
|
252
329
|
static SkMesh MakeIndexed(sk_sp<SkMeshSpecification>,
|
@@ -257,22 +334,29 @@ public:
|
|
257
334
|
sk_sp<IndexBuffer>,
|
258
335
|
size_t indexCount,
|
259
336
|
size_t indexOffset,
|
337
|
+
sk_sp<const SkData> uniforms,
|
260
338
|
const SkRect& bounds);
|
261
339
|
|
262
|
-
sk_sp<SkMeshSpecification>
|
340
|
+
sk_sp<SkMeshSpecification> refSpec() const { return fSpec; }
|
341
|
+
SkMeshSpecification* spec() const { return fSpec.get(); }
|
263
342
|
|
264
343
|
Mode mode() const { return fMode; }
|
265
344
|
|
266
|
-
sk_sp<VertexBuffer>
|
345
|
+
sk_sp<VertexBuffer> refVertexBuffer() const { return fVB; }
|
346
|
+
VertexBuffer* vertexBuffer() const { return fVB.get(); }
|
267
347
|
|
268
348
|
size_t vertexOffset() const { return fVOffset; }
|
269
349
|
size_t vertexCount() const { return fVCount; }
|
270
350
|
|
271
|
-
sk_sp<IndexBuffer>
|
351
|
+
sk_sp<IndexBuffer> refIndexBuffer() const { return fIB; }
|
352
|
+
IndexBuffer* indexBuffer() const { return fIB.get(); }
|
272
353
|
|
273
354
|
size_t indexOffset() const { return fIOffset; }
|
274
355
|
size_t indexCount() const { return fICount; }
|
275
356
|
|
357
|
+
sk_sp<const SkData> refUniforms() const { return fUniforms; }
|
358
|
+
const SkData* uniforms() const { return fUniforms.get(); }
|
359
|
+
|
276
360
|
SkRect bounds() const { return fBounds; }
|
277
361
|
|
278
362
|
bool isValid() const;
|
@@ -287,6 +371,8 @@ private:
|
|
287
371
|
sk_sp<VertexBuffer> fVB;
|
288
372
|
sk_sp<IndexBuffer> fIB;
|
289
373
|
|
374
|
+
sk_sp<const SkData> fUniforms;
|
375
|
+
|
290
376
|
size_t fVOffset = 0; // Must be a multiple of spec->stride()
|
291
377
|
size_t fVCount = 0;
|
292
378
|
|
@@ -22,7 +22,8 @@ public:
|
|
22
22
|
SkOverdrawCanvas(SkCanvas*);
|
23
23
|
|
24
24
|
void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override;
|
25
|
-
void onDrawGlyphRunList(
|
25
|
+
void onDrawGlyphRunList(
|
26
|
+
const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) override;
|
26
27
|
void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode,
|
27
28
|
const SkPaint&) override;
|
28
29
|
void onDrawPaint(const SkPaint&) override;
|
@@ -251,12 +251,14 @@ public:
|
|
251
251
|
|
252
252
|
/** Retrieves alpha from the color used when stroking and filling.
|
253
253
|
|
254
|
-
@return alpha ranging from zero, fully transparent, to
|
254
|
+
@return alpha ranging from zero, fully transparent, to one, fully opaque
|
255
255
|
*/
|
256
256
|
float getAlphaf() const { return fColor4f.fA; }
|
257
257
|
|
258
258
|
// Helper that scales the alpha by 255.
|
259
|
-
uint8_t getAlpha() const {
|
259
|
+
uint8_t getAlpha() const {
|
260
|
+
return static_cast<uint8_t>(sk_float_round2int(this->getAlphaf() * 255));
|
261
|
+
}
|
260
262
|
|
261
263
|
/** Replaces alpha, leaving RGB
|
262
264
|
unchanged. An out of range value triggers an assert in the debug
|
@@ -676,6 +678,8 @@ public:
|
|
676
678
|
const SkRect& doComputeFastBounds(const SkRect& orig, SkRect* storage,
|
677
679
|
Style style) const;
|
678
680
|
|
681
|
+
using sk_is_trivially_relocatable = std::true_type;
|
682
|
+
|
679
683
|
private:
|
680
684
|
sk_sp<SkPathEffect> fPathEffect;
|
681
685
|
sk_sp<SkShader> fShader;
|
@@ -699,6 +703,15 @@ private:
|
|
699
703
|
uint32_t fBitfieldsUInt;
|
700
704
|
};
|
701
705
|
|
706
|
+
static_assert(::sk_is_trivially_relocatable<decltype(fPathEffect)>::value);
|
707
|
+
static_assert(::sk_is_trivially_relocatable<decltype(fShader)>::value);
|
708
|
+
static_assert(::sk_is_trivially_relocatable<decltype(fMaskFilter)>::value);
|
709
|
+
static_assert(::sk_is_trivially_relocatable<decltype(fColorFilter)>::value);
|
710
|
+
static_assert(::sk_is_trivially_relocatable<decltype(fImageFilter)>::value);
|
711
|
+
static_assert(::sk_is_trivially_relocatable<decltype(fBlender)>::value);
|
712
|
+
static_assert(::sk_is_trivially_relocatable<decltype(fColor4f)>::value);
|
713
|
+
static_assert(::sk_is_trivially_relocatable<decltype(fBitfields)>::value);
|
714
|
+
|
702
715
|
friend class SkPaintPriv;
|
703
716
|
};
|
704
717
|
|
@@ -1756,6 +1756,8 @@ public:
|
|
1756
1756
|
*/
|
1757
1757
|
bool isValid() const;
|
1758
1758
|
|
1759
|
+
using sk_is_trivially_relocatable = std::true_type;
|
1760
|
+
|
1759
1761
|
private:
|
1760
1762
|
SkPath(sk_sp<SkPathRef>, SkPathFillType, bool isVolatile, SkPathConvexity,
|
1761
1763
|
SkPathFirstDirection firstDirection);
|
@@ -1767,6 +1769,8 @@ private:
|
|
1767
1769
|
uint8_t fFillType : 2;
|
1768
1770
|
uint8_t fIsVolatile : 1;
|
1769
1771
|
|
1772
|
+
static_assert(::sk_is_trivially_relocatable<decltype(fPathRef)>::value);
|
1773
|
+
|
1770
1774
|
/** Resets all fields other than fPathRef to their initial 'empty' values.
|
1771
1775
|
* Assumes the caller has already emptied fPathRef.
|
1772
1776
|
* On Android increments fGenerationID without reseting it.
|
@@ -242,7 +242,7 @@ private:
|
|
242
242
|
int fIsAStart = -1; // tracks direction iff fIsA is not unknown
|
243
243
|
bool fIsACCW = false; // tracks direction iff fIsA is not unknown
|
244
244
|
|
245
|
-
int countVerbs() const { return fVerbs.
|
245
|
+
int countVerbs() const { return fVerbs.size(); }
|
246
246
|
|
247
247
|
// called right before we add a (non-move) verb
|
248
248
|
void ensureMove() {
|
@@ -240,7 +240,6 @@ private:
|
|
240
240
|
friend class SkBigPicture;
|
241
241
|
friend class SkEmptyPicture;
|
242
242
|
friend class SkPicturePriv;
|
243
|
-
template <typename> friend class SkMiniPicture;
|
244
243
|
|
245
244
|
void serialize(SkWStream*, const SkSerialProcs*, class SkRefCntSet* typefaces,
|
246
245
|
bool textBlobsOnly=false) const;
|
@@ -263,8 +262,6 @@ private:
|
|
263
262
|
// Returns NULL if this is not an SkBigPicture.
|
264
263
|
virtual const class SkBigPicture* asSkBigPicture() const { return nullptr; }
|
265
264
|
|
266
|
-
friend struct SkPathCounter;
|
267
|
-
|
268
265
|
static bool IsValidPictInfo(const struct SkPictInfo& info);
|
269
266
|
static sk_sp<SkPicture> Forwardport(const struct SkPictInfo&,
|
270
267
|
const class SkPictureData*,
|
@@ -20,7 +20,6 @@ namespace android {
|
|
20
20
|
|
21
21
|
class SkCanvas;
|
22
22
|
class SkDrawable;
|
23
|
-
class SkMiniRecorder;
|
24
23
|
class SkPictureRecord;
|
25
24
|
class SkRecord;
|
26
25
|
class SkRecorder;
|
@@ -106,7 +105,6 @@ private:
|
|
106
105
|
sk_sp<SkBBoxHierarchy> fBBH;
|
107
106
|
std::unique_ptr<SkRecorder> fRecorder;
|
108
107
|
sk_sp<SkRecord> fRecord;
|
109
|
-
std::unique_ptr<SkMiniRecorder> fMiniRecorder;
|
110
108
|
|
111
109
|
SkPictureRecorder(SkPictureRecorder&&) = delete;
|
112
110
|
SkPictureRecorder& operator=(SkPictureRecorder&&) = delete;
|
@@ -261,6 +261,25 @@ public:
|
|
261
261
|
*/
|
262
262
|
SkColor getColor(int x, int y) const;
|
263
263
|
|
264
|
+
/** Returns pixel at (x, y) as unpremultiplied color as an SkColor4f.
|
265
|
+
Returns black with alpha if SkColorType is kAlpha_8_SkColorType.
|
266
|
+
|
267
|
+
Input is not validated: out of bounds values of x or y trigger an assert() if
|
268
|
+
built with SK_DEBUG defined; and returns undefined values or may crash if
|
269
|
+
SK_RELEASE is defined. Fails if SkColorType is kUnknown_SkColorType or
|
270
|
+
pixel address is nullptr.
|
271
|
+
|
272
|
+
SkColorSpace in SkImageInfo is ignored. Some color precision may be lost in the
|
273
|
+
conversion to unpremultiplied color; original pixel data may have additional
|
274
|
+
precision, though this is less likely than for getColor(). Rounding errors may
|
275
|
+
occur if the underlying type has lower precision.
|
276
|
+
|
277
|
+
@param x column index, zero or greater, and less than width()
|
278
|
+
@param y row index, zero or greater, and less than height()
|
279
|
+
@return pixel converted to unpremultiplied float color
|
280
|
+
*/
|
281
|
+
SkColor4f getColor4f(int x, int y) const;
|
282
|
+
|
264
283
|
/** Look up the pixel at (x,y) and return its alpha component, normalized to [0..1].
|
265
284
|
This is roughly equivalent to SkGetColorA(getColor()), but can be more efficent
|
266
285
|
(and more precise if the pixels store more than 8 bits per component).
|
@@ -13,6 +13,7 @@
|
|
13
13
|
class SkBitmap;
|
14
14
|
class SkCanvas;
|
15
15
|
class SkMatrix;
|
16
|
+
class SkSurfaceProps;
|
16
17
|
|
17
18
|
/**
|
18
19
|
* If a client wants to control the allocation of raster layers in a canvas, it should subclass
|
@@ -76,7 +77,8 @@ public:
|
|
76
77
|
* If rec is null, then the allocator will be called for the base-layer as well.
|
77
78
|
*/
|
78
79
|
static std::unique_ptr<SkCanvas> MakeCanvas(std::unique_ptr<SkRasterHandleAllocator>,
|
79
|
-
const SkImageInfo&, const Rec* rec = nullptr
|
80
|
+
const SkImageInfo&, const Rec* rec = nullptr,
|
81
|
+
const SkSurfaceProps* props = nullptr);
|
80
82
|
|
81
83
|
protected:
|
82
84
|
SkRasterHandleAllocator() = default;
|
@@ -215,7 +215,8 @@ struct SK_API SkIRect {
|
|
215
215
|
@return true if members are equal
|
216
216
|
*/
|
217
217
|
friend bool operator==(const SkIRect& a, const SkIRect& b) {
|
218
|
-
return
|
218
|
+
return a.fLeft == b.fLeft && a.fTop == b.fTop &&
|
219
|
+
a.fRight == b.fRight && a.fBottom == b.fBottom;
|
219
220
|
}
|
220
221
|
|
221
222
|
/** Returns true if any member in a: fLeft, fTop, fRight, and fBottom; is not
|
@@ -226,7 +227,8 @@ struct SK_API SkIRect {
|
|
226
227
|
@return true if members are not equal
|
227
228
|
*/
|
228
229
|
friend bool operator!=(const SkIRect& a, const SkIRect& b) {
|
229
|
-
return
|
230
|
+
return a.fLeft != b.fLeft || a.fTop != b.fTop ||
|
231
|
+
a.fRight != b.fRight || a.fBottom != b.fBottom;
|
230
232
|
}
|
231
233
|
|
232
234
|
/** Sets SkIRect to (0, 0, 0, 0).
|
@@ -783,7 +785,7 @@ struct SK_API SkRect {
|
|
783
785
|
|
784
786
|
@return midpoint on x-axis
|
785
787
|
*/
|
786
|
-
SkScalar centerX() const {
|
788
|
+
constexpr SkScalar centerX() const {
|
787
789
|
// don't use SkScalarHalf(fLeft + fBottom) as that might overflow before the 0.5
|
788
790
|
return SkScalarHalf(fLeft) + SkScalarHalf(fRight);
|
789
791
|
}
|
@@ -793,11 +795,16 @@ struct SK_API SkRect {
|
|
793
795
|
|
794
796
|
@return midpoint on y-axis
|
795
797
|
*/
|
796
|
-
SkScalar centerY() const {
|
798
|
+
constexpr SkScalar centerY() const {
|
797
799
|
// don't use SkScalarHalf(fTop + fBottom) as that might overflow before the 0.5
|
798
800
|
return SkScalarHalf(fTop) + SkScalarHalf(fBottom);
|
799
801
|
}
|
800
802
|
|
803
|
+
/** Returns the point this->centerX(), this->centerY().
|
804
|
+
@return rectangle center
|
805
|
+
*/
|
806
|
+
constexpr SkPoint center() const { return {this->centerX(), this->centerY()}; }
|
807
|
+
|
801
808
|
/** Returns true if all members in a: fLeft, fTop, fRight, and fBottom; are
|
802
809
|
equal to the corresponding members in b.
|
803
810
|
|
@@ -9,6 +9,7 @@
|
|
9
9
|
#define SkRefCnt_DEFINED
|
10
10
|
|
11
11
|
#include "include/core/SkTypes.h"
|
12
|
+
#include "include/private/SkTemplates.h"
|
12
13
|
|
13
14
|
#include <atomic> // std::atomic, std::memory_order_*
|
14
15
|
#include <cstddef> // std::nullptr_t
|
@@ -211,8 +212,17 @@ private:
|
|
211
212
|
* This can be used for classes inheriting from SkRefCnt, but it also works for other
|
212
213
|
* classes that match the interface, but have different internal choices: e.g. the hosted class
|
213
214
|
* may have its ref/unref be thread-safe, but that is not assumed/imposed by sk_sp.
|
215
|
+
*
|
216
|
+
* Declared with the trivial_abi attribute where supported so that sk_sp and types containing it
|
217
|
+
* may be considered as trivially relocatable by the compiler so that destroying-move operations
|
218
|
+
* i.e. move constructor followed by destructor can be optimized to memcpy.
|
214
219
|
*/
|
215
|
-
|
220
|
+
#if defined(__clang__) && defined(__has_cpp_attribute) && __has_cpp_attribute(clang::trivial_abi)
|
221
|
+
#define SK_SP_TRIVIAL_ABI [[clang::trivial_abi]]
|
222
|
+
#else
|
223
|
+
#define SK_SP_TRIVIAL_ABI
|
224
|
+
#endif
|
225
|
+
template <typename T> class SK_SP_TRIVIAL_ABI sk_sp {
|
216
226
|
public:
|
217
227
|
using element_type = T;
|
218
228
|
|
@@ -327,6 +337,8 @@ public:
|
|
327
337
|
swap(fPtr, that.fPtr);
|
328
338
|
}
|
329
339
|
|
340
|
+
using sk_is_trivially_relocatable = std::true_type;
|
341
|
+
|
330
342
|
private:
|
331
343
|
T* fPtr;
|
332
344
|
};
|
@@ -9,6 +9,7 @@
|
|
9
9
|
#define SkRegion_DEFINED
|
10
10
|
|
11
11
|
#include "include/core/SkRect.h"
|
12
|
+
#include "include/private/SkTemplates.h"
|
12
13
|
|
13
14
|
class SkPath;
|
14
15
|
class SkRgnBuilder;
|
@@ -606,6 +607,8 @@ public:
|
|
606
607
|
*/
|
607
608
|
size_t readFromMemory(const void* buffer, size_t length);
|
608
609
|
|
610
|
+
using sk_is_trivially_relocatable = std::true_type;
|
611
|
+
|
609
612
|
private:
|
610
613
|
static constexpr int kOpCount = kReplace_Op + 1;
|
611
614
|
|
@@ -629,6 +632,9 @@ private:
|
|
629
632
|
SkIRect fBounds;
|
630
633
|
RunHead* fRunHead;
|
631
634
|
|
635
|
+
static_assert(::sk_is_trivially_relocatable<decltype(fBounds)>::value);
|
636
|
+
static_assert(::sk_is_trivially_relocatable<decltype(fRunHead)>::value);
|
637
|
+
|
632
638
|
void freeRuns();
|
633
639
|
|
634
640
|
/**
|