@shopify/react-native-skia 0.1.191 → 0.1.193
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +1 -1
- package/android/build.gradle +1 -0
- package/android/cpp/jni/JniPlatformContext.cpp +1 -1
- package/cpp/api/JsiSkColorFilter.h +2 -17
- package/cpp/api/JsiSkContourMeasure.h +3 -17
- package/cpp/api/JsiSkContourMeasureIter.h +3 -18
- package/cpp/api/JsiSkData.h +1 -18
- package/cpp/api/JsiSkFont.h +4 -14
- package/cpp/api/JsiSkHostObjects.h +85 -10
- package/cpp/api/JsiSkImage.h +26 -16
- package/cpp/api/JsiSkImageFactory.h +2 -2
- package/cpp/api/JsiSkImageFilter.h +1 -17
- package/cpp/api/JsiSkMaskFilter.h +1 -17
- package/cpp/api/JsiSkMatrix.h +3 -6
- package/cpp/api/JsiSkPaint.h +3 -15
- package/cpp/api/JsiSkPath.h +10 -21
- package/cpp/api/JsiSkPathEffect.h +2 -17
- package/cpp/api/JsiSkPicture.h +4 -18
- package/cpp/api/JsiSkPictureRecorder.h +4 -1
- package/cpp/api/JsiSkPoint.h +6 -1
- package/cpp/api/JsiSkRRect.h +6 -1
- package/cpp/api/JsiSkRSXform.h +4 -6
- package/cpp/api/JsiSkRect.h +6 -2
- package/cpp/api/JsiSkRuntimeEffect.h +4 -7
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +2 -10
- package/cpp/api/JsiSkSVG.h +1 -10
- package/cpp/api/JsiSkShader.h +2 -16
- package/cpp/api/JsiSkSurface.h +3 -16
- package/cpp/api/JsiSkTextBlob.h +2 -18
- package/cpp/api/JsiSkTypeface.h +1 -22
- package/cpp/api/JsiSkVertices.h +3 -17
- package/cpp/rnskia/dom/base/Declaration.h +5 -7
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +1 -0
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +2 -2
- package/cpp/rnskia/dom/props/BoxShadowProps.h +2 -0
- package/cpp/rnskia/values/RNSkReadonlyValue.h +2 -2
- package/cpp/rnskia/values/RNSkValue.h +1 -1
- package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +2 -8
- package/cpp/skia/include/android/SkImageAndroid.h +101 -0
- package/cpp/skia/include/codec/SkAndroidCodec.h +26 -8
- package/cpp/skia/include/codec/SkCodec.h +31 -17
- package/cpp/skia/include/codec/SkEncodedImageFormat.h +36 -0
- package/cpp/skia/include/codec/SkPixmapUtils.h +31 -0
- package/cpp/skia/include/config/SkUserConfig.h +61 -29
- package/cpp/skia/include/core/SkBitmap.h +25 -25
- package/cpp/skia/include/core/SkBlurTypes.h +0 -2
- package/cpp/skia/include/core/SkCanvas.h +32 -15
- package/cpp/skia/include/core/SkCapabilities.h +2 -2
- package/cpp/skia/include/core/SkColor.h +2 -0
- package/cpp/skia/include/core/SkColorPriv.h +19 -4
- package/cpp/skia/include/core/SkColorSpace.h +14 -17
- package/cpp/skia/include/core/SkColorType.h +1 -0
- package/cpp/skia/include/core/SkContourMeasure.h +1 -1
- package/cpp/skia/include/core/SkCoverageMode.h +0 -2
- package/cpp/skia/include/core/SkCubicMap.h +2 -0
- package/cpp/skia/include/core/SkData.h +5 -2
- package/cpp/skia/include/core/SkDataTable.h +6 -2
- package/cpp/skia/include/core/SkDeferredDisplayList.h +11 -10
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +9 -8
- package/cpp/skia/include/core/SkDrawable.h +10 -2
- package/cpp/skia/include/core/SkEncodedImageFormat.h +3 -30
- package/cpp/skia/include/core/SkFlattenable.h +4 -2
- package/cpp/skia/include/core/SkFont.h +1 -0
- package/cpp/skia/include/core/SkFontMetrics.h +1 -0
- package/cpp/skia/include/core/SkFontMgr.h +20 -29
- package/cpp/skia/include/core/SkFontStyle.h +4 -1
- package/cpp/skia/include/core/SkGraphics.h +21 -18
- package/cpp/skia/include/core/SkICC.h +3 -13
- package/cpp/skia/include/core/SkImage.h +395 -717
- package/cpp/skia/include/core/SkImageGenerator.h +19 -74
- package/cpp/skia/include/core/SkImageInfo.h +7 -5
- package/cpp/skia/include/core/SkM44.h +11 -0
- package/cpp/skia/include/core/SkMaskFilter.h +6 -3
- package/cpp/skia/include/core/SkMatrix.h +14 -4
- package/cpp/skia/include/core/SkMesh.h +52 -18
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPaint.h +11 -34
- package/cpp/skia/include/core/SkPath.h +23 -4
- package/cpp/skia/include/core/SkPathBuilder.h +13 -5
- package/cpp/skia/include/core/SkPathMeasure.h +1 -1
- package/cpp/skia/include/core/SkPathTypes.h +0 -2
- package/cpp/skia/include/core/SkPathUtils.h +42 -0
- package/cpp/skia/include/core/SkPicture.h +3 -2
- package/cpp/skia/include/core/SkPictureRecorder.h +2 -0
- package/cpp/skia/include/core/SkPixelRef.h +4 -8
- package/cpp/skia/include/core/SkPixmap.h +12 -20
- package/cpp/skia/include/core/SkPoint.h +4 -2
- package/cpp/skia/include/core/SkPromiseImageTexture.h +2 -2
- package/cpp/skia/include/core/SkRRect.h +5 -1
- package/cpp/skia/include/core/SkRect.h +6 -3
- package/cpp/skia/include/core/SkRefCnt.h +9 -14
- package/cpp/skia/include/core/SkRegion.h +1 -1
- package/cpp/skia/include/core/SkScalar.h +2 -4
- package/cpp/skia/include/core/SkSerialProcs.h +18 -10
- package/cpp/skia/include/core/SkShader.h +1 -64
- package/cpp/skia/include/core/SkSize.h +2 -0
- package/cpp/skia/include/core/SkSpan.h +4 -112
- package/cpp/skia/include/core/SkStream.h +11 -12
- package/cpp/skia/include/core/SkString.h +9 -25
- package/cpp/skia/include/core/SkStrokeRec.h +1 -1
- package/cpp/skia/include/core/SkSurface.h +83 -61
- package/cpp/skia/include/core/SkSurfaceCharacterization.h +3 -3
- package/cpp/skia/include/core/SkSurfaceProps.h +9 -1
- package/cpp/skia/include/core/SkTextBlob.h +2 -2
- package/cpp/skia/include/core/SkTextureCompressionType.h +30 -0
- package/cpp/skia/include/core/SkTime.h +1 -1
- package/cpp/skia/include/core/SkTypeface.h +9 -2
- package/cpp/skia/include/core/SkTypes.h +37 -466
- package/cpp/skia/include/core/SkVertices.h +2 -0
- package/cpp/skia/include/core/SkYUVAInfo.h +4 -0
- package/cpp/skia/include/core/SkYUVAPixmaps.h +7 -1
- package/cpp/skia/include/docs/SkPDFDocument.h +12 -1
- package/cpp/skia/include/effects/SkColorMatrix.h +2 -1
- package/cpp/skia/include/effects/SkGradientShader.h +65 -14
- package/cpp/skia/include/effects/SkImageFilters.h +0 -11
- package/cpp/skia/include/effects/SkRuntimeEffect.h +41 -11
- package/cpp/skia/include/encode/SkEncoder.h +7 -3
- package/cpp/skia/include/encode/SkICC.h +36 -0
- package/cpp/skia/include/encode/SkJpegEncoder.h +102 -71
- package/cpp/skia/include/encode/SkPngEncoder.h +89 -71
- package/cpp/skia/include/encode/SkWebpEncoder.h +65 -38
- package/cpp/skia/include/gpu/GpuTypes.h +23 -1
- package/cpp/skia/include/gpu/GrBackendSurface.h +9 -7
- package/cpp/skia/include/gpu/GrContextOptions.h +28 -9
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +6 -4
- package/cpp/skia/include/gpu/GrDirectContext.h +84 -63
- package/cpp/skia/include/gpu/GrDriverBugWorkarounds.h +2 -1
- package/cpp/skia/include/gpu/GrRecordingContext.h +9 -5
- package/cpp/skia/include/gpu/GrTypes.h +18 -18
- package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +4 -4
- package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +3 -3
- package/cpp/skia/include/gpu/ganesh/GrTextureGenerator.h +77 -0
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +385 -0
- package/cpp/skia/include/gpu/gl/GrGLExtensions.h +3 -3
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -1
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +0 -3
- package/cpp/skia/include/gpu/gl/GrGLTypes.h +2 -1
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +72 -3
- package/cpp/skia/include/gpu/graphite/Context.h +85 -32
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +15 -11
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +55 -5
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +6 -4
- package/cpp/skia/include/gpu/graphite/Recorder.h +41 -11
- package/cpp/skia/include/gpu/graphite/Recording.h +50 -3
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +47 -8
- package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +139 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +40 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnUtils.h +28 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +1 -1
- package/cpp/skia/include/gpu/graphite/mtl/{MtlTypes.h → MtlGraphiteTypes.h} +7 -6
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h +27 -0
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +4 -9
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteUtils.h +28 -0
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +17 -13
- package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
- package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +1 -1
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +3 -3
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +3 -3
- package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +5 -7
- package/cpp/skia/include/pathops/SkPathOps.h +3 -3
- package/cpp/skia/include/ports/SkFontMgr_data.h +22 -0
- package/cpp/skia/include/ports/SkFontMgr_indirect.h +14 -14
- package/cpp/skia/include/ports/SkRemotableFontMgr.h +2 -2
- package/cpp/skia/include/ports/SkTypeface_win.h +2 -1
- package/cpp/skia/include/private/SkChecksum.h +32 -7
- package/cpp/skia/include/private/SkColorData.h +1 -26
- package/cpp/skia/include/private/SkGainmapInfo.h +97 -0
- package/cpp/skia/include/private/SkGainmapShader.h +53 -0
- package/cpp/skia/include/private/SkIDChangeListener.h +4 -3
- package/cpp/skia/include/private/SkJpegGainmapEncoder.h +71 -0
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +61 -0
- package/cpp/skia/include/private/SkOpts_spi.h +3 -1
- package/cpp/skia/include/private/SkPathRef.h +64 -47
- package/cpp/skia/include/private/SkSLDefines.h +5 -5
- package/cpp/skia/include/private/SkSLSampleUsage.h +0 -4
- package/cpp/skia/include/private/SkSpinlock.h +1 -1
- package/cpp/skia/include/private/SkWeakRefCnt.h +3 -0
- package/cpp/skia/include/private/{SingleOwner.h → base/SingleOwner.h} +8 -5
- package/cpp/skia/include/private/base/SkAPI.h +52 -0
- package/cpp/skia/include/private/base/SkAlign.h +39 -0
- package/cpp/skia/include/private/base/SkAlignedStorage.h +32 -0
- package/cpp/skia/include/private/base/SkAssert.h +92 -0
- package/cpp/skia/include/private/base/SkAttributes.h +102 -0
- package/cpp/skia/include/private/base/SkCPUTypes.h +25 -0
- package/cpp/skia/include/private/base/SkContainers.h +46 -0
- package/cpp/skia/include/private/base/SkDebug.h +27 -0
- package/cpp/skia/include/private/{SkDeque.h → base/SkDeque.h} +3 -1
- package/cpp/skia/include/private/base/SkFeatures.h +151 -0
- package/cpp/skia/include/private/{SkFixed.h → base/SkFixed.h} +9 -7
- package/cpp/skia/include/private/{SkFloatBits.h → base/SkFloatBits.h} +2 -3
- package/cpp/skia/include/private/{SkFloatingPoint.h → base/SkFloatingPoint.h} +18 -9
- package/cpp/skia/include/private/base/SkLoadUserConfig.h +63 -0
- package/cpp/skia/include/private/{SkMacros.h → base/SkMacros.h} +17 -2
- package/cpp/skia/include/private/{SkMalloc.h → base/SkMalloc.h} +4 -7
- package/cpp/skia/include/{core → private/base}/SkMath.h +25 -2
- package/cpp/skia/include/private/{SkMutex.h → base/SkMutex.h} +5 -5
- package/cpp/skia/include/private/{SkNoncopyable.h → base/SkNoncopyable.h} +2 -2
- package/cpp/skia/include/private/{SkOnce.h → base/SkOnce.h} +3 -1
- package/cpp/skia/include/private/base/SkPathEnums.h +25 -0
- package/cpp/skia/include/private/{SkSafe32.h → base/SkSafe32.h} +16 -1
- package/cpp/skia/include/private/{SkSemaphore.h → base/SkSemaphore.h} +4 -3
- package/cpp/skia/include/private/base/SkSpan_impl.h +129 -0
- package/cpp/skia/include/private/base/SkTArray.h +694 -0
- package/cpp/skia/include/private/{SkTDArray.h → base/SkTDArray.h} +17 -54
- package/cpp/skia/include/private/{SkTFitsIn.h → base/SkTFitsIn.h} +14 -8
- package/cpp/skia/include/private/{SkTLogic.h → base/SkTLogic.h} +1 -1
- package/cpp/skia/include/private/{SkTemplates.h → base/SkTemplates.h} +63 -88
- package/cpp/skia/include/private/{SkThreadID.h → base/SkThreadID.h} +5 -2
- package/cpp/skia/include/private/{SkTo.h → base/SkTo.h} +13 -2
- package/cpp/skia/include/private/base/SkTypeTraits.h +33 -0
- package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +130 -0
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +5 -9
- package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +70 -0
- package/cpp/skia/include/private/chromium/Slug.h +0 -9
- package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +2 -1
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +3 -2
- package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +17 -23
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -2
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +38 -0
- package/cpp/skia/include/private/gpu/graphite/{MtlTypesPriv.h → MtlGraphiteTypesPriv.h} +5 -5
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +1 -9
- package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +4 -0
- package/cpp/skia/include/utils/SkCamera.h +1 -1
- package/cpp/skia/include/utils/SkCustomTypeface.h +7 -1
- package/cpp/skia/include/utils/SkNWayCanvas.h +6 -6
- package/cpp/skia/include/utils/SkOrderedFontMgr.h +7 -6
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +2 -2
- package/cpp/skia/include/utils/SkParsePath.h +1 -1
- package/cpp/skia/modules/skcms/skcms.h +14 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +19 -0
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +2 -2
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +72 -2
- package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +1 -11
- package/cpp/skia/modules/skparagraph/include/ParagraphPainter.h +63 -0
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +27 -4
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +13 -13
- package/cpp/skia/modules/skresources/include/SkResources.h +18 -4
- package/cpp/skia/modules/svg/include/SkSVGAttribute.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFilterContext.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGGradient.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGIDMapper.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
- package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +22 -21
- package/cpp/skia/modules/svg/include/SkSVGValue.h +1 -1
- package/cpp/skia/{include/private → src/core}/SkTHash.h +41 -37
- package/ios/RNSkia-iOS/ViewScreenshotService.mm +1 -1
- package/lib/commonjs/renderer/Canvas.js +17 -1
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/core/Data.d.ts +2 -2
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/types/Data/Data.d.ts +2 -2
- package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
- package/lib/commonjs/skia/types/Image/Image.d.ts +2 -2
- package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
- package/lib/commonjs/skia/types/JsiInstance.d.ts +4 -4
- package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
- package/lib/commonjs/skia/types/SVG/SVG.d.ts +2 -2
- package/lib/commonjs/skia/types/SVG/SVG.js.map +1 -1
- package/lib/commonjs/skia/types/Typeface/Typeface.d.ts +2 -2
- package/lib/commonjs/skia/types/Typeface/Typeface.js.map +1 -1
- package/lib/commonjs/skia/web/Host.d.ts +1 -0
- package/lib/commonjs/skia/web/Host.js +2 -0
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkCanvas.js +6 -0
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilter.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkColorFilter.js +6 -0
- package/lib/commonjs/skia/web/JsiSkColorFilter.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkContourMeasure.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkContourMeasure.js +6 -0
- package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js +6 -0
- package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkData.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkData.js +4 -2
- package/lib/commonjs/skia/web/JsiSkData.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkFont.js +6 -0
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +6 -4
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilter.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkImageFilter.js +6 -0
- package/lib/commonjs/skia/web/JsiSkImageFilter.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilter.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkMaskFilter.js +6 -0
- package/lib/commonjs/skia/web/JsiSkMaskFilter.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkMatrix.js +5 -0
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPaint.js +6 -0
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPath.js +6 -0
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffect.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPathEffect.js +6 -0
- package/lib/commonjs/skia/web/JsiSkPathEffect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPicture.js +6 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +6 -0
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPoint.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPoint.js +5 -0
- package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkRRect.js +5 -0
- package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRSXform.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkRSXform.js +5 -0
- package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRect.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkRect.js +5 -0
- package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +6 -0
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShader.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkShader.js +6 -0
- package/lib/commonjs/skia/web/JsiSkShader.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js +6 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTextBlob.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkTextBlob.js +6 -0
- package/lib/commonjs/skia/web/JsiSkTextBlob.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypeface.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkTypeface.js +6 -4
- package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkVertices.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkVertices.js +6 -0
- package/lib/commonjs/skia/web/JsiSkVertices.js.map +1 -1
- package/lib/commonjs/values/hooks/useComputedValue.js +1 -1
- package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
- package/lib/commonjs/values/types.d.ts +1 -1
- package/lib/commonjs/values/types.js.map +1 -1
- package/lib/commonjs/values/web/RNSkComputedValue.d.ts +1 -1
- package/lib/commonjs/values/web/RNSkComputedValue.js +1 -1
- package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.d.ts +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.web.js +14 -4
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +2 -1
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/renderer/Canvas.js +15 -1
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/core/Data.d.ts +2 -2
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/types/Data/Data.d.ts +2 -2
- package/lib/module/skia/types/Data/Data.js.map +1 -1
- package/lib/module/skia/types/Image/Image.d.ts +2 -2
- package/lib/module/skia/types/Image/Image.js.map +1 -1
- package/lib/module/skia/types/JsiInstance.d.ts +4 -4
- package/lib/module/skia/types/JsiInstance.js.map +1 -1
- package/lib/module/skia/types/SVG/SVG.d.ts +2 -2
- package/lib/module/skia/types/SVG/SVG.js.map +1 -1
- package/lib/module/skia/types/Typeface/Typeface.d.ts +2 -2
- package/lib/module/skia/types/Typeface/Typeface.js.map +1 -1
- package/lib/module/skia/web/Host.d.ts +1 -0
- package/lib/module/skia/web/Host.js +2 -0
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -0
- package/lib/module/skia/web/JsiSkCanvas.js +6 -0
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilter.d.ts +1 -0
- package/lib/module/skia/web/JsiSkColorFilter.js +6 -0
- package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasure.d.ts +1 -0
- package/lib/module/skia/web/JsiSkContourMeasure.js +6 -0
- package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
- package/lib/module/skia/web/JsiSkContourMeasureIter.js +6 -0
- package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
- package/lib/module/skia/web/JsiSkData.d.ts +1 -1
- package/lib/module/skia/web/JsiSkData.js +4 -2
- package/lib/module/skia/web/JsiSkData.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.d.ts +1 -0
- package/lib/module/skia/web/JsiSkFont.js +6 -0
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.d.ts +1 -1
- package/lib/module/skia/web/JsiSkImage.js +6 -4
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilter.d.ts +1 -0
- package/lib/module/skia/web/JsiSkImageFilter.js +6 -0
- package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilter.d.ts +1 -0
- package/lib/module/skia/web/JsiSkMaskFilter.js +6 -0
- package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.d.ts +1 -0
- package/lib/module/skia/web/JsiSkMatrix.js +5 -0
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPaint.js +6 -0
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPath.js +6 -0
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffect.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPathEffect.js +6 -0
- package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPicture.js +6 -0
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPictureRecorder.js +6 -0
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkPoint.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPoint.js +5 -0
- package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.d.ts +1 -0
- package/lib/module/skia/web/JsiSkRRect.js +5 -0
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.d.ts +1 -0
- package/lib/module/skia/web/JsiSkRSXform.js +5 -0
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.d.ts +1 -0
- package/lib/module/skia/web/JsiSkRect.js +5 -0
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
- package/lib/module/skia/web/JsiSkRuntimeEffect.js +6 -0
- package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkShader.d.ts +1 -0
- package/lib/module/skia/web/JsiSkShader.js +6 -0
- package/lib/module/skia/web/JsiSkShader.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/module/skia/web/JsiSkSurface.js +6 -0
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlob.d.ts +1 -0
- package/lib/module/skia/web/JsiSkTextBlob.js +6 -0
- package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypeface.d.ts +1 -1
- package/lib/module/skia/web/JsiSkTypeface.js +6 -4
- package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
- package/lib/module/skia/web/JsiSkVertices.d.ts +1 -0
- package/lib/module/skia/web/JsiSkVertices.js +6 -0
- package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
- package/lib/module/values/hooks/useComputedValue.js +1 -1
- package/lib/module/values/hooks/useComputedValue.js.map +1 -1
- package/lib/module/values/types.d.ts +1 -1
- package/lib/module/values/types.js.map +1 -1
- package/lib/module/values/web/RNSkComputedValue.d.ts +1 -1
- package/lib/module/values/web/RNSkComputedValue.js +1 -1
- package/lib/module/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.d.ts +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.js +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/module/views/SkiaDomView.web.js +13 -4
- package/lib/module/views/SkiaDomView.web.js.map +1 -1
- package/lib/module/views/types.d.ts +2 -1
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/skia/core/Data.d.ts +2 -2
- package/lib/typescript/src/skia/types/Data/Data.d.ts +2 -2
- package/lib/typescript/src/skia/types/Image/Image.d.ts +2 -2
- package/lib/typescript/src/skia/types/JsiInstance.d.ts +4 -4
- package/lib/typescript/src/skia/types/SVG/SVG.d.ts +2 -2
- package/lib/typescript/src/skia/types/Typeface/Typeface.d.ts +2 -2
- package/lib/typescript/src/skia/web/Host.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkColorFilter.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkContourMeasure.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkData.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkFont.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkImageFilter.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkMaskFilter.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPath.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPathEffect.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPicture.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPictureRecorder.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkRect.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkShader.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkTextBlob.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkTypeface.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkVertices.d.ts +1 -0
- package/lib/typescript/src/values/types.d.ts +1 -1
- package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +1 -1
- package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +1 -1
- package/lib/typescript/src/views/types.d.ts +2 -1
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/react-native-skia.podspec +1 -1
- package/scripts/install-npm.js +11 -1
- package/src/renderer/Canvas.tsx +21 -1
- package/src/skia/core/Data.ts +3 -3
- package/src/skia/types/Data/Data.ts +2 -2
- package/src/skia/types/Image/Image.ts +2 -2
- package/src/skia/types/JsiInstance.ts +4 -4
- package/src/skia/types/SVG/SVG.ts +2 -2
- package/src/skia/types/Typeface/Typeface.ts +2 -2
- package/src/skia/web/Host.ts +2 -0
- package/src/skia/web/JsiSkCanvas.ts +4 -0
- package/src/skia/web/JsiSkColorFilter.ts +4 -0
- package/src/skia/web/JsiSkContourMeasure.ts +4 -0
- package/src/skia/web/JsiSkContourMeasureIter.ts +4 -0
- package/src/skia/web/JsiSkData.ts +3 -3
- package/src/skia/web/JsiSkFont.ts +4 -0
- package/src/skia/web/JsiSkImage.ts +2 -2
- package/src/skia/web/JsiSkImageFilter.ts +4 -0
- package/src/skia/web/JsiSkMaskFilter.ts +4 -0
- package/src/skia/web/JsiSkMatrix.ts +4 -0
- package/src/skia/web/JsiSkPaint.ts +4 -0
- package/src/skia/web/JsiSkPath.ts +4 -0
- package/src/skia/web/JsiSkPathEffect.ts +4 -0
- package/src/skia/web/JsiSkPicture.ts +4 -0
- package/src/skia/web/JsiSkPictureRecorder.ts +4 -0
- package/src/skia/web/JsiSkPoint.ts +4 -0
- package/src/skia/web/JsiSkRRect.ts +4 -0
- package/src/skia/web/JsiSkRSXform.ts +4 -0
- package/src/skia/web/JsiSkRect.ts +4 -0
- package/src/skia/web/JsiSkRuntimeEffect.ts +4 -0
- package/src/skia/web/JsiSkShader.ts +4 -0
- package/src/skia/web/JsiSkSurface.ts +4 -0
- package/src/skia/web/JsiSkTextBlob.ts +4 -0
- package/src/skia/web/JsiSkTypeface.ts +2 -2
- package/src/skia/web/JsiSkVertices.ts +4 -0
- package/src/values/hooks/useComputedValue.ts +1 -1
- package/src/values/types.ts +1 -1
- package/src/values/web/RNSkComputedValue.ts +1 -1
- package/src/values/web/RNSkReadonlyValue.ts +1 -1
- package/src/views/SkiaDomView.web.tsx +6 -1
- package/src/views/types.ts +2 -1
- package/cpp/skia/include/core/SkImageEncoder.h +0 -71
- package/cpp/skia/include/gpu/GrConfig.h +0 -53
- package/cpp/skia/include/gpu/graphite/CombinationBuilder.h +0 -195
- package/cpp/skia/include/private/SkHalf.h +0 -38
- package/cpp/skia/include/private/SkImageInfoPriv.h +0 -199
- package/cpp/skia/include/private/SkSLIRNode.h +0 -64
- package/cpp/skia/include/private/SkSLLayout.h +0 -144
- package/cpp/skia/include/private/SkSLModifiers.h +0 -178
- package/cpp/skia/include/private/SkSLProgramElement.h +0 -77
- package/cpp/skia/include/private/SkSLProgramKind.h +0 -35
- package/cpp/skia/include/private/SkSLStatement.h +0 -86
- package/cpp/skia/include/private/SkSLString.h +0 -41
- package/cpp/skia/include/private/SkSLSymbol.h +0 -94
- package/cpp/skia/include/private/SkSafe_math.h +0 -52
- package/cpp/skia/include/private/SkStringView.h +0 -51
- package/cpp/skia/include/private/SkTArray.h +0 -655
- package/cpp/skia/include/private/SkUniquePaintParamsID.h +0 -35
- package/cpp/skia/include/private/SkVx.h +0 -1026
- package/cpp/skia/include/sksl/DSL.h +0 -37
- package/cpp/skia/include/sksl/DSLBlock.h +0 -58
- package/cpp/skia/include/sksl/DSLCase.h +0 -62
- package/cpp/skia/include/sksl/DSLCore.h +0 -492
- package/cpp/skia/include/sksl/DSLExpression.h +0 -241
- package/cpp/skia/include/sksl/DSLFunction.h +0 -113
- package/cpp/skia/include/sksl/DSLLayout.h +0 -92
- package/cpp/skia/include/sksl/DSLModifiers.h +0 -69
- package/cpp/skia/include/sksl/DSLStatement.h +0 -82
- package/cpp/skia/include/sksl/DSLSymbols.h +0 -61
- package/cpp/skia/include/sksl/DSLType.h +0 -271
- package/cpp/skia/include/sksl/DSLVar.h +0 -231
- package/cpp/skia/include/sksl/SkSLErrorReporter.h +0 -65
- package/cpp/skia/include/sksl/SkSLOperator.h +0 -154
- package/cpp/skia/include/sksl/SkSLPosition.h +0 -104
- package/cpp/skia/include/utils/SkRandom.h +0 -169
- package/cpp/skia/src/core/SkLRUCache.h +0 -126
- package/cpp/skia/src/core/SkTInternalLList.h +0 -302
- /package/cpp/skia/include/{core → codec}/SkPngChunkReader.h +0 -0
- /package/cpp/skia/include/private/{SkTPin.h → base/SkTPin.h} +0 -0
- /package/cpp/skia/include/private/{SkThreadAnnotations.h → base/SkThreadAnnotations.h} +0 -0
@@ -8,21 +8,18 @@
|
|
8
8
|
#ifndef SkTDArray_DEFINED
|
9
9
|
#define SkTDArray_DEFINED
|
10
10
|
|
11
|
-
#include "include/
|
12
|
-
#include "include/private/
|
13
|
-
#include "include/private/SkTo.h"
|
11
|
+
#include "include/private/base/SkAPI.h"
|
12
|
+
#include "include/private/base/SkAssert.h"
|
13
|
+
#include "include/private/base/SkTo.h"
|
14
14
|
|
15
15
|
#include <algorithm>
|
16
16
|
#include <cstddef>
|
17
|
-
#include <climits>
|
18
17
|
#include <initializer_list>
|
19
|
-
#include <tuple>
|
20
|
-
#include <utility>
|
21
18
|
|
22
19
|
class SK_SPI SkTDStorage {
|
23
20
|
public:
|
24
21
|
explicit SkTDStorage(int sizeOfT);
|
25
|
-
SkTDStorage(const void* src, int
|
22
|
+
SkTDStorage(const void* src, int size, int sizeOfT);
|
26
23
|
|
27
24
|
// Copy
|
28
25
|
SkTDStorage(const SkTDStorage& that);
|
@@ -38,15 +35,15 @@ public:
|
|
38
35
|
void swap(SkTDStorage& that);
|
39
36
|
|
40
37
|
// Size routines
|
41
|
-
bool empty() const { return
|
42
|
-
void clear() {
|
43
|
-
int size() const { return
|
44
|
-
void resize(int
|
45
|
-
size_t size_bytes() const { return this->bytes(
|
38
|
+
bool empty() const { return fSize == 0; }
|
39
|
+
void clear() { fSize = 0; }
|
40
|
+
int size() const { return fSize; }
|
41
|
+
void resize(int newSize);
|
42
|
+
size_t size_bytes() const { return this->bytes(fSize); }
|
46
43
|
|
47
44
|
// Capacity routines
|
48
|
-
int capacity() const { return
|
49
|
-
void reserve(int
|
45
|
+
int capacity() const { return fCapacity; }
|
46
|
+
void reserve(int newCapacity);
|
50
47
|
void shrink_to_fit();
|
51
48
|
|
52
49
|
void* data() { return fStorage; }
|
@@ -68,8 +65,8 @@ public:
|
|
68
65
|
void* insert(int index, int count, const void* src);
|
69
66
|
|
70
67
|
void pop_back() {
|
71
|
-
SkASSERT(
|
72
|
-
|
68
|
+
SkASSERT(fSize > 0);
|
69
|
+
fSize--;
|
73
70
|
}
|
74
71
|
|
75
72
|
friend bool operator==(const SkTDStorage& a, const SkTDStorage& b);
|
@@ -81,7 +78,7 @@ private:
|
|
81
78
|
size_t bytes(int n) const { return SkToSizeT(n * fSizeOfT); }
|
82
79
|
void* address(int n) { return fStorage + this->bytes(n); }
|
83
80
|
|
84
|
-
// Adds delta to
|
81
|
+
// Adds delta to fSize. Crash if outside [0, INT_MAX]
|
85
82
|
int calculateSizeOrDie(int delta);
|
86
83
|
|
87
84
|
// Move the tail of the array defined by the indexes tailStart and tailEnd to dstIndex. The
|
@@ -93,8 +90,8 @@ private:
|
|
93
90
|
|
94
91
|
const int fSizeOfT;
|
95
92
|
std::byte* fStorage{nullptr};
|
96
|
-
int
|
97
|
-
int
|
93
|
+
int fCapacity{0}; // size of the allocation in fArray (#elements)
|
94
|
+
int fSize{0}; // logical number of elements (fSize <= fCapacity)
|
98
95
|
};
|
99
96
|
|
100
97
|
static inline void swap(SkTDStorage& a, SkTDStorage& b) {
|
@@ -188,7 +185,7 @@ public:
|
|
188
185
|
fStorage.resize(count);
|
189
186
|
}
|
190
187
|
|
191
|
-
void reserve(
|
188
|
+
void reserve(int n) {
|
192
189
|
fStorage.reserve(n);
|
193
190
|
}
|
194
191
|
|
@@ -219,18 +216,6 @@ public:
|
|
219
216
|
fStorage.removeShuffle(index);
|
220
217
|
}
|
221
218
|
|
222
|
-
int find(const T& elem) const {
|
223
|
-
const T* iter = this->begin();
|
224
|
-
const T* stop = this->end();
|
225
|
-
|
226
|
-
for (; iter < stop; iter++) {
|
227
|
-
if (*iter == elem) {
|
228
|
-
return SkToInt(iter - this->begin());
|
229
|
-
}
|
230
|
-
}
|
231
|
-
return -1;
|
232
|
-
}
|
233
|
-
|
234
219
|
// routines to treat the array like a stack
|
235
220
|
void push_back(const T& v) {
|
236
221
|
this->append();
|
@@ -238,28 +223,6 @@ public:
|
|
238
223
|
}
|
239
224
|
void pop_back() { fStorage.pop_back(); }
|
240
225
|
|
241
|
-
void deleteAll() {
|
242
|
-
for (T p : *this) {
|
243
|
-
delete p;
|
244
|
-
}
|
245
|
-
this->reset();
|
246
|
-
}
|
247
|
-
|
248
|
-
void freeAll() {
|
249
|
-
for (T p : *this) {
|
250
|
-
sk_free(p);
|
251
|
-
}
|
252
|
-
|
253
|
-
this->reset();
|
254
|
-
}
|
255
|
-
|
256
|
-
void unrefAll() {
|
257
|
-
for (T p : *this) {
|
258
|
-
p->unref();
|
259
|
-
}
|
260
|
-
this->reset();
|
261
|
-
}
|
262
|
-
|
263
226
|
void shrink_to_fit() {
|
264
227
|
fStorage.shrink_to_fit();
|
265
228
|
}
|
@@ -8,8 +8,10 @@
|
|
8
8
|
#ifndef SkTFitsIn_DEFINED
|
9
9
|
#define SkTFitsIn_DEFINED
|
10
10
|
|
11
|
+
#include "include/private/base/SkDebug.h"
|
12
|
+
|
13
|
+
#include <cstdint>
|
11
14
|
#include <limits>
|
12
|
-
#include <stdint.h>
|
13
15
|
#include <type_traits>
|
14
16
|
|
15
17
|
/**
|
@@ -71,28 +73,32 @@ static constexpr inline
|
|
71
73
|
typename std::enable_if<(std::is_integral<S>::value || std::is_enum<S>::value) &&
|
72
74
|
(std::is_integral<D>::value || std::is_enum<D>::value), bool>::type
|
73
75
|
/*bool*/ SkTFitsIn(S src) {
|
76
|
+
// Ensure that is_signed and is_unsigned are passed the arithmetic underlyng types of enums.
|
77
|
+
using Sa = typename sk_strip_enum<S>::type;
|
78
|
+
using Da = typename sk_strip_enum<D>::type;
|
79
|
+
|
74
80
|
// SkTFitsIn() is used in public headers, so needs to be written targeting at most C++11.
|
75
81
|
return
|
76
82
|
|
77
83
|
// E.g. (int8_t)(uint8_t) int8_t(-1) == -1, but the uint8_t == 255, not -1.
|
78
|
-
(std::is_signed<
|
84
|
+
(std::is_signed<Sa>::value && std::is_unsigned<Da>::value && sizeof(Sa) <= sizeof(Da)) ?
|
79
85
|
(S)0 <= src :
|
80
86
|
|
81
87
|
// E.g. (uint8_t)(int8_t) uint8_t(255) == 255, but the int8_t == -1.
|
82
|
-
(std::is_signed<
|
83
|
-
src <= (S)std::numeric_limits<
|
88
|
+
(std::is_signed<Da>::value && std::is_unsigned<Sa>::value && sizeof(Da) <= sizeof(Sa)) ?
|
89
|
+
src <= (S)std::numeric_limits<Da>::max() :
|
84
90
|
|
85
91
|
#if !defined(SK_DEBUG) && !defined(__MSVC_RUNTIME_CHECKS )
|
86
92
|
// Correct (simple) version. This trips up MSVC's /RTCc run-time checking.
|
87
93
|
(S)(D)src == src;
|
88
94
|
#else
|
89
95
|
// More complex version that's safe with /RTCc. Used in all debug builds, for coverage.
|
90
|
-
(std::is_signed<
|
91
|
-
(intmax_t)src >= (intmax_t)std::numeric_limits<
|
92
|
-
(intmax_t)src <= (intmax_t)std::numeric_limits<
|
96
|
+
(std::is_signed<Sa>::value) ?
|
97
|
+
(intmax_t)src >= (intmax_t)std::numeric_limits<Da>::min() &&
|
98
|
+
(intmax_t)src <= (intmax_t)std::numeric_limits<Da>::max() :
|
93
99
|
|
94
100
|
// std::is_unsigned<S> ?
|
95
|
-
(uintmax_t)src <= (uintmax_t)std::numeric_limits<
|
101
|
+
(uintmax_t)src <= (uintmax_t)std::numeric_limits<Da>::max();
|
96
102
|
#endif
|
97
103
|
}
|
98
104
|
|
@@ -8,18 +8,21 @@
|
|
8
8
|
#ifndef SkTemplates_DEFINED
|
9
9
|
#define SkTemplates_DEFINED
|
10
10
|
|
11
|
-
#include "include/
|
12
|
-
#include "include/private/
|
13
|
-
#include "include/private/
|
11
|
+
#include "include/private/base/SkAlign.h"
|
12
|
+
#include "include/private/base/SkAssert.h"
|
13
|
+
#include "include/private/base/SkDebug.h"
|
14
|
+
#include "include/private/base/SkMalloc.h"
|
15
|
+
#include "include/private/base/SkTLogic.h"
|
14
16
|
|
15
|
-
#include <string.h>
|
16
17
|
#include <array>
|
17
18
|
#include <cstddef>
|
19
|
+
#include <cstdint>
|
20
|
+
#include <cstring>
|
18
21
|
#include <memory>
|
19
|
-
#include <new>
|
20
22
|
#include <type_traits>
|
21
23
|
#include <utility>
|
22
24
|
|
25
|
+
|
23
26
|
/** \file SkTemplates.h
|
24
27
|
|
25
28
|
This file contains light-weight template classes for type-safe and exception-safe
|
@@ -32,6 +35,17 @@
|
|
32
35
|
*/
|
33
36
|
template<typename T> inline void sk_ignore_unused_variable(const T&) { }
|
34
37
|
|
38
|
+
/**
|
39
|
+
* This is a general purpose absolute-value function.
|
40
|
+
* See SkAbs32 in (SkSafe32.h) for a 32-bit int specific version that asserts.
|
41
|
+
*/
|
42
|
+
template <typename T> static inline T SkTAbs(T value) {
|
43
|
+
if (value < 0) {
|
44
|
+
value = -value;
|
45
|
+
}
|
46
|
+
return value;
|
47
|
+
}
|
48
|
+
|
35
49
|
/**
|
36
50
|
* Returns a pointer to a D which comes immediately after S[count].
|
37
51
|
*/
|
@@ -48,14 +62,16 @@ template <typename D, typename S> inline D* SkTAddOffset(S* ptr, ptrdiff_t byteO
|
|
48
62
|
return reinterpret_cast<D*>(reinterpret_cast<sknonstd::same_cv_t<char, D>*>(ptr) + byteOffset);
|
49
63
|
}
|
50
64
|
|
51
|
-
|
52
|
-
template <typename T, T* P> struct SkFunctionWrapper {
|
65
|
+
template <typename T, T* P> struct SkOverloadedFunctionObject {
|
53
66
|
template <typename... Args>
|
54
67
|
auto operator()(Args&&... args) const -> decltype(P(std::forward<Args>(args)...)) {
|
55
68
|
return P(std::forward<Args>(args)...);
|
56
69
|
}
|
57
70
|
};
|
58
71
|
|
72
|
+
template <auto F> using SkFunctionObject =
|
73
|
+
SkOverloadedFunctionObject<std::remove_pointer_t<decltype(F)>, F>;
|
74
|
+
|
59
75
|
/** \class SkAutoTCallVProc
|
60
76
|
|
61
77
|
Call a function when this goes out of scope. The template uses two
|
@@ -65,8 +81,8 @@ template <typename T, T* P> struct SkFunctionWrapper {
|
|
65
81
|
function.
|
66
82
|
*/
|
67
83
|
template <typename T, void (*P)(T*)> class SkAutoTCallVProc
|
68
|
-
: public std::unique_ptr<T,
|
69
|
-
using inherited = std::unique_ptr<T,
|
84
|
+
: public std::unique_ptr<T, SkFunctionObject<P>> {
|
85
|
+
using inherited = std::unique_ptr<T, SkFunctionObject<P>>;
|
70
86
|
public:
|
71
87
|
using inherited::inherited;
|
72
88
|
SkAutoTCallVProc(const SkAutoTCallVProc&) = delete;
|
@@ -75,14 +91,16 @@ public:
|
|
75
91
|
operator T*() const { return this->get(); }
|
76
92
|
};
|
77
93
|
|
94
|
+
|
95
|
+
namespace skia_private {
|
78
96
|
/** Allocate an array of T elements, and free the array in the destructor
|
79
97
|
*/
|
80
|
-
template <typename T> class
|
98
|
+
template <typename T> class AutoTArray {
|
81
99
|
public:
|
82
|
-
|
100
|
+
AutoTArray() {}
|
83
101
|
/** Allocate count number of T elements
|
84
102
|
*/
|
85
|
-
explicit
|
103
|
+
explicit AutoTArray(int count) {
|
86
104
|
SkASSERT(count >= 0);
|
87
105
|
if (count) {
|
88
106
|
fArray.reset(new T[count]);
|
@@ -90,10 +108,10 @@ public:
|
|
90
108
|
SkDEBUGCODE(fCount = count;)
|
91
109
|
}
|
92
110
|
|
93
|
-
|
111
|
+
AutoTArray(AutoTArray&& other) : fArray(std::move(other.fArray)) {
|
94
112
|
SkDEBUGCODE(fCount = other.fCount; other.fCount = 0;)
|
95
113
|
}
|
96
|
-
|
114
|
+
AutoTArray& operator=(AutoTArray&& other) {
|
97
115
|
if (this != &other) {
|
98
116
|
fArray = std::move(other.fArray);
|
99
117
|
SkDEBUGCODE(fCount = other.fCount; other.fCount = 0;)
|
@@ -103,7 +121,7 @@ public:
|
|
103
121
|
|
104
122
|
/** Reallocates given a new count. Reallocation occurs even if new count equals old count.
|
105
123
|
*/
|
106
|
-
void reset(int count = 0) { *this =
|
124
|
+
void reset(int count = 0) { *this = AutoTArray(count); }
|
107
125
|
|
108
126
|
/** Return the array of T elements. Will be NULL if count == 0
|
109
127
|
*/
|
@@ -125,30 +143,30 @@ private:
|
|
125
143
|
SkDEBUGCODE(int fCount = 0;)
|
126
144
|
};
|
127
145
|
|
128
|
-
/** Wraps
|
146
|
+
/** Wraps AutoTArray, with room for kCountRequested elements preallocated.
|
129
147
|
*/
|
130
|
-
template <int kCountRequested, typename T> class
|
148
|
+
template <int kCountRequested, typename T> class AutoSTArray {
|
131
149
|
public:
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
150
|
+
AutoSTArray(AutoSTArray&&) = delete;
|
151
|
+
AutoSTArray(const AutoSTArray&) = delete;
|
152
|
+
AutoSTArray& operator=(AutoSTArray&&) = delete;
|
153
|
+
AutoSTArray& operator=(const AutoSTArray&) = delete;
|
136
154
|
|
137
155
|
/** Initialize with no objects */
|
138
|
-
|
156
|
+
AutoSTArray() {
|
139
157
|
fArray = nullptr;
|
140
158
|
fCount = 0;
|
141
159
|
}
|
142
160
|
|
143
161
|
/** Allocate count number of T elements
|
144
162
|
*/
|
145
|
-
|
163
|
+
AutoSTArray(int count) {
|
146
164
|
fArray = nullptr;
|
147
165
|
fCount = 0;
|
148
166
|
this->reset(count);
|
149
167
|
}
|
150
168
|
|
151
|
-
~
|
169
|
+
~AutoSTArray() {
|
152
170
|
this->reset(0);
|
153
171
|
}
|
154
172
|
|
@@ -216,8 +234,8 @@ public:
|
|
216
234
|
|
217
235
|
private:
|
218
236
|
#if defined(SK_BUILD_FOR_GOOGLE3)
|
219
|
-
// Stack frame size is limited for SK_BUILD_FOR_GOOGLE3. 4k is less than the actual max,
|
220
|
-
// have multiple large stack allocations.
|
237
|
+
// Stack frame size is limited for SK_BUILD_FOR_GOOGLE3. 4k is less than the actual max,
|
238
|
+
// but some functions have multiple large stack allocations.
|
221
239
|
static const int kMaxBytes = 4 * 1024;
|
222
240
|
static const int kCount = kCountRequested * sizeof(T) > kMaxBytes
|
223
241
|
? kMaxBytes / sizeof(T)
|
@@ -226,10 +244,9 @@ private:
|
|
226
244
|
static const int kCount = kCountRequested;
|
227
245
|
#endif
|
228
246
|
|
229
|
-
int
|
230
|
-
T*
|
231
|
-
|
232
|
-
char fStorage[kCount * sizeof(T)];
|
247
|
+
int fCount;
|
248
|
+
T* fArray;
|
249
|
+
alignas(T) char fStorage[kCount * sizeof(T)];
|
233
250
|
};
|
234
251
|
|
235
252
|
/** Manages an array of T elements, freeing the array in the destructor.
|
@@ -238,17 +255,17 @@ private:
|
|
238
255
|
template <typename T,
|
239
256
|
typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value &&
|
240
257
|
std::is_trivially_destructible<T>::value>>
|
241
|
-
class
|
258
|
+
class AutoTMalloc {
|
242
259
|
public:
|
243
260
|
/** Takes ownership of the ptr. The ptr must be a value which can be passed to sk_free. */
|
244
|
-
explicit
|
261
|
+
explicit AutoTMalloc(T* ptr = nullptr) : fPtr(ptr) {}
|
245
262
|
|
246
263
|
/** Allocates space for 'count' Ts. */
|
247
|
-
explicit
|
264
|
+
explicit AutoTMalloc(size_t count)
|
248
265
|
: fPtr(count ? (T*)sk_malloc_throw(count, sizeof(T)) : nullptr) {}
|
249
266
|
|
250
|
-
|
251
|
-
|
267
|
+
AutoTMalloc(AutoTMalloc&&) = default;
|
268
|
+
AutoTMalloc& operator=(AutoTMalloc&&) = default;
|
252
269
|
|
253
270
|
/** Resize the memory area pointed to by the current ptr preserving contents. */
|
254
271
|
void realloc(size_t count) {
|
@@ -283,18 +300,18 @@ public:
|
|
283
300
|
T* release() { return fPtr.release(); }
|
284
301
|
|
285
302
|
private:
|
286
|
-
std::unique_ptr<T,
|
303
|
+
std::unique_ptr<T, SkOverloadedFunctionObject<void(void*), sk_free>> fPtr;
|
287
304
|
};
|
288
305
|
|
289
306
|
template <size_t kCountRequested,
|
290
307
|
typename T,
|
291
308
|
typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value &&
|
292
309
|
std::is_trivially_destructible<T>::value>>
|
293
|
-
class
|
310
|
+
class AutoSTMalloc {
|
294
311
|
public:
|
295
|
-
|
312
|
+
AutoSTMalloc() : fPtr(fTStorage) {}
|
296
313
|
|
297
|
-
|
314
|
+
AutoSTMalloc(size_t count) {
|
298
315
|
if (count > kCount) {
|
299
316
|
fPtr = (T*)sk_malloc_throw(count, sizeof(T));
|
300
317
|
} else if (count) {
|
@@ -304,12 +321,12 @@ public:
|
|
304
321
|
}
|
305
322
|
}
|
306
323
|
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
324
|
+
AutoSTMalloc(AutoSTMalloc&&) = delete;
|
325
|
+
AutoSTMalloc(const AutoSTMalloc&) = delete;
|
326
|
+
AutoSTMalloc& operator=(AutoSTMalloc&&) = delete;
|
327
|
+
AutoSTMalloc& operator=(const AutoSTMalloc&) = delete;
|
311
328
|
|
312
|
-
~
|
329
|
+
~AutoSTMalloc() {
|
313
330
|
if (fPtr != fTStorage) {
|
314
331
|
sk_free(fPtr);
|
315
332
|
}
|
@@ -391,27 +408,9 @@ private:
|
|
391
408
|
};
|
392
409
|
};
|
393
410
|
|
394
|
-
|
411
|
+
using UniqueVoidPtr = std::unique_ptr<void, SkOverloadedFunctionObject<void(void*), sk_free>>;
|
395
412
|
|
396
|
-
|
397
|
-
public:
|
398
|
-
SkAlignedSTStorage() {}
|
399
|
-
SkAlignedSTStorage(SkAlignedSTStorage&&) = delete;
|
400
|
-
SkAlignedSTStorage(const SkAlignedSTStorage&) = delete;
|
401
|
-
SkAlignedSTStorage& operator=(SkAlignedSTStorage&&) = delete;
|
402
|
-
SkAlignedSTStorage& operator=(const SkAlignedSTStorage&) = delete;
|
403
|
-
|
404
|
-
/**
|
405
|
-
* Returns void* because this object does not initialize the
|
406
|
-
* memory. Use placement new for types that require a constructor.
|
407
|
-
*/
|
408
|
-
void* get() { return fStorage; }
|
409
|
-
const void* get() const { return fStorage; }
|
410
|
-
private:
|
411
|
-
alignas(T) char fStorage[sizeof(T)*N];
|
412
|
-
};
|
413
|
-
|
414
|
-
using SkAutoFree = std::unique_ptr<void, SkFunctionWrapper<void(void*), sk_free>>;
|
413
|
+
} // namespace skia_private
|
415
414
|
|
416
415
|
template<typename C, std::size_t... Is>
|
417
416
|
constexpr auto SkMakeArrayFromIndexSequence(C c, std::index_sequence<Is...> is)
|
@@ -424,28 +423,4 @@ template<size_t N, typename C> constexpr auto SkMakeArray(C c)
|
|
424
423
|
return SkMakeArrayFromIndexSequence(c, std::make_index_sequence<N>{});
|
425
424
|
}
|
426
425
|
|
427
|
-
/**
|
428
|
-
* Trait for identifying types which are relocatable via memcpy, for container optimizations.
|
429
|
-
*
|
430
|
-
*/
|
431
|
-
template<typename, typename = void>
|
432
|
-
struct sk_has_trivially_relocatable_member : std::false_type {};
|
433
|
-
|
434
|
-
// Types can declare themselves trivially relocatable with a public
|
435
|
-
// using sk_is_trivially_relocatable = std::true_type;
|
436
|
-
template<typename T>
|
437
|
-
struct sk_has_trivially_relocatable_member<T, std::void_t<typename T::sk_is_trivially_relocatable>>
|
438
|
-
: T::sk_is_trivially_relocatable {};
|
439
|
-
|
440
|
-
// By default, all trivially copyable types are trivially relocatable.
|
441
|
-
template <typename T>
|
442
|
-
struct sk_is_trivially_relocatable
|
443
|
-
: std::disjunction<std::is_trivially_copyable<T>, sk_has_trivially_relocatable_member<T>
|
444
|
-
>{};
|
445
|
-
|
446
|
-
// Here be some dragons: while technically not guaranteed, we count on all sane unique_ptr
|
447
|
-
// implementations to be trivially relocatable.
|
448
|
-
template <typename T>
|
449
|
-
struct sk_is_trivially_relocatable<std::unique_ptr<T>> : std::true_type {};
|
450
|
-
|
451
426
|
#endif
|
@@ -8,11 +8,14 @@
|
|
8
8
|
#ifndef SkThreadID_DEFINED
|
9
9
|
#define SkThreadID_DEFINED
|
10
10
|
|
11
|
-
#include "include/
|
11
|
+
#include "include/private/base/SkAPI.h"
|
12
|
+
#include "include/private/base/SkDebug.h"
|
13
|
+
|
14
|
+
#include <cstdint>
|
12
15
|
|
13
16
|
typedef int64_t SkThreadID;
|
14
17
|
|
15
|
-
// SkMutex.h uses
|
18
|
+
// SkMutex.h uses SkGetThreadID in debug only code.
|
16
19
|
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID();
|
17
20
|
|
18
21
|
const SkThreadID kIllegalThreadID = 0;
|
@@ -7,8 +7,11 @@
|
|
7
7
|
#ifndef SkTo_DEFINED
|
8
8
|
#define SkTo_DEFINED
|
9
9
|
|
10
|
-
#include "include/
|
11
|
-
#include "include/private/SkTFitsIn.h"
|
10
|
+
#include "include/private/base/SkAssert.h"
|
11
|
+
#include "include/private/base/SkTFitsIn.h"
|
12
|
+
|
13
|
+
#include <cstddef>
|
14
|
+
#include <cstdint>
|
12
15
|
|
13
16
|
template <typename D, typename S> constexpr D SkTo(S s) {
|
14
17
|
return SkASSERT(SkTFitsIn<D>(s)),
|
@@ -21,8 +24,16 @@ template <typename S> constexpr int16_t SkToS16(S x) { return SkTo<int16_t>(x
|
|
21
24
|
template <typename S> constexpr uint16_t SkToU16(S x) { return SkTo<uint16_t>(x); }
|
22
25
|
template <typename S> constexpr int32_t SkToS32(S x) { return SkTo<int32_t>(x); }
|
23
26
|
template <typename S> constexpr uint32_t SkToU32(S x) { return SkTo<uint32_t>(x); }
|
27
|
+
template <typename S> constexpr int64_t SkToS64(S x) { return SkTo<int64_t>(x); }
|
28
|
+
template <typename S> constexpr uint64_t SkToU64(S x) { return SkTo<uint64_t>(x); }
|
24
29
|
template <typename S> constexpr int SkToInt(S x) { return SkTo<int>(x); }
|
25
30
|
template <typename S> constexpr unsigned SkToUInt(S x) { return SkTo<unsigned>(x); }
|
26
31
|
template <typename S> constexpr size_t SkToSizeT(S x) { return SkTo<size_t>(x); }
|
27
32
|
|
33
|
+
/** @return false or true based on the condition
|
34
|
+
*/
|
35
|
+
template <typename T> static constexpr bool SkToBool(const T& x) {
|
36
|
+
return (bool)x;
|
37
|
+
}
|
38
|
+
|
28
39
|
#endif // SkTo_DEFINED
|
@@ -0,0 +1,33 @@
|
|
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 SkTypeTraits_DEFINED
|
5
|
+
#define SkTypeTraits_DEFINED
|
6
|
+
|
7
|
+
#include <memory>
|
8
|
+
#include <type_traits>
|
9
|
+
|
10
|
+
// Trait for identifying types which are relocatable via memcpy, for container optimizations.
|
11
|
+
template<typename, typename = void>
|
12
|
+
struct sk_has_trivially_relocatable_member : std::false_type {};
|
13
|
+
|
14
|
+
// Types can declare themselves trivially relocatable with a public
|
15
|
+
// using sk_is_trivially_relocatable = std::true_type;
|
16
|
+
template<typename T>
|
17
|
+
struct sk_has_trivially_relocatable_member<T, std::void_t<typename T::sk_is_trivially_relocatable>>
|
18
|
+
: T::sk_is_trivially_relocatable {};
|
19
|
+
|
20
|
+
// By default, all trivially copyable types are trivially relocatable.
|
21
|
+
template <typename T>
|
22
|
+
struct sk_is_trivially_relocatable
|
23
|
+
: std::disjunction<std::is_trivially_copyable<T>, sk_has_trivially_relocatable_member<T>>{};
|
24
|
+
|
25
|
+
// Here be some dragons: while technically not guaranteed, we count on all sane unique_ptr
|
26
|
+
// implementations to be trivially relocatable.
|
27
|
+
template <typename T>
|
28
|
+
struct sk_is_trivially_relocatable<std::unique_ptr<T>> : std::true_type {};
|
29
|
+
|
30
|
+
template <typename T>
|
31
|
+
inline constexpr bool sk_is_trivially_relocatable_v = sk_is_trivially_relocatable<T>::value;
|
32
|
+
|
33
|
+
#endif // SkTypeTraits_DEFINED
|