rngine 0.7.2 → 0.8.1
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/README.md +51 -26
- package/android/CMakeLists.txt +45 -2
- package/android/build.gradle +1 -3
- package/android/kls_database.db +0 -0
- package/android/src/main/cpp/game-view.cpp +29 -0
- package/android/src/main/java/com/margelo/nitro/rngine/GameEngine.kt +1 -28
- package/android/src/main/java/com/margelo/nitro/rngine/GameView.kt +22 -166
- package/android/src/main/java/com/margelo/nitro/rngine/SvgLoaderHelper.kt +24 -0
- package/lib/module/GameMethods.js +46 -2
- package/lib/module/GameMethods.js.map +1 -1
- package/lib/module/GameMethods.nitro.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/GameMethods.d.ts +2 -1
- package/lib/typescript/src/GameMethods.d.ts.map +1 -1
- package/lib/typescript/src/GameMethods.nitro.d.ts +5 -2
- package/lib/typescript/src/GameMethods.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nativeTypes.d.ts +12 -0
- package/lib/typescript/src/nativeTypes.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +7 -10
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitro.json +0 -10
- package/nitrogen/generated/android/rngine+autolinking.cmake +0 -2
- package/nitrogen/generated/android/rngineOnLoad.cpp +0 -16
- package/nitrogen/generated/ios/Rngine-Swift-Cxx-Bridge.cpp +0 -33
- package/nitrogen/generated/ios/Rngine-Swift-Cxx-Bridge.hpp +0 -96
- package/nitrogen/generated/ios/Rngine-Swift-Cxx-Umbrella.hpp +0 -9
- package/nitrogen/generated/ios/RngineAutolinking.mm +0 -8
- package/nitrogen/generated/ios/RngineAutolinking.swift +0 -12
- package/nitrogen/generated/shared/c++/Entity.hpp +10 -2
- package/nitrogen/generated/shared/c++/EntityUpdate.hpp +10 -2
- package/nitrogen/generated/shared/c++/HybridGameMethodsSpec.cpp +4 -1
- package/nitrogen/generated/shared/c++/HybridGameMethodsSpec.hpp +8 -1
- package/nitrogen/generated/shared/c++/World.hpp +91 -0
- package/package.json +4 -1
- package/shared/CollisionUtils.hpp +1 -6
- package/{android/src/main/cpp/ColorUtils.hpp → shared/ColorUtils.cpp} +8 -12
- package/shared/ColorUtils.hpp +7 -0
- package/shared/GameLoop.cpp +142 -51
- package/shared/GameLoop.hpp +10 -14
- package/shared/GameMethods.cpp +101 -10
- package/shared/GameMethods.hpp +19 -1
- package/shared/GameRenderer.cpp +420 -0
- package/shared/GameRenderer.hpp +65 -0
- package/shared/GameStats.hpp +3 -3
- package/shared/Overlap.hpp +9 -0
- package/shared/skia/include/android/AHardwareBufferUtils.h +26 -0
- package/shared/skia/include/android/GrAHardwareBufferUtils.h +97 -0
- package/shared/skia/include/android/SkAndroidFrameworkUtils.h +83 -0
- package/shared/skia/include/android/SkAnimatedImage.h +193 -0
- package/shared/skia/include/android/SkCanvasAndroid.h +20 -0
- package/shared/skia/include/android/SkImageAndroid.h +100 -0
- package/shared/skia/include/android/SkSurfaceAndroid.h +50 -0
- package/shared/skia/include/android/graphite/SurfaceAndroid.h +59 -0
- package/shared/skia/include/android/vk/AndroidVulkanMemoryAllocator.h +31 -0
- package/shared/skia/include/codec/SkAndroidCodec.h +302 -0
- package/shared/skia/include/codec/SkAvifDecoder.h +80 -0
- package/shared/skia/include/codec/SkBmpDecoder.h +44 -0
- package/shared/skia/include/codec/SkBmpRustDecoder.h +42 -0
- package/shared/skia/include/codec/SkCodec.h +1178 -0
- package/shared/skia/include/codec/SkCodecAnimation.h +61 -0
- package/shared/skia/include/codec/SkEncodedImageFormat.h +33 -0
- package/shared/skia/include/codec/SkEncodedOrigin.h +71 -0
- package/shared/skia/include/codec/SkGifDecoder.h +44 -0
- package/shared/skia/include/codec/SkIcoDecoder.h +44 -0
- package/shared/skia/include/codec/SkJpegDecoder.h +51 -0
- package/shared/skia/include/codec/SkJpegxlDecoder.h +44 -0
- package/shared/skia/include/codec/SkPixmapUtils.h +31 -0
- package/shared/skia/include/codec/SkPngChunkReader.h +45 -0
- package/shared/skia/include/codec/SkPngDecoder.h +51 -0
- package/shared/skia/include/codec/SkPngRustDecoder.h +30 -0
- package/shared/skia/include/codec/SkRawDecoder.h +50 -0
- package/shared/skia/include/codec/SkWbmpDecoder.h +44 -0
- package/shared/skia/include/codec/SkWebpDecoder.h +51 -0
- package/shared/skia/include/config/SkUserConfig.h +141 -0
- package/shared/skia/include/core/SkAlphaType.h +45 -0
- package/shared/skia/include/core/SkAnnotation.h +52 -0
- package/shared/skia/include/core/SkArc.h +69 -0
- package/shared/skia/include/core/SkBBHFactory.h +67 -0
- package/shared/skia/include/core/SkBitmap.h +1264 -0
- package/shared/skia/include/core/SkBlendMode.h +112 -0
- package/shared/skia/include/core/SkBlender.h +30 -0
- package/shared/skia/include/core/SkBlurTypes.h +20 -0
- package/shared/skia/include/core/SkCPUContext.h +31 -0
- package/shared/skia/include/core/SkCPURecorder.h +76 -0
- package/shared/skia/include/core/SkCanvas.h +2770 -0
- package/shared/skia/include/core/SkCanvasVirtualEnforcer.h +61 -0
- package/shared/skia/include/core/SkCapabilities.h +35 -0
- package/shared/skia/include/core/SkClipOp.h +19 -0
- package/shared/skia/include/core/SkColor.h +469 -0
- package/shared/skia/include/core/SkColorFilter.h +150 -0
- package/shared/skia/include/core/SkColorSpace.h +432 -0
- package/shared/skia/include/core/SkColorTable.h +62 -0
- package/shared/skia/include/core/SkColorType.h +159 -0
- package/shared/skia/include/core/SkContourMeasure.h +215 -0
- package/shared/skia/include/core/SkCoverageMode.h +28 -0
- package/shared/skia/include/core/SkCubicMap.h +47 -0
- package/shared/skia/include/core/SkData.h +225 -0
- package/shared/skia/include/core/SkDataTable.h +122 -0
- package/shared/skia/include/core/SkDocument.h +93 -0
- package/shared/skia/include/core/SkDrawable.h +178 -0
- package/shared/skia/include/core/SkExecutor.h +59 -0
- package/shared/skia/include/core/SkFlattenable.h +115 -0
- package/shared/skia/include/core/SkFont.h +536 -0
- package/shared/skia/include/core/SkFontArguments.h +116 -0
- package/shared/skia/include/core/SkFontMetrics.h +139 -0
- package/shared/skia/include/core/SkFontMgr.h +178 -0
- package/shared/skia/include/core/SkFontParameters.h +43 -0
- package/shared/skia/include/core/SkFontScanner.h +45 -0
- package/shared/skia/include/core/SkFontStyle.h +84 -0
- package/shared/skia/include/core/SkFontTypes.h +25 -0
- package/shared/skia/include/core/SkFourByteTag.h +19 -0
- package/shared/skia/include/core/SkGraphics.h +169 -0
- package/shared/skia/include/core/SkImage.h +918 -0
- package/shared/skia/include/core/SkImageFilter.h +119 -0
- package/shared/skia/include/core/SkImageGenerator.h +140 -0
- package/shared/skia/include/core/SkImageInfo.h +634 -0
- package/shared/skia/include/core/SkM44.h +442 -0
- package/shared/skia/include/core/SkMallocPixelRef.h +45 -0
- package/shared/skia/include/core/SkMaskFilter.h +45 -0
- package/shared/skia/include/core/SkMatrix.h +1887 -0
- package/shared/skia/include/core/SkMesh.h +429 -0
- package/shared/skia/include/core/SkMilestone.h +9 -0
- package/shared/skia/include/core/SkOpenTypeSVGDecoder.h +30 -0
- package/shared/skia/include/core/SkOverdrawCanvas.h +94 -0
- package/shared/skia/include/core/SkPaint.h +698 -0
- package/shared/skia/include/core/SkPath.h +1145 -0
- package/shared/skia/include/core/SkPathBuilder.h +1052 -0
- package/shared/skia/include/core/SkPathEffect.h +88 -0
- package/shared/skia/include/core/SkPathIter.h +90 -0
- package/shared/skia/include/core/SkPathMeasure.h +96 -0
- package/shared/skia/include/core/SkPathTypes.h +71 -0
- package/shared/skia/include/core/SkPathUtils.h +39 -0
- package/shared/skia/include/core/SkPicture.h +291 -0
- package/shared/skia/include/core/SkPictureRecorder.h +115 -0
- package/shared/skia/include/core/SkPixelRef.h +120 -0
- package/shared/skia/include/core/SkPixmap.h +736 -0
- package/shared/skia/include/core/SkPoint.h +560 -0
- package/shared/skia/include/core/SkPoint3.h +149 -0
- package/shared/skia/include/core/SkRRect.h +548 -0
- package/shared/skia/include/core/SkRSXform.h +71 -0
- package/shared/skia/include/core/SkRasterHandleAllocator.h +94 -0
- package/shared/skia/include/core/SkRecorder.h +49 -0
- package/shared/skia/include/core/SkRect.h +1419 -0
- package/shared/skia/include/core/SkRefCnt.h +391 -0
- package/shared/skia/include/core/SkRegion.h +701 -0
- package/shared/skia/include/core/SkSamplingOptions.h +107 -0
- package/shared/skia/include/core/SkScalar.h +148 -0
- package/shared/skia/include/core/SkSerialProcs.h +127 -0
- package/shared/skia/include/core/SkShader.h +123 -0
- package/shared/skia/include/core/SkSize.h +93 -0
- package/shared/skia/include/core/SkSpan.h +174 -0
- package/shared/skia/include/core/SkStream.h +524 -0
- package/shared/skia/include/core/SkStrikeRef.h +96 -0
- package/shared/skia/include/core/SkString.h +297 -0
- package/shared/skia/include/core/SkStrokeRec.h +160 -0
- package/shared/skia/include/core/SkSurface.h +689 -0
- package/shared/skia/include/core/SkSurfaceProps.h +122 -0
- package/shared/skia/include/core/SkSwizzle.h +21 -0
- package/shared/skia/include/core/SkTextBlob.h +541 -0
- package/shared/skia/include/core/SkTextureCompressionType.h +30 -0
- package/shared/skia/include/core/SkTileMode.h +41 -0
- package/shared/skia/include/core/SkTiledImageUtils.h +125 -0
- package/shared/skia/include/core/SkTraceMemoryDump.h +121 -0
- package/shared/skia/include/core/SkTypeface.h +468 -0
- package/shared/skia/include/core/SkTypes.h +193 -0
- package/shared/skia/include/core/SkUnPreMultiply.h +55 -0
- package/shared/skia/include/core/SkVertices.h +136 -0
- package/shared/skia/include/core/SkYUVAInfo.h +311 -0
- package/shared/skia/include/core/SkYUVAPixmaps.h +335 -0
- package/shared/skia/include/docs/SkMultiPictureDocument.h +53 -0
- package/shared/skia/include/docs/SkPDFDocument.h +277 -0
- package/shared/skia/include/docs/SkPDFJpegHelpers.h +41 -0
- package/shared/skia/include/docs/SkXPSDocument.h +43 -0
- package/shared/skia/include/effects/Sk1DPathEffect.h +40 -0
- package/shared/skia/include/effects/Sk2DPathEffect.h +33 -0
- package/shared/skia/include/effects/SkBlenders.h +27 -0
- package/shared/skia/include/effects/SkBlurMaskFilter.h +35 -0
- package/shared/skia/include/effects/SkColorMatrix.h +57 -0
- package/shared/skia/include/effects/SkColorMatrixFilter.h +22 -0
- package/shared/skia/include/effects/SkCornerPathEffect.h +32 -0
- package/shared/skia/include/effects/SkDashPathEffect.h +43 -0
- package/shared/skia/include/effects/SkDiscretePathEffect.h +37 -0
- package/shared/skia/include/effects/SkGradient.h +206 -0
- package/shared/skia/include/effects/SkHighContrastFilter.h +84 -0
- package/shared/skia/include/effects/SkImageFilters.h +641 -0
- package/shared/skia/include/effects/SkLumaColorFilter.h +37 -0
- package/shared/skia/include/effects/SkOverdrawColorFilter.h +33 -0
- package/shared/skia/include/effects/SkPerlinNoiseShader.h +53 -0
- package/shared/skia/include/effects/SkRuntimeEffect.h +503 -0
- package/shared/skia/include/effects/SkShaderMaskFilter.h +28 -0
- package/shared/skia/include/effects/SkTableMaskFilter.h +47 -0
- package/shared/skia/include/effects/SkTrimPathEffect.h +45 -0
- package/shared/skia/include/encode/SkEncoder.h +63 -0
- package/shared/skia/include/encode/SkICC.h +36 -0
- package/shared/skia/include/encode/SkJpegEncoder.h +127 -0
- package/shared/skia/include/encode/SkPngEncoder.h +132 -0
- package/shared/skia/include/encode/SkPngRustEncoder.h +121 -0
- package/shared/skia/include/encode/SkWebpEncoder.h +87 -0
- package/shared/skia/include/gpu/GpuTypes.h +98 -0
- package/shared/skia/include/gpu/MutableTextureState.h +68 -0
- package/shared/skia/include/gpu/ShaderErrorHandler.h +46 -0
- package/shared/skia/include/gpu/ganesh/GrBackendSemaphore.h +50 -0
- package/shared/skia/include/gpu/ganesh/GrBackendSurface.h +257 -0
- package/shared/skia/include/gpu/ganesh/GrContextOptions.h +384 -0
- package/shared/skia/include/gpu/ganesh/GrContextThreadSafeProxy.h +175 -0
- package/shared/skia/include/gpu/ganesh/GrDirectContext.h +1027 -0
- package/shared/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +53 -0
- package/shared/skia/include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h +49 -0
- package/shared/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +54 -0
- package/shared/skia/include/gpu/ganesh/GrRecordingContext.h +300 -0
- package/shared/skia/include/gpu/ganesh/GrTypes.h +193 -0
- package/shared/skia/include/gpu/ganesh/GrYUVABackendTextures.h +130 -0
- package/shared/skia/include/gpu/ganesh/SkImageGanesh.h +361 -0
- package/shared/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
- package/shared/skia/include/gpu/ganesh/SkSurfaceGanesh.h +218 -0
- package/shared/skia/include/gpu/ganesh/d3d/GrD3DBackendContext.h +35 -0
- package/shared/skia/include/gpu/ganesh/d3d/GrD3DBackendSemaphore.h +20 -0
- package/shared/skia/include/gpu/ganesh/d3d/GrD3DBackendSurface.h +59 -0
- package/shared/skia/include/gpu/ganesh/d3d/GrD3DDirectContext.h +28 -0
- package/shared/skia/include/gpu/ganesh/d3d/GrD3DTypes.h +248 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLAssembleHelpers.h +17 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLAssembleInterface.h +45 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +64 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLConfig.h +69 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +30 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLExtensions.h +79 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLFunctions.h +313 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLInterface.h +337 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLMakeWebGLInterface.h +19 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLTypes.h +219 -0
- package/shared/skia/include/gpu/ganesh/gl/egl/GrGLMakeEGLInterface.h +23 -0
- package/shared/skia/include/gpu/ganesh/gl/epoxy/GrGLMakeEpoxyEGLInterface.h +20 -0
- package/shared/skia/include/gpu/ganesh/gl/glx/GrGLMakeGLXInterface.h +23 -0
- package/shared/skia/include/gpu/ganesh/gl/ios/GrGLMakeIOSInterface.h +20 -0
- package/shared/skia/include/gpu/ganesh/gl/mac/GrGLMakeMacInterface.h +20 -0
- package/shared/skia/include/gpu/ganesh/gl/win/GrGLMakeWinInterface.h +20 -0
- package/shared/skia/include/gpu/ganesh/mock/GrMockBackendSurface.h +59 -0
- package/shared/skia/include/gpu/ganesh/mock/GrMockTypes.h +166 -0
- package/shared/skia/include/gpu/ganesh/mtl/GrMtlBackendContext.h +21 -0
- package/shared/skia/include/gpu/ganesh/mtl/GrMtlBackendSemaphore.h +23 -0
- package/shared/skia/include/gpu/ganesh/mtl/GrMtlBackendSurface.h +44 -0
- package/shared/skia/include/gpu/ganesh/mtl/GrMtlDirectContext.h +30 -0
- package/shared/skia/include/gpu/ganesh/mtl/GrMtlTypes.h +61 -0
- package/shared/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +73 -0
- package/shared/skia/include/gpu/ganesh/vk/GrBackendDrawableInfo.h +44 -0
- package/shared/skia/include/gpu/ganesh/vk/GrVkBackendSemaphore.h +20 -0
- package/shared/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +71 -0
- package/shared/skia/include/gpu/ganesh/vk/GrVkDirectContext.h +33 -0
- package/shared/skia/include/gpu/ganesh/vk/GrVkTypes.h +101 -0
- package/shared/skia/include/gpu/graphite/BackendSemaphore.h +60 -0
- package/shared/skia/include/gpu/graphite/BackendTexture.h +65 -0
- package/shared/skia/include/gpu/graphite/Context.h +440 -0
- package/shared/skia/include/gpu/graphite/ContextOptions.h +239 -0
- package/shared/skia/include/gpu/graphite/GraphiteTypes.h +315 -0
- package/shared/skia/include/gpu/graphite/Image.h +428 -0
- package/shared/skia/include/gpu/graphite/ImageProvider.h +68 -0
- package/shared/skia/include/gpu/graphite/PersistentPipelineStorage.h +45 -0
- package/shared/skia/include/gpu/graphite/PrecompileContext.h +109 -0
- package/shared/skia/include/gpu/graphite/Recorder.h +355 -0
- package/shared/skia/include/gpu/graphite/Recording.h +100 -0
- package/shared/skia/include/gpu/graphite/Surface.h +121 -0
- package/shared/skia/include/gpu/graphite/TextureInfo.h +133 -0
- package/shared/skia/include/gpu/graphite/YUVABackendTextures.h +148 -0
- package/shared/skia/include/gpu/graphite/dawn/DawnBackendContext.h +77 -0
- package/shared/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +163 -0
- package/shared/skia/include/gpu/graphite/dawn/DawnTypes.h +9 -0
- package/shared/skia/include/gpu/graphite/dawn/DawnUtils.h +9 -0
- package/shared/skia/include/gpu/graphite/mtl/MtlBackendContext.h +34 -0
- package/shared/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +73 -0
- package/shared/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +10 -0
- package/shared/skia/include/gpu/graphite/mtl/MtlGraphiteTypes_cpp.h +50 -0
- package/shared/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h +9 -0
- package/shared/skia/include/gpu/graphite/precompile/PaintOptions.h +211 -0
- package/shared/skia/include/gpu/graphite/precompile/Precompile.h +59 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileBase.h +76 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileBlender.h +56 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileColorFilter.h +95 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileImageFilter.h +116 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileMaskFilter.h +49 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileRuntimeEffect.h +47 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileShader.h +268 -0
- package/shared/skia/include/gpu/graphite/vk/VulkanGraphiteContext.h +31 -0
- package/shared/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +104 -0
- package/shared/skia/include/gpu/graphite/vk/precompile/VulkanPrecompileShader.h +39 -0
- package/shared/skia/include/gpu/mtl/MtlMemoryAllocator.h +41 -0
- package/shared/skia/include/gpu/vk/VulkanBackendContext.h +57 -0
- package/shared/skia/include/gpu/vk/VulkanExtensions.h +73 -0
- package/shared/skia/include/gpu/vk/VulkanMemoryAllocator.h +117 -0
- package/shared/skia/include/gpu/vk/VulkanMutableTextureState.h +26 -0
- package/shared/skia/include/gpu/vk/VulkanPreferredFeatures.h +225 -0
- package/shared/skia/include/gpu/vk/VulkanTypes.h +245 -0
- package/shared/skia/include/pathops/SkPathOps.h +150 -0
- package/shared/skia/include/ports/SkCFObject.h +180 -0
- package/shared/skia/include/ports/SkFontConfigInterface.h +112 -0
- package/shared/skia/include/ports/SkFontMgr_FontConfigInterface.h +24 -0
- package/shared/skia/include/ports/SkFontMgr_Fontations.h +20 -0
- package/shared/skia/include/ports/SkFontMgr_android.h +48 -0
- package/shared/skia/include/ports/SkFontMgr_android_ndk.h +27 -0
- package/shared/skia/include/ports/SkFontMgr_data.h +22 -0
- package/shared/skia/include/ports/SkFontMgr_directory.h +21 -0
- package/shared/skia/include/ports/SkFontMgr_empty.h +21 -0
- package/shared/skia/include/ports/SkFontMgr_fontconfig.h +24 -0
- package/shared/skia/include/ports/SkFontMgr_fuchsia.h +21 -0
- package/shared/skia/include/ports/SkFontMgr_mac_ct.h +27 -0
- package/shared/skia/include/ports/SkFontScanner_Fontations.h +15 -0
- package/shared/skia/include/ports/SkFontScanner_FreeType.h +15 -0
- package/shared/skia/include/ports/SkImageGeneratorCG.h +28 -0
- package/shared/skia/include/ports/SkImageGeneratorNDK.h +40 -0
- package/shared/skia/include/ports/SkImageGeneratorWIC.h +41 -0
- package/shared/skia/include/ports/SkTypeface_fontations.h +24 -0
- package/shared/skia/include/ports/SkTypeface_mac.h +44 -0
- package/shared/skia/include/ports/SkTypeface_win.h +63 -0
- package/shared/skia/include/private/SingleOwner.h +75 -0
- package/shared/skia/include/private/SkAPI.h +52 -0
- package/shared/skia/include/private/SkASAN.h +56 -0
- package/shared/skia/include/private/SkAlign.h +51 -0
- package/shared/skia/include/private/SkAlignedStorage.h +32 -0
- package/shared/skia/include/private/SkAnySubclass.h +79 -0
- package/shared/skia/include/private/SkAssert.h +203 -0
- package/shared/skia/include/private/SkAttributes.h +96 -0
- package/shared/skia/include/private/SkCPUTypes.h +25 -0
- package/shared/skia/include/private/SkContainers.h +54 -0
- package/shared/skia/include/private/SkDebug.h +27 -0
- package/shared/skia/include/private/SkDeque.h +138 -0
- package/shared/skia/include/private/SkEncodedInfo.h +249 -0
- package/shared/skia/include/private/SkEnumBitMask.h +92 -0
- package/shared/skia/include/private/SkExif.h +69 -0
- package/shared/skia/include/private/SkFeatures.h +173 -0
- package/shared/skia/include/private/SkFixed.h +143 -0
- package/shared/skia/include/private/SkFloatingPoint.h +183 -0
- package/shared/skia/include/private/SkGainmapInfo.h +140 -0
- package/shared/skia/include/private/SkGainmapShader.h +60 -0
- package/shared/skia/include/private/SkHdrMetadata.h +357 -0
- package/shared/skia/include/private/SkIDChangeListener.h +76 -0
- package/shared/skia/include/private/SkJpegGainmapEncoder.h +48 -0
- package/shared/skia/include/private/SkJpegMetadataDecoder.h +103 -0
- package/shared/skia/include/private/SkLoadUserConfig.h +64 -0
- package/shared/skia/include/private/SkLog.h +62 -0
- package/shared/skia/include/private/SkLogPriority.h +34 -0
- package/shared/skia/include/private/SkMacros.h +170 -0
- package/shared/skia/include/private/SkMalloc.h +152 -0
- package/shared/skia/include/private/SkMath.h +77 -0
- package/shared/skia/include/private/SkMutex.h +72 -0
- package/shared/skia/include/private/SkNoncopyable.h +30 -0
- package/shared/skia/include/private/SkOnce.h +55 -0
- package/shared/skia/include/private/SkPathRef.h +90 -0
- package/shared/skia/include/private/SkPixelStorage.h +52 -0
- package/shared/skia/include/private/SkSLSampleUsage.h +85 -0
- package/shared/skia/include/private/SkSafe32.h +49 -0
- package/shared/skia/include/private/SkSemaphore.h +84 -0
- package/shared/skia/include/private/SkTArray.h +823 -0
- package/shared/skia/include/private/SkTDArray.h +247 -0
- package/shared/skia/include/private/SkTFitsIn.h +92 -0
- package/shared/skia/include/private/SkTLogic.h +56 -0
- package/shared/skia/include/private/SkTPin.h +23 -0
- package/shared/skia/include/private/SkTemplates.h +500 -0
- package/shared/skia/include/private/SkThreadAnnotations.h +104 -0
- package/shared/skia/include/private/SkThreadID.h +23 -0
- package/shared/skia/include/private/SkTo.h +39 -0
- package/shared/skia/include/private/SkTypeTraits.h +53 -0
- package/shared/skia/include/private/SkWeakRefCnt.h +173 -0
- package/shared/skia/include/private/SkXmp.h +62 -0
- package/shared/skia/include/private/chromium/GrDeferredDisplayList.h +120 -0
- package/shared/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +62 -0
- package/shared/skia/include/private/chromium/GrPromiseImageTexture.h +43 -0
- package/shared/skia/include/private/chromium/GrSurfaceCharacterization.h +211 -0
- package/shared/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +131 -0
- package/shared/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +150 -0
- package/shared/skia/include/private/chromium/SkCodecsICCProfileChromium.h +52 -0
- package/shared/skia/include/private/chromium/SkDiscardableMemory.h +70 -0
- package/shared/skia/include/private/chromium/SkExifChromium.h +26 -0
- package/shared/skia/include/private/chromium/SkImageChromium.h +117 -0
- package/shared/skia/include/private/chromium/SkPMColor.h +38 -0
- package/shared/skia/include/private/chromium/Slug.h +72 -0
- package/shared/skia/include/private/gpu/ganesh/GrContext_Base.h +104 -0
- package/shared/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +60 -0
- package/shared/skia/include/private/gpu/ganesh/GrImageContext.h +56 -0
- package/shared/skia/include/private/gpu/ganesh/GrTextureGenerator.h +66 -0
- package/shared/skia/include/private/gpu/ganesh/GrTypesPriv.h +959 -0
- package/shared/skia/include/private/gpu/vk/SkiaVulkan.h +36 -0
- package/shared/skia/include/sksl/SkSLDebugTrace.h +25 -0
- package/shared/skia/include/sksl/SkSLVersion.h +27 -0
- package/shared/skia/include/svg/SkSVGCanvas.h +62 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_icd.h +245 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_layer.h +192 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_platform.h +84 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std.h +394 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_decode.h +109 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_encode.h +143 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +312 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +77 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_encode.h +147 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +446 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +67 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_encode.h +157 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_vp9std.h +151 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_vp9std_decode.h +68 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +36 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan.h +103 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_android.h +159 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_beta.h +375 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_core.h +25896 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_directfb.h +59 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_fuchsia.h +282 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_ggp.h +62 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +50 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +50 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_metal.h +244 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_ohos.h +120 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_screen.h +114 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_vi.h +50 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_wayland.h +59 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +372 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +60 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_xlib.h +60 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_xlib_xrandr.h +50 -0
- package/shared/skia/include/utils/SkCamera.h +109 -0
- package/shared/skia/include/utils/SkCanvasStateUtils.h +81 -0
- package/shared/skia/include/utils/SkCustomTypeface.h +70 -0
- package/shared/skia/include/utils/SkEventTracer.h +93 -0
- package/shared/skia/include/utils/SkNWayCanvas.h +123 -0
- package/shared/skia/include/utils/SkNoDrawCanvas.h +78 -0
- package/shared/skia/include/utils/SkNullCanvas.h +22 -0
- package/shared/skia/include/utils/SkOrderedFontMgr.h +66 -0
- package/shared/skia/include/utils/SkPaintFilterCanvas.h +140 -0
- package/shared/skia/include/utils/SkParse.h +36 -0
- package/shared/skia/include/utils/SkParsePath.h +33 -0
- package/shared/skia/include/utils/SkShadowUtils.h +102 -0
- package/shared/skia/include/utils/SkTextUtils.h +43 -0
- package/shared/skia/include/utils/SkTraceEventPhase.h +19 -0
- package/shared/skia/include/utils/mac/SkCGUtils.h +90 -0
- package/shared/skia/modules/jsonreader/SkJSONReader.cpp +996 -0
- package/shared/skia/modules/jsonreader/SkJSONReader.h +389 -0
- package/shared/skia/modules/skcms/skcms.h +10 -0
- package/shared/skia/modules/skcms/src/Transform_inl.h +1600 -0
- package/shared/skia/modules/skcms/src/skcms_Transform.h +167 -0
- package/shared/skia/modules/skcms/src/skcms_internals.h +157 -0
- package/shared/skia/modules/skcms/src/skcms_public.h +496 -0
- package/shared/skia/modules/skottie/include/ExternalLayer.h +56 -0
- package/shared/skia/modules/skottie/include/Skottie.h +324 -0
- package/shared/skia/modules/skottie/include/SkottieProperty.h +190 -0
- package/shared/skia/modules/skottie/include/SlotManager.h +113 -0
- package/shared/skia/modules/skottie/include/TextShaper.h +197 -0
- package/shared/skia/modules/skottie/src/SkottieValue.h +56 -0
- package/shared/skia/modules/skottie/src/animator/Animator.h +89 -0
- package/shared/skia/modules/skottie/src/text/Font.h +82 -0
- package/shared/skia/modules/skottie/src/text/TextAdapter.h +155 -0
- package/shared/skia/modules/skottie/src/text/TextAnimator.h +122 -0
- package/shared/skia/modules/skottie/src/text/TextValue.h +28 -0
- package/shared/skia/modules/skparagraph/include/DartTypes.h +153 -0
- package/shared/skia/modules/skparagraph/include/FontArguments.h +46 -0
- package/shared/skia/modules/skparagraph/include/FontCollection.h +76 -0
- package/shared/skia/modules/skparagraph/include/Metrics.h +98 -0
- package/shared/skia/modules/skparagraph/include/Paragraph.h +289 -0
- package/shared/skia/modules/skparagraph/include/ParagraphBuilder.h +94 -0
- package/shared/skia/modules/skparagraph/include/ParagraphCache.h +52 -0
- package/shared/skia/modules/skparagraph/include/ParagraphPainter.h +63 -0
- package/shared/skia/modules/skparagraph/include/ParagraphStyle.h +160 -0
- package/shared/skia/modules/skparagraph/include/TextShadow.h +30 -0
- package/shared/skia/modules/skparagraph/include/TextStyle.h +392 -0
- package/shared/skia/modules/skparagraph/include/TypefaceFontProvider.h +78 -0
- package/shared/skia/modules/skresources/include/SkResources.h +291 -0
- package/shared/skia/modules/sksg/include/SkSGClipEffect.h +61 -0
- package/shared/skia/modules/sksg/include/SkSGColorFilter.h +135 -0
- package/shared/skia/modules/sksg/include/SkSGDraw.h +57 -0
- package/shared/skia/modules/sksg/include/SkSGEffectNode.h +50 -0
- package/shared/skia/modules/sksg/include/SkSGGeometryEffect.h +207 -0
- package/shared/skia/modules/sksg/include/SkSGGeometryNode.h +54 -0
- package/shared/skia/modules/sksg/include/SkSGGradient.h +108 -0
- package/shared/skia/modules/sksg/include/SkSGGroup.h +65 -0
- package/shared/skia/modules/sksg/include/SkSGImage.h +59 -0
- package/shared/skia/modules/sksg/include/SkSGInvalidationController.h +46 -0
- package/shared/skia/modules/sksg/include/SkSGMaskEffect.h +65 -0
- package/shared/skia/modules/sksg/include/SkSGMerge.h +74 -0
- package/shared/skia/modules/sksg/include/SkSGNode.h +128 -0
- package/shared/skia/modules/sksg/include/SkSGOpacityEffect.h +54 -0
- package/shared/skia/modules/sksg/include/SkSGPaint.h +112 -0
- package/shared/skia/modules/sksg/include/SkSGPath.h +68 -0
- package/shared/skia/modules/sksg/include/SkSGPlane.h +47 -0
- package/shared/skia/modules/sksg/include/SkSGRect.h +122 -0
- package/shared/skia/modules/sksg/include/SkSGRenderEffect.h +283 -0
- package/shared/skia/modules/sksg/include/SkSGRenderNode.h +157 -0
- package/shared/skia/modules/sksg/include/SkSGScene.h +47 -0
- package/shared/skia/modules/sksg/include/SkSGText.h +82 -0
- package/shared/skia/modules/sksg/include/SkSGTransform.h +127 -0
- package/shared/skia/modules/skshaper/include/SkShaper.h +318 -0
- package/shared/skia/modules/skshaper/include/SkShaper_coretext.h +26 -0
- package/shared/skia/modules/skshaper/include/SkShaper_factory.h +41 -0
- package/shared/skia/modules/skshaper/include/SkShaper_harfbuzz.h +39 -0
- package/shared/skia/modules/skshaper/include/SkShaper_skunicode.h +28 -0
- package/shared/skia/modules/skunicode/include/SkUnicode.h +321 -0
- package/shared/skia/modules/skunicode/include/SkUnicode_icu.h +18 -0
- package/shared/skia/modules/skunicode/include/SkUnicode_libgrapheme.h +19 -0
- package/shared/skia/modules/svg/include/SkSVGAttribute.h +110 -0
- package/shared/skia/modules/svg/include/SkSVGAttributeParser.h +170 -0
- package/shared/skia/modules/svg/include/SkSVGCircle.h +56 -0
- package/shared/skia/modules/svg/include/SkSVGClipPath.h +41 -0
- package/shared/skia/modules/svg/include/SkSVGContainer.h +52 -0
- package/shared/skia/modules/svg/include/SkSVGDOM.h +111 -0
- package/shared/skia/modules/svg/include/SkSVGDefs.h +23 -0
- package/shared/skia/modules/svg/include/SkSVGEllipse.h +51 -0
- package/shared/skia/modules/svg/include/SkSVGFe.h +93 -0
- package/shared/skia/modules/svg/include/SkSVGFeBlend.h +54 -0
- package/shared/skia/modules/svg/include/SkSVGFeColorMatrix.h +55 -0
- package/shared/skia/modules/svg/include/SkSVGFeComponentTransfer.h +82 -0
- package/shared/skia/modules/svg/include/SkSVGFeComposite.h +55 -0
- package/shared/skia/modules/svg/include/SkSVGFeDisplacementMap.h +56 -0
- package/shared/skia/modules/svg/include/SkSVGFeFlood.h +42 -0
- package/shared/skia/modules/svg/include/SkSVGFeGaussianBlur.h +50 -0
- package/shared/skia/modules/svg/include/SkSVGFeImage.h +44 -0
- package/shared/skia/modules/svg/include/SkSVGFeLightSource.h +93 -0
- package/shared/skia/modules/svg/include/SkSVGFeLighting.h +131 -0
- package/shared/skia/modules/svg/include/SkSVGFeMerge.h +63 -0
- package/shared/skia/modules/svg/include/SkSVGFeMorphology.h +55 -0
- package/shared/skia/modules/svg/include/SkSVGFeOffset.h +44 -0
- package/shared/skia/modules/svg/include/SkSVGFeTurbulence.h +49 -0
- package/shared/skia/modules/svg/include/SkSVGFilter.h +48 -0
- package/shared/skia/modules/svg/include/SkSVGFilterContext.h +69 -0
- package/shared/skia/modules/svg/include/SkSVGG.h +23 -0
- package/shared/skia/modules/svg/include/SkSVGGradient.h +56 -0
- package/shared/skia/modules/svg/include/SkSVGHiddenContainer.h +23 -0
- package/shared/skia/modules/svg/include/SkSVGIDMapper.h +19 -0
- package/shared/skia/modules/svg/include/SkSVGImage.h +67 -0
- package/shared/skia/modules/svg/include/SkSVGLine.h +53 -0
- package/shared/skia/modules/svg/include/SkSVGLinearGradient.h +47 -0
- package/shared/skia/modules/svg/include/SkSVGMask.h +49 -0
- package/shared/skia/modules/svg/include/SkSVGNode.h +235 -0
- package/shared/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h +37 -0
- package/shared/skia/modules/svg/include/SkSVGPath.h +46 -0
- package/shared/skia/modules/svg/include/SkSVGPattern.h +61 -0
- package/shared/skia/modules/svg/include/SkSVGPoly.h +56 -0
- package/shared/skia/modules/svg/include/SkSVGRadialGradient.h +48 -0
- package/shared/skia/modules/svg/include/SkSVGRect.h +56 -0
- package/shared/skia/modules/svg/include/SkSVGRenderContext.h +229 -0
- package/shared/skia/modules/svg/include/SkSVGSVG.h +60 -0
- package/shared/skia/modules/svg/include/SkSVGShape.h +40 -0
- package/shared/skia/modules/svg/include/SkSVGStop.h +36 -0
- package/shared/skia/modules/svg/include/SkSVGText.h +128 -0
- package/shared/skia/modules/svg/include/SkSVGTransformableNode.h +48 -0
- package/shared/skia/modules/svg/include/SkSVGTypes.h +740 -0
- package/shared/skia/modules/svg/include/SkSVGUse.h +49 -0
- package/shared/skia/modules/svg/include/SkSVGValue.h +85 -0
- package/shared/skia/src/core/SkArenaAlloc.h +371 -0
- package/shared/skia/src/core/SkAutoLocaleSetter.h +94 -0
- package/shared/skia/src/core/SkChecksum.h +118 -0
- package/shared/skia/src/core/SkLRUCache.h +143 -0
- package/shared/skia/src/core/SkMathPriv.h +225 -0
- package/shared/skia/src/core/SkTHash.h +714 -0
- package/shared/skia/src/core/SkTInternalLList.h +304 -0
- package/shared/skia/src/core/SkTLazy.h +216 -0
- package/shared/skia/src/core/SkUTF.h +102 -0
- package/shared/skia/src/gpu/ganesh/gl/GrGLDefines.h +1162 -0
- package/src/GameMethods.nitro.ts +12 -2
- package/src/GameMethods.ts +57 -2
- package/src/index.tsx +1 -1
- package/src/nativeTypes.ts +13 -0
- package/src/types.ts +7 -9
- package/android/src/main/cpp/GameLoopJNI.cpp +0 -132
- package/android/src/main/java/com/margelo/nitro/rngine/Asset.kt +0 -9
- package/android/src/main/java/com/margelo/nitro/rngine/GameAssets.kt +0 -61
- package/android/src/main/java/com/margelo/nitro/rngine/Screen.kt +0 -9
- package/android/src/main/java/com/margelo/nitro/rngine/Shape.kt +0 -26
- package/android/src/main/java/com/margelo/nitro/rngine/Snapshot.kt +0 -3
- package/android/src/main/java/com/margelo/nitro/rngine/SnapshotSerializer.kt +0 -53
- package/lib/module/GameAssets.js +0 -41
- package/lib/module/GameAssets.js.map +0 -1
- package/lib/module/GameAssets.nitro.js +0 -5
- package/lib/module/GameAssets.nitro.js.map +0 -1
- package/lib/typescript/src/GameAssets.d.ts +0 -2
- package/lib/typescript/src/GameAssets.d.ts.map +0 -1
- package/lib/typescript/src/GameAssets.nitro.d.ts +0 -12
- package/lib/typescript/src/GameAssets.nitro.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JHybridGameAssetsSpec.cpp +0 -86
- package/nitrogen/generated/android/c++/JHybridGameAssetsSpec.hpp +0 -65
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngine/HybridGameAssetsSpec.kt +0 -63
- package/nitrogen/generated/ios/c++/HybridGameAssetsSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridGameAssetsSpecSwift.hpp +0 -99
- package/nitrogen/generated/ios/swift/Func_void.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +0 -46
- package/nitrogen/generated/ios/swift/HybridGameAssetsSpec.swift +0 -57
- package/nitrogen/generated/ios/swift/HybridGameAssetsSpec_cxx.swift +0 -176
- package/nitrogen/generated/shared/c++/HybridGameAssetsSpec.cpp +0 -23
- package/nitrogen/generated/shared/c++/HybridGameAssetsSpec.hpp +0 -65
- package/src/GameAssets.nitro.ts +0 -14
- package/src/GameAssets.ts +0 -47
|
@@ -0,0 +1,56 @@
|
|
|
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 SkASAN_DEFINED
|
|
9
|
+
#define SkASAN_DEFINED
|
|
10
|
+
|
|
11
|
+
#include <cstddef>
|
|
12
|
+
|
|
13
|
+
#ifdef __SANITIZE_ADDRESS__
|
|
14
|
+
#define SK_SANITIZE_ADDRESS 1
|
|
15
|
+
#endif
|
|
16
|
+
#if !defined(SK_SANITIZE_ADDRESS) && defined(__has_feature)
|
|
17
|
+
#if __has_feature(address_sanitizer)
|
|
18
|
+
#define SK_SANITIZE_ADDRESS 1
|
|
19
|
+
#endif
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
// Typically declared in LLVM's asan_interface.h.
|
|
23
|
+
#ifdef SK_SANITIZE_ADDRESS
|
|
24
|
+
extern "C" {
|
|
25
|
+
void __asan_poison_memory_region(void const volatile *addr, size_t size);
|
|
26
|
+
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
|
|
27
|
+
int __asan_address_is_poisoned(void const volatile *addr);
|
|
28
|
+
}
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Code that implements bespoke allocation arenas can poison the entire arena on creation, then
|
|
32
|
+
// unpoison chunks of arena memory as they are parceled out. Consider leaving gaps between blocks
|
|
33
|
+
// to detect buffer overrun.
|
|
34
|
+
static inline void sk_asan_poison_memory_region([[maybe_unused]] void const volatile* addr,
|
|
35
|
+
[[maybe_unused]] size_t size) {
|
|
36
|
+
#ifdef SK_SANITIZE_ADDRESS
|
|
37
|
+
__asan_poison_memory_region(addr, size);
|
|
38
|
+
#endif
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static inline void sk_asan_unpoison_memory_region([[maybe_unused]] void const volatile* addr,
|
|
42
|
+
[[maybe_unused]] size_t size) {
|
|
43
|
+
#ifdef SK_SANITIZE_ADDRESS
|
|
44
|
+
__asan_unpoison_memory_region(addr, size);
|
|
45
|
+
#endif
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static inline int sk_asan_address_is_poisoned([[maybe_unused]] void const volatile* addr) {
|
|
49
|
+
#ifdef SK_SANITIZE_ADDRESS
|
|
50
|
+
return __asan_address_is_poisoned(addr);
|
|
51
|
+
#else
|
|
52
|
+
return 0;
|
|
53
|
+
#endif
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#endif // SkASAN_DEFINED
|
|
@@ -0,0 +1,51 @@
|
|
|
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 SkAlign_DEFINED
|
|
9
|
+
#define SkAlign_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/private/SkAssert.h"
|
|
12
|
+
|
|
13
|
+
#include <cstddef>
|
|
14
|
+
|
|
15
|
+
template <typename T> static constexpr T SkAlign2(T x) { return (x + 1) >> 1 << 1; }
|
|
16
|
+
template <typename T> static constexpr T SkAlign4(T x) { return (x + 3) >> 2 << 2; }
|
|
17
|
+
template <typename T> static constexpr T SkAlign8(T x) { return (x + 7) >> 3 << 3; }
|
|
18
|
+
template <typename T> static constexpr T SkAlign16(T x) { return (x + 15) >> 4 << 4; }
|
|
19
|
+
|
|
20
|
+
template <typename T> static constexpr bool SkIsAlign2(T x) { return 0 == (x & 1); }
|
|
21
|
+
template <typename T> static constexpr bool SkIsAlign4(T x) { return 0 == (x & 3); }
|
|
22
|
+
template <typename T> static constexpr bool SkIsAlign8(T x) { return 0 == (x & 7); }
|
|
23
|
+
template <typename T> static constexpr bool SkIsAlign16(T x) { return 0 == (x & 15); }
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
template <typename T> static constexpr T SkAlignPtr(T x) {
|
|
27
|
+
static_assert(sizeof(void*) == 4 || sizeof(void*) == 8);
|
|
28
|
+
return sizeof(void*) == 8 ? SkAlign8(x) : SkAlign4(x);
|
|
29
|
+
}
|
|
30
|
+
template <typename T> static constexpr bool SkIsAlignPtr(T x) {
|
|
31
|
+
static_assert(sizeof(void*) == 4 || sizeof(void*) == 8);
|
|
32
|
+
return sizeof(void*) == 8 ? SkIsAlign8(x) : SkIsAlign4(x);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* align up to a power of 2
|
|
37
|
+
*/
|
|
38
|
+
template <typename T> static constexpr T SkAlignTo(T x, T alignment) {
|
|
39
|
+
// The same as alignment && SkIsPow2(value), w/o a dependency cycle.
|
|
40
|
+
SkASSERT(alignment && (alignment & (alignment - 1)) == 0);
|
|
41
|
+
return (x + alignment - 1) & ~(alignment - 1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* align up to a non power of 2
|
|
46
|
+
*/
|
|
47
|
+
template <typename T> static constexpr T SkAlignNonPow2(T x, T alignment) {
|
|
48
|
+
return ((x + alignment - 1) / alignment) * alignment;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#endif
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 2022 Google LLC
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
3
|
+
|
|
4
|
+
#ifndef SkAlignedStorage_DEFINED
|
|
5
|
+
#define SkAlignedStorage_DEFINED
|
|
6
|
+
|
|
7
|
+
#include <cstddef>
|
|
8
|
+
#include <iterator>
|
|
9
|
+
|
|
10
|
+
template <int N, typename T> class SkAlignedSTStorage {
|
|
11
|
+
public:
|
|
12
|
+
SkAlignedSTStorage() {}
|
|
13
|
+
SkAlignedSTStorage(SkAlignedSTStorage&&) = delete;
|
|
14
|
+
SkAlignedSTStorage(const SkAlignedSTStorage&) = delete;
|
|
15
|
+
SkAlignedSTStorage& operator=(SkAlignedSTStorage&&) = delete;
|
|
16
|
+
SkAlignedSTStorage& operator=(const SkAlignedSTStorage&) = delete;
|
|
17
|
+
|
|
18
|
+
// Returns void* because this object does not initialize the
|
|
19
|
+
// memory. Use placement new for types that require a constructor.
|
|
20
|
+
void* get() { return fStorage; }
|
|
21
|
+
const void* get() const { return fStorage; }
|
|
22
|
+
|
|
23
|
+
// Act as a container of bytes because the storage is uninitialized.
|
|
24
|
+
std::byte* data() { return fStorage; }
|
|
25
|
+
const std::byte* data() const { return fStorage; }
|
|
26
|
+
size_t size() const { return std::size(fStorage); }
|
|
27
|
+
|
|
28
|
+
private:
|
|
29
|
+
alignas(T) std::byte fStorage[sizeof(T) * N];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
#endif // SkAlignedStorage_DEFINED
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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 SkAnySubclass_DEFINED
|
|
9
|
+
#define SkAnySubclass_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/private/SkAssert.h"
|
|
12
|
+
|
|
13
|
+
#include <cstddef>
|
|
14
|
+
#include <new>
|
|
15
|
+
#include <type_traits> // IWYU pragma: keep
|
|
16
|
+
#include <utility>
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Stores any subclass `T` of `Base`, where sizeof(T) <= `Size`, without using the heap.
|
|
20
|
+
* Doesn't need advance knowledge of T, so it's particularly suited to platform or backend
|
|
21
|
+
* implementations of a generic interface, where the set of possible subclasses is finite and
|
|
22
|
+
* known, but can't be made available at compile-time.
|
|
23
|
+
*/
|
|
24
|
+
template <typename Base, size_t Size>
|
|
25
|
+
class SkAnySubclass {
|
|
26
|
+
public:
|
|
27
|
+
SkAnySubclass() = default;
|
|
28
|
+
~SkAnySubclass() {
|
|
29
|
+
this->reset();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
SkAnySubclass(const SkAnySubclass&) = delete;
|
|
33
|
+
SkAnySubclass& operator=(const SkAnySubclass&) = delete;
|
|
34
|
+
SkAnySubclass(SkAnySubclass&&) = delete;
|
|
35
|
+
SkAnySubclass& operator=(SkAnySubclass&&) = delete;
|
|
36
|
+
|
|
37
|
+
template <typename T, typename... Args>
|
|
38
|
+
void emplace(Args&&... args) {
|
|
39
|
+
static_assert(std::is_base_of_v<Base, T>);
|
|
40
|
+
static_assert(sizeof(T) <= Size);
|
|
41
|
+
// We're going to clean up our stored object by calling ~Base:
|
|
42
|
+
static_assert(std::has_virtual_destructor_v<Base> || std::is_trivially_destructible_v<T>);
|
|
43
|
+
SkASSERT(!fValid);
|
|
44
|
+
new (fData) T(std::forward<Args>(args)...);
|
|
45
|
+
fValid = true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void reset() {
|
|
49
|
+
if (fValid) {
|
|
50
|
+
this->get()->~Base();
|
|
51
|
+
}
|
|
52
|
+
fValid = false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
bool has_value() const { return fValid; }
|
|
56
|
+
explicit operator bool() const { return this->has_value(); }
|
|
57
|
+
|
|
58
|
+
const Base* get() const {
|
|
59
|
+
SkASSERT(fValid);
|
|
60
|
+
return std::launder(reinterpret_cast<const Base*>(fData));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
Base* get() {
|
|
64
|
+
SkASSERT(fValid);
|
|
65
|
+
return std::launder(reinterpret_cast<Base*>(fData));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Base* operator->() { return this->get(); }
|
|
69
|
+
const Base* operator->() const { return this->get(); }
|
|
70
|
+
|
|
71
|
+
Base& operator*() { return *this->get(); }
|
|
72
|
+
const Base& operator*() const { return *this->get(); }
|
|
73
|
+
|
|
74
|
+
private:
|
|
75
|
+
alignas(8) std::byte fData[Size];
|
|
76
|
+
bool fValid = false;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
#endif // SkAnySubclass_DEFINED
|
|
@@ -0,0 +1,203 @@
|
|
|
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 SkAssert_DEFINED
|
|
9
|
+
#define SkAssert_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/private/SkAPI.h"
|
|
12
|
+
#include "include/private/SkAttributes.h"
|
|
13
|
+
#include "include/private/SkDebug.h" // IWYU pragma: keep
|
|
14
|
+
#include "include/private/SkLog.h"
|
|
15
|
+
|
|
16
|
+
#include <cstddef>
|
|
17
|
+
#include <limits>
|
|
18
|
+
|
|
19
|
+
#if defined(__clang__) && defined(__has_attribute)
|
|
20
|
+
#if __has_attribute(likely)
|
|
21
|
+
#define SK_LIKELY [[likely]]
|
|
22
|
+
#define SK_UNLIKELY [[unlikely]]
|
|
23
|
+
#else
|
|
24
|
+
#define SK_LIKELY
|
|
25
|
+
#define SK_UNLIKELY
|
|
26
|
+
#endif
|
|
27
|
+
#else
|
|
28
|
+
#define SK_LIKELY
|
|
29
|
+
#define SK_UNLIKELY
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
// c++23 will give us [[assume]] -- until then we're stuck with various other options:
|
|
33
|
+
#if defined(__clang__)
|
|
34
|
+
#define SK_ASSUME(cond) __builtin_assume(cond)
|
|
35
|
+
#elif defined(__GNUC__)
|
|
36
|
+
#if __GNUC__ >= 13
|
|
37
|
+
#define SK_ASSUME(cond) __attribute__((assume(cond)))
|
|
38
|
+
#else
|
|
39
|
+
// NOTE: This implementation could actually evaluate `cond`, which is not desirable.
|
|
40
|
+
#define SK_ASSUME(cond) ((cond) ? (void)0 : __builtin_unreachable())
|
|
41
|
+
#endif
|
|
42
|
+
#elif defined(_MSC_VER)
|
|
43
|
+
#define SK_ASSUME(cond) __assume(cond)
|
|
44
|
+
#else
|
|
45
|
+
#define SK_ASSUME(cond) ((void)0)
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
/** Called internally if we hit an unrecoverable error.
|
|
49
|
+
The platform implementation must not return, but should either throw
|
|
50
|
+
an exception or otherwise exit.
|
|
51
|
+
*/
|
|
52
|
+
[[noreturn]] SK_API extern void sk_abort_no_print(void);
|
|
53
|
+
|
|
54
|
+
#if defined(SK_BUILD_FOR_GOOGLE3)
|
|
55
|
+
void SkDebugfForDumpStackTrace(const char* data, void* unused);
|
|
56
|
+
namespace base {
|
|
57
|
+
void DumpStackTrace(int skip_count, void w(const char*, void*), void* arg);
|
|
58
|
+
}
|
|
59
|
+
# define SK_DUMP_GOOGLE3_STACK() ::base::DumpStackTrace(0, SkDebugfForDumpStackTrace, nullptr)
|
|
60
|
+
#else
|
|
61
|
+
# define SK_DUMP_GOOGLE3_STACK()
|
|
62
|
+
#endif
|
|
63
|
+
|
|
64
|
+
#if !defined(SK_ABORT)
|
|
65
|
+
# if defined(SK_BUILD_FOR_WIN)
|
|
66
|
+
// This style lets Visual Studio follow errors back to the source file.
|
|
67
|
+
# define SK_DUMP_LINE_FORMAT "%s(%d)"
|
|
68
|
+
# else
|
|
69
|
+
# define SK_DUMP_LINE_FORMAT "%s:%d"
|
|
70
|
+
# endif
|
|
71
|
+
# define SK_ABORT(message, ...) \
|
|
72
|
+
do { \
|
|
73
|
+
SKIA_LOG_E(SK_DUMP_LINE_FORMAT ": fatal error: \"" message "\"", \
|
|
74
|
+
__FILE__, __LINE__, ##__VA_ARGS__); \
|
|
75
|
+
SK_DUMP_GOOGLE3_STACK(); \
|
|
76
|
+
sk_abort_no_print(); \
|
|
77
|
+
} while (false)
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
// SkASSERT, SkASSERTF and SkASSERT_RELEASE can be used as standalone assertion expressions, e.g.
|
|
81
|
+
// uint32_t foo(int x) {
|
|
82
|
+
// SkASSERT(x > 4);
|
|
83
|
+
// return x - 4;
|
|
84
|
+
// }
|
|
85
|
+
// and are also written to be compatible with constexpr functions:
|
|
86
|
+
// constexpr uint32_t foo(int x) {
|
|
87
|
+
// return SkASSERT(x > 4),
|
|
88
|
+
// x - 4;
|
|
89
|
+
// }
|
|
90
|
+
#if defined(__clang__)
|
|
91
|
+
#define SkASSERT_RELEASE(cond) \
|
|
92
|
+
static_cast<void>( __builtin_expect(static_cast<bool>(cond), 1) \
|
|
93
|
+
? static_cast<void>(0) \
|
|
94
|
+
: []{ SK_ABORT("check(%s)", #cond); }() )
|
|
95
|
+
|
|
96
|
+
#define SkASSERTF_RELEASE(cond, fmt, ...) \
|
|
97
|
+
static_cast<void>( __builtin_expect(static_cast<bool>(cond), 1) \
|
|
98
|
+
? static_cast<void>(0) \
|
|
99
|
+
: [&]{ SK_ABORT("assertf(%s): " fmt, #cond, ##__VA_ARGS__); }() )
|
|
100
|
+
#else
|
|
101
|
+
#define SkASSERT_RELEASE(cond) \
|
|
102
|
+
static_cast<void>( (cond) ? static_cast<void>(0) : []{ SK_ABORT("check(%s)", #cond); }() )
|
|
103
|
+
|
|
104
|
+
#define SkASSERTF_RELEASE(cond, fmt, ...) \
|
|
105
|
+
static_cast<void>( (cond) \
|
|
106
|
+
? static_cast<void>(0) \
|
|
107
|
+
: [&]{ SK_ABORT("assertf(%s): " fmt, #cond, ##__VA_ARGS__); }() )
|
|
108
|
+
#endif
|
|
109
|
+
|
|
110
|
+
#if defined(SK_DEBUG)
|
|
111
|
+
#define SkASSERT(cond) SkASSERT_RELEASE(cond)
|
|
112
|
+
#define SkASSERTF(cond, fmt, ...) SkASSERTF_RELEASE(cond, fmt, ##__VA_ARGS__)
|
|
113
|
+
#define SkDEBUGFAIL(message) SK_ABORT("%s", message)
|
|
114
|
+
#define SkDEBUGFAILF(fmt, ...) SK_ABORT(fmt, ##__VA_ARGS__)
|
|
115
|
+
#define SkAssertResult(cond) SkASSERT(cond)
|
|
116
|
+
#else
|
|
117
|
+
#define SkASSERT(cond) static_cast<void>(0)
|
|
118
|
+
#define SkASSERTF(cond, fmt, ...) static_cast<void>(0)
|
|
119
|
+
#define SkDEBUGFAIL(message)
|
|
120
|
+
#define SkDEBUGFAILF(fmt, ...)
|
|
121
|
+
|
|
122
|
+
// unlike SkASSERT, this macro executes its condition in the non-debug build.
|
|
123
|
+
// The if is present so that this can be used with functions marked [[nodiscard]].
|
|
124
|
+
#define SkAssertResult(cond) if (cond) {} do {} while(false)
|
|
125
|
+
#endif
|
|
126
|
+
|
|
127
|
+
#if !defined(SkUNREACHABLE)
|
|
128
|
+
# if defined(_MSC_VER) && !defined(__clang__)
|
|
129
|
+
# include <intrin.h>
|
|
130
|
+
# define FAST_FAIL_INVALID_ARG 5
|
|
131
|
+
// See https://developercommunity.visualstudio.com/content/problem/1128631/code-flow-doesnt-see-noreturn-with-extern-c.html
|
|
132
|
+
// for why this is wrapped. Hopefully removable after msvc++ 19.27 is no longer supported.
|
|
133
|
+
[[noreturn]] static inline void sk_fast_fail() { __fastfail(FAST_FAIL_INVALID_ARG); }
|
|
134
|
+
# define SkUNREACHABLE sk_fast_fail()
|
|
135
|
+
# else
|
|
136
|
+
# define SkUNREACHABLE __builtin_trap()
|
|
137
|
+
# endif
|
|
138
|
+
#endif
|
|
139
|
+
|
|
140
|
+
[[noreturn]] SK_API inline void sk_print_index_out_of_bounds(size_t i, size_t size) {
|
|
141
|
+
SK_ABORT("Index (%zu) out of bounds for size %zu.", i, size);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
template <typename T> SK_API inline T sk_collection_check_bounds(T i, T size) {
|
|
145
|
+
if (0 <= i && i < size) SK_LIKELY {
|
|
146
|
+
return i;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
SK_UNLIKELY {
|
|
150
|
+
#if defined(SK_DEBUG)
|
|
151
|
+
sk_print_index_out_of_bounds(static_cast<size_t>(i), static_cast<size_t>(size));
|
|
152
|
+
#else
|
|
153
|
+
SkUNREACHABLE;
|
|
154
|
+
#endif
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
[[noreturn]] SK_API inline void sk_print_length_too_big(size_t i, size_t size) {
|
|
159
|
+
SK_ABORT("Length (%zu) is too big for size %zu.", i, size);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
template <typename T> SK_API inline T sk_collection_check_length(T i, T size) {
|
|
163
|
+
if (0 <= i && i <= size) SK_LIKELY {
|
|
164
|
+
return i;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
SK_UNLIKELY {
|
|
168
|
+
#if defined(SK_DEBUG)
|
|
169
|
+
sk_print_length_too_big(static_cast<size_t>(i), static_cast<size_t>(size));
|
|
170
|
+
#else
|
|
171
|
+
SkUNREACHABLE;
|
|
172
|
+
#endif
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
SK_API inline void sk_collection_not_empty(bool empty) {
|
|
177
|
+
if (empty) SK_UNLIKELY {
|
|
178
|
+
#if defined(SK_DEBUG)
|
|
179
|
+
SK_ABORT("Collection is empty.");
|
|
180
|
+
#else
|
|
181
|
+
SkUNREACHABLE;
|
|
182
|
+
#endif
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
[[noreturn]] SK_API inline void sk_print_size_too_big(size_t size, size_t maxSize) {
|
|
187
|
+
SK_ABORT("Size (%zu) can't be represented in bytes. Max size is %zu.", size, maxSize);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
template <typename T>
|
|
191
|
+
SK_ALWAYS_INLINE size_t check_size_bytes_too_big(size_t size) {
|
|
192
|
+
const size_t kMaxSize = std::numeric_limits<size_t>::max() / sizeof(T);
|
|
193
|
+
if (size > kMaxSize) {
|
|
194
|
+
#if defined(SK_DEBUG)
|
|
195
|
+
sk_print_size_too_big(size, kMaxSize);
|
|
196
|
+
#else
|
|
197
|
+
SkUNREACHABLE;
|
|
198
|
+
#endif
|
|
199
|
+
}
|
|
200
|
+
return size;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
#endif // SkAssert_DEFINED
|
|
@@ -0,0 +1,96 @@
|
|
|
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 SkAttributes_DEFINED
|
|
9
|
+
#define SkAttributes_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/private/SkFeatures.h" // IWYU pragma: keep
|
|
12
|
+
#include "include/private/SkLoadUserConfig.h" // IWYU pragma: keep
|
|
13
|
+
|
|
14
|
+
#if defined(__clang__) || defined(__GNUC__)
|
|
15
|
+
# define SK_ATTRIBUTE(attr) __attribute__((attr))
|
|
16
|
+
#else
|
|
17
|
+
# define SK_ATTRIBUTE(attr)
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* If your judgment is better than the compiler's (i.e. you've profiled it),
|
|
22
|
+
* you can use SK_ALWAYS_INLINE to force inlining. E.g.
|
|
23
|
+
* inline void someMethod() { ... } // may not be inlined
|
|
24
|
+
* SK_ALWAYS_INLINE void someMethod() { ... } // should always be inlined
|
|
25
|
+
*/
|
|
26
|
+
#if !defined(SK_ALWAYS_INLINE)
|
|
27
|
+
# if defined(SK_BUILD_FOR_WIN)
|
|
28
|
+
# define SK_ALWAYS_INLINE __forceinline
|
|
29
|
+
# else
|
|
30
|
+
# define SK_ALWAYS_INLINE SK_ATTRIBUTE(always_inline) inline
|
|
31
|
+
# endif
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* If your judgment is better than the compiler's (i.e. you've profiled it),
|
|
36
|
+
* you can use SK_NEVER_INLINE to prevent inlining.
|
|
37
|
+
*/
|
|
38
|
+
#if !defined(SK_NEVER_INLINE)
|
|
39
|
+
# if defined(SK_BUILD_FOR_WIN)
|
|
40
|
+
# define SK_NEVER_INLINE __declspec(noinline)
|
|
41
|
+
# else
|
|
42
|
+
# define SK_NEVER_INLINE SK_ATTRIBUTE(noinline)
|
|
43
|
+
# endif
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Used to annotate a function as taking printf style arguments.
|
|
48
|
+
* `A` is the (1 based) index of the format string argument.
|
|
49
|
+
* `B` is the (1 based) index of the first argument used by the format string.
|
|
50
|
+
*/
|
|
51
|
+
#if !defined(SK_PRINTF_LIKE)
|
|
52
|
+
# define SK_PRINTF_LIKE(A, B) SK_ATTRIBUTE(format(printf, (A), (B)))
|
|
53
|
+
#endif
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Used to ignore sanitizer warnings.
|
|
57
|
+
*/
|
|
58
|
+
#if !defined(SK_NO_SANITIZE)
|
|
59
|
+
#if defined(__has_attribute)
|
|
60
|
+
#if __has_attribute(no_sanitize)
|
|
61
|
+
// This should be for clang and versions of gcc >= 8.0
|
|
62
|
+
#define SK_NO_SANITIZE(A) SK_ATTRIBUTE(no_sanitize(A))
|
|
63
|
+
#else
|
|
64
|
+
// For compilers that don't support sanitization, just do nothing.
|
|
65
|
+
#define SK_NO_SANITIZE(A)
|
|
66
|
+
#endif
|
|
67
|
+
#else // no __has_attribute, e.g. MSVC
|
|
68
|
+
#define SK_NO_SANITIZE(A)
|
|
69
|
+
#endif
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Used to ignore CFI sanitizer warnings, supported only by Clang at the moment.
|
|
74
|
+
*/
|
|
75
|
+
#if defined(__clang__)
|
|
76
|
+
#define SK_NO_SANITIZE_CFI SK_NO_SANITIZE("cfi")
|
|
77
|
+
#else
|
|
78
|
+
#define SK_NO_SANITIZE_CFI
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Annotates a class' non-trivial special functions as trivial for the purposes of calls.
|
|
83
|
+
* Allows a class with a non-trivial destructor to be __is_trivially_relocatable.
|
|
84
|
+
* Use of this attribute on a public API breaks platform ABI.
|
|
85
|
+
* Annotated classes may not hold pointers derived from `this`.
|
|
86
|
+
* Annotated classes must implement move+delete as equivalent to memcpy+free.
|
|
87
|
+
* Use may require more complete types, as callee destroys.
|
|
88
|
+
*
|
|
89
|
+
* https://clang.llvm.org/docs/AttributeReference.html#trivial-abi
|
|
90
|
+
* https://libcxx.llvm.org/DesignDocs/UniquePtrTrivialAbi.html
|
|
91
|
+
*/
|
|
92
|
+
#if !defined(SK_TRIVIAL_ABI)
|
|
93
|
+
# define SK_TRIVIAL_ABI
|
|
94
|
+
#endif
|
|
95
|
+
|
|
96
|
+
#endif
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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
|
+
#ifndef SkCPUTypes_DEFINED
|
|
8
|
+
#define SkCPUTypes_DEFINED
|
|
9
|
+
|
|
10
|
+
// TODO(bungeman,kjlubick) There are a lot of assumptions throughout the codebase that
|
|
11
|
+
// these types are 32 bits, when they could be more or less. Public APIs should stop
|
|
12
|
+
// using these. Internally, we could use uint_fast8_t and uint_fast16_t, but not in
|
|
13
|
+
// public APIs due to ABI incompatibilities.
|
|
14
|
+
|
|
15
|
+
/** Fast type for unsigned 8 bits. Use for parameter passing and local
|
|
16
|
+
variables, not for storage
|
|
17
|
+
*/
|
|
18
|
+
typedef unsigned U8CPU;
|
|
19
|
+
|
|
20
|
+
/** Fast type for unsigned 16 bits. Use for parameter passing and local
|
|
21
|
+
variables, not for storage
|
|
22
|
+
*/
|
|
23
|
+
typedef unsigned U16CPU;
|
|
24
|
+
|
|
25
|
+
#endif
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Copyright 2022 Google LLC
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
3
|
+
|
|
4
|
+
#ifndef SkContainers_DEFINED
|
|
5
|
+
#define SkContainers_DEFINED
|
|
6
|
+
|
|
7
|
+
#include "include/core/SkSpan.h"
|
|
8
|
+
#include "include/private/SkAPI.h"
|
|
9
|
+
#include "include/private/SkAlign.h"
|
|
10
|
+
|
|
11
|
+
#include <cstddef>
|
|
12
|
+
#include <cstdint>
|
|
13
|
+
|
|
14
|
+
class SK_SPI SkContainerAllocator {
|
|
15
|
+
public:
|
|
16
|
+
SkContainerAllocator(size_t sizeOfT, int maxCapacity)
|
|
17
|
+
: fSizeOfT{sizeOfT}
|
|
18
|
+
, fMaxCapacity{maxCapacity} {}
|
|
19
|
+
|
|
20
|
+
// allocate will abort on failure. Given a capacity of 0, it will return the empty span.
|
|
21
|
+
// The bytes allocated are freed using sk_free().
|
|
22
|
+
SkSpan<std::byte> allocate(int capacity, double growthFactor = 1.0);
|
|
23
|
+
|
|
24
|
+
// Rounds a requested capacity up towards `kCapacityMultiple` in a constexpr-friendly fashion.
|
|
25
|
+
template <typename T>
|
|
26
|
+
static constexpr size_t RoundUp(size_t capacity) {
|
|
27
|
+
return SkAlignTo(capacity * sizeof(T), (size_t) kCapacityMultiple) / sizeof(T);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private:
|
|
31
|
+
friend struct SkContainerAllocatorTestingPeer;
|
|
32
|
+
|
|
33
|
+
// All capacity counts will be rounded up to kCapacityMultiple. This matches ASAN's shadow
|
|
34
|
+
// granularity, as well as our typical struct alignment on a 64-bit machine.
|
|
35
|
+
static constexpr int64_t kCapacityMultiple = 8;
|
|
36
|
+
|
|
37
|
+
// Rounds up capacity to next multiple of kCapacityMultiple and pin to fMaxCapacity.
|
|
38
|
+
size_t roundUpCapacity(int64_t capacity) const;
|
|
39
|
+
|
|
40
|
+
// Grows the capacity by growthFactor being sure to stay with in kMinBytes and fMaxCapacity.
|
|
41
|
+
size_t growthFactorCapacity(int capacity, double growthFactor) const;
|
|
42
|
+
|
|
43
|
+
const size_t fSizeOfT;
|
|
44
|
+
const int64_t fMaxCapacity;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// sk_allocate_canfail returns the empty span on failure. Parameter size must be > 0.
|
|
48
|
+
SkSpan<std::byte> sk_allocate_canfail(size_t size);
|
|
49
|
+
|
|
50
|
+
// Returns the empty span if size is 0. sk_allocate_throw aborts on failure.
|
|
51
|
+
SkSpan<std::byte> sk_allocate_throw(size_t size);
|
|
52
|
+
|
|
53
|
+
SK_SPI void sk_report_container_overflow_and_die();
|
|
54
|
+
#endif // SkContainers_DEFINED
|
|
@@ -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/SkAPI.h"
|
|
12
|
+
#include "include/private/SkAttributes.h"
|
|
13
|
+
#include "include/private/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
|