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,173 @@
|
|
|
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(__EMSCRIPTEN__)
|
|
23
|
+
// WASM toolchains expose a Unix-like compilation environment, but it is
|
|
24
|
+
// not Unix (e.g. posix signals are not supported).
|
|
25
|
+
#define SK_BUILD_FOR_WASM
|
|
26
|
+
#elif defined(linux) || defined(__linux) || defined(__FreeBSD__) || \
|
|
27
|
+
defined(__OpenBSD__) || defined(__sun) || defined(__NetBSD__) || \
|
|
28
|
+
defined(__DragonFly__) || defined(__Fuchsia__) || \
|
|
29
|
+
defined(__GLIBC__) || defined(__GNU__) || defined(__unix__)
|
|
30
|
+
#define SK_BUILD_FOR_UNIX
|
|
31
|
+
#elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
|
32
|
+
#define SK_BUILD_FOR_IOS
|
|
33
|
+
#else
|
|
34
|
+
#define SK_BUILD_FOR_MAC
|
|
35
|
+
#endif
|
|
36
|
+
#endif // end SK_BUILD_FOR_*
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
#if defined(SK_BUILD_FOR_WIN) && !defined(__clang__)
|
|
40
|
+
#if !defined(SK_RESTRICT)
|
|
41
|
+
#define SK_RESTRICT __restrict
|
|
42
|
+
#endif
|
|
43
|
+
#endif
|
|
44
|
+
|
|
45
|
+
#if !defined(SK_RESTRICT)
|
|
46
|
+
#define SK_RESTRICT __restrict__
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
#if !defined(SK_CPU_BENDIAN) && !defined(SK_CPU_LENDIAN)
|
|
50
|
+
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
|
51
|
+
#define SK_CPU_BENDIAN
|
|
52
|
+
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
|
53
|
+
#define SK_CPU_LENDIAN
|
|
54
|
+
#elif defined(__sparc) || defined(__sparc__) || \
|
|
55
|
+
defined(_POWER) || defined(__powerpc__) || \
|
|
56
|
+
defined(__ppc__) || defined(__hppa) || \
|
|
57
|
+
defined(__PPC__) || defined(__PPC64__) || \
|
|
58
|
+
defined(_MIPSEB) || defined(__ARMEB__) || \
|
|
59
|
+
defined(__s390__) || \
|
|
60
|
+
(defined(__sh__) && defined(__BIG_ENDIAN__)) || \
|
|
61
|
+
(defined(__ia64) && defined(__BIG_ENDIAN__))
|
|
62
|
+
#define SK_CPU_BENDIAN
|
|
63
|
+
#else
|
|
64
|
+
#define SK_CPU_LENDIAN
|
|
65
|
+
#endif
|
|
66
|
+
#endif
|
|
67
|
+
|
|
68
|
+
#if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64)
|
|
69
|
+
#define SK_CPU_X86 1
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
#if defined(__loongarch__) || defined (__loongarch64)
|
|
73
|
+
#define SK_CPU_LOONGARCH 1
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
#if defined(__powerpc__) || defined (__powerpc64__)
|
|
77
|
+
#define SK_CPU_PPC 1
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* SK_CPU_X64_LEVEL
|
|
82
|
+
*
|
|
83
|
+
* If defined, SK_CPU_X64_LEVEL should be set to the highest supported level.
|
|
84
|
+
* On non-Intel, non-AMD CPUs this should be undefined.
|
|
85
|
+
*/
|
|
86
|
+
#define SK_CPU_X64_LEVEL_SSE1 10
|
|
87
|
+
#define SK_CPU_X64_LEVEL_SSE2 20
|
|
88
|
+
#define SK_CPU_X64_LEVEL_SSE3 30
|
|
89
|
+
#define SK_CPU_X64_LEVEL_SSSE3 31
|
|
90
|
+
#define SK_CPU_X64_LEVEL_SSE41 41
|
|
91
|
+
#define SK_CPU_X64_LEVEL_SSE42 42
|
|
92
|
+
#define SK_CPU_X64_LEVEL_AVX 51
|
|
93
|
+
#define SK_CPU_X64_LEVEL_AVX2 52
|
|
94
|
+
#define SK_CPU_X64_LEVEL_ML4 60
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* SK_CPU_LSX_LEVEL
|
|
98
|
+
*
|
|
99
|
+
* If defined, SK_CPU_LSX_LEVEL should be set to the highest supported level.
|
|
100
|
+
* On non-loongarch CPU this should be undefined.
|
|
101
|
+
*/
|
|
102
|
+
#define SK_CPU_LSX_LEVEL_LSX 10
|
|
103
|
+
#define SK_CPU_LSX_LEVEL_LASX 20
|
|
104
|
+
|
|
105
|
+
// TODO(kjlubick) clean up these checks
|
|
106
|
+
|
|
107
|
+
// Are we in GCC/Clang?
|
|
108
|
+
#ifndef SK_CPU_X64_LEVEL
|
|
109
|
+
// These checks must be done in descending order to ensure we set the highest
|
|
110
|
+
// available SSE level.
|
|
111
|
+
#if defined(__AVX512F__) && defined(__AVX512DQ__) && defined(__AVX512CD__) && \
|
|
112
|
+
defined(__AVX512BW__) && defined(__AVX512VL__)
|
|
113
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_ML4
|
|
114
|
+
#elif defined(__AVX2__)
|
|
115
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_AVX2
|
|
116
|
+
#elif defined(__AVX__)
|
|
117
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_AVX
|
|
118
|
+
#elif defined(__SSE4_2__)
|
|
119
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_SSE42
|
|
120
|
+
#elif defined(__SSE4_1__)
|
|
121
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_SSE41
|
|
122
|
+
#elif defined(__SSSE3__)
|
|
123
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_SSSE3
|
|
124
|
+
#elif defined(__SSE3__)
|
|
125
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_SSE3
|
|
126
|
+
#elif defined(__SSE2__)
|
|
127
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_SSE2
|
|
128
|
+
#endif
|
|
129
|
+
#endif
|
|
130
|
+
|
|
131
|
+
#ifndef SK_CPU_LSX_LEVEL
|
|
132
|
+
#if defined(__loongarch_asx)
|
|
133
|
+
#define SK_CPU_LSX_LEVEL SK_CPU_LSX_LEVEL_LASX
|
|
134
|
+
#elif defined(__loongarch_sx)
|
|
135
|
+
#define SK_CPU_LSX_LEVEL SK_CPU_LSX_LEVEL_LSX
|
|
136
|
+
#endif
|
|
137
|
+
#endif
|
|
138
|
+
|
|
139
|
+
// Are we in VisualStudio?
|
|
140
|
+
#ifndef SK_CPU_X64_LEVEL
|
|
141
|
+
// These checks must be done in descending order to ensure we set the highest
|
|
142
|
+
// available SSE level. 64-bit intel guarantees at least SSE2 support.
|
|
143
|
+
#if defined(__AVX512F__) && defined(__AVX512DQ__) && defined(__AVX512CD__) && \
|
|
144
|
+
defined(__AVX512BW__) && defined(__AVX512VL__)
|
|
145
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_ML4
|
|
146
|
+
#elif defined(__AVX2__)
|
|
147
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_AVX2
|
|
148
|
+
#elif defined(__AVX__)
|
|
149
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_AVX
|
|
150
|
+
#elif defined(_M_X64) || defined(_M_AMD64)
|
|
151
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_SSE2
|
|
152
|
+
#elif defined(_M_IX86_FP)
|
|
153
|
+
#if _M_IX86_FP >= 2
|
|
154
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_SSE2
|
|
155
|
+
#elif _M_IX86_FP == 1
|
|
156
|
+
#define SK_CPU_X64_LEVEL SK_CPU_X64_LEVEL_SSE1
|
|
157
|
+
#endif
|
|
158
|
+
#endif
|
|
159
|
+
#endif
|
|
160
|
+
|
|
161
|
+
// ARM defines
|
|
162
|
+
#if defined(__arm__) && (!defined(__APPLE__) || !TARGET_IPHONE_SIMULATOR)
|
|
163
|
+
#define SK_CPU_ARM32
|
|
164
|
+
#elif defined(__aarch64__)
|
|
165
|
+
#define SK_CPU_ARM64
|
|
166
|
+
#endif
|
|
167
|
+
|
|
168
|
+
// All 64-bit ARM chips have NEON. Many 32-bit ARM chips do too.
|
|
169
|
+
#if !defined(SK_ARM_HAS_NEON) && defined(__ARM_NEON)
|
|
170
|
+
#define SK_ARM_HAS_NEON
|
|
171
|
+
#endif
|
|
172
|
+
|
|
173
|
+
#endif // SkFeatures_DEFINED
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2006 The Android Open Source Project
|
|
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 SkFixed_DEFINED
|
|
9
|
+
#define SkFixed_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/private/SkAssert.h"
|
|
12
|
+
#include "include/private/SkDebug.h"
|
|
13
|
+
#include "include/private/SkMath.h" // IWYU pragma: keep
|
|
14
|
+
#include "include/private/SkTPin.h" // IWYU pragma: keep
|
|
15
|
+
|
|
16
|
+
#include <cstdint>
|
|
17
|
+
|
|
18
|
+
/** \file SkFixed.h
|
|
19
|
+
|
|
20
|
+
Types and macros for 16.16 fixed point
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/** 32 bit signed integer used to represent fractions values with 16 bits to the right of the decimal point
|
|
24
|
+
*/
|
|
25
|
+
typedef int32_t SkFixed;
|
|
26
|
+
#define SK_Fixed1 (1 << 16)
|
|
27
|
+
#define SK_FixedHalf (1 << 15)
|
|
28
|
+
#define SK_FixedQuarter (1 << 14)
|
|
29
|
+
#define SK_FixedMax (0x7FFFFFFF)
|
|
30
|
+
#define SK_FixedMin (-SK_FixedMax)
|
|
31
|
+
#define SK_FixedPI (0x3243F)
|
|
32
|
+
#define SK_FixedSqrt2 (92682)
|
|
33
|
+
#define SK_FixedTanPIOver8 (0x6A0A)
|
|
34
|
+
#define SK_FixedRoot2Over2 (0xB505)
|
|
35
|
+
|
|
36
|
+
// NOTE: SkFixedToFloat is exact. SkFloatToFixed seems to lack a rounding step. For all fixed-point
|
|
37
|
+
// values, this version is as accurate as possible for (fixed -> float -> fixed). Rounding reduces
|
|
38
|
+
// accuracy if the intermediate floats are in the range that only holds integers (adding 0.5f to an
|
|
39
|
+
// odd integer then snaps to nearest even). Using double for the rounding math gives maximum
|
|
40
|
+
// accuracy for (float -> fixed -> float), but that's usually overkill.
|
|
41
|
+
#define SkFixedToFloat(x) ((x) * 1.52587890625e-5f)
|
|
42
|
+
#define SkFloatToFixed(x) sk_float_saturate2int((x) * SK_Fixed1)
|
|
43
|
+
|
|
44
|
+
#ifdef SK_DEBUG
|
|
45
|
+
static inline SkFixed SkFloatToFixed_Check(float x) {
|
|
46
|
+
int64_t n64 = (int64_t)(x * SK_Fixed1);
|
|
47
|
+
SkFixed n32 = (SkFixed)n64;
|
|
48
|
+
SkASSERT(n64 == n32);
|
|
49
|
+
return n32;
|
|
50
|
+
}
|
|
51
|
+
#else
|
|
52
|
+
#define SkFloatToFixed_Check(x) SkFloatToFixed(x)
|
|
53
|
+
#endif
|
|
54
|
+
|
|
55
|
+
#define SkFixedToDouble(x) ((x) * 1.52587890625e-5)
|
|
56
|
+
#define SkDoubleToFixed(x) ((SkFixed)((x) * SK_Fixed1))
|
|
57
|
+
|
|
58
|
+
/** Converts an integer to a SkFixed, asserting that the result does not overflow
|
|
59
|
+
a 32 bit signed integer
|
|
60
|
+
*/
|
|
61
|
+
#ifdef SK_DEBUG
|
|
62
|
+
inline SkFixed SkIntToFixed(int n)
|
|
63
|
+
{
|
|
64
|
+
SkASSERT(n >= -32768 && n <= 32767);
|
|
65
|
+
// Left shifting a negative value has undefined behavior in C, so we cast to unsigned before
|
|
66
|
+
// shifting.
|
|
67
|
+
return (SkFixed)( (unsigned)n << 16 );
|
|
68
|
+
}
|
|
69
|
+
#else
|
|
70
|
+
// Left shifting a negative value has undefined behavior in C, so we cast to unsigned before
|
|
71
|
+
// shifting. Then we force the cast to SkFixed to ensure that the answer is signed (like the
|
|
72
|
+
// debug version).
|
|
73
|
+
#define SkIntToFixed(n) (SkFixed)((unsigned)(n) << 16)
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
#define SkFixedRoundToInt(x) (((x) + SK_FixedHalf) >> 16)
|
|
77
|
+
#define SkFixedCeilToInt(x) (((x) + SK_Fixed1 - 1) >> 16)
|
|
78
|
+
#define SkFixedFloorToInt(x) ((x) >> 16)
|
|
79
|
+
|
|
80
|
+
static inline SkFixed SkFixedRoundToFixed(SkFixed x) {
|
|
81
|
+
return (SkFixed)( (uint32_t)(x + SK_FixedHalf) & 0xFFFF0000 );
|
|
82
|
+
}
|
|
83
|
+
static inline SkFixed SkFixedCeilToFixed(SkFixed x) {
|
|
84
|
+
return (SkFixed)( (uint32_t)(x + SK_Fixed1 - 1) & 0xFFFF0000 );
|
|
85
|
+
}
|
|
86
|
+
static inline SkFixed SkFixedFloorToFixed(SkFixed x) {
|
|
87
|
+
return (SkFixed)( (uint32_t)x & 0xFFFF0000 );
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#define SkFixedAve(a, b) (((a) + (b)) >> 1)
|
|
91
|
+
|
|
92
|
+
// The divide may exceed 32 bits. Clamp to a signed 32 bit result.
|
|
93
|
+
#define SkFixedDiv(numer, denom) \
|
|
94
|
+
SkToS32(SkTPin<int64_t>((SkLeftShift((int64_t)(numer), 16) / (denom)), SK_MinS32, SK_MaxS32))
|
|
95
|
+
|
|
96
|
+
static inline SkFixed SkFixedMul(SkFixed a, SkFixed b) {
|
|
97
|
+
return (SkFixed)((int64_t)a * b >> 16);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
101
|
+
// Platform-specific alternatives to our portable versions.
|
|
102
|
+
|
|
103
|
+
// The VCVT float-to-fixed instruction is part of the VFPv3 instruction set.
|
|
104
|
+
#if defined(__ARM_VFPV3__)
|
|
105
|
+
#include <cstring>
|
|
106
|
+
|
|
107
|
+
/* This does not handle NaN or other obscurities, but is faster than
|
|
108
|
+
than (int)(x*65536). When built on Android with -Os, needs forcing
|
|
109
|
+
to inline or we lose the speed benefit.
|
|
110
|
+
*/
|
|
111
|
+
SK_ALWAYS_INLINE SkFixed SkFloatToFixed_arm(float x)
|
|
112
|
+
{
|
|
113
|
+
int32_t y;
|
|
114
|
+
asm("vcvt.s32.f32 %0, %0, #16": "+w"(x));
|
|
115
|
+
std::memcpy(&y, &x, sizeof(y));
|
|
116
|
+
return y;
|
|
117
|
+
}
|
|
118
|
+
#undef SkFloatToFixed
|
|
119
|
+
#define SkFloatToFixed(x) SkFloatToFixed_arm(x)
|
|
120
|
+
#endif
|
|
121
|
+
|
|
122
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
123
|
+
|
|
124
|
+
#define SkFixedToScalar(x) SkFixedToFloat(x)
|
|
125
|
+
#define SkScalarToFixed(x) SkFloatToFixed(x)
|
|
126
|
+
|
|
127
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
128
|
+
|
|
129
|
+
typedef int64_t SkFixed3232; // 32.32
|
|
130
|
+
|
|
131
|
+
#define SkFixed3232Max SK_MaxS64
|
|
132
|
+
#define SkFixed3232Min (-SkFixed3232Max)
|
|
133
|
+
|
|
134
|
+
#define SkIntToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 32))
|
|
135
|
+
#define SkFixed3232ToInt(x) ((int)((x) >> 32))
|
|
136
|
+
#define SkFixedToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 16))
|
|
137
|
+
#define SkFixed3232ToFixed(x) ((SkFixed)((x) >> 16))
|
|
138
|
+
#define SkFloatToFixed3232(x) sk_float_saturate2int64((x) * (65536.0f * 65536.0f))
|
|
139
|
+
#define SkFixed3232ToFloat(x) (x * (1 / (65536.0f * 65536.0f)))
|
|
140
|
+
|
|
141
|
+
#define SkScalarToFixed3232(x) SkFloatToFixed3232(x)
|
|
142
|
+
|
|
143
|
+
#endif
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2006 The Android Open Source Project
|
|
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 SkFloatingPoint_DEFINED
|
|
9
|
+
#define SkFloatingPoint_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/private/SkAttributes.h"
|
|
12
|
+
#include "include/private/SkMath.h"
|
|
13
|
+
|
|
14
|
+
#include <cmath>
|
|
15
|
+
#include <cstdint>
|
|
16
|
+
#include <limits>
|
|
17
|
+
#include <type_traits>
|
|
18
|
+
|
|
19
|
+
inline constexpr float SK_FloatSqrt2 = 1.41421356f;
|
|
20
|
+
inline constexpr float SK_FloatPI = 3.14159265f;
|
|
21
|
+
inline constexpr double SK_DoublePI = 3.14159265358979323846264338327950288;
|
|
22
|
+
|
|
23
|
+
static constexpr int sk_float_sgn(float x) {
|
|
24
|
+
return (0.0f < x) - (x < 0.0f);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static constexpr float sk_float_degrees_to_radians(float degrees) {
|
|
28
|
+
return degrees * (SK_FloatPI / 180);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static constexpr float sk_float_radians_to_degrees(float radians) {
|
|
32
|
+
return radians * (180 / SK_FloatPI);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// floor(double+0.5) vs. floorf(float+0.5f) give comparable performance, but upcasting to double
|
|
36
|
+
// means tricky values like 0.49999997 and 2^24 get rounded correctly. If these were rounded
|
|
37
|
+
// as floatf(x + .5f), they would be 1 higher than expected.
|
|
38
|
+
#define sk_float_round(x) (float)sk_double_round((double)(x))
|
|
39
|
+
|
|
40
|
+
template <typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
|
|
41
|
+
static inline constexpr bool SkIsNaN(T x) {
|
|
42
|
+
return x != x;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Subtracting a value from itself will result in zero, except for NAN or ±Inf, which make NAN.
|
|
46
|
+
// Multiplying a group of values against zero will result in zero for each product, except for
|
|
47
|
+
// NAN or ±Inf, which will result in NAN and continue resulting in NAN for the rest of the elements.
|
|
48
|
+
// This generates better code than `std::isfinite` when building with clang-cl (April 2024).
|
|
49
|
+
template <typename T, typename... Pack, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
|
|
50
|
+
static inline bool SkIsFinite(T x, Pack... values) {
|
|
51
|
+
T prod = x - x;
|
|
52
|
+
prod = (prod * ... * values);
|
|
53
|
+
// At this point, `prod` will either be NaN or 0.
|
|
54
|
+
return prod == prod;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
template <typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
|
|
58
|
+
static inline bool SkIsFinite(const T array[], int count) {
|
|
59
|
+
T x = array[0];
|
|
60
|
+
T prod = x - x;
|
|
61
|
+
for (int i = 1; i < count; ++i) {
|
|
62
|
+
prod *= array[i];
|
|
63
|
+
}
|
|
64
|
+
// At this point, `prod` will either be NaN or 0.
|
|
65
|
+
return prod == prod;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
inline constexpr int SK_MaxS32FitsInFloat = 2147483520;
|
|
69
|
+
inline constexpr int SK_MinS32FitsInFloat = -SK_MaxS32FitsInFloat;
|
|
70
|
+
|
|
71
|
+
// 0x7fffff8000000000
|
|
72
|
+
inline constexpr int64_t SK_MaxS64FitsInFloat = SK_MaxS64 >> (63-24) << (63-24);
|
|
73
|
+
inline constexpr int64_t SK_MinS64FitsInFloat = -SK_MaxS64FitsInFloat;
|
|
74
|
+
|
|
75
|
+
// sk_[float|double]_saturate2int are written to return their maximum values when passed NaN.
|
|
76
|
+
// MSVC 19.38+ has a bug with this implementation, leading to incorrect results:
|
|
77
|
+
// https://developercommunity.visualstudio.com/t/Optimizer-incorrectly-handles-NaN-floati/10654403
|
|
78
|
+
//
|
|
79
|
+
// We inject an explicit NaN test on MSVC to work around the problem.
|
|
80
|
+
#if defined(_MSC_VER) && !defined(__clang__)
|
|
81
|
+
#define SK_CHECK_NAN(resultVal) if (SkIsNaN(x)) { return resultVal; }
|
|
82
|
+
#else
|
|
83
|
+
#define SK_CHECK_NAN(resultVal)
|
|
84
|
+
#endif
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Return the closest int for the given float. Returns SK_MaxS32FitsInFloat for NaN.
|
|
88
|
+
*/
|
|
89
|
+
static constexpr int sk_float_saturate2int(float x) {
|
|
90
|
+
SK_CHECK_NAN(SK_MaxS32FitsInFloat)
|
|
91
|
+
x = x < SK_MaxS32FitsInFloat ? x : SK_MaxS32FitsInFloat;
|
|
92
|
+
x = x > SK_MinS32FitsInFloat ? x : SK_MinS32FitsInFloat;
|
|
93
|
+
return (int)x;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Return the closest int for the given double. Returns SK_MaxS32 for NaN.
|
|
98
|
+
*/
|
|
99
|
+
static constexpr int sk_double_saturate2int(double x) {
|
|
100
|
+
SK_CHECK_NAN(SK_MaxS32)
|
|
101
|
+
x = x < SK_MaxS32 ? x : SK_MaxS32;
|
|
102
|
+
x = x > SK_MinS32 ? x : SK_MinS32;
|
|
103
|
+
return (int)x;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Return the closest int64_t for the given float. Returns SK_MaxS64FitsInFloat for NaN.
|
|
108
|
+
*/
|
|
109
|
+
static constexpr int64_t sk_float_saturate2int64(float x) {
|
|
110
|
+
SK_CHECK_NAN(SK_MaxS64FitsInFloat)
|
|
111
|
+
x = x < SK_MaxS64FitsInFloat ? x : SK_MaxS64FitsInFloat;
|
|
112
|
+
x = x > SK_MinS64FitsInFloat ? x : SK_MinS64FitsInFloat;
|
|
113
|
+
return (int64_t)x;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
#undef SK_CHECK_NAN
|
|
117
|
+
|
|
118
|
+
#define sk_float_floor2int(x) sk_float_saturate2int(std::floor(x))
|
|
119
|
+
#define sk_float_round2int(x) sk_float_saturate2int(sk_float_round(x))
|
|
120
|
+
#define sk_float_ceil2int(x) sk_float_saturate2int(std::ceil(x))
|
|
121
|
+
|
|
122
|
+
#define sk_float_floor2int_no_saturate(x) ((int)std::floor(x))
|
|
123
|
+
#define sk_float_round2int_no_saturate(x) ((int)sk_float_round(x))
|
|
124
|
+
#define sk_float_ceil2int_no_saturate(x) ((int)std::ceil(x))
|
|
125
|
+
|
|
126
|
+
#define sk_double_round(x) (std::floor((x) + 0.5))
|
|
127
|
+
#define sk_double_floor2int(x) ((int)std::floor(x))
|
|
128
|
+
#define sk_double_round2int(x) ((int)std::round(x))
|
|
129
|
+
#define sk_double_ceil2int(x) ((int)std::ceil(x))
|
|
130
|
+
|
|
131
|
+
// Cast double to float, ignoring any warning about too-large finite values being cast to float.
|
|
132
|
+
// Clang thinks this is undefined, but it's actually implementation defined to return either
|
|
133
|
+
// the largest float or infinity (one of the two bracketing representable floats). Good enough!
|
|
134
|
+
SK_NO_SANITIZE("float-cast-overflow")
|
|
135
|
+
static constexpr float sk_double_to_float(double x) {
|
|
136
|
+
return static_cast<float>(x);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
inline constexpr float SK_FloatNaN = std::numeric_limits<float>::quiet_NaN();
|
|
140
|
+
inline constexpr float SK_FloatInfinity = std::numeric_limits<float>::infinity();
|
|
141
|
+
inline constexpr float SK_FloatNegativeInfinity = -SK_FloatInfinity;
|
|
142
|
+
|
|
143
|
+
inline constexpr double SK_DoubleNaN = std::numeric_limits<double>::quiet_NaN();
|
|
144
|
+
|
|
145
|
+
// Calculate the midpoint between a and b. Similar to std::midpoint in c++20.
|
|
146
|
+
static constexpr float sk_float_midpoint(float a, float b) {
|
|
147
|
+
// Use double math to avoid underflow and overflow.
|
|
148
|
+
return static_cast<float>(0.5 * (static_cast<double>(a) + b));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static inline float sk_float_rsqrt (float x) { return 1.0f / std::sqrt(x); }
|
|
152
|
+
|
|
153
|
+
// IEEE defines how float divide behaves for non-finite values and zero-denoms, but C does not,
|
|
154
|
+
// so we have a helper that suppresses the possible undefined-behavior warnings.
|
|
155
|
+
#ifdef SK_BUILD_FOR_WIN
|
|
156
|
+
#pragma warning(push)
|
|
157
|
+
#pragma warning(disable : 4723)
|
|
158
|
+
#endif
|
|
159
|
+
SK_NO_SANITIZE("float-divide-by-zero")
|
|
160
|
+
static constexpr float sk_ieee_float_divide(float numer, float denom) {
|
|
161
|
+
return numer / denom;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
SK_NO_SANITIZE("float-divide-by-zero")
|
|
165
|
+
static constexpr double sk_ieee_double_divide(double numer, double denom) {
|
|
166
|
+
return numer / denom;
|
|
167
|
+
}
|
|
168
|
+
#ifdef SK_BUILD_FOR_WIN
|
|
169
|
+
#pragma warning( pop )
|
|
170
|
+
#endif
|
|
171
|
+
|
|
172
|
+
// Returns true iff the provided number is within a small epsilon of 0.
|
|
173
|
+
bool sk_double_nearly_zero(double a);
|
|
174
|
+
|
|
175
|
+
// Compare two doubles and return true if they are within maxUlpsDiff of each other.
|
|
176
|
+
// * nan as a or b - returns false.
|
|
177
|
+
// * infinity, infinity or -infinity, -infinity - returns true.
|
|
178
|
+
// * infinity and any other number - returns false.
|
|
179
|
+
//
|
|
180
|
+
// ulp is an initialism for Units in the Last Place.
|
|
181
|
+
bool sk_doubles_nearly_equal_ulps(double a, double b, uint8_t maxUlpsDiff = 16);
|
|
182
|
+
|
|
183
|
+
#endif
|
|
@@ -0,0 +1,140 @@
|
|
|
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 SkGainmapInfo_DEFINED
|
|
9
|
+
#define SkGainmapInfo_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkColor.h"
|
|
12
|
+
#include "include/core/SkColorSpace.h"
|
|
13
|
+
#include "include/core/SkRefCnt.h"
|
|
14
|
+
class SkData;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Gainmap rendering parameters. Suppose our display has HDR to SDR ratio of H and we wish to
|
|
18
|
+
* display an image with gainmap on this display. Let B be the pixel value from the base image
|
|
19
|
+
* in a color space that has the primaries of the base image and a linear transfer function. Let
|
|
20
|
+
* G be the pixel value from the gainmap. Let D be the output pixel in the same color space as B.
|
|
21
|
+
* The value of D is computed as follows:
|
|
22
|
+
*
|
|
23
|
+
* First, let W be a weight parameter determing how much the gainmap will be applied.
|
|
24
|
+
* W = clamp((log(H) - log(fDisplayRatioSdr)) /
|
|
25
|
+
* (log(fDisplayRatioHdr) - log(fDisplayRatioSdr), 0, 1)
|
|
26
|
+
*
|
|
27
|
+
* Next, let L be the gainmap value in log space. We compute this from the value G that was
|
|
28
|
+
* sampled from the texture as follows:
|
|
29
|
+
* L = mix(log(fGainmapRatioMin), log(fGainmapRatioMax), pow(G, fGainmapGamma))
|
|
30
|
+
*
|
|
31
|
+
* Finally, apply the gainmap to compute D, the displayed pixel. If the base image is SDR then
|
|
32
|
+
* compute:
|
|
33
|
+
* D = (B + fEpsilonSdr) * exp(L * W) - fEpsilonHdr
|
|
34
|
+
* If the base image is HDR then compute:
|
|
35
|
+
* D = (B + fEpsilonHdr) * exp(L * (W - 1)) - fEpsilonSdr
|
|
36
|
+
*
|
|
37
|
+
* In the above math, log() is a natural logarithm and exp() is natural exponentiation. Note,
|
|
38
|
+
* however, that the base used for the log() and exp() functions does not affect the results of
|
|
39
|
+
* the computation (it cancels out, as long as the same base is used throughout).
|
|
40
|
+
*
|
|
41
|
+
* This product includes Gain Map technology under license by Adobe.
|
|
42
|
+
*/
|
|
43
|
+
struct SkGainmapInfo {
|
|
44
|
+
/**
|
|
45
|
+
* Parameters for converting the gainmap from its image encoding to log space. These are
|
|
46
|
+
* specified per color channel. The alpha value is unused.
|
|
47
|
+
*/
|
|
48
|
+
SkColor4f fGainmapRatioMin = {1.f, 1.f, 1.f, 1.0};
|
|
49
|
+
SkColor4f fGainmapRatioMax = {2.f, 2.f, 2.f, 1.0};
|
|
50
|
+
SkColor4f fGainmapGamma = {1.f, 1.f, 1.f, 1.f};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Parameters sometimes used in gainmap computation to avoid numerical instability.
|
|
54
|
+
*/
|
|
55
|
+
SkColor4f fEpsilonSdr = {0.f, 0.f, 0.f, 1.0};
|
|
56
|
+
SkColor4f fEpsilonHdr = {0.f, 0.f, 0.f, 1.0};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* If the output display's HDR to SDR ratio is less or equal than fDisplayRatioSdr then the SDR
|
|
60
|
+
* rendition is displayed. If the output display's HDR to SDR ratio is greater or equal than
|
|
61
|
+
* fDisplayRatioHdr then the HDR rendition is displayed. If the output display's HDR to SDR
|
|
62
|
+
* ratio is between these values then an interpolation between the two is displayed using the
|
|
63
|
+
* math above.
|
|
64
|
+
*/
|
|
65
|
+
float fDisplayRatioSdr = 1.f;
|
|
66
|
+
float fDisplayRatioHdr = 2.f;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Whether the base image is the SDR image or the HDR image.
|
|
70
|
+
*/
|
|
71
|
+
enum class BaseImageType {
|
|
72
|
+
kSDR,
|
|
73
|
+
kHDR,
|
|
74
|
+
};
|
|
75
|
+
BaseImageType fBaseImageType = BaseImageType::kSDR;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The type of the gainmap image. If the type is kApple, then the gainmap image was originally
|
|
79
|
+
* encoded according to the specification at [0], and can be converted to the kDefault type by
|
|
80
|
+
* applying the transformation described at [1].
|
|
81
|
+
* [0] https://developer.apple.com/documentation/appkit/images_and_pdf/
|
|
82
|
+
* applying_apple_hdr_effect_to_your_photos
|
|
83
|
+
* [1] https://docs.google.com/document/d/1iUpYAThVV_FuDdeiO3t0vnlfoA1ryq0WfGS9FuydwKc
|
|
84
|
+
*/
|
|
85
|
+
enum class Type {
|
|
86
|
+
kDefault,
|
|
87
|
+
kApple,
|
|
88
|
+
};
|
|
89
|
+
Type fType = Type::kDefault;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* If specified, color space to apply the gainmap in, otherwise the base image's color space
|
|
93
|
+
* is used. Only the color primaries are used, the transfer function is irrelevant.
|
|
94
|
+
*/
|
|
95
|
+
sk_sp<SkColorSpace> fGainmapMathColorSpace = nullptr;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Return true if this can be encoded as an UltraHDR v1 image.
|
|
99
|
+
*/
|
|
100
|
+
bool isUltraHDRv1Compatible() const;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* If |data| contains an ISO 21496-1 version that is supported, return true. Otherwise return
|
|
104
|
+
* false.
|
|
105
|
+
*/
|
|
106
|
+
static bool ParseVersion(const SkData* data);
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* If |data| constains ISO 21496-1 metadata then parse that metadata then use it to populate
|
|
110
|
+
* |info| and return true, otherwise return false. If |data| indicates that that the base image
|
|
111
|
+
* color space primaries should be used for gainmap application then set
|
|
112
|
+
* |fGainmapMathColorSpace| to nullptr, otherwise set |fGainmapMathColorSpace| to sRGB (the
|
|
113
|
+
* default, to be overwritten by the image decoder).
|
|
114
|
+
*/
|
|
115
|
+
static bool Parse(const SkData* data, SkGainmapInfo& info);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Serialize an ISO 21496-1 version 0 blob containing only the version structure.
|
|
119
|
+
*/
|
|
120
|
+
static sk_sp<SkData> SerializeVersion();
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Serialize an ISO 21496-1 version 0 blob containing this' gainmap parameters.
|
|
124
|
+
*/
|
|
125
|
+
sk_sp<SkData> serialize() const;
|
|
126
|
+
|
|
127
|
+
inline bool operator==(const SkGainmapInfo& other) const {
|
|
128
|
+
return fGainmapRatioMin == other.fGainmapRatioMin &&
|
|
129
|
+
fGainmapRatioMax == other.fGainmapRatioMax && fGainmapGamma == other.fGainmapGamma &&
|
|
130
|
+
fEpsilonSdr == other.fEpsilonSdr && fEpsilonHdr == other.fEpsilonHdr &&
|
|
131
|
+
fDisplayRatioSdr == other.fDisplayRatioSdr &&
|
|
132
|
+
fDisplayRatioHdr == other.fDisplayRatioHdr &&
|
|
133
|
+
fBaseImageType == other.fBaseImageType && fType == other.fType &&
|
|
134
|
+
SkColorSpace::Equals(fGainmapMathColorSpace.get(),
|
|
135
|
+
other.fGainmapMathColorSpace.get());
|
|
136
|
+
}
|
|
137
|
+
inline bool operator!=(const SkGainmapInfo& other) const { return !(*this == other); }
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
#endif
|