@shopify/react-native-skia 2.0.0-next.1 → 2.0.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +25 -11
- package/android/cpp/jni/JniPlatformContext.cpp +1 -0
- package/{ios/RNSkia-iOS → apple}/MetalContext.h +0 -5
- package/{ios/RNSkia-iOS → apple}/MetalWindowContext.mm +4 -0
- package/{ios/RNSkia-iOS/RNSkiOSPlatformContext.h → apple/RNSkApplePlatformContext.h} +7 -3
- package/{ios/RNSkia-iOS/RNSkiOSPlatformContext.mm → apple/RNSkApplePlatformContext.mm} +19 -19
- package/{ios/RNSkia-iOS/RNSkiOSVideo.h → apple/RNSkAppleVideo.h} +3 -3
- package/{ios/RNSkia-iOS/RNSkiOSVideo.mm → apple/RNSkAppleVideo.mm} +14 -14
- package/{ios/RNSkia-iOS/RNSkiOSView.h → apple/RNSkAppleView.h} +4 -4
- package/{ios/RNSkia-iOS/RNSkiOSView.mm → apple/RNSkAppleView.mm} +4 -4
- package/{ios/RNSkia-iOS → apple}/RNSkMetalCanvasProvider.mm +6 -1
- package/{ios/RNSkia-iOS → apple}/SkiaManager.mm +2 -2
- package/{ios/RNSkia-iOS → apple}/SkiaPictureView.mm +2 -2
- package/{ios/RNSkia-iOS → apple}/SkiaPictureViewManager.mm +6 -2
- package/{ios/RNSkia-iOS → apple}/SkiaUIView.h +12 -4
- package/{ios/RNSkia-iOS → apple}/SkiaUIView.mm +11 -7
- package/{ios/RNSkia-iOS → apple}/ViewScreenshotService.h +4 -0
- package/{ios/RNSkia-iOS → apple}/ViewScreenshotService.mm +4 -0
- package/cpp/api/JsiSkCanvas.h +45 -2
- package/cpp/api/JsiSkContourMeasure.h +1 -1
- package/cpp/api/JsiSkHostObjects.h +21 -10
- package/cpp/api/JsiSkParagraph.h +17 -27
- package/cpp/api/JsiSkPathEffect.h +1 -1
- package/cpp/api/JsiSkPictureFactory.h +1 -1
- package/cpp/api/JsiSkShaderFactory.h +43 -8
- package/cpp/api/JsiSkVertices.h +14 -3
- package/cpp/api/recorder/Drawings.h +35 -5
- package/cpp/api/recorder/Shaders.h +40 -0
- package/cpp/rnskia/DawnContext.h +1 -1
- package/cpp/skia/include/codec/SkCodec.h +7 -2
- package/cpp/skia/include/config/SkUserConfig.h +11 -0
- package/cpp/skia/include/core/SkCanvas.h +11 -7
- package/cpp/skia/include/core/SkColor.h +10 -0
- package/cpp/skia/include/core/SkColorSpace.h +184 -2
- package/cpp/skia/include/core/SkColorType.h +114 -32
- package/cpp/skia/include/core/SkFontScanner.h +5 -8
- package/cpp/skia/include/core/SkFontStyle.h +1 -1
- package/cpp/skia/include/core/SkMaskFilter.h +0 -8
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +1 -1
- package/cpp/skia/include/core/SkRRect.h +3 -1
- package/cpp/skia/include/core/SkShader.h +3 -3
- package/cpp/skia/include/core/SkString.h +8 -8
- package/cpp/skia/include/core/SkSurface.h +14 -0
- package/cpp/skia/include/core/SkTypeface.h +24 -7
- package/cpp/skia/include/effects/SkGradientShader.h +6 -1
- package/cpp/skia/include/effects/SkRuntimeEffect.h +1 -0
- package/cpp/skia/include/encode/SkPngEncoder.h +14 -0
- package/cpp/skia/include/gpu/GpuTypes.h +9 -0
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +135 -133
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +5 -0
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +3 -3
- package/cpp/skia/include/gpu/ganesh/GrTypes.h +14 -9
- package/cpp/skia/include/gpu/graphite/Context.h +25 -2
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +23 -5
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +20 -1
- package/cpp/skia/include/gpu/graphite/Image.h +1 -0
- package/cpp/skia/include/gpu/graphite/LogPriority.h +36 -0
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +52 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +6 -0
- package/cpp/skia/include/gpu/graphite/Recording.h +3 -1
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +4 -36
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +48 -0
- package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +3 -2
- package/cpp/skia/include/pathops/SkPathOps.h +9 -1
- package/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h +3 -0
- package/cpp/skia/include/private/SkPathRef.h +15 -21
- package/cpp/skia/include/private/base/SkAttributes.h +16 -10
- package/cpp/skia/include/private/base/SkMutex.h +8 -0
- package/cpp/skia/include/private/base/SkTArray.h +1 -1
- package/cpp/skia/include/private/base/SkTDArray.h +1 -1
- package/cpp/skia/include/private/base/SkTemplates.h +24 -11
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/sksl/SkSLDebugTrace.h +0 -3
- package/cpp/skia/modules/skcms/src/Transform_inl.h +20 -20
- package/cpp/skia/modules/skcms/src/skcms_Transform.h +4 -3
- package/cpp/skia/modules/skcms/src/skcms_public.h +19 -15
- package/cpp/skia/modules/skresources/include/SkResources.h +3 -1
- package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGImage.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +2 -0
- package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -0
- package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +4 -0
- package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
- package/cpp/skia/src/core/SkLRUCache.h +19 -13
- package/cpp/skia/src/core/SkTHash.h +50 -4
- package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +1 -0
- package/lib/commonjs/__tests__/setup.d.ts +18 -0
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +4 -3
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/commonjs/headless/index.d.ts +1 -0
- package/lib/commonjs/headless/index.js +12 -0
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/mock/index.js +1 -2
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +1 -2
- package/lib/commonjs/renderer/Canvas.js +3 -1
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/web/Host.d.ts +4 -6
- package/lib/commonjs/skia/web/Host.js +23 -10
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +15 -15
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +3 -3
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFontMgr.js +1 -1
- package/lib/commonjs/skia/web/JsiSkFontMgr.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +6 -6
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +3 -3
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +9 -9
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +3 -3
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +4 -4
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +3 -3
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js +2 -2
- package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +5 -5
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +4 -3
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiVideo.js +2 -1
- package/lib/commonjs/skia/web/JsiVideo.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig.js +3 -1
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Core.d.ts +1 -5
- package/lib/commonjs/sksg/Recorder/Core.js +12 -4
- package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.d.ts +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +4 -5
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Box.js +4 -6
- package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +1 -3
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js +1 -58
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +2 -0
- package/lib/commonjs/specs/NativeSkiaModule.web.js +10 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/module/__tests__/setup.d.ts +18 -0
- package/lib/module/external/reanimated/useAnimatedImageValue.js +4 -3
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/module/headless/index.d.ts +1 -0
- package/lib/module/headless/index.js +1 -0
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/mock/index.js +1 -2
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +1 -2
- package/lib/module/renderer/Canvas.js +3 -1
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/web/Host.d.ts +4 -6
- package/lib/module/skia/web/Host.js +21 -8
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +15 -15
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +4 -4
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkFontMgr.js +2 -2
- package/lib/module/skia/web/JsiSkFontMgr.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +6 -6
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +4 -4
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +10 -10
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js +1 -1
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +3 -3
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +4 -4
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +4 -4
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +3 -3
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +1 -1
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +5 -5
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +2 -2
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +4 -3
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/skia/web/JsiVideo.js +2 -1
- package/lib/module/skia/web/JsiVideo.js.map +1 -1
- package/lib/module/sksg/HostConfig.js +3 -1
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/module/sksg/Recorder/Core.d.ts +1 -5
- package/lib/module/sksg/Recorder/Core.js +10 -2
- package/lib/module/sksg/Recorder/Core.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.d.ts +1 -1
- package/lib/module/sksg/Recorder/Player.js +5 -6
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Box.js +5 -7
- package/lib/module/sksg/Recorder/commands/Box.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Drawing.d.ts +1 -3
- package/lib/module/sksg/Recorder/commands/Drawing.js +2 -58
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/specs/NativeSkiaModule.web.d.ts +2 -0
- package/lib/module/specs/NativeSkiaModule.web.js +10 -1
- package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/typescript/lib/commonjs/mock/index.d.ts +2 -2
- package/lib/typescript/lib/commonjs/skia/index.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/Host.d.ts +3 -5
- package/lib/typescript/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkFontMgr.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFilterFactory.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPathEffectFactory.d.ts +2 -2
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +3 -3
- package/lib/typescript/lib/commonjs/skia/web/JsiVideo.d.ts +1 -1
- package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +1 -1
- package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +0 -1
- package/lib/typescript/lib/module/headless/index.d.ts +1 -0
- package/lib/typescript/lib/module/mock/index.d.ts +5 -5
- package/lib/typescript/lib/module/skia/Skia.d.ts +1 -1
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +3 -3
- package/lib/typescript/lib/module/skia/web/Host.d.ts +3 -5
- package/lib/typescript/lib/module/skia/web/JsiSkFont.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkFontMgr.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFilterFactory.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPathEffectFactory.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +3 -3
- package/lib/typescript/lib/module/skia/web/JsiVideo.d.ts +1 -1
- package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +1 -1
- package/lib/typescript/lib/module/sksg/Recorder/commands/Drawing.d.ts +0 -1
- package/lib/typescript/src/__tests__/setup.d.ts +18 -0
- package/lib/typescript/src/headless/index.d.ts +1 -0
- package/lib/typescript/src/renderer/Canvas.d.ts +1 -2
- package/lib/typescript/src/skia/web/Host.d.ts +4 -6
- package/lib/typescript/src/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/typescript/src/sksg/Recorder/Core.d.ts +1 -5
- package/lib/typescript/src/sksg/Recorder/Player.d.ts +1 -1
- package/lib/typescript/src/sksg/Recorder/commands/Drawing.d.ts +1 -3
- package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +2 -0
- package/package.json +8 -7
- package/react-native-skia.podspec +3 -3
- package/src/__tests__/setup.ts +67 -1
- package/src/__tests__/snapshots/box/box-shadow-opacity.png +0 -0
- package/src/__tests__/snapshots/platform-buffer.png +0 -0
- package/src/__tests__/snapshots/screens/snapshot2-android-ci.png +0 -0
- package/src/external/reanimated/useAnimatedImageValue.ts +4 -3
- package/src/headless/index.ts +2 -1
- package/src/mock/index.ts +1 -2
- package/src/renderer/Canvas.tsx +3 -2
- package/src/renderer/__tests__/e2e/Box.spec.tsx +22 -0
- package/src/renderer/__tests__/e2e/Matrix4.spec.tsx +1 -2
- package/src/renderer/__tests__/e2e/NativeBuffer.spec.tsx +2 -0
- package/src/renderer/__tests__/e2e/Paths.spec.tsx +13 -11
- package/src/skia/__tests__/Enums.spec.ts +24 -2
- package/src/skia/__tests__/Path.spec.ts +2 -2
- package/src/skia/web/Host.ts +29 -11
- package/src/skia/web/JsiSkCanvas.ts +17 -17
- package/src/skia/web/JsiSkColorFilterFactory.ts +1 -1
- package/src/skia/web/JsiSkFont.ts +5 -5
- package/src/skia/web/JsiSkFontMgr.ts +3 -3
- package/src/skia/web/JsiSkImage.ts +14 -10
- package/src/skia/web/JsiSkImageFactory.ts +5 -5
- package/src/skia/web/JsiSkImageFilterFactory.ts +12 -22
- package/src/skia/web/JsiSkMaskFilterFactory.ts +1 -1
- package/src/skia/web/JsiSkPaint.ts +3 -3
- package/src/skia/web/JsiSkPath.ts +4 -4
- package/src/skia/web/JsiSkPathEffectFactory.ts +6 -6
- package/src/skia/web/JsiSkPathFactory.ts +4 -9
- package/src/skia/web/JsiSkPicture.ts +3 -3
- package/src/skia/web/JsiSkShaderFactory.ts +5 -5
- package/src/skia/web/JsiSkTypefaceFontProvider.ts +3 -3
- package/src/skia/web/JsiSkVerticesFactory.ts +1 -1
- package/src/skia/web/JsiSkia.ts +7 -4
- package/src/skia/web/JsiVideo.ts +2 -1
- package/src/sksg/HostConfig.ts +1 -1
- package/src/sksg/Recorder/Core.ts +5 -7
- package/src/sksg/Recorder/Player.ts +6 -7
- package/src/sksg/Recorder/commands/Box.ts +5 -7
- package/src/sksg/Recorder/commands/Drawing.ts +0 -65
- package/src/specs/NativeSkiaModule.web.ts +12 -2
- package/ios/Rnskia.xcodeproj/project.pbxproj +0 -281
- package/ios/Rnskia.xcworkspace/contents.xcworkspacedata +0 -7
- package/lib/commonjs/skia/types/Image/ColorType.web.d.ts +0 -19
- package/lib/commonjs/skia/types/Image/ColorType.web.js +0 -43
- package/lib/commonjs/skia/types/Image/ColorType.web.js.map +0 -1
- package/lib/module/skia/types/Image/ColorType.web.d.ts +0 -19
- package/lib/module/skia/types/Image/ColorType.web.js +0 -37
- package/lib/module/skia/types/Image/ColorType.web.js.map +0 -1
- package/lib/typescript/lib/commonjs/skia/types/Image/ColorType.web.d.ts +0 -2
- package/lib/typescript/lib/module/skia/types/Image/ColorType.web.d.ts +0 -1
- package/lib/typescript/src/skia/types/Image/ColorType.web.d.ts +0 -19
- package/src/skia/types/Image/ColorType.web.ts +0 -19
- /package/{ios/RNSkia-iOS → apple}/MetalContext.mm +0 -0
- /package/{ios/RNSkia-iOS → apple}/MetalWindowContext.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/RNSkMetalCanvasProvider.h +0 -0
- /package/{ios → apple}/RNSkiaModule.h +0 -0
- /package/{ios → apple}/RNSkiaModule.mm +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaCVPixelBufferUtils.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaCVPixelBufferUtils.mm +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaManager.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaPictureView.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaPictureViewManager.h +0 -0
@@ -8,11 +8,13 @@
|
|
8
8
|
#ifndef skgpu_graphite_ContextOptions_DEFINED
|
9
9
|
#define skgpu_graphite_ContextOptions_DEFINED
|
10
10
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
11
12
|
#include "include/private/base/SkAPI.h"
|
12
13
|
#include "include/private/base/SkMath.h"
|
13
14
|
|
14
15
|
#include <optional>
|
15
16
|
|
17
|
+
class SkData;
|
16
18
|
namespace skgpu { class ShaderErrorHandler; }
|
17
19
|
|
18
20
|
namespace skgpu::graphite {
|
@@ -85,12 +87,12 @@ struct SK_API ContextOptions {
|
|
85
87
|
bool fSupportBilerpFromGlyphAtlas = false;
|
86
88
|
|
87
89
|
/**
|
88
|
-
*
|
89
|
-
*
|
90
|
-
*
|
91
|
-
*
|
90
|
+
* For the moment, if Recordings are replayed in the order they are recorded, then
|
91
|
+
* Graphite can make certain assumptions that allow for better performance. Otherwise
|
92
|
+
* we have to flush some caches at the start of each Recording to ensure that they can
|
93
|
+
* be played back properly.
|
92
94
|
*/
|
93
|
-
bool
|
95
|
+
bool fRequireOrderedRecordings = false;
|
94
96
|
|
95
97
|
static constexpr size_t kDefaultContextBudget = 256 * (1 << 20);
|
96
98
|
/**
|
@@ -118,6 +120,22 @@ struct SK_API ContextOptions {
|
|
118
120
|
*/
|
119
121
|
std::optional<uint64_t> fVulkanVMALargeHeapBlockSize;
|
120
122
|
|
123
|
+
/** Client-provided context that is passed to client-provided PipelineCallback. */
|
124
|
+
using PipelineCallbackContext = void*;
|
125
|
+
/** Client-provided callback that is called whenever Graphite encounters a new Pipeline. */
|
126
|
+
using PipelineCallback = void (*)(PipelineCallbackContext context, sk_sp<SkData> pipelineData);
|
127
|
+
|
128
|
+
/**
|
129
|
+
* These two members allow a client to register a callback that will be invoked
|
130
|
+
* whenever Graphite encounters a new Pipeline. The callback will be passed an
|
131
|
+
* sk_sp<SkData> that a client can take ownership of and serialize. The SkData
|
132
|
+
* contains all the information Graphite requires to recreate the Pipeline at
|
133
|
+
* a later date. The SkData is versioned however, so must be regenerated and
|
134
|
+
* re-serialized when it becomes out of date.
|
135
|
+
*/
|
136
|
+
PipelineCallbackContext fPipelineCallbackContext = nullptr;
|
137
|
+
PipelineCallback fPipelineCallback = nullptr;
|
138
|
+
|
121
139
|
/**
|
122
140
|
* Private options that are only meant for testing within Skia's tools.
|
123
141
|
*/
|
@@ -30,13 +30,23 @@ class Task;
|
|
30
30
|
using GpuFinishedContext = void*;
|
31
31
|
using GpuFinishedProc = void (*)(GpuFinishedContext finishedContext, CallbackResult);
|
32
32
|
|
33
|
+
using GpuFinishedWithStatsProc = void (*)(GpuFinishedContext finishedContext,
|
34
|
+
CallbackResult,
|
35
|
+
const GpuStats&);
|
36
|
+
|
33
37
|
/**
|
34
38
|
* The fFinishedProc is called when the Recording has been submitted and finished on the GPU, or
|
35
39
|
* when there is a failure that caused it not to be submitted. The callback will always be called
|
36
40
|
* and the caller can use the callback to know it is safe to free any resources associated with
|
37
41
|
* the Recording that they may be holding onto. If the Recording is successfully submitted to the
|
38
42
|
* GPU the callback will be called with CallbackResult::kSuccess once the GPU has finished. All
|
39
|
-
* other cases where some failure
|
43
|
+
* other cases where some failure occurred it will be called with CallbackResult::kFailed.
|
44
|
+
*
|
45
|
+
* Alternatively, the client can provide fFinishedProcWithStats. This provides additional
|
46
|
+
* information about execution of the recording on the GPU. Only the stats requested using
|
47
|
+
* fStatsFlags will be valid and only if CallbackResult is kSuccess. If both fFinishedProc
|
48
|
+
* and fFinishedProcWithStats are provided the latter is preferred and the former won't be
|
49
|
+
* called.
|
40
50
|
*
|
41
51
|
* The fTargetSurface, if provided, is used as a target for any draws recorded onto a deferred
|
42
52
|
* canvas returned from Recorder::makeDeferredCanvas. This target surface must be provided iff
|
@@ -74,8 +84,10 @@ struct InsertRecordingInfo {
|
|
74
84
|
size_t fNumSignalSemaphores = 0;
|
75
85
|
BackendSemaphore* fSignalSemaphores = nullptr;
|
76
86
|
|
87
|
+
GpuStatsFlags fGpuStatsFlags = GpuStatsFlags::kNone;
|
77
88
|
GpuFinishedContext fFinishedContext = nullptr;
|
78
89
|
GpuFinishedProc fFinishedProc = nullptr;
|
90
|
+
GpuFinishedWithStatsProc fFinishedWithStatsProc = nullptr;
|
79
91
|
};
|
80
92
|
|
81
93
|
/**
|
@@ -87,8 +99,15 @@ struct InsertRecordingInfo {
|
|
87
99
|
* other cases where some failure occured it will be called with CallbackResult::kFailed.
|
88
100
|
*/
|
89
101
|
struct InsertFinishInfo {
|
102
|
+
InsertFinishInfo() = default;
|
103
|
+
InsertFinishInfo(GpuFinishedContext context, GpuFinishedProc proc)
|
104
|
+
: fFinishedContext{context}, fFinishedProc{proc} {}
|
105
|
+
InsertFinishInfo(GpuFinishedContext context, GpuFinishedWithStatsProc proc)
|
106
|
+
: fFinishedContext{context}, fFinishedWithStatsProc{proc} {}
|
90
107
|
GpuFinishedContext fFinishedContext = nullptr;
|
91
108
|
GpuFinishedProc fFinishedProc = nullptr;
|
109
|
+
GpuFinishedWithStatsProc fFinishedWithStatsProc = nullptr;
|
110
|
+
GpuStatsFlags fGpuStatsFlags = GpuStatsFlags::kNone;
|
92
111
|
};
|
93
112
|
|
94
113
|
/**
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2024 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 skgpu_graphite_LogPriority_DEFINED
|
9
|
+
#define skgpu_graphite_LogPriority_DEFINED
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Note: this file may be included in clients' SkUserConfig.h files, so including any other headers
|
13
|
+
* in this file should be avoided.
|
14
|
+
*/
|
15
|
+
|
16
|
+
namespace skgpu::graphite {
|
17
|
+
/**
|
18
|
+
* SKGPU_GRAPHITE_LOWEST_ACTIVE_LOG_PRIORITY can be defined to one of these values (in
|
19
|
+
* SkUserConfig.h) to control Graphite's logging behavior.
|
20
|
+
*
|
21
|
+
* For example:
|
22
|
+
* ```
|
23
|
+
* #define SKGPU_GRAPHITE_LOWEST_ACTIVE_LOG_PRIORITY skgpu::graphite::LogPriority::kWarning
|
24
|
+
* ```
|
25
|
+
* Would cause Graphite to log warnings, non-fatal errors, and fatal errors.
|
26
|
+
* However, debug logs would be omitted.
|
27
|
+
*/
|
28
|
+
enum class LogPriority : int {
|
29
|
+
kFatal = 0,
|
30
|
+
kError = 1,
|
31
|
+
kWarning = 2,
|
32
|
+
kDebug = 3,
|
33
|
+
};
|
34
|
+
}; // namespace skgpu::graphite
|
35
|
+
|
36
|
+
#endif // skgpu_graphite_LogPriority_DEFINED
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2024 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 skgpu_graphite_PrecompileContext_DEFINED
|
9
|
+
#define skgpu_graphite_PrecompileContext_DEFINED
|
10
|
+
|
11
|
+
#include "include/core/SkRefCnt.h"
|
12
|
+
#include "include/private/base/SingleOwner.h"
|
13
|
+
|
14
|
+
#include <chrono>
|
15
|
+
#include <memory>
|
16
|
+
|
17
|
+
namespace skgpu::graphite {
|
18
|
+
|
19
|
+
class SharedContext;
|
20
|
+
class PrecompileContextPriv;
|
21
|
+
class ResourceProvider;
|
22
|
+
|
23
|
+
class SK_API PrecompileContext {
|
24
|
+
public:
|
25
|
+
~PrecompileContext();
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Purge Pipelines that haven't been used in the past 'msNotUsed' milliseconds
|
29
|
+
* regardless of whether the pipeline cache is under budget.
|
30
|
+
*
|
31
|
+
* @param msNotUsed Pipelines not used in these last milliseconds will be cleaned up.
|
32
|
+
*/
|
33
|
+
void purgePipelinesNotUsedInMs(std::chrono::milliseconds msNotUsed);
|
34
|
+
|
35
|
+
// Provides access to functions that aren't part of the public API.
|
36
|
+
PrecompileContextPriv priv();
|
37
|
+
const PrecompileContextPriv priv() const; // NOLINT(readability-const-return-type)
|
38
|
+
|
39
|
+
private:
|
40
|
+
friend class PrecompileContextPriv;
|
41
|
+
friend class Context; // for ctor
|
42
|
+
|
43
|
+
PrecompileContext(sk_sp<SharedContext>);
|
44
|
+
|
45
|
+
mutable SingleOwner fSingleOwner;
|
46
|
+
sk_sp<SharedContext> fSharedContext;
|
47
|
+
std::unique_ptr<ResourceProvider> fResourceProvider;
|
48
|
+
};
|
49
|
+
|
50
|
+
} // namespace skgpu::graphite
|
51
|
+
|
52
|
+
#endif // skgpu_graphite_PrecompileContext_DEFINED
|
@@ -209,6 +209,12 @@ public:
|
|
209
209
|
*/
|
210
210
|
size_t maxBudgetedBytes() const;
|
211
211
|
|
212
|
+
/**
|
213
|
+
* Sets the size of Recorders's gpu memory cache budget in bytes. If the new budget is lower
|
214
|
+
* than the current budget, the cache will try to free resources to get under the new budget.
|
215
|
+
*/
|
216
|
+
void setMaxBudgetedBytes(size_t bytes);
|
217
|
+
|
212
218
|
/**
|
213
219
|
* Enumerates all cached GPU resources owned by the Recorder and dumps their memory to
|
214
220
|
* traceMemoryDump.
|
@@ -9,6 +9,7 @@
|
|
9
9
|
#define skgpu_graphite_Recording_DEFINED
|
10
10
|
|
11
11
|
#include "include/core/SkRefCnt.h"
|
12
|
+
#include "include/core/SkSize.h"
|
12
13
|
#include "include/private/base/SkTArray.h"
|
13
14
|
|
14
15
|
#include <memory>
|
@@ -21,6 +22,7 @@ class RefCntedCallback;
|
|
21
22
|
|
22
23
|
namespace skgpu::graphite {
|
23
24
|
|
25
|
+
class Caps;
|
24
26
|
class CommandBuffer;
|
25
27
|
class RecordingPriv;
|
26
28
|
class Resource;
|
@@ -44,7 +46,7 @@ private:
|
|
44
46
|
// replay, and it handles the target proxy's instantiation with the provided target.
|
45
47
|
class LazyProxyData {
|
46
48
|
public:
|
47
|
-
LazyProxyData(const TextureInfo&);
|
49
|
+
LazyProxyData(const Caps*, SkISize dimensions, const TextureInfo&);
|
48
50
|
|
49
51
|
TextureProxy* lazyProxy();
|
50
52
|
sk_sp<TextureProxy> refLazyProxy();
|
@@ -8,27 +8,19 @@
|
|
8
8
|
#ifndef skgpu_graphite_MtlGraphiteTypes_DEFINED
|
9
9
|
#define skgpu_graphite_MtlGraphiteTypes_DEFINED
|
10
10
|
|
11
|
+
#if __OBJC__ // <Metal/Metal.h> only works when compiled for Objective C
|
12
|
+
|
11
13
|
#include "include/core/SkTypes.h"
|
12
14
|
|
13
|
-
#if __OBJC__ // <Metal/Metal.h> only works when compiled for Objective C
|
14
|
-
#include "include/gpu/graphite/BackendTexture.h"
|
15
15
|
#include "include/gpu/graphite/GraphiteTypes.h"
|
16
|
-
#include "include/gpu/graphite/
|
17
|
-
#include "include/ports/SkCFObject.h"
|
16
|
+
#include "include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h"
|
18
17
|
#include "include/private/base/SkAPI.h"
|
19
18
|
|
20
19
|
#import <CoreFoundation/CoreFoundation.h>
|
21
20
|
#import <Metal/Metal.h>
|
22
21
|
#import <TargetConditionals.h>
|
23
22
|
|
24
|
-
#if TARGET_OS_SIMULATOR
|
25
|
-
#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0), tvos(13.0))
|
26
|
-
#else // TARGET_OS_SIMULATOR
|
27
|
-
#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0), tvos(9.0))
|
28
|
-
#endif // TARGET_OS_SIMULATOR
|
29
|
-
|
30
23
|
namespace skgpu::graphite {
|
31
|
-
|
32
24
|
struct SK_API MtlTextureInfo {
|
33
25
|
uint32_t fSampleCount = 1;
|
34
26
|
skgpu::Mipmapped fMipmapped = skgpu::Mipmapped::kNo;
|
@@ -53,31 +45,7 @@ struct SK_API MtlTextureInfo {
|
|
53
45
|
, fStorageMode(storageMode)
|
54
46
|
, fFramebufferOnly(framebufferOnly) {}
|
55
47
|
};
|
56
|
-
|
57
|
-
namespace TextureInfos {
|
58
|
-
SK_API TextureInfo MakeMetal(const MtlTextureInfo&);
|
59
|
-
SK_API TextureInfo MakeMetal(CFTypeRef mtlTexture);
|
60
|
-
|
61
|
-
SK_API bool GetMtlTextureInfo(const TextureInfo&, MtlTextureInfo*);
|
62
|
-
} // namespace TextureInfos
|
63
|
-
|
64
|
-
namespace BackendTextures {
|
65
|
-
// The BackendTexture will not call retain or release on the passed in CFTypeRef. Thus the
|
66
|
-
// client must keep the CFTypeRef valid until they are no longer using the BackendTexture.
|
67
|
-
SK_API BackendTexture MakeMetal(SkISize dimensions, CFTypeRef mtlTexture);
|
68
|
-
|
69
|
-
SK_API CFTypeRef GetMtlTexture(const BackendTexture&);
|
70
|
-
} // namespace BackendTextures
|
71
|
-
|
72
|
-
namespace BackendSemaphores {
|
73
|
-
// TODO(b/286088355) Determine creator's responsibility for setting refcnt.
|
74
|
-
SK_API BackendSemaphore MakeMetal(CFTypeRef mtlEvent, uint64_t value);
|
75
|
-
|
76
|
-
SK_API CFTypeRef GetMtlEvent(const BackendSemaphore&);
|
77
|
-
SK_API uint64_t GetMtlValue(const BackendSemaphore&);
|
78
|
-
} // namespace BackendSemaphores
|
79
|
-
|
80
|
-
} // namespace skgpu::graphite
|
48
|
+
} // namespace skgpu::graphite
|
81
49
|
|
82
50
|
#endif // __OBJC__
|
83
51
|
|
@@ -0,0 +1,48 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2024 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 skgpu_graphite_MtlGraphiteTypesUtils_DEFINED
|
9
|
+
#define skgpu_graphite_MtlGraphiteTypesUtils_DEFINED
|
10
|
+
|
11
|
+
#include "include/core/SkTypes.h"
|
12
|
+
|
13
|
+
#include "include/gpu/graphite/BackendTexture.h"
|
14
|
+
#include "include/gpu/graphite/TextureInfo.h"
|
15
|
+
#include "include/private/base/SkAPI.h"
|
16
|
+
|
17
|
+
#import <CoreFoundation/CoreFoundation.h>
|
18
|
+
|
19
|
+
namespace skgpu::graphite {
|
20
|
+
|
21
|
+
struct SK_API MtlTextureInfo;
|
22
|
+
|
23
|
+
namespace TextureInfos {
|
24
|
+
SK_API TextureInfo MakeMetal(const MtlTextureInfo&);
|
25
|
+
SK_API TextureInfo MakeMetal(CFTypeRef mtlTexture);
|
26
|
+
|
27
|
+
SK_API bool GetMtlTextureInfo(const TextureInfo&, MtlTextureInfo*);
|
28
|
+
} // namespace TextureInfos
|
29
|
+
|
30
|
+
namespace BackendTextures {
|
31
|
+
// The BackendTexture will not call retain or release on the passed in CFTypeRef. Thus the
|
32
|
+
// client must keep the CFTypeRef valid until they are no longer using the BackendTexture.
|
33
|
+
SK_API BackendTexture MakeMetal(SkISize dimensions, CFTypeRef mtlTexture);
|
34
|
+
|
35
|
+
SK_API CFTypeRef GetMtlTexture(const BackendTexture&);
|
36
|
+
} // namespace BackendTextures
|
37
|
+
|
38
|
+
namespace BackendSemaphores {
|
39
|
+
// TODO(b/286088355) Determine creator's responsibility for setting refcnt.
|
40
|
+
SK_API BackendSemaphore MakeMetal(CFTypeRef mtlEvent, uint64_t value);
|
41
|
+
|
42
|
+
SK_API CFTypeRef GetMtlEvent(const BackendSemaphore&);
|
43
|
+
SK_API uint64_t GetMtlValue(const BackendSemaphore&);
|
44
|
+
} // namespace BackendSemaphores
|
45
|
+
|
46
|
+
} // namespace skgpu::graphite
|
47
|
+
|
48
|
+
#endif // skgpu_graphite_MtlGraphiteTypesUtils_DEFINED
|
@@ -15,6 +15,7 @@ namespace skgpu::graphite {
|
|
15
15
|
|
16
16
|
class Context;
|
17
17
|
class PaintOptions;
|
18
|
+
class PrecompileContext;
|
18
19
|
|
19
20
|
/**
|
20
21
|
* Describes the required properties of a RenderPass that will be combined with the
|
@@ -33,12 +34,12 @@ struct SK_API RenderPassProperties {
|
|
33
34
|
* drawing. Graphite will always be able to perform an inline compilation if some SkPaint
|
34
35
|
* combination was omitted from precompilation.
|
35
36
|
*
|
36
|
-
* @param
|
37
|
+
* @param precompileContext thread-safe helper holding required portions of the Context
|
37
38
|
* @param paintOptions captures a set of SkPaints that will be drawn
|
38
39
|
* @param drawTypes communicates which primitives those paints will be drawn with
|
39
40
|
* @param renderPassProperties describes the RenderPasses needed for the desired Pipelines
|
40
41
|
*/
|
41
|
-
void SK_API Precompile(
|
42
|
+
void SK_API Precompile(PrecompileContext* precompileContext,
|
42
43
|
const PaintOptions& paintOptions,
|
43
44
|
DrawTypeFlags drawTypes,
|
44
45
|
SkSpan<const RenderPassProperties> renderPassProperties);
|
@@ -65,7 +65,15 @@ bool SK_API Simplify(const SkPath& path, SkPath* result);
|
|
65
65
|
@param result The tight bounds of the path.
|
66
66
|
@return True if the bounds could be computed.
|
67
67
|
*/
|
68
|
-
|
68
|
+
[[deprecated]]
|
69
|
+
static inline bool TightBounds(const SkPath& path, SkRect* result) {
|
70
|
+
auto rect = path.computeTightBounds();
|
71
|
+
if (rect.isFinite()) {
|
72
|
+
*result = rect;
|
73
|
+
return true;
|
74
|
+
}
|
75
|
+
return false;
|
76
|
+
}
|
69
77
|
|
70
78
|
/** Set the result with fill type winding to area equivalent to path.
|
71
79
|
Returns true if successful. Does not detect if path contains contours which
|
@@ -13,8 +13,11 @@
|
|
13
13
|
|
14
14
|
class SkFontMgr;
|
15
15
|
class SkFontConfigInterface;
|
16
|
+
class SkFontScanner;
|
16
17
|
|
17
18
|
/** Creates a SkFontMgr which wraps a SkFontConfigInterface. */
|
18
19
|
SK_API sk_sp<SkFontMgr> SkFontMgr_New_FCI(sk_sp<SkFontConfigInterface> fci);
|
20
|
+
SK_API sk_sp<SkFontMgr> SkFontMgr_New_FCI(sk_sp<SkFontConfigInterface> fci,
|
21
|
+
std::unique_ptr<SkFontScanner> scanner);
|
19
22
|
|
20
23
|
#endif // #ifndef SkFontMgr_FontConfigInterface_DEFINED
|
@@ -28,15 +28,6 @@
|
|
28
28
|
class SkMatrix;
|
29
29
|
class SkRRect;
|
30
30
|
|
31
|
-
// These are computed from a stream of verbs
|
32
|
-
struct SkPathVerbAnalysis {
|
33
|
-
bool valid;
|
34
|
-
int points, weights;
|
35
|
-
unsigned segmentMask;
|
36
|
-
};
|
37
|
-
SkPathVerbAnalysis sk_path_analyze_verbs(const uint8_t verbs[], int count);
|
38
|
-
|
39
|
-
|
40
31
|
/**
|
41
32
|
* Holds the path verbs and points. It is versioned by a generation ID. None of its public methods
|
42
33
|
* modify the contents. To modify or append to the verbs/points wrap the SkPathRef in an
|
@@ -541,7 +532,12 @@ private:
|
|
541
532
|
|
542
533
|
void callGenIDChangeListeners();
|
543
534
|
|
535
|
+
PointsArray fPoints;
|
536
|
+
VerbsArray fVerbs;
|
537
|
+
ConicWeightsArray fConicWeights;
|
538
|
+
|
544
539
|
mutable SkRect fBounds;
|
540
|
+
SkRect fArcOval;
|
545
541
|
|
546
542
|
enum {
|
547
543
|
kEmptyGenID = 1, // GenID reserved for path ref with zero points and zero verbs.
|
@@ -549,27 +545,25 @@ private:
|
|
549
545
|
mutable uint32_t fGenerationID;
|
550
546
|
SkIDChangeListener::List fGenIDChangeListeners;
|
551
547
|
|
552
|
-
PointsArray fPoints;
|
553
|
-
VerbsArray fVerbs;
|
554
|
-
ConicWeightsArray fConicWeights;
|
555
|
-
|
556
548
|
SkDEBUGCODE(std::atomic<int> fEditorsAttached;) // assert only one editor in use at any time.
|
557
549
|
|
558
|
-
|
559
|
-
|
550
|
+
SkScalar fArcStartAngle;
|
551
|
+
SkScalar fArcSweepAngle;
|
560
552
|
|
561
553
|
PathType fType;
|
562
|
-
|
563
|
-
|
564
|
-
|
554
|
+
|
555
|
+
mutable uint8_t fBoundsIsDirty;
|
556
|
+
|
565
557
|
uint8_t fRRectOrOvalStartIdx;
|
566
558
|
uint8_t fSegmentMask;
|
567
559
|
// If the path is an arc, these four variables store that information.
|
568
560
|
// We should just store an SkArc, but alignment would cost us 8 more bytes.
|
569
561
|
SkArc::Type fArcType;
|
570
|
-
|
571
|
-
|
572
|
-
|
562
|
+
|
563
|
+
mutable bool fIsFinite; // only meaningful if bounds are valid
|
564
|
+
// Both the circle and rrect special cases have a notion of direction and starting point
|
565
|
+
// The next two variables store that information for either.
|
566
|
+
bool fRRectOrOvalIsCCW;
|
573
567
|
|
574
568
|
friend class PathRefTest_Private;
|
575
569
|
friend class ForceIsRRect_Private; // unit test isRRect
|
@@ -56,20 +56,26 @@
|
|
56
56
|
* Used to ignore sanitizer warnings.
|
57
57
|
*/
|
58
58
|
#if !defined(SK_NO_SANITIZE)
|
59
|
-
#
|
59
|
+
#if defined(__has_attribute)
|
60
|
+
#if __has_attribute(no_sanitize)
|
61
|
+
// This should be for clang and versions of gcc >= 8.0
|
62
|
+
#define SK_NO_SANITIZE(A) SK_ATTRIBUTE(no_sanitize(A))
|
63
|
+
#else
|
64
|
+
// For compilers that don't support sanitization, just do nothing.
|
65
|
+
#define SK_NO_SANITIZE(A)
|
66
|
+
#endif
|
67
|
+
#else // no __has_attribute, e.g. MSVC
|
68
|
+
#define SK_NO_SANITIZE(A)
|
69
|
+
#endif
|
60
70
|
#endif
|
61
71
|
|
62
72
|
/**
|
63
|
-
*
|
73
|
+
* Used to ignore CFI sanitizer warnings, supported only by Clang at the moment.
|
64
74
|
*/
|
65
|
-
#if defined(__clang__)
|
66
|
-
#
|
67
|
-
|
68
|
-
#
|
69
|
-
#endif
|
70
|
-
|
71
|
-
#if !defined(SK_CLANG_NO_SANITIZE)
|
72
|
-
#define SK_CLANG_NO_SANITIZE(A)
|
75
|
+
#if defined(__clang__)
|
76
|
+
#define SK_NO_SANITIZE_CFI SK_NO_SANITIZE("cfi")
|
77
|
+
#else
|
78
|
+
#define SK_NO_SANITIZE_CFI
|
73
79
|
#endif
|
74
80
|
|
75
81
|
/**
|
@@ -14,6 +14,14 @@
|
|
14
14
|
#include "include/private/base/SkThreadAnnotations.h"
|
15
15
|
#include "include/private/base/SkThreadID.h"
|
16
16
|
|
17
|
+
/**
|
18
|
+
* class SkMutex
|
19
|
+
*
|
20
|
+
* This allows us to have a mutex without needing the one in
|
21
|
+
* the C++ std library which does not work with all clients.
|
22
|
+
* go/cstyle#Disallowed_Stdlib
|
23
|
+
*/
|
24
|
+
|
17
25
|
class SK_CAPABILITY("mutex") SkMutex {
|
18
26
|
public:
|
19
27
|
constexpr SkMutex() = default;
|
@@ -617,7 +617,7 @@ private:
|
|
617
617
|
// unpredictable location in memory. Of course, TArray won't actually use fItemArray in this
|
618
618
|
// way, and we don't want to construct a T before the user requests one. There's no real risk
|
619
619
|
// here, so disable CFI when doing these casts.
|
620
|
-
|
620
|
+
SK_NO_SANITIZE_CFI
|
621
621
|
static T* TCast(void* buffer) {
|
622
622
|
return (T*)buffer;
|
623
623
|
}
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#include "include/private/base/SkTLogic.h"
|
16
16
|
#include "include/private/base/SkTo.h"
|
17
17
|
|
18
|
+
#include <algorithm>
|
18
19
|
#include <array>
|
19
20
|
#include <cstddef>
|
20
21
|
#include <cstdint>
|
@@ -94,7 +95,8 @@ public:
|
|
94
95
|
|
95
96
|
|
96
97
|
namespace skia_private {
|
97
|
-
/** Allocate an array of T elements
|
98
|
+
/** Allocate an array of T elements on the heap. Once this goes out of scope, the
|
99
|
+
* elements will be cleaned up "auto"matically.
|
98
100
|
*/
|
99
101
|
template <typename T> class AutoTArray {
|
100
102
|
public:
|
@@ -164,7 +166,10 @@ private:
|
|
164
166
|
size_t fSize = 0;
|
165
167
|
};
|
166
168
|
|
167
|
-
/**
|
169
|
+
/** Like AutoTArray with room for kCountRequested elements preallocated on
|
170
|
+
* the Stack. If count exceeds the space of the preallocation, the elements
|
171
|
+
* will live on the heap. Once this goes out of scope, the elements will be
|
172
|
+
* cleaned up "auto"matically.
|
168
173
|
*/
|
169
174
|
template <int kCountRequested, typename T> class AutoSTArray {
|
170
175
|
public:
|
@@ -256,17 +261,25 @@ private:
|
|
256
261
|
#if defined(SK_BUILD_FOR_GOOGLE3)
|
257
262
|
// Stack frame size is limited for SK_BUILD_FOR_GOOGLE3. 4k is less than the actual max,
|
258
263
|
// but some functions have multiple large stack allocations.
|
259
|
-
static
|
260
|
-
static
|
264
|
+
static constexpr int kMaxBytes = 4 * 1024;
|
265
|
+
static constexpr int kMinCount = kCountRequested * sizeof(T) > kMaxBytes
|
261
266
|
? kMaxBytes / sizeof(T)
|
262
267
|
: kCountRequested;
|
263
268
|
#else
|
264
|
-
static
|
269
|
+
static constexpr int kMinCount = kCountRequested;
|
265
270
|
#endif
|
266
271
|
|
267
|
-
int
|
272
|
+
// Because we are also storing an int, there is a tiny bit of padding that
|
273
|
+
// the C++ compiler adds after fStorage if sizeof(T) <= alignof(T*).
|
274
|
+
// Thus, we can expand how many elements are stored on the stack to make use of this
|
275
|
+
// (e.g. 1 extra element for 4 byte T if kCountRequested was even).
|
276
|
+
static_assert(alignof(int) <= alignof(T*) || alignof(int) <= alignof(T));
|
277
|
+
static constexpr int kCount =
|
278
|
+
SkAlignTo(kMinCount*sizeof(T) + sizeof(int), std::max(alignof(T*), alignof(T))) / sizeof(T);
|
279
|
+
|
268
280
|
T* fArray;
|
269
|
-
alignas(T)
|
281
|
+
alignas(T) std::byte fStorage[kCount * sizeof(T)];
|
282
|
+
int fCount;
|
270
283
|
};
|
271
284
|
|
272
285
|
/** Manages an array of T elements, freeing the array in the destructor.
|
@@ -409,16 +422,16 @@ public:
|
|
409
422
|
|
410
423
|
private:
|
411
424
|
// Since we use uint32_t storage, we might be able to get more elements for free.
|
412
|
-
static
|
425
|
+
static constexpr size_t kCountWithPadding = SkAlign4(kCountRequested*sizeof(T)) / sizeof(T);
|
413
426
|
#if defined(SK_BUILD_FOR_GOOGLE3)
|
414
427
|
// Stack frame size is limited for SK_BUILD_FOR_GOOGLE3. 4k is less than the actual max, but some functions
|
415
428
|
// have multiple large stack allocations.
|
416
|
-
static
|
417
|
-
static
|
429
|
+
static constexpr size_t kMaxBytes = 4 * 1024;
|
430
|
+
static constexpr size_t kCount = kCountRequested * sizeof(T) > kMaxBytes
|
418
431
|
? kMaxBytes / sizeof(T)
|
419
432
|
: kCountWithPadding;
|
420
433
|
#else
|
421
|
-
static
|
434
|
+
static constexpr size_t kCount = kCountWithPadding;
|
422
435
|
#endif
|
423
436
|
|
424
437
|
T* fPtr;
|
@@ -539,7 +539,7 @@ SK_MAKE_BITFIELD_CLASS_OPS(GpuPathRenderers)
|
|
539
539
|
enum class GrColorType {
|
540
540
|
kUnknown,
|
541
541
|
kAlpha_8,
|
542
|
-
kBGR_565,
|
542
|
+
kBGR_565, // This corresponds to kRGB_565_SkColorType, which is misnamed.
|
543
543
|
kRGB_565,
|
544
544
|
kABGR_4444, // This name differs from SkColorType. kARGB_4444_SkColorType is misnamed.
|
545
545
|
kRGBA_8888,
|
@@ -16,9 +16,6 @@ namespace SkSL {
|
|
16
16
|
|
17
17
|
class DebugTrace : public SkRefCnt {
|
18
18
|
public:
|
19
|
-
/** Serializes a debug trace to JSON which can be parsed by our debugger. */
|
20
|
-
virtual void writeTrace(SkWStream* w) const = 0;
|
21
|
-
|
22
19
|
/** Generates a human-readable dump of the debug trace. */
|
23
20
|
virtual void dump(SkWStream* o) const = 0;
|
24
21
|
};
|