@shopify/react-native-skia 0.1.192 → 0.1.193
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +1 -1
- package/android/build.gradle +1 -0
- package/android/cpp/jni/JniPlatformContext.cpp +1 -1
- 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/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/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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef SkDebug_DEFINED
|
|
9
|
+
#define SkDebug_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/private/base/SkAPI.h"
|
|
12
|
+
#include "include/private/base/SkAttributes.h"
|
|
13
|
+
#include "include/private/base/SkLoadUserConfig.h" // IWYU pragma: keep
|
|
14
|
+
|
|
15
|
+
#if !defined(SkDebugf)
|
|
16
|
+
void SK_SPI SkDebugf(const char format[], ...) SK_PRINTF_LIKE(1, 2);
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#if defined(SK_DEBUG)
|
|
20
|
+
#define SkDEBUGCODE(...) __VA_ARGS__
|
|
21
|
+
#define SkDEBUGF(...) SkDebugf(__VA_ARGS__)
|
|
22
|
+
#else
|
|
23
|
+
#define SkDEBUGCODE(...)
|
|
24
|
+
#define SkDEBUGF(...)
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
#endif
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef SkFeatures_DEFINED
|
|
9
|
+
#define SkFeatures_DEFINED
|
|
10
|
+
|
|
11
|
+
#if !defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_WIN) && \
|
|
12
|
+
!defined(SK_BUILD_FOR_UNIX) && !defined(SK_BUILD_FOR_MAC)
|
|
13
|
+
|
|
14
|
+
#ifdef __APPLE__
|
|
15
|
+
#include <TargetConditionals.h>
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#if defined(_WIN32) || defined(__SYMBIAN32__)
|
|
19
|
+
#define SK_BUILD_FOR_WIN
|
|
20
|
+
#elif defined(ANDROID) || defined(__ANDROID__)
|
|
21
|
+
#define SK_BUILD_FOR_ANDROID
|
|
22
|
+
#elif defined(linux) || defined(__linux) || defined(__FreeBSD__) || \
|
|
23
|
+
defined(__OpenBSD__) || defined(__sun) || defined(__NetBSD__) || \
|
|
24
|
+
defined(__DragonFly__) || defined(__Fuchsia__) || \
|
|
25
|
+
defined(__GLIBC__) || defined(__GNU__) || defined(__unix__)
|
|
26
|
+
#define SK_BUILD_FOR_UNIX
|
|
27
|
+
#elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
|
28
|
+
#define SK_BUILD_FOR_IOS
|
|
29
|
+
#else
|
|
30
|
+
#define SK_BUILD_FOR_MAC
|
|
31
|
+
#endif
|
|
32
|
+
#endif // end SK_BUILD_FOR_*
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
#if defined(SK_BUILD_FOR_WIN) && !defined(__clang__)
|
|
36
|
+
#if !defined(SK_RESTRICT)
|
|
37
|
+
#define SK_RESTRICT __restrict
|
|
38
|
+
#endif
|
|
39
|
+
#if !defined(SK_WARN_UNUSED_RESULT)
|
|
40
|
+
#define SK_WARN_UNUSED_RESULT
|
|
41
|
+
#endif
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
#if !defined(SK_RESTRICT)
|
|
45
|
+
#define SK_RESTRICT __restrict__
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
#if !defined(SK_CPU_BENDIAN) && !defined(SK_CPU_LENDIAN)
|
|
49
|
+
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
|
50
|
+
#define SK_CPU_BENDIAN
|
|
51
|
+
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
|
52
|
+
#define SK_CPU_LENDIAN
|
|
53
|
+
#elif defined(__sparc) || defined(__sparc__) || \
|
|
54
|
+
defined(_POWER) || defined(__powerpc__) || \
|
|
55
|
+
defined(__ppc__) || defined(__hppa) || \
|
|
56
|
+
defined(__PPC__) || defined(__PPC64__) || \
|
|
57
|
+
defined(_MIPSEB) || defined(__ARMEB__) || \
|
|
58
|
+
defined(__s390__) || \
|
|
59
|
+
(defined(__sh__) && defined(__BIG_ENDIAN__)) || \
|
|
60
|
+
(defined(__ia64) && defined(__BIG_ENDIAN__))
|
|
61
|
+
#define SK_CPU_BENDIAN
|
|
62
|
+
#else
|
|
63
|
+
#define SK_CPU_LENDIAN
|
|
64
|
+
#endif
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
#if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64)
|
|
68
|
+
#define SK_CPU_X86 1
|
|
69
|
+
#endif
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* SK_CPU_SSE_LEVEL
|
|
73
|
+
*
|
|
74
|
+
* If defined, SK_CPU_SSE_LEVEL should be set to the highest supported level.
|
|
75
|
+
* On non-intel CPU this should be undefined.
|
|
76
|
+
*/
|
|
77
|
+
#define SK_CPU_SSE_LEVEL_SSE1 10
|
|
78
|
+
#define SK_CPU_SSE_LEVEL_SSE2 20
|
|
79
|
+
#define SK_CPU_SSE_LEVEL_SSE3 30
|
|
80
|
+
#define SK_CPU_SSE_LEVEL_SSSE3 31
|
|
81
|
+
#define SK_CPU_SSE_LEVEL_SSE41 41
|
|
82
|
+
#define SK_CPU_SSE_LEVEL_SSE42 42
|
|
83
|
+
#define SK_CPU_SSE_LEVEL_AVX 51
|
|
84
|
+
#define SK_CPU_SSE_LEVEL_AVX2 52
|
|
85
|
+
#define SK_CPU_SSE_LEVEL_SKX 60
|
|
86
|
+
|
|
87
|
+
// TODO(brianosman,kjlubick) clean up these checks
|
|
88
|
+
|
|
89
|
+
// Are we in GCC/Clang?
|
|
90
|
+
#ifndef SK_CPU_SSE_LEVEL
|
|
91
|
+
// These checks must be done in descending order to ensure we set the highest
|
|
92
|
+
// available SSE level.
|
|
93
|
+
#if defined(__AVX512F__) && defined(__AVX512DQ__) && defined(__AVX512CD__) && \
|
|
94
|
+
defined(__AVX512BW__) && defined(__AVX512VL__)
|
|
95
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SKX
|
|
96
|
+
#elif defined(__AVX2__)
|
|
97
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX2
|
|
98
|
+
#elif defined(__AVX__)
|
|
99
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX
|
|
100
|
+
#elif defined(__SSE4_2__)
|
|
101
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE42
|
|
102
|
+
#elif defined(__SSE4_1__)
|
|
103
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE41
|
|
104
|
+
#elif defined(__SSSE3__)
|
|
105
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSSE3
|
|
106
|
+
#elif defined(__SSE3__)
|
|
107
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE3
|
|
108
|
+
#elif defined(__SSE2__)
|
|
109
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2
|
|
110
|
+
#endif
|
|
111
|
+
#endif
|
|
112
|
+
|
|
113
|
+
// Are we in VisualStudio?
|
|
114
|
+
#ifndef SK_CPU_SSE_LEVEL
|
|
115
|
+
// These checks must be done in descending order to ensure we set the highest
|
|
116
|
+
// available SSE level. 64-bit intel guarantees at least SSE2 support.
|
|
117
|
+
#if defined(__AVX512F__) && defined(__AVX512DQ__) && defined(__AVX512CD__) && \
|
|
118
|
+
defined(__AVX512BW__) && defined(__AVX512VL__)
|
|
119
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SKX
|
|
120
|
+
#elif defined(__AVX2__)
|
|
121
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX2
|
|
122
|
+
#elif defined(__AVX__)
|
|
123
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX
|
|
124
|
+
#elif defined(_M_X64) || defined(_M_AMD64)
|
|
125
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2
|
|
126
|
+
#elif defined(_M_IX86_FP)
|
|
127
|
+
#if _M_IX86_FP >= 2
|
|
128
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2
|
|
129
|
+
#elif _M_IX86_FP == 1
|
|
130
|
+
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE1
|
|
131
|
+
#endif
|
|
132
|
+
#endif
|
|
133
|
+
#endif
|
|
134
|
+
|
|
135
|
+
// ARM defines
|
|
136
|
+
#if defined(__arm__) && (!defined(__APPLE__) || !TARGET_IPHONE_SIMULATOR)
|
|
137
|
+
#define SK_CPU_ARM32
|
|
138
|
+
#elif defined(__aarch64__)
|
|
139
|
+
#define SK_CPU_ARM64
|
|
140
|
+
#endif
|
|
141
|
+
|
|
142
|
+
// All 64-bit ARM chips have NEON. Many 32-bit ARM chips do too.
|
|
143
|
+
#if !defined(SK_ARM_HAS_NEON) && defined(__ARM_NEON)
|
|
144
|
+
#define SK_ARM_HAS_NEON
|
|
145
|
+
#endif
|
|
146
|
+
|
|
147
|
+
#if defined(__ARM_FEATURE_CRC32)
|
|
148
|
+
#define SK_ARM_HAS_CRC32
|
|
149
|
+
#endif
|
|
150
|
+
|
|
151
|
+
#endif // SkFeatures_DEFINED
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
#ifndef SkFixed_DEFINED
|
|
9
9
|
#define SkFixed_DEFINED
|
|
10
10
|
|
|
11
|
-
#include "include/
|
|
12
|
-
#include "include/
|
|
13
|
-
#include "include/private/
|
|
14
|
-
#include "include/private/SkTPin.h"
|
|
15
|
-
|
|
11
|
+
#include "include/private/base/SkAssert.h"
|
|
12
|
+
#include "include/private/base/SkDebug.h"
|
|
13
|
+
#include "include/private/base/SkMath.h" // IWYU pragma: keep
|
|
14
|
+
#include "include/private/base/SkTPin.h" // IWYU pragma: keep
|
|
15
|
+
|
|
16
|
+
#include <cstdint>
|
|
16
17
|
|
|
17
18
|
/** \file SkFixed.h
|
|
18
19
|
|
|
@@ -86,7 +87,6 @@ static inline SkFixed SkFixedFloorToFixed(SkFixed x) {
|
|
|
86
87
|
return (SkFixed)( (uint32_t)x & 0xFFFF0000 );
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
#define SkFixedAbs(x) SkAbs32(x)
|
|
90
90
|
#define SkFixedAve(a, b) (((a) + (b)) >> 1)
|
|
91
91
|
|
|
92
92
|
// The divide may exceed 32 bits. Clamp to a signed 32 bit result.
|
|
@@ -102,6 +102,8 @@ static inline SkFixed SkFixedMul(SkFixed a, SkFixed b) {
|
|
|
102
102
|
|
|
103
103
|
// The VCVT float-to-fixed instruction is part of the VFPv3 instruction set.
|
|
104
104
|
#if defined(__ARM_VFPV3__)
|
|
105
|
+
#include <cstring>
|
|
106
|
+
|
|
105
107
|
/* This does not handle NaN or other obscurities, but is faster than
|
|
106
108
|
than (int)(x*65536). When built on Android with -Os, needs forcing
|
|
107
109
|
to inline or we lose the speed benefit.
|
|
@@ -110,7 +112,7 @@ static inline SkFixed SkFixedMul(SkFixed a, SkFixed b) {
|
|
|
110
112
|
{
|
|
111
113
|
int32_t y;
|
|
112
114
|
asm("vcvt.s32.f32 %0, %0, #16": "+w"(x));
|
|
113
|
-
memcpy(&y, &x, sizeof(y));
|
|
115
|
+
std::memcpy(&y, &x, sizeof(y));
|
|
114
116
|
return y;
|
|
115
117
|
}
|
|
116
118
|
#undef SkFloatToFixed
|
|
@@ -8,10 +8,9 @@
|
|
|
8
8
|
#ifndef SkFloatBits_DEFINED
|
|
9
9
|
#define SkFloatBits_DEFINED
|
|
10
10
|
|
|
11
|
-
#include "include/
|
|
12
|
-
#include "include/private/SkSafe_math.h"
|
|
11
|
+
#include "include/private/base/SkMath.h"
|
|
13
12
|
|
|
14
|
-
#include <
|
|
13
|
+
#include <cstdint>
|
|
15
14
|
|
|
16
15
|
/** Convert a sign-bit int (i.e. float interpreted as int) into a 2s compliement
|
|
17
16
|
int. This also converts -0 (0x80000000) to 0. Doing this to a float allows
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
#ifndef SkFloatingPoint_DEFINED
|
|
9
9
|
#define SkFloatingPoint_DEFINED
|
|
10
10
|
|
|
11
|
-
#include "include/
|
|
12
|
-
#include "include/private/SkFloatBits.h"
|
|
13
|
-
#include "include/private/
|
|
14
|
-
|
|
15
|
-
#include <
|
|
11
|
+
#include "include/private/base/SkAttributes.h"
|
|
12
|
+
#include "include/private/base/SkFloatBits.h"
|
|
13
|
+
#include "include/private/base/SkMath.h"
|
|
14
|
+
|
|
15
|
+
#include <cfloat>
|
|
16
16
|
#include <cmath>
|
|
17
|
+
#include <cstdint>
|
|
17
18
|
#include <cstring>
|
|
18
|
-
#include <limits>
|
|
19
19
|
|
|
20
20
|
constexpr float SK_FloatSqrt2 = 1.41421356f;
|
|
21
21
|
constexpr float SK_FloatPI = 3.14159265f;
|
|
@@ -150,7 +150,7 @@ static inline int64_t sk_float_saturate2int64(float x) {
|
|
|
150
150
|
// Cast double to float, ignoring any warning about too-large finite values being cast to float.
|
|
151
151
|
// Clang thinks this is undefined, but it's actually implementation defined to return either
|
|
152
152
|
// the largest float or infinity (one of the two bracketing representable floats). Good enough!
|
|
153
|
-
|
|
153
|
+
SK_NO_SANITIZE("float-cast-overflow")
|
|
154
154
|
static inline float sk_double_to_float(double x) {
|
|
155
155
|
return static_cast<float>(x);
|
|
156
156
|
}
|
|
@@ -196,12 +196,12 @@ static inline int sk_float_nextlog2(float x) {
|
|
|
196
196
|
// IEEE defines how float divide behaves for non-finite values and zero-denoms, but C does not
|
|
197
197
|
// so we have a helper that suppresses the possible undefined-behavior warnings.
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
SK_NO_SANITIZE("float-divide-by-zero")
|
|
200
200
|
static inline float sk_ieee_float_divide(float numer, float denom) {
|
|
201
201
|
return numer / denom;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
SK_NO_SANITIZE("float-divide-by-zero")
|
|
205
205
|
static inline double sk_ieee_double_divide(double numer, double denom) {
|
|
206
206
|
return numer / denom;
|
|
207
207
|
}
|
|
@@ -219,4 +219,13 @@ static inline float sk_fmaf(float f, float m, float a) {
|
|
|
219
219
|
#endif
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
+
// Returns true iff the provided number is within a small epsilon of 0.
|
|
223
|
+
bool sk_double_nearly_zero(double a);
|
|
224
|
+
|
|
225
|
+
// Comparing floating point numbers is complicated. This helper only works if one or none
|
|
226
|
+
// of the two inputs is not very close to zero. It also does not work if both inputs could be NaN.
|
|
227
|
+
// The term "ulps" stands for "units of least precision". Read the following for more nuance:
|
|
228
|
+
// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
|
|
229
|
+
bool sk_doubles_nearly_equal_ulps(double a, double b, uint8_t max_ulps_diff=16);
|
|
230
|
+
|
|
222
231
|
#endif
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef SK_USER_CONFIG_WAS_LOADED
|
|
9
|
+
|
|
10
|
+
// Include this to set reasonable defaults (e.g. for SK_CPU_LENDIAN)
|
|
11
|
+
#include "include/private/base/SkFeatures.h"
|
|
12
|
+
|
|
13
|
+
// Allows embedders that want to disable macros that take arguments to just
|
|
14
|
+
// define that symbol to be one of these
|
|
15
|
+
#define SK_NOTHING_ARG1(arg1)
|
|
16
|
+
#define SK_NOTHING_ARG2(arg1, arg2)
|
|
17
|
+
#define SK_NOTHING_ARG3(arg1, arg2, arg3)
|
|
18
|
+
|
|
19
|
+
// IWYU pragma: begin_exports
|
|
20
|
+
|
|
21
|
+
// Note: SK_USER_CONFIG_HEADER will not work with Bazel builds and some C++ compilers.
|
|
22
|
+
#if defined(SK_USER_CONFIG_HEADER)
|
|
23
|
+
#include SK_USER_CONFIG_HEADER
|
|
24
|
+
#elif defined(SK_USE_BAZEL_CONFIG_HEADER)
|
|
25
|
+
// The Bazel config file is presumed to be in the root directory of its Bazel Workspace.
|
|
26
|
+
// This is achieved in Skia by having a nested WORKSPACE in include/config and a cc_library
|
|
27
|
+
// defined in that folder. As a result, we do not try to include SkUserConfig.h from the
|
|
28
|
+
// top of Skia because Bazel sandboxing will move it to a different location.
|
|
29
|
+
#include "SkUserConfig.h"
|
|
30
|
+
#else
|
|
31
|
+
#include "include/config/SkUserConfig.h"
|
|
32
|
+
#endif
|
|
33
|
+
// IWYU pragma: end_exports
|
|
34
|
+
|
|
35
|
+
// Checks to make sure the SkUserConfig options do not conflict.
|
|
36
|
+
#if !defined(SK_DEBUG) && !defined(SK_RELEASE)
|
|
37
|
+
#ifdef NDEBUG
|
|
38
|
+
#define SK_RELEASE
|
|
39
|
+
#else
|
|
40
|
+
#define SK_DEBUG
|
|
41
|
+
#endif
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
#if defined(SK_DEBUG) && defined(SK_RELEASE)
|
|
45
|
+
# error "cannot define both SK_DEBUG and SK_RELEASE"
|
|
46
|
+
#elif !defined(SK_DEBUG) && !defined(SK_RELEASE)
|
|
47
|
+
# error "must define either SK_DEBUG or SK_RELEASE"
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
#if defined(SK_CPU_LENDIAN) && defined(SK_CPU_BENDIAN)
|
|
51
|
+
# error "cannot define both SK_CPU_LENDIAN and SK_CPU_BENDIAN"
|
|
52
|
+
#elif !defined(SK_CPU_LENDIAN) && !defined(SK_CPU_BENDIAN)
|
|
53
|
+
# error "must define either SK_CPU_LENDIAN or SK_CPU_BENDIAN"
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
#if defined(SK_CPU_BENDIAN) && !defined(I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN)
|
|
57
|
+
#error "The Skia team is not endian-savvy enough to support big-endian CPUs."
|
|
58
|
+
#error "If you still want to use Skia,"
|
|
59
|
+
#error "please define I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN."
|
|
60
|
+
#endif
|
|
61
|
+
|
|
62
|
+
#define SK_USER_CONFIG_WAS_LOADED
|
|
63
|
+
#endif // SK_USER_CONFIG_WAS_LOADED
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
#ifndef SkMacros_DEFINED
|
|
8
8
|
#define SkMacros_DEFINED
|
|
9
9
|
|
|
10
|
-
#include <type_traits>
|
|
11
|
-
|
|
12
10
|
/*
|
|
13
11
|
* Usage: SK_MACRO_CONCAT(a, b) to construct the symbol ab
|
|
14
12
|
*
|
|
@@ -40,6 +38,23 @@
|
|
|
40
38
|
#define SK_END_REQUIRE_DENSE
|
|
41
39
|
#endif
|
|
42
40
|
|
|
41
|
+
#if defined(__clang__) && defined(__has_feature)
|
|
42
|
+
// Some compilers have a preprocessor that does not appear to do short-circuit
|
|
43
|
+
// evaluation as expected
|
|
44
|
+
#if __has_feature(leak_sanitizer) || __has_feature(address_sanitizer)
|
|
45
|
+
// Chrome had issues if we tried to include lsan_interface.h ourselves.
|
|
46
|
+
// https://github.com/llvm/llvm-project/blob/10a35632d55bb05004fe3d0c2d4432bb74897ee7/compiler-rt/include/sanitizer/lsan_interface.h#L26
|
|
47
|
+
extern "C" {
|
|
48
|
+
void __lsan_ignore_object(const void *p);
|
|
49
|
+
}
|
|
50
|
+
#define SK_INTENTIONALLY_LEAKED(X) __lsan_ignore_object(X)
|
|
51
|
+
#else
|
|
52
|
+
#define SK_INTENTIONALLY_LEAKED(X) ((void)0)
|
|
53
|
+
#endif
|
|
54
|
+
#else
|
|
55
|
+
#define SK_INTENTIONALLY_LEAKED(X) ((void)0)
|
|
56
|
+
#endif
|
|
57
|
+
|
|
43
58
|
#define SK_INIT_TO_AVOID_WARNING = 0
|
|
44
59
|
|
|
45
60
|
////////////////////////////////////////////////////////////////////////////////
|
|
@@ -8,10 +8,9 @@
|
|
|
8
8
|
#ifndef SkMalloc_DEFINED
|
|
9
9
|
#define SkMalloc_DEFINED
|
|
10
10
|
|
|
11
|
-
#include <cstddef>
|
|
12
11
|
#include <cstring>
|
|
13
12
|
|
|
14
|
-
#include "include/
|
|
13
|
+
#include "include/private/base/SkAPI.h"
|
|
15
14
|
|
|
16
15
|
/*
|
|
17
16
|
memory wrappers to be implemented by the porting layer (platform)
|
|
@@ -51,7 +50,9 @@ enum {
|
|
|
51
50
|
SK_API extern void* sk_malloc_flags(size_t size, unsigned flags);
|
|
52
51
|
|
|
53
52
|
/** Same as standard realloc(), but this one never returns null on failure. It will throw
|
|
54
|
-
*
|
|
53
|
+
* if it fails.
|
|
54
|
+
* If size is 0, it will call sk_free on buffer and return null. (This behavior is implementation-
|
|
55
|
+
* defined for normal realloc. We follow what glibc does.)
|
|
55
56
|
*/
|
|
56
57
|
SK_API extern void* sk_realloc_throw(void* buffer, size_t size);
|
|
57
58
|
|
|
@@ -78,10 +79,6 @@ SK_API extern void* sk_calloc_throw(size_t count, size_t elemSize);
|
|
|
78
79
|
SK_API extern void* sk_malloc_throw(size_t count, size_t elemSize);
|
|
79
80
|
SK_API extern void* sk_realloc_throw(void* buffer, size_t count, size_t elemSize);
|
|
80
81
|
|
|
81
|
-
// Returns the true usable size provided by the underlying allocator, or 0 if
|
|
82
|
-
// querying the allocation size is not supported.
|
|
83
|
-
SK_API extern size_t sk_malloc_usable_size(void* buffer);
|
|
84
|
-
|
|
85
82
|
/**
|
|
86
83
|
* These variants return nullptr on failure
|
|
87
84
|
*/
|
|
@@ -8,7 +8,22 @@
|
|
|
8
8
|
#ifndef SkMath_DEFINED
|
|
9
9
|
#define SkMath_DEFINED
|
|
10
10
|
|
|
11
|
-
#include "include/
|
|
11
|
+
#include "include/private/base/SkAssert.h"
|
|
12
|
+
#include "include/private/base/SkCPUTypes.h"
|
|
13
|
+
|
|
14
|
+
#include <cstdint>
|
|
15
|
+
#include <climits>
|
|
16
|
+
|
|
17
|
+
// Max Signed 16 bit value
|
|
18
|
+
static constexpr int16_t SK_MaxS16 = INT16_MAX;
|
|
19
|
+
static constexpr int16_t SK_MinS16 = -SK_MaxS16;
|
|
20
|
+
|
|
21
|
+
static constexpr int32_t SK_MaxS32 = INT32_MAX;
|
|
22
|
+
static constexpr int32_t SK_MinS32 = -SK_MaxS32;
|
|
23
|
+
static constexpr int32_t SK_NaN32 = INT32_MIN;
|
|
24
|
+
|
|
25
|
+
static constexpr int64_t SK_MaxS64 = INT64_MAX;
|
|
26
|
+
static constexpr int64_t SK_MinS64 = -SK_MaxS64;
|
|
12
27
|
|
|
13
28
|
// 64bit -> 32bit utilities
|
|
14
29
|
|
|
@@ -19,6 +34,14 @@ static inline int64_t sk_64_mul(int64_t a, int64_t b) {
|
|
|
19
34
|
return a * b;
|
|
20
35
|
}
|
|
21
36
|
|
|
37
|
+
static inline constexpr int32_t SkLeftShift(int32_t value, int32_t shift) {
|
|
38
|
+
return (int32_t) ((uint32_t) value << shift);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static inline constexpr int64_t SkLeftShift(int64_t value, int32_t shift) {
|
|
42
|
+
return (int64_t) ((uint64_t) value << shift);
|
|
43
|
+
}
|
|
44
|
+
|
|
22
45
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
46
|
|
|
24
47
|
/**
|
|
@@ -48,7 +71,7 @@ static inline unsigned SkMul16ShiftRound(U16CPU a, U16CPU b, int shift) {
|
|
|
48
71
|
* Only valid if a and b are unsigned and <= 32767.
|
|
49
72
|
*/
|
|
50
73
|
static inline U8CPU SkMulDiv255Round(U16CPU a, U16CPU b) {
|
|
51
|
-
return SkMul16ShiftRound(a,b,8);
|
|
74
|
+
return SkMul16ShiftRound(a, b, 8);
|
|
52
75
|
}
|
|
53
76
|
|
|
54
77
|
#endif
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
#ifndef SkMutex_DEFINED
|
|
9
9
|
#define SkMutex_DEFINED
|
|
10
10
|
|
|
11
|
-
#include "include/
|
|
12
|
-
#include "include/private/
|
|
13
|
-
#include "include/private/SkSemaphore.h"
|
|
14
|
-
#include "include/private/SkThreadAnnotations.h"
|
|
15
|
-
#include "include/private/SkThreadID.h"
|
|
11
|
+
#include "include/private/base/SkAssert.h"
|
|
12
|
+
#include "include/private/base/SkDebug.h"
|
|
13
|
+
#include "include/private/base/SkSemaphore.h"
|
|
14
|
+
#include "include/private/base/SkThreadAnnotations.h"
|
|
15
|
+
#include "include/private/base/SkThreadID.h"
|
|
16
16
|
|
|
17
17
|
class SK_CAPABILITY("mutex") SkMutex {
|
|
18
18
|
public:
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
#ifndef SkNoncopyable_DEFINED
|
|
9
9
|
#define SkNoncopyable_DEFINED
|
|
10
10
|
|
|
11
|
-
#include "include/
|
|
11
|
+
#include "include/private/base/SkAPI.h"
|
|
12
12
|
|
|
13
|
-
/** \class SkNoncopyable
|
|
13
|
+
/** \class SkNoncopyable (DEPRECATED)
|
|
14
14
|
|
|
15
15
|
SkNoncopyable is the base class for objects that do not want to
|
|
16
16
|
be copied. It hides its copy-constructor and its assignment-operator.
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
#ifndef SkOnce_DEFINED
|
|
9
9
|
#define SkOnce_DEFINED
|
|
10
10
|
|
|
11
|
-
#include "include/private/SkThreadAnnotations.h"
|
|
11
|
+
#include "include/private/base/SkThreadAnnotations.h"
|
|
12
|
+
|
|
12
13
|
#include <atomic>
|
|
14
|
+
#include <cstdint>
|
|
13
15
|
#include <utility>
|
|
14
16
|
|
|
15
17
|
// SkOnce provides call-once guarantees for Skia, much like std::once_flag/std::call_once().
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*
|
|
7
|
+
* This file contains private enums related to paths. See also skbug.com/10670
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#ifndef SkPathEnums_DEFINED
|
|
11
|
+
#define SkPathEnums_DEFINED
|
|
12
|
+
|
|
13
|
+
enum class SkPathConvexity {
|
|
14
|
+
kConvex,
|
|
15
|
+
kConcave,
|
|
16
|
+
kUnknown,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
enum class SkPathFirstDirection {
|
|
20
|
+
kCW, // == SkPathDirection::kCW
|
|
21
|
+
kCCW, // == SkPathDirection::kCCW
|
|
22
|
+
kUnknown,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
#endif
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
#ifndef SkSafe32_DEFINED
|
|
9
9
|
#define SkSafe32_DEFINED
|
|
10
10
|
|
|
11
|
-
#include "include/
|
|
11
|
+
#include "include/private/base/SkAssert.h"
|
|
12
|
+
#include "include/private/base/SkMath.h"
|
|
13
|
+
|
|
14
|
+
#include <cstdint>
|
|
12
15
|
|
|
13
16
|
static constexpr int32_t Sk64_pin_to_s32(int64_t x) {
|
|
14
17
|
return x < SK_MinS32 ? SK_MinS32 : (x > SK_MaxS32 ? SK_MaxS32 : (int32_t)x);
|
|
@@ -31,4 +34,16 @@ static constexpr int32_t Sk32_can_overflow_sub(int32_t a, int32_t b) {
|
|
|
31
34
|
return (int32_t)((uint32_t)a - (uint32_t)b);
|
|
32
35
|
}
|
|
33
36
|
|
|
37
|
+
/**
|
|
38
|
+
* This is a 'safe' abs for 32-bit integers that asserts when undefined behavior would occur.
|
|
39
|
+
* SkTAbs (in SkTemplates.h) is a general purpose absolute-value function.
|
|
40
|
+
*/
|
|
41
|
+
static inline int32_t SkAbs32(int32_t value) {
|
|
42
|
+
SkASSERT(value != SK_NaN32); // The most negative int32_t can't be negated.
|
|
43
|
+
if (value < 0) {
|
|
44
|
+
value = -value;
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
|
|
34
49
|
#endif
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
#ifndef SkSemaphore_DEFINED
|
|
9
9
|
#define SkSemaphore_DEFINED
|
|
10
10
|
|
|
11
|
-
#include "include/
|
|
12
|
-
#include "include/private/SkOnce.h"
|
|
13
|
-
#include "include/private/SkThreadAnnotations.h"
|
|
11
|
+
#include "include/private/base/SkAPI.h"
|
|
12
|
+
#include "include/private/base/SkOnce.h"
|
|
13
|
+
#include "include/private/base/SkThreadAnnotations.h"
|
|
14
|
+
|
|
14
15
|
#include <algorithm>
|
|
15
16
|
#include <atomic>
|
|
16
17
|
|