@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,271 +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_TYPE
|
9
|
-
#define SKSL_DSL_TYPE
|
10
|
-
|
11
|
-
#include "include/core/SkSpan.h"
|
12
|
-
#include "include/core/SkTypes.h"
|
13
|
-
#include "include/sksl/DSLExpression.h"
|
14
|
-
#include "include/sksl/DSLModifiers.h"
|
15
|
-
#include "include/sksl/SkSLPosition.h"
|
16
|
-
|
17
|
-
#include <cstdint>
|
18
|
-
#include <string_view>
|
19
|
-
#include <utility>
|
20
|
-
|
21
|
-
namespace SkSL {
|
22
|
-
|
23
|
-
class Compiler;
|
24
|
-
class Type;
|
25
|
-
|
26
|
-
namespace dsl {
|
27
|
-
|
28
|
-
class DSLField;
|
29
|
-
class DSLVarBase;
|
30
|
-
|
31
|
-
enum TypeConstant : uint8_t {
|
32
|
-
kBool_Type,
|
33
|
-
kBool2_Type,
|
34
|
-
kBool3_Type,
|
35
|
-
kBool4_Type,
|
36
|
-
kHalf_Type,
|
37
|
-
kHalf2_Type,
|
38
|
-
kHalf3_Type,
|
39
|
-
kHalf4_Type,
|
40
|
-
kHalf2x2_Type,
|
41
|
-
kHalf3x2_Type,
|
42
|
-
kHalf4x2_Type,
|
43
|
-
kHalf2x3_Type,
|
44
|
-
kHalf3x3_Type,
|
45
|
-
kHalf4x3_Type,
|
46
|
-
kHalf2x4_Type,
|
47
|
-
kHalf3x4_Type,
|
48
|
-
kHalf4x4_Type,
|
49
|
-
kFloat_Type,
|
50
|
-
kFloat2_Type,
|
51
|
-
kFloat3_Type,
|
52
|
-
kFloat4_Type,
|
53
|
-
kFragmentProcessor_Type,
|
54
|
-
kFloat2x2_Type,
|
55
|
-
kFloat3x2_Type,
|
56
|
-
kFloat4x2_Type,
|
57
|
-
kFloat2x3_Type,
|
58
|
-
kFloat3x3_Type,
|
59
|
-
kFloat4x3_Type,
|
60
|
-
kFloat2x4_Type,
|
61
|
-
kFloat3x4_Type,
|
62
|
-
kFloat4x4_Type,
|
63
|
-
kInt_Type,
|
64
|
-
kInt2_Type,
|
65
|
-
kInt3_Type,
|
66
|
-
kInt4_Type,
|
67
|
-
kShader_Type,
|
68
|
-
kShort_Type,
|
69
|
-
kShort2_Type,
|
70
|
-
kShort3_Type,
|
71
|
-
kShort4_Type,
|
72
|
-
kUInt_Type,
|
73
|
-
kUInt2_Type,
|
74
|
-
kUInt3_Type,
|
75
|
-
kUInt4_Type,
|
76
|
-
kUShort_Type,
|
77
|
-
kUShort2_Type,
|
78
|
-
kUShort3_Type,
|
79
|
-
kUShort4_Type,
|
80
|
-
kVoid_Type,
|
81
|
-
kPoison_Type,
|
82
|
-
};
|
83
|
-
|
84
|
-
class DSLType {
|
85
|
-
public:
|
86
|
-
DSLType(TypeConstant tc, Position pos = {});
|
87
|
-
|
88
|
-
DSLType(const SkSL::Type* type, Position pos = {});
|
89
|
-
|
90
|
-
DSLType(std::string_view name, Position pos = {});
|
91
|
-
|
92
|
-
DSLType(std::string_view name,
|
93
|
-
DSLModifiers* modifiers,
|
94
|
-
Position pos = {});
|
95
|
-
|
96
|
-
/**
|
97
|
-
* Returns true if the SkSL type is non-null.
|
98
|
-
*/
|
99
|
-
bool hasValue() const { return fSkSLType != nullptr; }
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Returns true if this type is a bool.
|
103
|
-
*/
|
104
|
-
bool isBoolean() const;
|
105
|
-
|
106
|
-
/**
|
107
|
-
* Returns true if this is a numeric scalar type.
|
108
|
-
*/
|
109
|
-
bool isNumber() const;
|
110
|
-
|
111
|
-
/**
|
112
|
-
* Returns true if this is a floating-point scalar type (float or half).
|
113
|
-
*/
|
114
|
-
bool isFloat() const;
|
115
|
-
|
116
|
-
/**
|
117
|
-
* Returns true if this is a signed scalar type (int or short).
|
118
|
-
*/
|
119
|
-
bool isSigned() const;
|
120
|
-
|
121
|
-
/**
|
122
|
-
* Returns true if this is an unsigned scalar type (uint or ushort).
|
123
|
-
*/
|
124
|
-
bool isUnsigned() const;
|
125
|
-
|
126
|
-
/**
|
127
|
-
* Returns true if this is a signed or unsigned integer.
|
128
|
-
*/
|
129
|
-
bool isInteger() const;
|
130
|
-
|
131
|
-
/**
|
132
|
-
* Returns true if this is a scalar type.
|
133
|
-
*/
|
134
|
-
bool isScalar() const;
|
135
|
-
|
136
|
-
/**
|
137
|
-
* Returns true if this is a vector type.
|
138
|
-
*/
|
139
|
-
bool isVector() const;
|
140
|
-
|
141
|
-
/**
|
142
|
-
* Returns true if this is a matrix type.
|
143
|
-
*/
|
144
|
-
bool isMatrix() const;
|
145
|
-
|
146
|
-
/**
|
147
|
-
* Returns true if this is a array type.
|
148
|
-
*/
|
149
|
-
bool isArray() const;
|
150
|
-
|
151
|
-
/**
|
152
|
-
* Returns true if this is a struct type.
|
153
|
-
*/
|
154
|
-
bool isStruct() const;
|
155
|
-
|
156
|
-
/**
|
157
|
-
* Returns true if this is a Skia object type (shader, colorFilter, blender).
|
158
|
-
*/
|
159
|
-
bool isEffectChild() const;
|
160
|
-
|
161
|
-
template<typename... Args>
|
162
|
-
static DSLExpression Construct(DSLType type, DSLVarBase& var, Args&&... args) {
|
163
|
-
DSLExpression argArray[] = {var, args...};
|
164
|
-
return Construct(type, SkSpan(argArray));
|
165
|
-
}
|
166
|
-
|
167
|
-
template<typename... Args>
|
168
|
-
static DSLExpression Construct(DSLType type, DSLExpression expr, Args&&... args) {
|
169
|
-
DSLExpression argArray[] = {std::move(expr), std::move(args)...};
|
170
|
-
return Construct(type, SkSpan(argArray));
|
171
|
-
}
|
172
|
-
|
173
|
-
static DSLExpression Construct(DSLType type, SkSpan<DSLExpression> argArray);
|
174
|
-
|
175
|
-
private:
|
176
|
-
const SkSL::Type& skslType() const {
|
177
|
-
SkASSERT(fSkSLType);
|
178
|
-
return *fSkSLType;
|
179
|
-
}
|
180
|
-
|
181
|
-
const SkSL::Type* fSkSLType = nullptr;
|
182
|
-
|
183
|
-
friend DSLType Array(const DSLType& base, int count, Position pos);
|
184
|
-
friend DSLType Struct(std::string_view name, SkSpan<DSLField> fields, Position pos);
|
185
|
-
friend DSLType UnsizedArray(const DSLType& base, Position pos);
|
186
|
-
friend class DSLCore;
|
187
|
-
friend class DSLFunction;
|
188
|
-
friend class DSLVarBase;
|
189
|
-
friend class DSLWriter;
|
190
|
-
friend class SkSL::Compiler;
|
191
|
-
};
|
192
|
-
|
193
|
-
#define TYPE(T) \
|
194
|
-
template<typename... Args> \
|
195
|
-
DSLExpression T(Args&&... args) { \
|
196
|
-
return DSLType::Construct(k ## T ## _Type, std::forward<Args>(args)...); \
|
197
|
-
}
|
198
|
-
|
199
|
-
#define VECTOR_TYPE(T) \
|
200
|
-
TYPE(T) \
|
201
|
-
TYPE(T ## 2) \
|
202
|
-
TYPE(T ## 3) \
|
203
|
-
TYPE(T ## 4)
|
204
|
-
|
205
|
-
#define MATRIX_TYPE(T) \
|
206
|
-
TYPE(T ## 2x2) \
|
207
|
-
TYPE(T ## 3x2) \
|
208
|
-
TYPE(T ## 4x2) \
|
209
|
-
TYPE(T ## 2x3) \
|
210
|
-
TYPE(T ## 3x3) \
|
211
|
-
TYPE(T ## 4x3) \
|
212
|
-
TYPE(T ## 2x4) \
|
213
|
-
TYPE(T ## 3x4) \
|
214
|
-
TYPE(T ## 4x4)
|
215
|
-
|
216
|
-
VECTOR_TYPE(Bool)
|
217
|
-
VECTOR_TYPE(Float)
|
218
|
-
VECTOR_TYPE(Half)
|
219
|
-
VECTOR_TYPE(Int)
|
220
|
-
VECTOR_TYPE(UInt)
|
221
|
-
VECTOR_TYPE(Short)
|
222
|
-
VECTOR_TYPE(UShort)
|
223
|
-
|
224
|
-
MATRIX_TYPE(Float)
|
225
|
-
MATRIX_TYPE(Half)
|
226
|
-
|
227
|
-
#undef TYPE
|
228
|
-
#undef VECTOR_TYPE
|
229
|
-
#undef MATRIX_TYPE
|
230
|
-
|
231
|
-
DSLType Array(const DSLType& base, int count, Position pos = {});
|
232
|
-
|
233
|
-
DSLType UnsizedArray(const DSLType& base, Position pos = {});
|
234
|
-
|
235
|
-
class DSLField {
|
236
|
-
public:
|
237
|
-
DSLField(const DSLType type, std::string_view name,
|
238
|
-
Position pos = {})
|
239
|
-
: DSLField(DSLModifiers(), type, name, pos) {}
|
240
|
-
|
241
|
-
DSLField(const DSLModifiers& modifiers, const DSLType type, std::string_view name,
|
242
|
-
Position pos = {})
|
243
|
-
: fModifiers(modifiers)
|
244
|
-
, fType(type)
|
245
|
-
, fName(name)
|
246
|
-
, fPosition(pos) {}
|
247
|
-
|
248
|
-
private:
|
249
|
-
DSLModifiers fModifiers;
|
250
|
-
const DSLType fType;
|
251
|
-
std::string_view fName;
|
252
|
-
Position fPosition;
|
253
|
-
|
254
|
-
friend class DSLCore;
|
255
|
-
friend DSLType Struct(std::string_view name, SkSpan<DSLField> fields, Position pos);
|
256
|
-
};
|
257
|
-
|
258
|
-
DSLType Struct(std::string_view name, SkSpan<DSLField> fields,
|
259
|
-
Position pos = {});
|
260
|
-
|
261
|
-
template<typename... Field>
|
262
|
-
DSLType Struct(std::string_view name, Field... fields) {
|
263
|
-
DSLField fieldTypes[] = {std::move(fields)...};
|
264
|
-
return Struct(name, SkSpan(fieldTypes), Position());
|
265
|
-
}
|
266
|
-
|
267
|
-
} // namespace dsl
|
268
|
-
|
269
|
-
} // namespace SkSL
|
270
|
-
|
271
|
-
#endif
|
@@ -1,231 +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_VAR
|
9
|
-
#define SKSL_DSL_VAR
|
10
|
-
|
11
|
-
#include "include/private/SkSLStatement.h"
|
12
|
-
#include "include/sksl/DSLExpression.h"
|
13
|
-
#include "include/sksl/DSLModifiers.h"
|
14
|
-
#include "include/sksl/DSLType.h"
|
15
|
-
#include "include/sksl/SkSLPosition.h"
|
16
|
-
|
17
|
-
#include <cstdint>
|
18
|
-
#include <memory>
|
19
|
-
#include <string_view>
|
20
|
-
#include <utility>
|
21
|
-
|
22
|
-
namespace SkSL {
|
23
|
-
|
24
|
-
class Expression;
|
25
|
-
class ExpressionArray;
|
26
|
-
class Variable;
|
27
|
-
enum class VariableStorage : int8_t;
|
28
|
-
|
29
|
-
namespace dsl {
|
30
|
-
|
31
|
-
class DSLVarBase {
|
32
|
-
public:
|
33
|
-
/**
|
34
|
-
* Constructs a new variable with the specified type and name.
|
35
|
-
*/
|
36
|
-
DSLVarBase(VariableStorage storage, DSLType type, std::string_view name,
|
37
|
-
DSLExpression initialValue, Position pos, Position namePos);
|
38
|
-
|
39
|
-
DSLVarBase(VariableStorage storage, const DSLModifiers& modifiers, DSLType type,
|
40
|
-
std::string_view name, DSLExpression initialValue, Position pos, Position namePos);
|
41
|
-
|
42
|
-
DSLVarBase(DSLVarBase&&) = default;
|
43
|
-
|
44
|
-
std::string_view name() const {
|
45
|
-
return fName;
|
46
|
-
}
|
47
|
-
|
48
|
-
const DSLModifiers& modifiers() const {
|
49
|
-
return fModifiers;
|
50
|
-
}
|
51
|
-
|
52
|
-
VariableStorage storage() const {
|
53
|
-
return fStorage;
|
54
|
-
}
|
55
|
-
|
56
|
-
DSLExpression x() {
|
57
|
-
return DSLExpression(*this).x();
|
58
|
-
}
|
59
|
-
|
60
|
-
DSLExpression y() {
|
61
|
-
return DSLExpression(*this).y();
|
62
|
-
}
|
63
|
-
|
64
|
-
DSLExpression z() {
|
65
|
-
return DSLExpression(*this).z();
|
66
|
-
}
|
67
|
-
|
68
|
-
DSLExpression w() {
|
69
|
-
return DSLExpression(*this).w();
|
70
|
-
}
|
71
|
-
|
72
|
-
DSLExpression r() {
|
73
|
-
return DSLExpression(*this).r();
|
74
|
-
}
|
75
|
-
|
76
|
-
DSLExpression g() {
|
77
|
-
return DSLExpression(*this).g();
|
78
|
-
}
|
79
|
-
|
80
|
-
DSLExpression b() {
|
81
|
-
return DSLExpression(*this).b();
|
82
|
-
}
|
83
|
-
|
84
|
-
DSLExpression a() {
|
85
|
-
return DSLExpression(*this).a();
|
86
|
-
}
|
87
|
-
|
88
|
-
DSLExpression field(std::string_view name) {
|
89
|
-
return DSLExpression(*this).field(name);
|
90
|
-
}
|
91
|
-
|
92
|
-
DSLExpression operator[](DSLExpression&& index);
|
93
|
-
|
94
|
-
DSLExpression operator++() {
|
95
|
-
return ++DSLExpression(*this);
|
96
|
-
}
|
97
|
-
|
98
|
-
DSLExpression operator++(int) {
|
99
|
-
return DSLExpression(*this)++;
|
100
|
-
}
|
101
|
-
|
102
|
-
DSLExpression operator--() {
|
103
|
-
return --DSLExpression(*this);
|
104
|
-
}
|
105
|
-
|
106
|
-
DSLExpression operator--(int) {
|
107
|
-
return DSLExpression(*this)--;
|
108
|
-
}
|
109
|
-
|
110
|
-
template <class T> DSLExpression assign(T&& param) {
|
111
|
-
return this->assignExpression(DSLExpression(std::forward<T>(param)));
|
112
|
-
}
|
113
|
-
|
114
|
-
protected:
|
115
|
-
/**
|
116
|
-
* Creates an empty, unpopulated var. Can be replaced with a real var later via `swap`.
|
117
|
-
*/
|
118
|
-
DSLVarBase(VariableStorage storage) : fType(kVoid_Type), fStorage(storage) {}
|
119
|
-
|
120
|
-
DSLExpression assignExpression(DSLExpression other);
|
121
|
-
|
122
|
-
void swap(DSLVarBase& other);
|
123
|
-
|
124
|
-
DSLModifiers fModifiers;
|
125
|
-
// We only need to keep track of the type here so that we can create the SkSL::Variable. For
|
126
|
-
// predefined variables this field is unnecessary, so we don't bother tracking it and just set
|
127
|
-
// it to kVoid; in other words, you shouldn't generally be relying on this field to be correct.
|
128
|
-
// If you need to determine the variable's type, look at DSLWriter::Var(...)->type() instead.
|
129
|
-
DSLType fType;
|
130
|
-
std::unique_ptr<SkSL::Statement> fDeclaration;
|
131
|
-
SkSL::Variable* fVar = nullptr;
|
132
|
-
Position fNamePosition;
|
133
|
-
std::string_view fName;
|
134
|
-
DSLExpression fInitialValue;
|
135
|
-
Position fPosition;
|
136
|
-
VariableStorage fStorage;
|
137
|
-
bool fInitialized = false;
|
138
|
-
|
139
|
-
friend class DSLCore;
|
140
|
-
friend class DSLFunction;
|
141
|
-
friend class DSLWriter;
|
142
|
-
};
|
143
|
-
|
144
|
-
/**
|
145
|
-
* A local variable.
|
146
|
-
*/
|
147
|
-
class DSLVar : public DSLVarBase {
|
148
|
-
public:
|
149
|
-
DSLVar();
|
150
|
-
|
151
|
-
DSLVar(DSLType type, std::string_view name, DSLExpression initialValue = DSLExpression(),
|
152
|
-
Position pos = {}, Position namePos = {});
|
153
|
-
|
154
|
-
DSLVar(const DSLModifiers& modifiers, DSLType type, std::string_view name,
|
155
|
-
DSLExpression initialValue = DSLExpression(), Position pos = {}, Position namePos = {});
|
156
|
-
|
157
|
-
DSLVar(DSLVar&&) = default;
|
158
|
-
|
159
|
-
void swap(DSLVar& other);
|
160
|
-
|
161
|
-
private:
|
162
|
-
using INHERITED = DSLVarBase;
|
163
|
-
};
|
164
|
-
|
165
|
-
/**
|
166
|
-
* A global variable.
|
167
|
-
*/
|
168
|
-
class DSLGlobalVar : public DSLVarBase {
|
169
|
-
public:
|
170
|
-
DSLGlobalVar();
|
171
|
-
|
172
|
-
DSLGlobalVar(DSLType type, std::string_view name, DSLExpression initialValue = DSLExpression(),
|
173
|
-
Position pos = {}, Position namePos = {});
|
174
|
-
|
175
|
-
DSLGlobalVar(const DSLModifiers& modifiers, DSLType type, std::string_view name,
|
176
|
-
DSLExpression initialValue = DSLExpression(),
|
177
|
-
Position pos = {}, Position namePos = {});
|
178
|
-
|
179
|
-
DSLGlobalVar(const char* name);
|
180
|
-
|
181
|
-
DSLGlobalVar(DSLGlobalVar&&) = default;
|
182
|
-
|
183
|
-
void swap(DSLGlobalVar& other);
|
184
|
-
|
185
|
-
/**
|
186
|
-
* Implements the following method calls:
|
187
|
-
* half4 shader::eval(float2 coords);
|
188
|
-
* half4 colorFilter::eval(half4 input);
|
189
|
-
*/
|
190
|
-
DSLExpression eval(DSLExpression x, Position pos = {});
|
191
|
-
|
192
|
-
/**
|
193
|
-
* Implements the following method call:
|
194
|
-
* half4 blender::eval(half4 src, half4 dst);
|
195
|
-
*/
|
196
|
-
DSLExpression eval(DSLExpression x, DSLExpression y, Position pos = {});
|
197
|
-
|
198
|
-
private:
|
199
|
-
DSLExpression eval(ExpressionArray args, Position pos);
|
200
|
-
|
201
|
-
std::unique_ptr<SkSL::Expression> methodCall(std::string_view methodName, Position pos);
|
202
|
-
|
203
|
-
using INHERITED = DSLVarBase;
|
204
|
-
};
|
205
|
-
|
206
|
-
/**
|
207
|
-
* A function parameter.
|
208
|
-
*/
|
209
|
-
class DSLParameter : public DSLVarBase {
|
210
|
-
public:
|
211
|
-
DSLParameter();
|
212
|
-
|
213
|
-
DSLParameter(DSLType type, std::string_view name, Position pos = {}, Position namePos = {});
|
214
|
-
|
215
|
-
DSLParameter(const DSLModifiers& modifiers, DSLType type, std::string_view name,
|
216
|
-
Position pos = {}, Position namePos = {});
|
217
|
-
|
218
|
-
DSLParameter(DSLParameter&&) = default;
|
219
|
-
|
220
|
-
void swap(DSLParameter& other);
|
221
|
-
|
222
|
-
private:
|
223
|
-
using INHERITED = DSLVarBase;
|
224
|
-
};
|
225
|
-
|
226
|
-
} // namespace dsl
|
227
|
-
|
228
|
-
} // namespace SkSL
|
229
|
-
|
230
|
-
|
231
|
-
#endif
|
@@ -1,65 +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_ERROR_REPORTER
|
9
|
-
#define SKSL_ERROR_REPORTER
|
10
|
-
|
11
|
-
#include "include/core/SkTypes.h"
|
12
|
-
|
13
|
-
#include <string_view>
|
14
|
-
|
15
|
-
namespace SkSL {
|
16
|
-
|
17
|
-
class Position;
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Class which is notified in the event of an error.
|
21
|
-
*/
|
22
|
-
class ErrorReporter {
|
23
|
-
public:
|
24
|
-
ErrorReporter() {}
|
25
|
-
|
26
|
-
virtual ~ErrorReporter() {}
|
27
|
-
|
28
|
-
void error(Position position, std::string_view msg);
|
29
|
-
|
30
|
-
std::string_view source() const { return fSource; }
|
31
|
-
|
32
|
-
void setSource(std::string_view source) { fSource = source; }
|
33
|
-
|
34
|
-
int errorCount() const {
|
35
|
-
return fErrorCount;
|
36
|
-
}
|
37
|
-
|
38
|
-
void resetErrorCount() {
|
39
|
-
fErrorCount = 0;
|
40
|
-
}
|
41
|
-
|
42
|
-
protected:
|
43
|
-
/**
|
44
|
-
* Called when an error is reported.
|
45
|
-
*/
|
46
|
-
virtual void handleError(std::string_view msg, Position position) = 0;
|
47
|
-
|
48
|
-
private:
|
49
|
-
Position position(int offset) const;
|
50
|
-
|
51
|
-
std::string_view fSource;
|
52
|
-
int fErrorCount = 0;
|
53
|
-
};
|
54
|
-
|
55
|
-
/**
|
56
|
-
* Error reporter for tests that need an SkSL context; aborts immediately if an error is reported.
|
57
|
-
*/
|
58
|
-
class TestingOnly_AbortErrorReporter : public ErrorReporter {
|
59
|
-
public:
|
60
|
-
void handleError(std::string_view msg, Position pos) override;
|
61
|
-
};
|
62
|
-
|
63
|
-
} // namespace SkSL
|
64
|
-
|
65
|
-
#endif
|
@@ -1,154 +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_OPERATOR
|
9
|
-
#define SKSL_OPERATOR
|
10
|
-
|
11
|
-
#include <cstdint>
|
12
|
-
#include <string_view>
|
13
|
-
|
14
|
-
namespace SkSL {
|
15
|
-
|
16
|
-
class Context;
|
17
|
-
class Type;
|
18
|
-
|
19
|
-
enum class OperatorKind : uint8_t {
|
20
|
-
PLUS,
|
21
|
-
MINUS,
|
22
|
-
STAR,
|
23
|
-
SLASH,
|
24
|
-
PERCENT,
|
25
|
-
SHL,
|
26
|
-
SHR,
|
27
|
-
LOGICALNOT,
|
28
|
-
LOGICALAND,
|
29
|
-
LOGICALOR,
|
30
|
-
LOGICALXOR,
|
31
|
-
BITWISENOT,
|
32
|
-
BITWISEAND,
|
33
|
-
BITWISEOR,
|
34
|
-
BITWISEXOR,
|
35
|
-
EQ,
|
36
|
-
EQEQ,
|
37
|
-
NEQ,
|
38
|
-
LT,
|
39
|
-
GT,
|
40
|
-
LTEQ,
|
41
|
-
GTEQ,
|
42
|
-
PLUSEQ,
|
43
|
-
MINUSEQ,
|
44
|
-
STAREQ,
|
45
|
-
SLASHEQ,
|
46
|
-
PERCENTEQ,
|
47
|
-
SHLEQ,
|
48
|
-
SHREQ,
|
49
|
-
BITWISEANDEQ,
|
50
|
-
BITWISEOREQ,
|
51
|
-
BITWISEXOREQ,
|
52
|
-
PLUSPLUS,
|
53
|
-
MINUSMINUS,
|
54
|
-
COMMA
|
55
|
-
};
|
56
|
-
|
57
|
-
enum class OperatorPrecedence : uint8_t {
|
58
|
-
kParentheses = 1,
|
59
|
-
kPostfix = 2,
|
60
|
-
kPrefix = 3,
|
61
|
-
kMultiplicative = 4,
|
62
|
-
kAdditive = 5,
|
63
|
-
kShift = 6,
|
64
|
-
kRelational = 7,
|
65
|
-
kEquality = 8,
|
66
|
-
kBitwiseAnd = 9,
|
67
|
-
kBitwiseXor = 10,
|
68
|
-
kBitwiseOr = 11,
|
69
|
-
kLogicalAnd = 12,
|
70
|
-
kLogicalXor = 13,
|
71
|
-
kLogicalOr = 14,
|
72
|
-
kTernary = 15,
|
73
|
-
kAssignment = 16,
|
74
|
-
kSequence = 17,
|
75
|
-
kTopLevel = kSequence
|
76
|
-
};
|
77
|
-
|
78
|
-
class Operator {
|
79
|
-
public:
|
80
|
-
using Kind = OperatorKind;
|
81
|
-
|
82
|
-
Operator(Kind op) : fKind(op) {}
|
83
|
-
|
84
|
-
Kind kind() const { return fKind; }
|
85
|
-
|
86
|
-
bool isEquality() const {
|
87
|
-
return fKind == Kind::EQEQ || fKind == Kind::NEQ;
|
88
|
-
}
|
89
|
-
|
90
|
-
OperatorPrecedence getBinaryPrecedence() const;
|
91
|
-
|
92
|
-
// Returns the operator name surrounded by the expected whitespace for a tidy binary expression.
|
93
|
-
const char* operatorName() const;
|
94
|
-
|
95
|
-
// Returns the operator name without any surrounding whitespace.
|
96
|
-
std::string_view tightOperatorName() const;
|
97
|
-
|
98
|
-
// Returns true if op is '=' or any compound assignment operator ('+=', '-=', etc.)
|
99
|
-
bool isAssignment() const;
|
100
|
-
|
101
|
-
// Given a compound assignment operator, returns the non-assignment version of the operator
|
102
|
-
// (e.g. '+=' becomes '+')
|
103
|
-
Operator removeAssignment() const;
|
104
|
-
|
105
|
-
/**
|
106
|
-
* Defines the set of relational (comparison) operators:
|
107
|
-
* < <= > >=
|
108
|
-
*/
|
109
|
-
bool isRelational() const;
|
110
|
-
|
111
|
-
/**
|
112
|
-
* Defines the set of operators which are only valid on integral types:
|
113
|
-
* << <<= >> >>= & &= | |= ^ ^= % %=
|
114
|
-
*/
|
115
|
-
bool isOnlyValidForIntegralTypes() const;
|
116
|
-
|
117
|
-
/**
|
118
|
-
* Defines the set of operators which perform vector/matrix math.
|
119
|
-
* + += - -= * *= / /= % %= << <<= >> >>= & &= | |= ^ ^=
|
120
|
-
*/
|
121
|
-
bool isValidForMatrixOrVector() const;
|
122
|
-
|
123
|
-
/*
|
124
|
-
* Defines the set of operators allowed by The OpenGL ES Shading Language 1.00, Section 5.1.
|
125
|
-
* The set of illegal (reserved) operators are the ones that only make sense with integral
|
126
|
-
* types. This is not a coincidence: It's because ES2 doesn't require 'int' to be anything but
|
127
|
-
* syntactic sugar for floats with truncation after each operation.
|
128
|
-
*/
|
129
|
-
bool isAllowedInStrictES2Mode() const {
|
130
|
-
return !this->isOnlyValidForIntegralTypes();
|
131
|
-
}
|
132
|
-
|
133
|
-
/**
|
134
|
-
* Determines the operand and result types of a binary expression. Returns true if the
|
135
|
-
* expression is legal, false otherwise. If false, the values of the out parameters are
|
136
|
-
* undefined.
|
137
|
-
*/
|
138
|
-
bool determineBinaryType(const Context& context,
|
139
|
-
const Type& left,
|
140
|
-
const Type& right,
|
141
|
-
const Type** outLeftType,
|
142
|
-
const Type** outRightType,
|
143
|
-
const Type** outResultType) const;
|
144
|
-
|
145
|
-
private:
|
146
|
-
bool isOperator() const;
|
147
|
-
bool isMatrixMultiply(const Type& left, const Type& right) const;
|
148
|
-
|
149
|
-
Kind fKind;
|
150
|
-
};
|
151
|
-
|
152
|
-
} // namespace SkSL
|
153
|
-
|
154
|
-
#endif
|