@shopify/react-native-skia 0.1.192 → 0.1.194
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +1 -1
- package/android/build.gradle +1 -0
- package/android/cpp/jni/JniPlatformContext.cpp +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +104 -103
- package/cpp/api/JsiSkImage.h +25 -4
- package/cpp/api/JsiSkImageFactory.h +2 -2
- package/cpp/api/JsiSkPath.h +8 -6
- package/cpp/rnskia/dom/base/Declaration.h +5 -7
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +3 -1
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +1 -0
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +2 -2
- package/cpp/rnskia/dom/props/BoxShadowProps.h +2 -0
- package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +2 -8
- package/cpp/skia/include/android/SkImageAndroid.h +101 -0
- package/cpp/skia/include/codec/SkAndroidCodec.h +26 -8
- package/cpp/skia/include/codec/SkCodec.h +31 -17
- package/cpp/skia/include/codec/SkEncodedImageFormat.h +36 -0
- package/cpp/skia/include/codec/SkPixmapUtils.h +31 -0
- package/cpp/skia/include/config/SkUserConfig.h +61 -29
- package/cpp/skia/include/core/SkBitmap.h +25 -25
- package/cpp/skia/include/core/SkBlurTypes.h +0 -2
- package/cpp/skia/include/core/SkCanvas.h +32 -15
- package/cpp/skia/include/core/SkCapabilities.h +2 -2
- package/cpp/skia/include/core/SkColor.h +2 -0
- package/cpp/skia/include/core/SkColorPriv.h +19 -4
- package/cpp/skia/include/core/SkColorSpace.h +14 -17
- package/cpp/skia/include/core/SkColorType.h +1 -0
- package/cpp/skia/include/core/SkContourMeasure.h +1 -1
- package/cpp/skia/include/core/SkCoverageMode.h +0 -2
- package/cpp/skia/include/core/SkCubicMap.h +2 -0
- package/cpp/skia/include/core/SkData.h +5 -2
- package/cpp/skia/include/core/SkDataTable.h +6 -2
- package/cpp/skia/include/core/SkDeferredDisplayList.h +11 -10
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +9 -8
- package/cpp/skia/include/core/SkDrawable.h +10 -2
- package/cpp/skia/include/core/SkEncodedImageFormat.h +3 -30
- package/cpp/skia/include/core/SkFlattenable.h +4 -2
- package/cpp/skia/include/core/SkFont.h +1 -0
- package/cpp/skia/include/core/SkFontMetrics.h +1 -0
- package/cpp/skia/include/core/SkFontMgr.h +20 -29
- package/cpp/skia/include/core/SkFontStyle.h +4 -1
- package/cpp/skia/include/core/SkGraphics.h +21 -18
- package/cpp/skia/include/core/SkICC.h +3 -13
- package/cpp/skia/include/core/SkImage.h +395 -717
- package/cpp/skia/include/core/SkImageGenerator.h +19 -74
- package/cpp/skia/include/core/SkImageInfo.h +7 -5
- package/cpp/skia/include/core/SkM44.h +11 -0
- package/cpp/skia/include/core/SkMaskFilter.h +6 -3
- package/cpp/skia/include/core/SkMatrix.h +14 -4
- package/cpp/skia/include/core/SkMesh.h +52 -18
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPaint.h +11 -34
- package/cpp/skia/include/core/SkPath.h +23 -4
- package/cpp/skia/include/core/SkPathBuilder.h +13 -5
- package/cpp/skia/include/core/SkPathMeasure.h +1 -1
- package/cpp/skia/include/core/SkPathTypes.h +0 -2
- package/cpp/skia/include/core/SkPathUtils.h +42 -0
- package/cpp/skia/include/core/SkPicture.h +3 -2
- package/cpp/skia/include/core/SkPictureRecorder.h +2 -0
- package/cpp/skia/include/core/SkPixelRef.h +4 -8
- package/cpp/skia/include/core/SkPixmap.h +12 -20
- package/cpp/skia/include/core/SkPoint.h +4 -2
- package/cpp/skia/include/core/SkPromiseImageTexture.h +2 -2
- package/cpp/skia/include/core/SkRRect.h +5 -1
- package/cpp/skia/include/core/SkRect.h +6 -3
- package/cpp/skia/include/core/SkRefCnt.h +9 -14
- package/cpp/skia/include/core/SkRegion.h +1 -1
- package/cpp/skia/include/core/SkScalar.h +2 -4
- package/cpp/skia/include/core/SkSerialProcs.h +18 -10
- package/cpp/skia/include/core/SkShader.h +1 -64
- package/cpp/skia/include/core/SkSize.h +2 -0
- package/cpp/skia/include/core/SkSpan.h +4 -112
- package/cpp/skia/include/core/SkStream.h +11 -12
- package/cpp/skia/include/core/SkString.h +9 -25
- package/cpp/skia/include/core/SkStrokeRec.h +1 -1
- package/cpp/skia/include/core/SkSurface.h +83 -61
- package/cpp/skia/include/core/SkSurfaceCharacterization.h +3 -3
- package/cpp/skia/include/core/SkSurfaceProps.h +9 -1
- package/cpp/skia/include/core/SkTextBlob.h +2 -2
- package/cpp/skia/include/core/SkTextureCompressionType.h +30 -0
- package/cpp/skia/include/core/SkTime.h +1 -1
- package/cpp/skia/include/core/SkTypeface.h +9 -2
- package/cpp/skia/include/core/SkTypes.h +37 -466
- package/cpp/skia/include/core/SkVertices.h +2 -0
- package/cpp/skia/include/core/SkYUVAInfo.h +4 -0
- package/cpp/skia/include/core/SkYUVAPixmaps.h +7 -1
- package/cpp/skia/include/docs/SkPDFDocument.h +12 -1
- package/cpp/skia/include/effects/SkColorMatrix.h +2 -1
- package/cpp/skia/include/effects/SkGradientShader.h +65 -14
- package/cpp/skia/include/effects/SkImageFilters.h +0 -11
- package/cpp/skia/include/effects/SkRuntimeEffect.h +41 -11
- package/cpp/skia/include/encode/SkEncoder.h +7 -3
- package/cpp/skia/include/encode/SkICC.h +36 -0
- package/cpp/skia/include/encode/SkJpegEncoder.h +102 -71
- package/cpp/skia/include/encode/SkPngEncoder.h +89 -71
- package/cpp/skia/include/encode/SkWebpEncoder.h +65 -38
- package/cpp/skia/include/gpu/GpuTypes.h +23 -1
- package/cpp/skia/include/gpu/GrBackendSurface.h +9 -7
- package/cpp/skia/include/gpu/GrContextOptions.h +28 -9
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +6 -4
- package/cpp/skia/include/gpu/GrDirectContext.h +84 -63
- package/cpp/skia/include/gpu/GrDriverBugWorkarounds.h +2 -1
- package/cpp/skia/include/gpu/GrRecordingContext.h +9 -5
- package/cpp/skia/include/gpu/GrTypes.h +18 -18
- package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +4 -4
- package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +3 -3
- package/cpp/skia/include/gpu/ganesh/GrTextureGenerator.h +77 -0
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +385 -0
- package/cpp/skia/include/gpu/gl/GrGLExtensions.h +3 -3
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -1
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +0 -3
- package/cpp/skia/include/gpu/gl/GrGLTypes.h +2 -1
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +72 -3
- package/cpp/skia/include/gpu/graphite/Context.h +85 -32
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +15 -11
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +55 -5
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +6 -4
- package/cpp/skia/include/gpu/graphite/Recorder.h +41 -11
- package/cpp/skia/include/gpu/graphite/Recording.h +50 -3
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +47 -8
- package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +139 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +40 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnUtils.h +28 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +1 -1
- package/cpp/skia/include/gpu/graphite/mtl/{MtlTypes.h → MtlGraphiteTypes.h} +7 -6
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h +27 -0
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +4 -9
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteUtils.h +28 -0
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +17 -13
- package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
- package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +1 -1
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +3 -3
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +3 -3
- package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +5 -7
- package/cpp/skia/include/pathops/SkPathOps.h +3 -3
- package/cpp/skia/include/ports/SkFontMgr_data.h +22 -0
- package/cpp/skia/include/ports/SkFontMgr_indirect.h +14 -14
- package/cpp/skia/include/ports/SkRemotableFontMgr.h +2 -2
- package/cpp/skia/include/ports/SkTypeface_win.h +2 -1
- package/cpp/skia/include/private/SkChecksum.h +32 -7
- package/cpp/skia/include/private/SkColorData.h +1 -26
- package/cpp/skia/include/private/SkGainmapInfo.h +97 -0
- package/cpp/skia/include/private/SkGainmapShader.h +53 -0
- package/cpp/skia/include/private/SkIDChangeListener.h +4 -3
- package/cpp/skia/include/private/SkJpegGainmapEncoder.h +71 -0
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +61 -0
- package/cpp/skia/include/private/SkOpts_spi.h +3 -1
- package/cpp/skia/include/private/SkPathRef.h +64 -47
- package/cpp/skia/include/private/SkSLDefines.h +5 -5
- package/cpp/skia/include/private/SkSLSampleUsage.h +0 -4
- package/cpp/skia/include/private/SkSpinlock.h +1 -1
- package/cpp/skia/include/private/SkWeakRefCnt.h +3 -0
- package/cpp/skia/include/private/{SingleOwner.h → base/SingleOwner.h} +8 -5
- package/cpp/skia/include/private/base/SkAPI.h +52 -0
- package/cpp/skia/include/private/base/SkAlign.h +39 -0
- package/cpp/skia/include/private/base/SkAlignedStorage.h +32 -0
- package/cpp/skia/include/private/base/SkAssert.h +92 -0
- package/cpp/skia/include/private/base/SkAttributes.h +102 -0
- package/cpp/skia/include/private/base/SkCPUTypes.h +25 -0
- package/cpp/skia/include/private/base/SkContainers.h +46 -0
- package/cpp/skia/include/private/base/SkDebug.h +27 -0
- package/cpp/skia/include/private/{SkDeque.h → base/SkDeque.h} +3 -1
- package/cpp/skia/include/private/base/SkFeatures.h +151 -0
- package/cpp/skia/include/private/{SkFixed.h → base/SkFixed.h} +9 -7
- package/cpp/skia/include/private/{SkFloatBits.h → base/SkFloatBits.h} +2 -3
- package/cpp/skia/include/private/{SkFloatingPoint.h → base/SkFloatingPoint.h} +18 -9
- package/cpp/skia/include/private/base/SkLoadUserConfig.h +63 -0
- package/cpp/skia/include/private/{SkMacros.h → base/SkMacros.h} +17 -2
- package/cpp/skia/include/private/{SkMalloc.h → base/SkMalloc.h} +4 -7
- package/cpp/skia/include/{core → private/base}/SkMath.h +25 -2
- package/cpp/skia/include/private/{SkMutex.h → base/SkMutex.h} +5 -5
- package/cpp/skia/include/private/{SkNoncopyable.h → base/SkNoncopyable.h} +2 -2
- package/cpp/skia/include/private/{SkOnce.h → base/SkOnce.h} +3 -1
- package/cpp/skia/include/private/base/SkPathEnums.h +25 -0
- package/cpp/skia/include/private/{SkSafe32.h → base/SkSafe32.h} +16 -1
- package/cpp/skia/include/private/{SkSemaphore.h → base/SkSemaphore.h} +4 -3
- package/cpp/skia/include/private/base/SkSpan_impl.h +129 -0
- package/cpp/skia/include/private/base/SkTArray.h +694 -0
- package/cpp/skia/include/private/{SkTDArray.h → base/SkTDArray.h} +17 -54
- package/cpp/skia/include/private/{SkTFitsIn.h → base/SkTFitsIn.h} +14 -8
- package/cpp/skia/include/private/{SkTLogic.h → base/SkTLogic.h} +1 -1
- package/cpp/skia/include/private/{SkTemplates.h → base/SkTemplates.h} +63 -88
- package/cpp/skia/include/private/{SkThreadID.h → base/SkThreadID.h} +5 -2
- package/cpp/skia/include/private/{SkTo.h → base/SkTo.h} +13 -2
- package/cpp/skia/include/private/base/SkTypeTraits.h +33 -0
- package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +130 -0
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +5 -9
- package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +70 -0
- package/cpp/skia/include/private/chromium/Slug.h +0 -9
- package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +2 -1
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +3 -2
- package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +17 -23
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -2
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +38 -0
- package/cpp/skia/include/private/gpu/graphite/{MtlTypesPriv.h → MtlGraphiteTypesPriv.h} +5 -5
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +1 -9
- package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +4 -0
- package/cpp/skia/include/utils/SkCamera.h +1 -1
- package/cpp/skia/include/utils/SkCustomTypeface.h +7 -1
- package/cpp/skia/include/utils/SkNWayCanvas.h +6 -6
- package/cpp/skia/include/utils/SkOrderedFontMgr.h +7 -6
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +2 -2
- package/cpp/skia/include/utils/SkParsePath.h +1 -1
- package/cpp/skia/modules/skcms/skcms.h +14 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +19 -0
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +2 -2
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +72 -2
- package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +1 -11
- package/cpp/skia/modules/skparagraph/include/ParagraphPainter.h +63 -0
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +27 -4
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +13 -13
- package/cpp/skia/modules/skresources/include/SkResources.h +18 -4
- package/cpp/skia/modules/svg/include/SkSVGAttribute.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFilterContext.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGGradient.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGIDMapper.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
- package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +22 -21
- package/cpp/skia/modules/svg/include/SkSVGValue.h +1 -1
- package/cpp/skia/{include/private → src/core}/SkTHash.h +41 -37
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +1 -2
- package/ios/RNSkia-iOS/ViewScreenshotService.mm +1 -1
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.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/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/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.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/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.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/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/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 +1 -1
- package/react-native-skia.podspec +1 -1
- package/scripts/install-npm.js +11 -1
- package/cpp/skia/include/core/SkImageEncoder.h +0 -71
- package/cpp/skia/include/gpu/GrConfig.h +0 -53
- package/cpp/skia/include/gpu/graphite/CombinationBuilder.h +0 -195
- package/cpp/skia/include/private/SkHalf.h +0 -38
- package/cpp/skia/include/private/SkImageInfoPriv.h +0 -199
- package/cpp/skia/include/private/SkSLIRNode.h +0 -64
- package/cpp/skia/include/private/SkSLLayout.h +0 -144
- package/cpp/skia/include/private/SkSLModifiers.h +0 -178
- package/cpp/skia/include/private/SkSLProgramElement.h +0 -77
- package/cpp/skia/include/private/SkSLProgramKind.h +0 -35
- package/cpp/skia/include/private/SkSLStatement.h +0 -86
- package/cpp/skia/include/private/SkSLString.h +0 -41
- package/cpp/skia/include/private/SkSLSymbol.h +0 -94
- package/cpp/skia/include/private/SkSafe_math.h +0 -52
- package/cpp/skia/include/private/SkStringView.h +0 -51
- package/cpp/skia/include/private/SkTArray.h +0 -655
- package/cpp/skia/include/private/SkUniquePaintParamsID.h +0 -35
- package/cpp/skia/include/private/SkVx.h +0 -1026
- package/cpp/skia/include/sksl/DSL.h +0 -37
- package/cpp/skia/include/sksl/DSLBlock.h +0 -58
- package/cpp/skia/include/sksl/DSLCase.h +0 -62
- package/cpp/skia/include/sksl/DSLCore.h +0 -492
- package/cpp/skia/include/sksl/DSLExpression.h +0 -241
- package/cpp/skia/include/sksl/DSLFunction.h +0 -113
- package/cpp/skia/include/sksl/DSLLayout.h +0 -92
- package/cpp/skia/include/sksl/DSLModifiers.h +0 -69
- package/cpp/skia/include/sksl/DSLStatement.h +0 -82
- package/cpp/skia/include/sksl/DSLSymbols.h +0 -61
- package/cpp/skia/include/sksl/DSLType.h +0 -271
- package/cpp/skia/include/sksl/DSLVar.h +0 -231
- package/cpp/skia/include/sksl/SkSLErrorReporter.h +0 -65
- package/cpp/skia/include/sksl/SkSLOperator.h +0 -154
- package/cpp/skia/include/sksl/SkSLPosition.h +0 -104
- package/cpp/skia/include/utils/SkRandom.h +0 -169
- package/cpp/skia/src/core/SkLRUCache.h +0 -126
- package/cpp/skia/src/core/SkTInternalLList.h +0 -302
- /package/cpp/skia/include/{core → codec}/SkPngChunkReader.h +0 -0
- /package/cpp/skia/include/private/{SkTPin.h → base/SkTPin.h} +0 -0
- /package/cpp/skia/include/private/{SkThreadAnnotations.h → base/SkThreadAnnotations.h} +0 -0
@@ -1,241 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2020 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 SKSL_DSL_EXPRESSION
|
9
|
-
#define SKSL_DSL_EXPRESSION
|
10
|
-
|
11
|
-
#include "include/private/SkTArray.h"
|
12
|
-
#include "include/sksl/SkSLOperator.h"
|
13
|
-
#include "include/sksl/SkSLPosition.h"
|
14
|
-
|
15
|
-
#include <cstdint>
|
16
|
-
#include <memory>
|
17
|
-
#include <string>
|
18
|
-
#include <string_view>
|
19
|
-
#include <type_traits>
|
20
|
-
|
21
|
-
#if defined(__has_cpp_attribute) && __has_cpp_attribute(clang::reinitializes)
|
22
|
-
#define SK_CLANG_REINITIALIZES [[clang::reinitializes]]
|
23
|
-
#else
|
24
|
-
#define SK_CLANG_REINITIALIZES
|
25
|
-
#endif
|
26
|
-
|
27
|
-
namespace SkSL {
|
28
|
-
|
29
|
-
class Expression;
|
30
|
-
class ExpressionArray;
|
31
|
-
|
32
|
-
namespace dsl {
|
33
|
-
|
34
|
-
class DSLType;
|
35
|
-
class DSLVarBase;
|
36
|
-
|
37
|
-
/**
|
38
|
-
* Represents an expression such as 'cos(x)' or 'a + b'.
|
39
|
-
*/
|
40
|
-
class DSLExpression {
|
41
|
-
public:
|
42
|
-
DSLExpression(const DSLExpression&) = delete;
|
43
|
-
|
44
|
-
DSLExpression(DSLExpression&&);
|
45
|
-
|
46
|
-
DSLExpression();
|
47
|
-
|
48
|
-
/**
|
49
|
-
* Creates an expression representing a literal float.
|
50
|
-
*/
|
51
|
-
DSLExpression(float value, Position pos = {});
|
52
|
-
|
53
|
-
/**
|
54
|
-
* Creates an expression representing a literal float.
|
55
|
-
*/
|
56
|
-
DSLExpression(double value, Position pos = {})
|
57
|
-
: DSLExpression((float) value) {}
|
58
|
-
|
59
|
-
/**
|
60
|
-
* Creates an expression representing a literal int.
|
61
|
-
*/
|
62
|
-
DSLExpression(int value, Position pos = {});
|
63
|
-
|
64
|
-
/**
|
65
|
-
* Creates an expression representing a literal int.
|
66
|
-
*/
|
67
|
-
DSLExpression(int64_t value, Position pos = {});
|
68
|
-
|
69
|
-
/**
|
70
|
-
* Creates an expression representing a literal uint.
|
71
|
-
*/
|
72
|
-
DSLExpression(unsigned int value, Position pos = {});
|
73
|
-
|
74
|
-
/**
|
75
|
-
* Creates an expression representing a literal bool.
|
76
|
-
*/
|
77
|
-
DSLExpression(bool value, Position pos = {});
|
78
|
-
|
79
|
-
/**
|
80
|
-
* Creates an expression representing a variable reference.
|
81
|
-
*/
|
82
|
-
DSLExpression(DSLVarBase& var, Position pos = {});
|
83
|
-
|
84
|
-
DSLExpression(DSLVarBase&& var, Position pos = {});
|
85
|
-
|
86
|
-
// If expression is null, returns Poison
|
87
|
-
explicit DSLExpression(std::unique_ptr<SkSL::Expression> expression, Position pos = {});
|
88
|
-
|
89
|
-
static DSLExpression Poison(Position pos = {});
|
90
|
-
|
91
|
-
~DSLExpression();
|
92
|
-
|
93
|
-
DSLType type() const;
|
94
|
-
|
95
|
-
std::string description() const;
|
96
|
-
|
97
|
-
Position position() const;
|
98
|
-
|
99
|
-
void setPosition(Position pos);
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Performs assignment, like the '=' operator.
|
103
|
-
*/
|
104
|
-
DSLExpression assign(DSLExpression other);
|
105
|
-
|
106
|
-
DSLExpression x(Position pos = {});
|
107
|
-
|
108
|
-
DSLExpression y(Position pos = {});
|
109
|
-
|
110
|
-
DSLExpression z(Position pos = {});
|
111
|
-
|
112
|
-
DSLExpression w(Position pos = {});
|
113
|
-
|
114
|
-
DSLExpression r(Position pos = {});
|
115
|
-
|
116
|
-
DSLExpression g(Position pos = {});
|
117
|
-
|
118
|
-
DSLExpression b(Position pos = {});
|
119
|
-
|
120
|
-
DSLExpression a(Position pos = {});
|
121
|
-
|
122
|
-
/**
|
123
|
-
* Creates an SkSL struct field access expression.
|
124
|
-
*/
|
125
|
-
DSLExpression field(std::string_view name, Position pos = {});
|
126
|
-
|
127
|
-
/**
|
128
|
-
* Creates an SkSL array index expression.
|
129
|
-
*/
|
130
|
-
DSLExpression operator[](DSLExpression index);
|
131
|
-
|
132
|
-
DSLExpression operator()(SkTArray<DSLExpression, true> args, Position pos = {});
|
133
|
-
|
134
|
-
DSLExpression operator()(ExpressionArray args, Position pos = {});
|
135
|
-
|
136
|
-
/**
|
137
|
-
* Invokes a prefix operator.
|
138
|
-
*/
|
139
|
-
DSLExpression prefix(Operator::Kind op, Position pos);
|
140
|
-
|
141
|
-
/**
|
142
|
-
* Invokes a postfix operator.
|
143
|
-
*/
|
144
|
-
DSLExpression postfix(Operator::Kind op, Position pos);
|
145
|
-
|
146
|
-
/**
|
147
|
-
* Invokes a binary operator.
|
148
|
-
*/
|
149
|
-
DSLExpression binary(Operator::Kind op, DSLExpression right, Position pos);
|
150
|
-
|
151
|
-
/**
|
152
|
-
* Equivalent to operator[].
|
153
|
-
*/
|
154
|
-
DSLExpression index(DSLExpression index, Position pos);
|
155
|
-
|
156
|
-
/**
|
157
|
-
* Returns true if this object contains an expression. DSLExpressions which were created with
|
158
|
-
* the empty constructor or which have already been release()ed do not have a value.
|
159
|
-
* DSLExpressions created with errors are still considered to have a value (but contain poison).
|
160
|
-
*/
|
161
|
-
bool hasValue() const {
|
162
|
-
return fExpression != nullptr;
|
163
|
-
}
|
164
|
-
|
165
|
-
/**
|
166
|
-
* Returns true if this object contains an expression which is not poison.
|
167
|
-
*/
|
168
|
-
bool isValid() const;
|
169
|
-
|
170
|
-
SK_CLANG_REINITIALIZES void swap(DSLExpression& other);
|
171
|
-
|
172
|
-
/**
|
173
|
-
* Invalidates this object and returns the SkSL expression it represents. It is an error to call
|
174
|
-
* this on an invalid DSLExpression.
|
175
|
-
*/
|
176
|
-
std::unique_ptr<SkSL::Expression> release();
|
177
|
-
|
178
|
-
private:
|
179
|
-
/**
|
180
|
-
* Calls release if this expression has a value, otherwise returns null.
|
181
|
-
*/
|
182
|
-
std::unique_ptr<SkSL::Expression> releaseIfPossible();
|
183
|
-
|
184
|
-
std::unique_ptr<SkSL::Expression> fExpression;
|
185
|
-
|
186
|
-
friend DSLExpression SampleChild(int index, DSLExpression coords);
|
187
|
-
|
188
|
-
friend class DSLCore;
|
189
|
-
friend class DSLVarBase;
|
190
|
-
friend class DSLWriter;
|
191
|
-
};
|
192
|
-
|
193
|
-
DSLExpression operator+(DSLExpression left, DSLExpression right);
|
194
|
-
DSLExpression operator+(DSLExpression expr);
|
195
|
-
DSLExpression operator+=(DSLExpression left, DSLExpression right);
|
196
|
-
DSLExpression operator-(DSLExpression left, DSLExpression right);
|
197
|
-
DSLExpression operator-(DSLExpression expr);
|
198
|
-
DSLExpression operator-=(DSLExpression left, DSLExpression right);
|
199
|
-
DSLExpression operator*(DSLExpression left, DSLExpression right);
|
200
|
-
DSLExpression operator*=(DSLExpression left, DSLExpression right);
|
201
|
-
DSLExpression operator/(DSLExpression left, DSLExpression right);
|
202
|
-
DSLExpression operator/=(DSLExpression left, DSLExpression right);
|
203
|
-
DSLExpression operator%(DSLExpression left, DSLExpression right);
|
204
|
-
DSLExpression operator%=(DSLExpression left, DSLExpression right);
|
205
|
-
DSLExpression operator<<(DSLExpression left, DSLExpression right);
|
206
|
-
DSLExpression operator<<=(DSLExpression left, DSLExpression right);
|
207
|
-
DSLExpression operator>>(DSLExpression left, DSLExpression right);
|
208
|
-
DSLExpression operator>>=(DSLExpression left, DSLExpression right);
|
209
|
-
DSLExpression operator&&(DSLExpression left, DSLExpression right);
|
210
|
-
DSLExpression operator||(DSLExpression left, DSLExpression right);
|
211
|
-
DSLExpression operator&(DSLExpression left, DSLExpression right);
|
212
|
-
DSLExpression operator&=(DSLExpression left, DSLExpression right);
|
213
|
-
DSLExpression operator|(DSLExpression left, DSLExpression right);
|
214
|
-
DSLExpression operator|=(DSLExpression left, DSLExpression right);
|
215
|
-
DSLExpression operator^(DSLExpression left, DSLExpression right);
|
216
|
-
DSLExpression operator^=(DSLExpression left, DSLExpression right);
|
217
|
-
DSLExpression LogicalXor(DSLExpression left, DSLExpression right);
|
218
|
-
DSLExpression operator,(DSLExpression left, DSLExpression right);
|
219
|
-
DSLExpression operator==(DSLExpression left, DSLExpression right);
|
220
|
-
DSLExpression operator!=(DSLExpression left, DSLExpression right);
|
221
|
-
DSLExpression operator>(DSLExpression left, DSLExpression right);
|
222
|
-
DSLExpression operator<(DSLExpression left, DSLExpression right);
|
223
|
-
DSLExpression operator>=(DSLExpression left, DSLExpression right);
|
224
|
-
DSLExpression operator<=(DSLExpression left, DSLExpression right);
|
225
|
-
DSLExpression operator!(DSLExpression expr);
|
226
|
-
DSLExpression operator~(DSLExpression expr);
|
227
|
-
DSLExpression operator++(DSLExpression expr);
|
228
|
-
DSLExpression operator++(DSLExpression expr, int);
|
229
|
-
DSLExpression operator--(DSLExpression expr);
|
230
|
-
DSLExpression operator--(DSLExpression expr, int);
|
231
|
-
|
232
|
-
} // namespace dsl
|
233
|
-
|
234
|
-
} // namespace SkSL
|
235
|
-
|
236
|
-
template <typename T> struct sk_is_trivially_relocatable;
|
237
|
-
|
238
|
-
template <>
|
239
|
-
struct sk_is_trivially_relocatable<SkSL::dsl::DSLExpression> : std::true_type {};
|
240
|
-
|
241
|
-
#endif
|
@@ -1,113 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2021 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 SKSL_DSL_FUNCTION
|
9
|
-
#define SKSL_DSL_FUNCTION
|
10
|
-
|
11
|
-
#include "include/private/SkSLDefines.h"
|
12
|
-
#include "include/private/SkTArray.h"
|
13
|
-
#include "include/sksl/DSLBlock.h"
|
14
|
-
#include "include/sksl/DSLExpression.h"
|
15
|
-
#include "include/sksl/DSLModifiers.h"
|
16
|
-
#include "include/sksl/DSLStatement.h"
|
17
|
-
#include "include/sksl/DSLVar.h"
|
18
|
-
#include "include/sksl/SkSLPosition.h"
|
19
|
-
|
20
|
-
#include <string_view>
|
21
|
-
#include <utility>
|
22
|
-
|
23
|
-
namespace SkSL {
|
24
|
-
|
25
|
-
class FunctionDeclaration;
|
26
|
-
|
27
|
-
namespace dsl {
|
28
|
-
|
29
|
-
class DSLType;
|
30
|
-
|
31
|
-
class DSLFunction {
|
32
|
-
public:
|
33
|
-
template<class... Parameters>
|
34
|
-
DSLFunction(const DSLType& returnType, std::string_view name, Parameters&... parameters)
|
35
|
-
: DSLFunction(DSLModifiers(), returnType, name, parameters...) {}
|
36
|
-
|
37
|
-
template<class... Parameters>
|
38
|
-
DSLFunction(const DSLModifiers& modifiers, const DSLType& returnType, std::string_view name,
|
39
|
-
Parameters&... parameters) {
|
40
|
-
SkTArray<DSLParameter*> parameterArray;
|
41
|
-
parameterArray.reserve_back(sizeof...(parameters));
|
42
|
-
(parameterArray.push_back(¶meters), ...);
|
43
|
-
|
44
|
-
// We can't have a default parameter and a template parameter pack at the same time, so
|
45
|
-
// unfortunately we can't capture position from this overload.
|
46
|
-
this->init(modifiers, returnType, name, std::move(parameterArray), Position());
|
47
|
-
}
|
48
|
-
|
49
|
-
DSLFunction(std::string_view name, const DSLModifiers& modifiers, const DSLType& returnType,
|
50
|
-
SkTArray<DSLParameter*> parameters, Position pos = {}) {
|
51
|
-
this->init(modifiers, returnType, name, std::move(parameters), pos);
|
52
|
-
}
|
53
|
-
|
54
|
-
DSLFunction(SkSL::FunctionDeclaration* decl)
|
55
|
-
: fDecl(decl) {}
|
56
|
-
|
57
|
-
virtual ~DSLFunction() = default;
|
58
|
-
|
59
|
-
template<class... Stmt>
|
60
|
-
void define(Stmt... stmts) {
|
61
|
-
DSLBlock block = DSLBlock(DSLStatement(std::move(stmts))...);
|
62
|
-
this->define(std::move(block));
|
63
|
-
}
|
64
|
-
|
65
|
-
void define(DSLBlock block, Position pos = {});
|
66
|
-
|
67
|
-
void prototype();
|
68
|
-
|
69
|
-
/**
|
70
|
-
* Invokes the function with the given arguments.
|
71
|
-
*/
|
72
|
-
template<class... Args>
|
73
|
-
DSLExpression operator()(Args&&... args) {
|
74
|
-
ExpressionArray argArray;
|
75
|
-
argArray.reserve_back(sizeof...(args));
|
76
|
-
this->collectArgs(argArray, std::forward<Args>(args)...);
|
77
|
-
return this->call(std::move(argArray));
|
78
|
-
}
|
79
|
-
|
80
|
-
/**
|
81
|
-
* Invokes the function with the given arguments.
|
82
|
-
*/
|
83
|
-
DSLExpression call(SkTArray<DSLExpression> args, Position pos = {});
|
84
|
-
|
85
|
-
DSLExpression call(ExpressionArray args, Position pos = {});
|
86
|
-
|
87
|
-
private:
|
88
|
-
void collectArgs(ExpressionArray& args) {}
|
89
|
-
|
90
|
-
template<class... RemainingArgs>
|
91
|
-
void collectArgs(ExpressionArray& args, DSLVar& var, RemainingArgs&&... remaining) {
|
92
|
-
args.push_back(DSLExpression(var).release());
|
93
|
-
collectArgs(args, std::forward<RemainingArgs>(remaining)...);
|
94
|
-
}
|
95
|
-
|
96
|
-
template<class... RemainingArgs>
|
97
|
-
void collectArgs(ExpressionArray& args, DSLExpression expr, RemainingArgs&&... remaining) {
|
98
|
-
args.push_back(expr.release());
|
99
|
-
collectArgs(args, std::forward<RemainingArgs>(remaining)...);
|
100
|
-
}
|
101
|
-
|
102
|
-
void init(DSLModifiers modifiers, const DSLType& returnType, std::string_view name,
|
103
|
-
SkTArray<DSLParameter*> params, Position pos);
|
104
|
-
|
105
|
-
SkSL::FunctionDeclaration* fDecl = nullptr;
|
106
|
-
SkSL::Position fPosition;
|
107
|
-
};
|
108
|
-
|
109
|
-
} // namespace dsl
|
110
|
-
|
111
|
-
} // namespace SkSL
|
112
|
-
|
113
|
-
#endif
|
@@ -1,92 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2021 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 SKSL_DSL_LAYOUT
|
9
|
-
#define SKSL_DSL_LAYOUT
|
10
|
-
|
11
|
-
#include "include/private/SkSLLayout.h"
|
12
|
-
#include "include/sksl/SkSLPosition.h"
|
13
|
-
|
14
|
-
namespace SkSL {
|
15
|
-
|
16
|
-
namespace dsl {
|
17
|
-
|
18
|
-
class DSLLayout {
|
19
|
-
public:
|
20
|
-
DSLLayout() {}
|
21
|
-
|
22
|
-
DSLLayout& originUpperLeft(Position pos = {}) {
|
23
|
-
return this->flag(SkSL::Layout::kOriginUpperLeft_Flag, "origin_upper_left", pos);
|
24
|
-
}
|
25
|
-
|
26
|
-
DSLLayout& pushConstant(Position pos = {}) {
|
27
|
-
return this->flag(SkSL::Layout::kPushConstant_Flag, "push_constant", pos);
|
28
|
-
}
|
29
|
-
|
30
|
-
DSLLayout& blendSupportAllEquations(Position pos = {}) {
|
31
|
-
return this->flag(SkSL::Layout::kBlendSupportAllEquations_Flag,
|
32
|
-
"blend_support_all_equations", pos);
|
33
|
-
}
|
34
|
-
|
35
|
-
DSLLayout& color(Position pos = {}) {
|
36
|
-
return this->flag(SkSL::Layout::kColor_Flag, "color", pos);
|
37
|
-
}
|
38
|
-
|
39
|
-
DSLLayout& location(int location, Position pos = {}) {
|
40
|
-
return this->intValue(&fSkSLLayout.fLocation, location, SkSL::Layout::kLocation_Flag,
|
41
|
-
"location", pos);
|
42
|
-
}
|
43
|
-
|
44
|
-
DSLLayout& offset(int offset, Position pos = {}) {
|
45
|
-
return this->intValue(&fSkSLLayout.fOffset, offset, SkSL::Layout::kOffset_Flag, "offset",
|
46
|
-
pos);
|
47
|
-
}
|
48
|
-
|
49
|
-
DSLLayout& binding(int binding, Position pos = {}) {
|
50
|
-
return this->intValue(&fSkSLLayout.fBinding, binding, SkSL::Layout::kBinding_Flag,
|
51
|
-
"binding", pos);
|
52
|
-
}
|
53
|
-
|
54
|
-
DSLLayout& index(int index, Position pos = {}) {
|
55
|
-
return this->intValue(&fSkSLLayout.fIndex, index, SkSL::Layout::kIndex_Flag, "index", pos);
|
56
|
-
}
|
57
|
-
|
58
|
-
DSLLayout& set(int set, Position pos = {}) {
|
59
|
-
return this->intValue(&fSkSLLayout.fSet, set, SkSL::Layout::kSet_Flag, "set", pos);
|
60
|
-
}
|
61
|
-
|
62
|
-
DSLLayout& builtin(int builtin, Position pos = {}) {
|
63
|
-
return this->intValue(&fSkSLLayout.fBuiltin, builtin, SkSL::Layout::kBuiltin_Flag,
|
64
|
-
"builtin", pos);
|
65
|
-
}
|
66
|
-
|
67
|
-
DSLLayout& inputAttachmentIndex(int inputAttachmentIndex,
|
68
|
-
Position pos = {}) {
|
69
|
-
return this->intValue(&fSkSLLayout.fInputAttachmentIndex, inputAttachmentIndex,
|
70
|
-
SkSL::Layout::kInputAttachmentIndex_Flag, "input_attachment_index",
|
71
|
-
pos);
|
72
|
-
}
|
73
|
-
|
74
|
-
private:
|
75
|
-
explicit DSLLayout(SkSL::Layout skslLayout)
|
76
|
-
: fSkSLLayout(skslLayout) {}
|
77
|
-
|
78
|
-
DSLLayout& flag(SkSL::Layout::Flag mask, const char* name, Position pos);
|
79
|
-
|
80
|
-
DSLLayout& intValue(int* target, int value, SkSL::Layout::Flag flag, const char* name,
|
81
|
-
Position pos);
|
82
|
-
|
83
|
-
SkSL::Layout fSkSLLayout;
|
84
|
-
|
85
|
-
friend class DSLModifiers;
|
86
|
-
};
|
87
|
-
|
88
|
-
} // namespace dsl
|
89
|
-
|
90
|
-
} // namespace SkSL
|
91
|
-
|
92
|
-
#endif
|
@@ -1,69 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2020 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 SKSL_DSL_MODIFIERS
|
9
|
-
#define SKSL_DSL_MODIFIERS
|
10
|
-
|
11
|
-
#include "include/core/SkSpan.h"
|
12
|
-
#include "include/private/SkSLModifiers.h"
|
13
|
-
#include "include/sksl/DSLLayout.h"
|
14
|
-
|
15
|
-
namespace SkSL {
|
16
|
-
|
17
|
-
namespace dsl {
|
18
|
-
|
19
|
-
class DSLField;
|
20
|
-
class DSLType;
|
21
|
-
|
22
|
-
enum Modifier {
|
23
|
-
kNo_Modifier = SkSL::Modifiers::kNo_Flag,
|
24
|
-
kConst_Modifier = SkSL::Modifiers::kConst_Flag,
|
25
|
-
kIn_Modifier = SkSL::Modifiers::kIn_Flag,
|
26
|
-
kOut_Modifier = SkSL::Modifiers::kOut_Flag,
|
27
|
-
kInOut_Modifier = SkSL::Modifiers::kIn_Flag | SkSL::Modifiers::kOut_Flag,
|
28
|
-
kUniform_Modifier = SkSL::Modifiers::kUniform_Flag,
|
29
|
-
kFlat_Modifier = SkSL::Modifiers::kFlat_Flag,
|
30
|
-
kNoPerspective_Modifier = SkSL::Modifiers::kNoPerspective_Flag,
|
31
|
-
};
|
32
|
-
|
33
|
-
class DSLModifiers {
|
34
|
-
public:
|
35
|
-
DSLModifiers(int flags = 0, Position pos = {})
|
36
|
-
: DSLModifiers(DSLLayout(), flags, pos) {}
|
37
|
-
|
38
|
-
DSLModifiers(DSLLayout layout, int flags = 0, Position pos = {})
|
39
|
-
: fModifiers(layout.fSkSLLayout, flags)
|
40
|
-
, fPosition(pos) {}
|
41
|
-
|
42
|
-
int& flags() {
|
43
|
-
return fModifiers.fFlags;
|
44
|
-
}
|
45
|
-
|
46
|
-
const int& flags() const {
|
47
|
-
return fModifiers.fFlags;
|
48
|
-
}
|
49
|
-
|
50
|
-
DSLLayout layout() const {
|
51
|
-
return DSLLayout(fModifiers.fLayout);
|
52
|
-
}
|
53
|
-
|
54
|
-
private:
|
55
|
-
SkSL::Modifiers fModifiers;
|
56
|
-
Position fPosition;
|
57
|
-
|
58
|
-
friend DSLType Struct(std::string_view name, SkSpan<DSLField> fields, Position pos);
|
59
|
-
friend class DSLCore;
|
60
|
-
friend class DSLFunction;
|
61
|
-
friend class DSLType;
|
62
|
-
friend class DSLWriter;
|
63
|
-
};
|
64
|
-
|
65
|
-
} // namespace dsl
|
66
|
-
|
67
|
-
} // namespace SkSL
|
68
|
-
|
69
|
-
#endif
|
@@ -1,82 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2021 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 SKSL_DSL_STATEMENT
|
9
|
-
#define SKSL_DSL_STATEMENT
|
10
|
-
|
11
|
-
#include "include/core/SkTypes.h"
|
12
|
-
#include "include/private/SkSLStatement.h"
|
13
|
-
#include "include/sksl/SkSLPosition.h"
|
14
|
-
|
15
|
-
#include <memory>
|
16
|
-
#include <utility>
|
17
|
-
|
18
|
-
namespace SkSL {
|
19
|
-
|
20
|
-
class Expression;
|
21
|
-
|
22
|
-
namespace dsl {
|
23
|
-
|
24
|
-
class DSLBlock;
|
25
|
-
class DSLExpression;
|
26
|
-
|
27
|
-
class DSLStatement {
|
28
|
-
public:
|
29
|
-
DSLStatement();
|
30
|
-
|
31
|
-
DSLStatement(DSLExpression expr);
|
32
|
-
|
33
|
-
DSLStatement(DSLBlock block);
|
34
|
-
|
35
|
-
DSLStatement(DSLStatement&&) = default;
|
36
|
-
|
37
|
-
DSLStatement(std::unique_ptr<SkSL::Expression> expr);
|
38
|
-
|
39
|
-
DSLStatement(std::unique_ptr<SkSL::Statement> stmt, Position pos);
|
40
|
-
|
41
|
-
DSLStatement(std::unique_ptr<SkSL::Statement> stmt);
|
42
|
-
|
43
|
-
~DSLStatement();
|
44
|
-
|
45
|
-
DSLStatement& operator=(DSLStatement&& other) = default;
|
46
|
-
|
47
|
-
Position position() {
|
48
|
-
SkASSERT(this->hasValue());
|
49
|
-
return fStatement->fPosition;
|
50
|
-
}
|
51
|
-
|
52
|
-
void setPosition(Position pos) {
|
53
|
-
SkASSERT(this->hasValue());
|
54
|
-
fStatement->fPosition = pos;
|
55
|
-
}
|
56
|
-
|
57
|
-
bool hasValue() { return fStatement != nullptr; }
|
58
|
-
|
59
|
-
std::unique_ptr<SkSL::Statement> release() {
|
60
|
-
SkASSERT(this->hasValue());
|
61
|
-
return std::move(fStatement);
|
62
|
-
}
|
63
|
-
|
64
|
-
private:
|
65
|
-
std::unique_ptr<SkSL::Statement> releaseIfPossible() {
|
66
|
-
return std::move(fStatement);
|
67
|
-
}
|
68
|
-
|
69
|
-
std::unique_ptr<SkSL::Statement> fStatement;
|
70
|
-
|
71
|
-
friend class DSLCore;
|
72
|
-
friend class DSLWriter;
|
73
|
-
friend DSLStatement operator,(DSLStatement left, DSLStatement right);
|
74
|
-
};
|
75
|
-
|
76
|
-
DSLStatement operator,(DSLStatement left, DSLStatement right);
|
77
|
-
|
78
|
-
} // namespace dsl
|
79
|
-
|
80
|
-
} // namespace SkSL
|
81
|
-
|
82
|
-
#endif
|
@@ -1,61 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2021 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 SKSL_DSL_SYMBOLS
|
9
|
-
#define SKSL_DSL_SYMBOLS
|
10
|
-
|
11
|
-
#include "include/sksl/DSLExpression.h"
|
12
|
-
|
13
|
-
#include <memory>
|
14
|
-
#include <string_view>
|
15
|
-
|
16
|
-
namespace SkSL {
|
17
|
-
|
18
|
-
class Position;
|
19
|
-
class SymbolTable;
|
20
|
-
|
21
|
-
namespace dsl {
|
22
|
-
|
23
|
-
class DSLVarBase;
|
24
|
-
|
25
|
-
// This header provides methods for manually managing symbol tables in DSL code. They should not be
|
26
|
-
// used by normal hand-written DSL code, where we rely on C++ to manage symbols, but are instead
|
27
|
-
// needed when DSL objects are being constructed programmatically (as in Parser).
|
28
|
-
|
29
|
-
/**
|
30
|
-
* Pushes a new symbol table onto the symbol table stack.
|
31
|
-
*/
|
32
|
-
void PushSymbolTable();
|
33
|
-
|
34
|
-
/**
|
35
|
-
* Pops the top symbol table from the stack. As symbol tables are shared pointers, this will only
|
36
|
-
* destroy the symbol table if it was never attached to anything (e.g. passed into a Block
|
37
|
-
* constructor).
|
38
|
-
*/
|
39
|
-
void PopSymbolTable();
|
40
|
-
|
41
|
-
/**
|
42
|
-
* Returns the current symbol table. Outside of SkSL itself, this is an opaque pointer, used only
|
43
|
-
* for passing it to DSL methods that require it.
|
44
|
-
*/
|
45
|
-
std::shared_ptr<SymbolTable> CurrentSymbolTable();
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Returns an expression referring to the named symbol.
|
49
|
-
*/
|
50
|
-
DSLExpression Symbol(std::string_view name, Position pos = {});
|
51
|
-
|
52
|
-
/**
|
53
|
-
* Adds a variable to the current symbol table.
|
54
|
-
*/
|
55
|
-
void AddToSymbolTable(DSLVarBase& var, Position pos = {});
|
56
|
-
|
57
|
-
} // namespace dsl
|
58
|
-
|
59
|
-
} // namespace SkSL
|
60
|
-
|
61
|
-
#endif
|