@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
@@ -330,6 +330,20 @@ public:
|
|
330
330
|
*/
|
331
331
|
sk_sp<SkImage> makeImageSnapshot(const SkIRect& bounds);
|
332
332
|
|
333
|
+
/** Returns an SkImage capturing the current SkSurface contents. However, the contents of the
|
334
|
+
SkImage are only valid as long as no other writes to the SkSurface occur. If writes to the
|
335
|
+
original SkSurface happen then contents of the SkImage are undefined. However, continued use
|
336
|
+
of the SkImage should not cause crashes or similar fatal behavior.
|
337
|
+
|
338
|
+
This API is useful for cases where the client either immediately destroys the SkSurface
|
339
|
+
after the SkImage is created or knows they will destroy the SkImage before writing to the
|
340
|
+
SkSurface again.
|
341
|
+
|
342
|
+
This API can be more performant than makeImageSnapshot as it never does an internal copy
|
343
|
+
of the data assuming the user frees either the SkImage or SkSurface as described above.
|
344
|
+
*/
|
345
|
+
sk_sp<SkImage> makeTemporaryImage();
|
346
|
+
|
333
347
|
/** Draws SkSurface contents to canvas, with its top-left corner at (x, y).
|
334
348
|
|
335
349
|
If SkPaint paint is not nullptr, apply SkColorFilter, alpha, SkImageFilter, and SkBlendMode.
|
@@ -53,20 +53,18 @@ typedef uint32_t SkFontTableTag;
|
|
53
53
|
class SK_API SkTypeface : public SkWeakRefCnt {
|
54
54
|
public:
|
55
55
|
/** Returns the typeface's intrinsic style attributes. */
|
56
|
-
SkFontStyle fontStyle() const
|
57
|
-
return fStyle;
|
58
|
-
}
|
56
|
+
SkFontStyle fontStyle() const;
|
59
57
|
|
60
58
|
/** Returns true if style() has the kBold bit set. */
|
61
|
-
bool isBold() const
|
59
|
+
bool isBold() const;
|
62
60
|
|
63
61
|
/** Returns true if style() has the kItalic bit set. */
|
64
|
-
bool isItalic() const
|
62
|
+
bool isItalic() const;
|
65
63
|
|
66
64
|
/** Returns true if the typeface claims to be fixed-pitch.
|
67
65
|
* This is a style bit, advance widths may vary even if this returns true.
|
68
66
|
*/
|
69
|
-
bool isFixedPitch() const
|
67
|
+
bool isFixedPitch() const;
|
70
68
|
|
71
69
|
/** Copy into 'coordinates' (allocated by the caller) the design variation coordinates.
|
72
70
|
*
|
@@ -287,6 +285,20 @@ public:
|
|
287
285
|
*/
|
288
286
|
bool getPostScriptName(SkString* name) const;
|
289
287
|
|
288
|
+
/**
|
289
|
+
* If the primary resource backing this typeface has a name (like a file
|
290
|
+
* path or URL) representable by unicode code points, the `resourceName`
|
291
|
+
* will be set. The primary purpose is as a user facing indication about
|
292
|
+
* where the data was obtained (which font file was used).
|
293
|
+
*
|
294
|
+
* Returns the number of resources backing this typeface.
|
295
|
+
*
|
296
|
+
* For local font collections resource name will often be a file path. The
|
297
|
+
* file path may or may not exist. If it does exist, using it to create an
|
298
|
+
* SkTypeface may or may not create a similar SkTypeface to this one.
|
299
|
+
*/
|
300
|
+
int getResourceName(SkString* resourceName) const;
|
301
|
+
|
290
302
|
/**
|
291
303
|
* Return a stream for the contents of the font data, or NULL on failure.
|
292
304
|
* If ttcIndex is not null, it is set to the TrueTypeCollection index
|
@@ -349,6 +361,10 @@ protected:
|
|
349
361
|
/** Sets the font style. If used, must be called in the constructor. */
|
350
362
|
void setFontStyle(SkFontStyle style) { fStyle = style; }
|
351
363
|
|
364
|
+
virtual SkFontStyle onGetFontStyle() const; // TODO: = 0;
|
365
|
+
|
366
|
+
virtual bool onGetFixedPitch() const; // TODO: = 0;
|
367
|
+
|
352
368
|
// Must return a valid scaler context. It can not return nullptr.
|
353
369
|
virtual std::unique_ptr<SkScalerContext> onCreateScalerContext(const SkScalerContextEffects&,
|
354
370
|
const SkDescriptor*) const = 0;
|
@@ -398,6 +414,7 @@ protected:
|
|
398
414
|
*/
|
399
415
|
virtual void onGetFamilyName(SkString* familyName) const = 0;
|
400
416
|
virtual bool onGetPostScriptName(SkString*) const = 0;
|
417
|
+
virtual int onGetResourceName(SkString* resourceName) const; // TODO: = 0;
|
401
418
|
|
402
419
|
/** Returns an iterator over the family names in the font. */
|
403
420
|
virtual LocalizedStrings* onCreateFamilyNameIterator() const = 0;
|
@@ -424,7 +441,7 @@ private:
|
|
424
441
|
std::unique_ptr<SkAdvancedTypefaceMetrics> getAdvancedMetrics() const;
|
425
442
|
friend class SkRandomTypeface; // getAdvancedMetrics
|
426
443
|
friend class SkPDFFont; // getAdvancedMetrics
|
427
|
-
friend class
|
444
|
+
friend class SkTypeface_proxy;
|
428
445
|
|
429
446
|
friend class SkFontPriv; // getGlyphToUnicodeMap
|
430
447
|
|
@@ -94,7 +94,12 @@ public:
|
|
94
94
|
kHSL,
|
95
95
|
kHWB,
|
96
96
|
|
97
|
-
|
97
|
+
kDisplayP3,
|
98
|
+
kRec2020,
|
99
|
+
kProphotoRGB,
|
100
|
+
kA98RGB,
|
101
|
+
|
102
|
+
kLastColorSpace = kA98RGB,
|
98
103
|
};
|
99
104
|
static constexpr int kColorSpaceCount = static_cast<int>(ColorSpace::kLastColorSpace) + 1;
|
100
105
|
|
@@ -170,6 +170,7 @@ public:
|
|
170
170
|
|
171
171
|
// Shader SkSL requires an entry point that looks like:
|
172
172
|
// vec4 main(vec2 inCoords) { ... }
|
173
|
+
// The color that is returned should be premultiplied.
|
173
174
|
static Result MakeForShader(SkString sksl, const Options&);
|
174
175
|
static Result MakeForShader(SkString sksl) {
|
175
176
|
return MakeForShader(std::move(sksl), Options{});
|
@@ -23,6 +23,7 @@ class SkImage;
|
|
23
23
|
class SkPixmap;
|
24
24
|
class SkWStream;
|
25
25
|
struct skcms_ICCProfile;
|
26
|
+
struct SkGainmapInfo;
|
26
27
|
|
27
28
|
namespace SkPngEncoder {
|
28
29
|
|
@@ -80,6 +81,19 @@ struct Options {
|
|
80
81
|
*/
|
81
82
|
const skcms_ICCProfile* fICCProfile = nullptr;
|
82
83
|
const char* fICCProfileDescription = nullptr;
|
84
|
+
|
85
|
+
/**
|
86
|
+
* If non-null, then a gainmap and its metadata will be encoded as png chunks.
|
87
|
+
* The gainmap will be encoded in a gmAP chunk as a full PNG container. The
|
88
|
+
* gainmap info will be encoded in a gdAT chunk inside of the gmAP chunk.
|
89
|
+
* This effectively is Option B proposed in this discussion for adding gainmaps
|
90
|
+
* into PNG: https://github.com/w3c/png/issues/380#issuecomment-2325163149.
|
91
|
+
*
|
92
|
+
* Note that if fGainmapInfo is null, then fGainmap will fail to encode, as the
|
93
|
+
* gainmap metadata is required to correctly interpret the encoded gainmap.
|
94
|
+
*/
|
95
|
+
const SkPixmap* fGainmap = nullptr;
|
96
|
+
const SkGainmapInfo* fGainmapInfo = nullptr;
|
83
97
|
};
|
84
98
|
|
85
99
|
/**
|
@@ -75,8 +75,55 @@ struct SK_API GrContextOptions {
|
|
75
75
|
|
76
76
|
GrContextOptions() {}
|
77
77
|
|
78
|
-
|
79
|
-
|
78
|
+
/**
|
79
|
+
* If Skia is creating a default VMA allocator for the Vulkan backend this value will be used
|
80
|
+
* for the preferredLargeHeapBlockSize. If the value is not set, then Skia will use an
|
81
|
+
* inernally defined default size.
|
82
|
+
*
|
83
|
+
* However, it is highly discouraged to have Skia make a default allocator (and support for
|
84
|
+
* doing so will be removed soon, b/321962001). Instead clients should create their own
|
85
|
+
* allocator to pass into Skia where they can fine tune this value themeselves.
|
86
|
+
*/
|
87
|
+
std::optional<uint64_t> fVulkanVMALargeHeapBlockSize;
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Optional callback that can be passed into the GrDirectContext which will be called when the
|
91
|
+
* GrDirectContext is about to be destroyed. When this call is made, it will be safe for the
|
92
|
+
* client to delete the GPU backend context that is backing the GrDirectContext. The
|
93
|
+
* GrDirectContextDestroyedContext will be passed back to the client in the callback.
|
94
|
+
*/
|
95
|
+
GrDirectContextDestroyedContext fContextDeleteContext = nullptr;
|
96
|
+
GrDirectContextDestroyedProc fContextDeleteProc = nullptr;
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Executor to handle threaded work within Ganesh. If this is nullptr, then all work will be
|
100
|
+
* done serially on the main thread. To have worker threads assist with various tasks, set this
|
101
|
+
* to a valid SkExecutor instance. Currently, used for software path rendering, but may be used
|
102
|
+
* for other tasks.
|
103
|
+
*/
|
104
|
+
SkExecutor* fExecutor = nullptr;
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Cache in which to store compiled shader binaries between runs.
|
108
|
+
*/
|
109
|
+
PersistentCache* fPersistentCache = nullptr;
|
110
|
+
|
111
|
+
/**
|
112
|
+
* If present, use this object to report shader compilation failures. If not, report failures
|
113
|
+
* via SkDebugf and assert.
|
114
|
+
*/
|
115
|
+
ShaderErrorHandler* fShaderErrorHandler = nullptr;
|
116
|
+
|
117
|
+
/** Default minimum size to use when allocating buffers for uploading data to textures. The
|
118
|
+
larger the value the more uploads can be packed into one buffer, but at the cost of
|
119
|
+
more gpu memory allocated that may not be used. Uploads larger than the minimum will still
|
120
|
+
work by allocating a dedicated buffer. */
|
121
|
+
size_t fMinimumStagingBufferSize = 64 * 1024;
|
122
|
+
|
123
|
+
/**
|
124
|
+
* The maximum size of cache textures used for Skia's Glyph cache.
|
125
|
+
*/
|
126
|
+
size_t fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4;
|
80
127
|
|
81
128
|
/**
|
82
129
|
* Controls whether we check for GL errors after functions that allocate resources (e.g.
|
@@ -86,6 +133,33 @@ struct SK_API GrContextOptions {
|
|
86
133
|
*/
|
87
134
|
Enable fSkipGLErrorChecks = Enable::kDefault;
|
88
135
|
|
136
|
+
/**
|
137
|
+
* Can the glyph atlas use multiple textures. If allowed, the each texture's size is bound by
|
138
|
+
* fGlypheCacheTextureMaximumBytes.
|
139
|
+
*/
|
140
|
+
Enable fAllowMultipleGlyphCacheTextures = Enable::kDefault;
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Enables driver workaround to use draws instead of HW clears, e.g. glClear on the GL backend.
|
144
|
+
*/
|
145
|
+
Enable fUseDrawInsteadOfClear = Enable::kDefault;
|
146
|
+
|
147
|
+
/**
|
148
|
+
* Allow Ganesh to more aggressively reorder operations to reduce the number of render passes.
|
149
|
+
* Offscreen draws will be done upfront instead of interrupting the main render pass when
|
150
|
+
* possible. May increase VRAM usage, but still observes the resource cache limit.
|
151
|
+
* Enabled by default.
|
152
|
+
*/
|
153
|
+
Enable fReduceOpsTaskSplitting = Enable::kDefault;
|
154
|
+
|
155
|
+
/**
|
156
|
+
* This affects the usage of the PersistentCache. We can cache SkSL, backend source (GLSL), or
|
157
|
+
* backend binaries (GL program binaries). By default we cache binaries, but if the driver's
|
158
|
+
* binary loading/storing is believed to have bugs, this can be limited to caching GLSL.
|
159
|
+
* Caching GLSL strings still saves CPU work when a GL program is created.
|
160
|
+
*/
|
161
|
+
ShaderCacheStrategy fShaderCacheStrategy = ShaderCacheStrategy::kBackendBinary;
|
162
|
+
|
89
163
|
/** Overrides: These options override feature detection using backend API queries. These
|
90
164
|
overrides can only reduce the feature set or limits, never increase them beyond the
|
91
165
|
detected values. */
|
@@ -97,19 +171,48 @@ struct SK_API GrContextOptions {
|
|
97
171
|
deduce the optimal value for this platform. */
|
98
172
|
int fBufferMapThreshold = -1;
|
99
173
|
|
100
|
-
/**
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
size_t fMinimumStagingBufferSize = 64 * 1024;
|
174
|
+
/**
|
175
|
+
* Maximum number of GPU programs or pipelines to keep active in the runtime cache.
|
176
|
+
*/
|
177
|
+
int fRuntimeProgramCacheSize = 256;
|
105
178
|
|
106
179
|
/**
|
107
|
-
*
|
108
|
-
*
|
109
|
-
*
|
110
|
-
*
|
180
|
+
* Specifies the number of samples Ganesh should use when performing internal draws with MSAA
|
181
|
+
* (hardware capabilities permitting).
|
182
|
+
*
|
183
|
+
* If 0, Ganesh will disable internal code paths that use multisampling.
|
111
184
|
*/
|
112
|
-
|
185
|
+
int fInternalMultisampleCount = 4;
|
186
|
+
|
187
|
+
/**
|
188
|
+
* In Skia's vulkan backend a single GrContext submit equates to the submission of a single
|
189
|
+
* primary command buffer to the VkQueue. This value specifies how many vulkan secondary command
|
190
|
+
* buffers we will cache for reuse on a given primary command buffer. A single submit may use
|
191
|
+
* more than this many secondary command buffers, but after the primary command buffer is
|
192
|
+
* finished on the GPU it will only hold on to this many secondary command buffers for reuse.
|
193
|
+
*
|
194
|
+
* A value of -1 means we will pick a limit value internally.
|
195
|
+
*/
|
196
|
+
int fMaxCachedVulkanSecondaryCommandBuffers = -1;
|
197
|
+
|
198
|
+
/**
|
199
|
+
* Below this threshold size in device space distance field fonts won't be used. Distance field
|
200
|
+
* fonts don't support hinting which is more important at smaller sizes.
|
201
|
+
*/
|
202
|
+
float fMinDistanceFieldFontSize = 18;
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Above this threshold size in device space glyphs are drawn as individual paths.
|
206
|
+
*/
|
207
|
+
#if defined(SK_BUILD_FOR_ANDROID)
|
208
|
+
float fGlyphsAsPathsFontSize = 384;
|
209
|
+
#elif defined(SK_BUILD_FOR_MAC)
|
210
|
+
float fGlyphsAsPathsFontSize = 256;
|
211
|
+
#else
|
212
|
+
float fGlyphsAsPathsFontSize = 324;
|
213
|
+
#endif
|
214
|
+
|
215
|
+
GrDriverBugWorkarounds fDriverBugWorkarounds;
|
113
216
|
|
114
217
|
/** Construct mipmaps manually, via repeated downsampling draw-calls. This is used when
|
115
218
|
the driver's implementation (glGenerateMipmap) contains bugs. This requires mipmap
|
@@ -142,34 +245,6 @@ struct SK_API GrContextOptions {
|
|
142
245
|
*/
|
143
246
|
bool fDisableGpuYUVConversion = false;
|
144
247
|
|
145
|
-
/**
|
146
|
-
* The maximum size of cache textures used for Skia's Glyph cache.
|
147
|
-
*/
|
148
|
-
size_t fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4;
|
149
|
-
|
150
|
-
/**
|
151
|
-
* Below this threshold size in device space distance field fonts won't be used. Distance field
|
152
|
-
* fonts don't support hinting which is more important at smaller sizes.
|
153
|
-
*/
|
154
|
-
float fMinDistanceFieldFontSize = 18;
|
155
|
-
|
156
|
-
/**
|
157
|
-
* Above this threshold size in device space glyphs are drawn as individual paths.
|
158
|
-
*/
|
159
|
-
#if defined(SK_BUILD_FOR_ANDROID)
|
160
|
-
float fGlyphsAsPathsFontSize = 384;
|
161
|
-
#elif defined(SK_BUILD_FOR_MAC)
|
162
|
-
float fGlyphsAsPathsFontSize = 256;
|
163
|
-
#else
|
164
|
-
float fGlyphsAsPathsFontSize = 324;
|
165
|
-
#endif
|
166
|
-
|
167
|
-
/**
|
168
|
-
* Can the glyph atlas use multiple textures. If allowed, the each texture's size is bound by
|
169
|
-
* fGlypheCacheTextureMaximumBytes.
|
170
|
-
*/
|
171
|
-
Enable fAllowMultipleGlyphCacheTextures = Enable::kDefault;
|
172
|
-
|
173
248
|
/**
|
174
249
|
* Bugs on certain drivers cause stencil buffers to leak. This flag causes Skia to avoid
|
175
250
|
* allocating stencil buffers and use alternate rasterization paths, avoiding the leak.
|
@@ -183,19 +258,6 @@ struct SK_API GrContextOptions {
|
|
183
258
|
*/
|
184
259
|
bool fSharpenMipmappedTextures = true;
|
185
260
|
|
186
|
-
/**
|
187
|
-
* Enables driver workaround to use draws instead of HW clears, e.g. glClear on the GL backend.
|
188
|
-
*/
|
189
|
-
Enable fUseDrawInsteadOfClear = Enable::kDefault;
|
190
|
-
|
191
|
-
/**
|
192
|
-
* Allow Ganesh to more aggressively reorder operations to reduce the number of render passes.
|
193
|
-
* Offscreen draws will be done upfront instead of interrupting the main render pass when
|
194
|
-
* possible. May increase VRAM usage, but still observes the resource cache limit.
|
195
|
-
* Enabled by default.
|
196
|
-
*/
|
197
|
-
Enable fReduceOpsTaskSplitting = Enable::kDefault;
|
198
|
-
|
199
261
|
/**
|
200
262
|
* Some ES3 contexts report the ES2 external image extension, but not the ES3 version.
|
201
263
|
* If support for external images is critical, enabling this option will cause Ganesh to limit
|
@@ -210,60 +272,6 @@ struct SK_API GrContextOptions {
|
|
210
272
|
*/
|
211
273
|
bool fDisableDriverCorrectnessWorkarounds = false;
|
212
274
|
|
213
|
-
/**
|
214
|
-
* Maximum number of GPU programs or pipelines to keep active in the runtime cache.
|
215
|
-
*/
|
216
|
-
int fRuntimeProgramCacheSize = 256;
|
217
|
-
|
218
|
-
/**
|
219
|
-
* Cache in which to store compiled shader binaries between runs.
|
220
|
-
*/
|
221
|
-
PersistentCache* fPersistentCache = nullptr;
|
222
|
-
|
223
|
-
/**
|
224
|
-
* This affects the usage of the PersistentCache. We can cache SkSL, backend source (GLSL), or
|
225
|
-
* backend binaries (GL program binaries). By default we cache binaries, but if the driver's
|
226
|
-
* binary loading/storing is believed to have bugs, this can be limited to caching GLSL.
|
227
|
-
* Caching GLSL strings still saves CPU work when a GL program is created.
|
228
|
-
*/
|
229
|
-
ShaderCacheStrategy fShaderCacheStrategy = ShaderCacheStrategy::kBackendBinary;
|
230
|
-
|
231
|
-
/**
|
232
|
-
* If present, use this object to report shader compilation failures. If not, report failures
|
233
|
-
* via SkDebugf and assert.
|
234
|
-
*/
|
235
|
-
ShaderErrorHandler* fShaderErrorHandler = nullptr;
|
236
|
-
|
237
|
-
/**
|
238
|
-
* Specifies the number of samples Ganesh should use when performing internal draws with MSAA
|
239
|
-
* (hardware capabilities permitting).
|
240
|
-
*
|
241
|
-
* If 0, Ganesh will disable internal code paths that use multisampling.
|
242
|
-
*/
|
243
|
-
int fInternalMultisampleCount = 4;
|
244
|
-
|
245
|
-
/**
|
246
|
-
* In Skia's vulkan backend a single GrContext submit equates to the submission of a single
|
247
|
-
* primary command buffer to the VkQueue. This value specifies how many vulkan secondary command
|
248
|
-
* buffers we will cache for reuse on a given primary command buffer. A single submit may use
|
249
|
-
* more than this many secondary command buffers, but after the primary command buffer is
|
250
|
-
* finished on the GPU it will only hold on to this many secondary command buffers for reuse.
|
251
|
-
*
|
252
|
-
* A value of -1 means we will pick a limit value internally.
|
253
|
-
*/
|
254
|
-
int fMaxCachedVulkanSecondaryCommandBuffers = -1;
|
255
|
-
|
256
|
-
/**
|
257
|
-
* If Skia is creating a default VMA allocator for the Vulkan backend this value will be used
|
258
|
-
* for the preferredLargeHeapBlockSize. If the value is not set, then Skia will use an
|
259
|
-
* inernally defined default size.
|
260
|
-
*
|
261
|
-
* However, it is highly discouraged to have Skia make a default allocator (and support for
|
262
|
-
* doing so will be removed soon, b/321962001). Instead clients should create their own
|
263
|
-
* allocator to pass into Skia where they can fine tune this value themeselves.
|
264
|
-
*/
|
265
|
-
std::optional<uint64_t> fVulkanVMALargeHeapBlockSize;
|
266
|
-
|
267
275
|
/**
|
268
276
|
* If true, the caps will never support mipmaps.
|
269
277
|
*/
|
@@ -307,20 +315,32 @@ struct SK_API GrContextOptions {
|
|
307
315
|
*/
|
308
316
|
bool fAlwaysUseTexStorageWhenAvailable = false;
|
309
317
|
|
310
|
-
|
311
|
-
|
312
|
-
* GrDirectContext is about to be destroyed. When this call is made, it will be safe for the
|
313
|
-
* client to delete the GPU backend context that is backing the GrDirectContext. The
|
314
|
-
* GrDirectContextDestroyedContext will be passed back to the client in the callback.
|
315
|
-
*/
|
316
|
-
GrDirectContextDestroyedContext fContextDeleteContext = nullptr;
|
317
|
-
GrDirectContextDestroyedProc fContextDeleteProc = nullptr;
|
318
|
+
// Suppress prints for the GrContext.
|
319
|
+
bool fSuppressPrints = false;
|
318
320
|
|
319
321
|
#if defined(GPU_TEST_UTILS)
|
320
322
|
/**
|
321
323
|
* Private options that are only meant for testing within Skia's tools.
|
322
324
|
*/
|
323
325
|
|
326
|
+
/**
|
327
|
+
* Include or exclude specific GPU path renderers.
|
328
|
+
*/
|
329
|
+
GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kDefault;
|
330
|
+
|
331
|
+
/**
|
332
|
+
* Specify the GPU resource cache limit. Equivalent to calling `setResourceCacheLimit` on the
|
333
|
+
* context at construction time.
|
334
|
+
*
|
335
|
+
* A value of -1 means use the default limit value.
|
336
|
+
*/
|
337
|
+
int fResourceCacheLimitOverride = -1;
|
338
|
+
|
339
|
+
/**
|
340
|
+
* Maximum width and height of internal texture atlases.
|
341
|
+
*/
|
342
|
+
int fMaxTextureAtlasSize = 2048;
|
343
|
+
|
324
344
|
/**
|
325
345
|
* Testing-only mode to exercise allocation failures in the flush-time callback objects.
|
326
346
|
* For now it only simulates allocation failure during the preFlush callback.
|
@@ -368,26 +388,8 @@ struct SK_API GrContextOptions {
|
|
368
388
|
*/
|
369
389
|
bool fDisallowWriteAndTransferPixelRowBytes = false;
|
370
390
|
|
371
|
-
/**
|
372
|
-
* Include or exclude specific GPU path renderers.
|
373
|
-
*/
|
374
|
-
GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kDefault;
|
375
|
-
|
376
|
-
/**
|
377
|
-
* Specify the GPU resource cache limit. Equivalent to calling `setResourceCacheLimit` on the
|
378
|
-
* context at construction time.
|
379
|
-
*
|
380
|
-
* A value of -1 means use the default limit value.
|
381
|
-
*/
|
382
|
-
int fResourceCacheLimitOverride = -1;
|
383
|
-
|
384
|
-
/**
|
385
|
-
* Maximum width and height of internal texture atlases.
|
386
|
-
*/
|
387
|
-
int fMaxTextureAtlasSize = 2048;
|
388
391
|
#endif
|
389
392
|
|
390
|
-
GrDriverBugWorkarounds fDriverBugWorkarounds;
|
391
393
|
};
|
392
394
|
|
393
395
|
#endif
|
@@ -271,6 +271,11 @@ public:
|
|
271
271
|
*/
|
272
272
|
void purgeUnlockedResources(GrPurgeResourceOptions opts);
|
273
273
|
|
274
|
+
/*
|
275
|
+
* Gets the types of GPU stats supported by this Context.
|
276
|
+
*/
|
277
|
+
skgpu::GpuStatsFlags supportedGpuStats() const;
|
278
|
+
|
274
279
|
/**
|
275
280
|
* Gets the maximum supported texture size.
|
276
281
|
*/
|
@@ -34,8 +34,10 @@ enum GrDriverBugWorkaroundType {
|
|
34
34
|
|
35
35
|
class SK_API GrDriverBugWorkarounds {
|
36
36
|
public:
|
37
|
-
GrDriverBugWorkarounds();
|
37
|
+
GrDriverBugWorkarounds() = default;
|
38
38
|
GrDriverBugWorkarounds(const GrDriverBugWorkarounds&) = default;
|
39
|
+
~GrDriverBugWorkarounds() = default;
|
40
|
+
|
39
41
|
explicit GrDriverBugWorkarounds(const std::vector<int32_t>& workarounds);
|
40
42
|
|
41
43
|
GrDriverBugWorkarounds& operator=(const GrDriverBugWorkarounds&) = default;
|
@@ -43,8 +45,6 @@ class SK_API GrDriverBugWorkarounds {
|
|
43
45
|
// Turn on any workarounds listed in |workarounds| (but don't turn any off).
|
44
46
|
void applyOverrides(const GrDriverBugWorkarounds& workarounds);
|
45
47
|
|
46
|
-
~GrDriverBugWorkarounds();
|
47
|
-
|
48
48
|
#define GPU_OP(type, name) bool name = false;
|
49
49
|
GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
|
50
50
|
#undef GPU_OP
|
@@ -9,17 +9,13 @@
|
|
9
9
|
#define GrTypes_DEFINED
|
10
10
|
|
11
11
|
#include "include/core/SkTypes.h"
|
12
|
+
#include "include/gpu/GpuTypes.h"
|
12
13
|
#include "include/private/base/SkTo.h" // IWYU pragma: keep
|
13
14
|
|
14
15
|
#include <cstddef>
|
15
16
|
#include <cstdint>
|
16
17
|
class GrBackendSemaphore;
|
17
18
|
|
18
|
-
namespace skgpu {
|
19
|
-
enum class Protected : bool;
|
20
|
-
enum class Renderable : bool;
|
21
|
-
}
|
22
|
-
|
23
19
|
///////////////////////////////////////////////////////////////////////////////
|
24
20
|
|
25
21
|
/**
|
@@ -110,6 +106,8 @@ static const uint32_t kAll_GrBackendState = 0xffffffff;
|
|
110
106
|
|
111
107
|
typedef void* GrGpuFinishedContext;
|
112
108
|
typedef void (*GrGpuFinishedProc)(GrGpuFinishedContext finishedContext);
|
109
|
+
typedef void (*GrGpuFinishedWithStatsProc)(GrGpuFinishedContext finishedContext,
|
110
|
+
const skgpu::GpuStats&);
|
113
111
|
|
114
112
|
typedef void* GrGpuSubmittedContext;
|
115
113
|
typedef void (*GrGpuSubmittedProc)(GrGpuSubmittedContext submittedContext, bool success);
|
@@ -131,10 +129,15 @@ typedef void (*GrDirectContextDestroyedProc)(GrDirectContextDestroyedContext des
|
|
131
129
|
* and returned in initialized GrBackendSemaphore objects. The GrBackendSemaphore objects
|
132
130
|
* themselves can be deleted as soon as this function returns.
|
133
131
|
*
|
134
|
-
* If a finishedProc is provided, the
|
135
|
-
* from this flush call and all previous flush calls has finished on the GPU.
|
136
|
-
* fails due to an error and nothing ends up getting sent to the GPU, the finished
|
137
|
-
* immediately.
|
132
|
+
* If a finishedProc or finishedWithStatsProc is provided, the proc will be called when all work
|
133
|
+
* submitted to the gpu from this flush call and all previous flush calls has finished on the GPU.
|
134
|
+
* If the flush call fails due to an error and nothing ends up getting sent to the GPU, the finished
|
135
|
+
* proc is called immediately. If both types of proc are provided then finishedWithStatsProc is
|
136
|
+
* preferred.
|
137
|
+
*
|
138
|
+
* When finishedWithStatsProc is called the GpuStats passed will contain valid values for stats
|
139
|
+
* by requested by gpuStatsFlags, assuming the stats are supported by the underlying backend GPU
|
140
|
+
* context and the GPU work completed successfully.
|
138
141
|
*
|
139
142
|
* If a submittedProc is provided, the submittedProc will be called when all work from this flush
|
140
143
|
* call is submitted to the GPU. If the flush call fails due to an error and nothing will get sent
|
@@ -148,8 +151,10 @@ typedef void (*GrDirectContextDestroyedProc)(GrDirectContextDestroyedContext des
|
|
148
151
|
*/
|
149
152
|
struct GrFlushInfo {
|
150
153
|
size_t fNumSemaphores = 0;
|
154
|
+
skgpu::GpuStatsFlags fGpuStatsFlags = skgpu::GpuStatsFlags::kNone;
|
151
155
|
GrBackendSemaphore* fSignalSemaphores = nullptr;
|
152
156
|
GrGpuFinishedProc fFinishedProc = nullptr;
|
157
|
+
GrGpuFinishedWithStatsProc fFinishedWithStatsProc = nullptr;
|
153
158
|
GrGpuFinishedContext fFinishedContext = nullptr;
|
154
159
|
GrGpuSubmittedProc fSubmittedProc = nullptr;
|
155
160
|
GrGpuSubmittedContext fSubmittedContext = nullptr;
|
@@ -16,6 +16,10 @@
|
|
16
16
|
#include "include/gpu/graphite/Recorder.h"
|
17
17
|
#include "include/private/base/SingleOwner.h"
|
18
18
|
|
19
|
+
#if defined(GPU_TEST_UTILS)
|
20
|
+
#include "include/private/base/SkMutex.h"
|
21
|
+
#endif
|
22
|
+
|
19
23
|
#include <chrono>
|
20
24
|
#include <functional>
|
21
25
|
#include <memory>
|
@@ -33,7 +37,7 @@ class Context;
|
|
33
37
|
class ContextPriv;
|
34
38
|
class GlobalCache;
|
35
39
|
class PaintOptions;
|
36
|
-
class
|
40
|
+
class PrecompileContext;
|
37
41
|
class QueueManager;
|
38
42
|
class Recording;
|
39
43
|
class ResourceProvider;
|
@@ -53,6 +57,11 @@ public:
|
|
53
57
|
|
54
58
|
std::unique_ptr<Recorder> makeRecorder(const RecorderOptions& = {});
|
55
59
|
|
60
|
+
/** Creates a helper object that can be moved to a different thread and used
|
61
|
+
* for precompilation.
|
62
|
+
*/
|
63
|
+
std::unique_ptr<PrecompileContext> makePrecompileContext();
|
64
|
+
|
56
65
|
bool insertRecording(const InsertRecordingInfo&);
|
57
66
|
bool submit(SyncToCpu = SyncToCpu::kNo);
|
58
67
|
|
@@ -218,6 +227,12 @@ public:
|
|
218
227
|
*/
|
219
228
|
size_t maxBudgetedBytes() const;
|
220
229
|
|
230
|
+
/**
|
231
|
+
* Sets the size of Context's gpu memory cache budget in bytes. If the new budget is lower than
|
232
|
+
* the current budget, the cache will try to free resources to get under the new budget.
|
233
|
+
*/
|
234
|
+
void setMaxBudgetedBytes(size_t bytes);
|
235
|
+
|
221
236
|
/**
|
222
237
|
* Enumerates all cached GPU resources owned by the Context and dumps their memory to
|
223
238
|
* traceMemoryDump.
|
@@ -240,6 +255,11 @@ public:
|
|
240
255
|
*/
|
241
256
|
bool supportsProtectedContent() const;
|
242
257
|
|
258
|
+
/*
|
259
|
+
* Gets the types of GPU stats supported by this Context.
|
260
|
+
*/
|
261
|
+
GpuStatsFlags supportedGpuStats() const;
|
262
|
+
|
243
263
|
// Provides access to functions that aren't part of the public API.
|
244
264
|
ContextPriv priv();
|
245
265
|
const ContextPriv priv() const; // NOLINT(readability-const-return-type)
|
@@ -343,11 +363,14 @@ private:
|
|
343
363
|
mutable SingleOwner fSingleOwner;
|
344
364
|
|
345
365
|
#if defined(GPU_TEST_UTILS)
|
366
|
+
void deregisterRecorder(const Recorder*) SK_EXCLUDES(fTestingLock);
|
367
|
+
|
346
368
|
// In test builds a Recorder may track the Context that was used to create it.
|
347
369
|
bool fStoreContextRefInRecorder = false;
|
348
370
|
// If this tracking is on, to allow the client to safely delete this Context or its Recorders
|
349
371
|
// in any order we must also track the Recorders created here.
|
350
|
-
|
372
|
+
SkMutex fTestingLock;
|
373
|
+
std::vector<Recorder*> fTrackedRecorders SK_GUARDED_BY(fTestingLock);
|
351
374
|
#endif
|
352
375
|
|
353
376
|
// Needed for MessageBox handling
|