@shopify/react-native-skia 1.11.9-next.1 → 1.11.10
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/CMakeLists.txt +153 -30
- package/android/build.gradle +1 -1
- package/cpp/skia/include/codec/SkCodec.h +2 -7
- package/cpp/skia/include/config/SkUserConfig.h +0 -11
- package/cpp/skia/include/core/SkCanvas.h +7 -11
- package/cpp/skia/include/core/SkColor.h +0 -10
- package/cpp/skia/include/core/SkColorSpace.h +2 -184
- package/cpp/skia/include/core/SkColorType.h +32 -114
- package/cpp/skia/include/core/SkFontScanner.h +8 -5
- package/cpp/skia/include/core/SkFontStyle.h +1 -1
- package/cpp/skia/include/core/SkMaskFilter.h +8 -0
- 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 +1 -3
- 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 +0 -14
- package/cpp/skia/include/core/SkTypeface.h +7 -24
- package/cpp/skia/include/effects/SkGradientShader.h +1 -6
- package/cpp/skia/include/effects/SkRuntimeEffect.h +0 -1
- package/cpp/skia/include/encode/SkPngEncoder.h +0 -14
- package/cpp/skia/include/gpu/GpuTypes.h +0 -9
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +133 -135
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +0 -5
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +3 -3
- package/cpp/skia/include/gpu/ganesh/GrTypes.h +9 -14
- package/cpp/skia/include/gpu/graphite/Context.h +2 -25
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +5 -23
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +1 -20
- package/cpp/skia/include/gpu/graphite/Image.h +0 -1
- package/cpp/skia/include/gpu/graphite/Recorder.h +0 -6
- package/cpp/skia/include/gpu/graphite/Recording.h +1 -3
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +36 -4
- package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +2 -3
- package/cpp/skia/include/pathops/SkPathOps.h +1 -9
- package/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h +0 -3
- package/cpp/skia/include/private/SkPathRef.h +21 -15
- package/cpp/skia/include/private/base/SkAttributes.h +10 -16
- package/cpp/skia/include/private/base/SkMutex.h +0 -8
- 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 +11 -24
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/sksl/SkSLDebugTrace.h +3 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +20 -20
- package/cpp/skia/modules/skcms/src/skcms_Transform.h +3 -4
- package/cpp/skia/modules/skcms/src/skcms_public.h +15 -19
- package/cpp/skia/modules/skresources/include/SkResources.h +1 -3
- 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 +0 -2
- package/cpp/skia/modules/svg/include/SkSVGShape.h +0 -1
- package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +0 -4
- package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
- package/cpp/skia/src/core/SkLRUCache.h +13 -19
- package/cpp/skia/src/core/SkTHash.h +4 -50
- package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +0 -1
- package/lib/commonjs/external/reanimated/textures.js +3 -4
- package/lib/commonjs/external/reanimated/textures.js.map +1 -1
- package/lib/commonjs/headless/index.d.ts +1 -1
- package/lib/commonjs/headless/index.js +2 -2
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +2 -2
- package/lib/commonjs/renderer/Canvas.js +28 -11
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.d.ts +2 -2
- package/lib/commonjs/renderer/Offscreen.js +4 -4
- package/lib/commonjs/renderer/Offscreen.js.map +1 -1
- package/lib/commonjs/renderer/__tests__/setup.d.ts +5 -5
- package/lib/commonjs/sksg/Container.d.ts +1 -3
- package/lib/commonjs/sksg/Container.js +1 -7
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig.d.ts +1 -1
- package/lib/commonjs/sksg/HostConfig.js +6 -36
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig2.d.ts +19 -0
- package/lib/commonjs/sksg/HostConfig2.js +159 -0
- package/lib/commonjs/sksg/HostConfig2.js.map +1 -0
- package/lib/commonjs/sksg/Reconciler.d.ts +2 -3
- package/lib/commonjs/sksg/Reconciler.js +6 -16
- package/lib/commonjs/sksg/Reconciler.js.map +1 -1
- package/lib/module/Platform/Platform.web.js +1 -1
- package/lib/module/Platform/Platform.web.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Circle.js +2 -1
- package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Gradient.js +3 -3
- package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.js +5 -3
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/external/reanimated/buffers.js +2 -1
- package/lib/module/external/reanimated/buffers.js.map +1 -1
- package/lib/module/external/reanimated/textures.js +4 -5
- package/lib/module/external/reanimated/textures.js.map +1 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.js +1 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/module/external/reanimated/useVideo.js +23 -10
- package/lib/module/external/reanimated/useVideo.js.map +1 -1
- package/lib/module/headless/index.d.ts +1 -1
- package/lib/module/headless/index.js +2 -2
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +2 -2
- package/lib/module/renderer/Canvas.js +28 -10
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/Offscreen.d.ts +2 -2
- package/lib/module/renderer/Offscreen.js +4 -4
- package/lib/module/renderer/Offscreen.js.map +1 -1
- package/lib/module/renderer/__tests__/setup.d.ts +5 -5
- package/lib/module/skia/core/Vector.js +1 -1
- package/lib/module/skia/core/Vector.js.map +1 -1
- package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js +4 -1
- package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js.map +1 -1
- package/lib/module/skia/web/Host.js +7 -1
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkAnimatedImage.js +6 -3
- package/lib/module/skia/web/JsiSkAnimatedImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +6 -3
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilter.js +6 -3
- package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasure.js +6 -3
- package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasureIter.js +6 -3
- package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
- package/lib/module/skia/web/JsiSkData.js +6 -3
- package/lib/module/skia/web/JsiSkData.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +6 -3
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +12 -8
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilter.js +6 -3
- package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilter.js +6 -3
- package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +8 -5
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +6 -3
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilder.js +3 -2
- package/lib/module/skia/web/JsiSkParagraphBuilder.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphStyle.js +15 -15
- package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +6 -3
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffect.js +6 -3
- package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +6 -3
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.js +6 -3
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkPoint.js +6 -3
- package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.js +6 -3
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.js +6 -3
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.js +6 -3
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRuntimeEffect.js +6 -3
- package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkSVG.js +8 -5
- package/lib/module/skia/web/JsiSkSVG.js.map +1 -1
- package/lib/module/skia/web/JsiSkShader.js +6 -3
- package/lib/module/skia/web/JsiSkShader.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.js +6 -3
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlob.js +6 -3
- package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypeface.js +6 -3
- package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +4 -1
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/module/skia/web/JsiSkVertices.js +6 -3
- package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
- package/lib/module/skia/web/JsiVideo.js +5 -2
- package/lib/module/skia/web/JsiVideo.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +1 -3
- package/lib/module/sksg/Container.js +8 -11
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/HostConfig.d.ts +1 -1
- package/lib/module/sksg/HostConfig.js +7 -36
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/module/sksg/HostConfig2.d.ts +19 -0
- package/lib/module/sksg/HostConfig2.js +152 -0
- package/lib/module/sksg/HostConfig2.js.map +1 -0
- package/lib/module/sksg/Reconciler.d.ts +2 -3
- package/lib/module/sksg/Reconciler.js +11 -16
- package/lib/module/sksg/Reconciler.js.map +1 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js +5 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Recorder.js +6 -3
- package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Visitor.js +1 -1
- package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Drawing.js +4 -2
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Shaders.js +3 -2
- package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +12 -9
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +5 -1
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.js +4 -1
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/web/LoadSkiaWeb.js +2 -1
- package/lib/module/web/LoadSkiaWeb.js.map +1 -1
- package/lib/module/web/WithSkiaWeb.js +1 -1
- package/lib/module/web/WithSkiaWeb.js.map +1 -1
- package/lib/typescript/lib/commonjs/headless/index.d.ts +1 -1
- package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +1 -9
- package/lib/typescript/lib/commonjs/renderer/Offscreen.d.ts +2 -2
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +0 -3
- package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +4 -21
- package/lib/typescript/lib/commonjs/sksg/HostConfig2.d.ts +44 -0
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +2 -9
- package/lib/typescript/lib/module/headless/index.d.ts +1 -1
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -9
- package/lib/typescript/lib/module/renderer/Offscreen.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/CanvasKitWebGLBufferImpl.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/JsiSkAnimatedImage.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkCanvas.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkColorFilter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkContourMeasure.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkContourMeasureIter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkData.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkFont.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImage.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFilter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkMaskFilter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkMatrix.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPaint.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPathEffect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPicture.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPictureRecorder.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPoint.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRRect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRSXform.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRuntimeEffect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkSVG.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkShader.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkSurface.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTextBlob.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTypeface.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkVertices.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiVideo.d.ts +2 -2
- package/lib/typescript/lib/module/sksg/Container.d.ts +12 -7
- package/lib/typescript/lib/module/sksg/HostConfig.d.ts +4 -20
- package/lib/typescript/lib/module/sksg/HostConfig2.d.ts +43 -0
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +17 -18
- package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +0 -1
- package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +2 -5
- package/lib/typescript/lib/module/views/SkiaBaseWebView.d.ts +11 -12
- package/lib/typescript/lib/module/views/SkiaPictureView.d.ts +2 -2
- package/lib/typescript/lib/module/views/SkiaPictureView.web.d.ts +1 -1
- package/lib/typescript/src/headless/index.d.ts +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +2 -2
- package/lib/typescript/src/renderer/Offscreen.d.ts +2 -2
- package/lib/typescript/src/renderer/__tests__/setup.d.ts +5 -5
- package/lib/typescript/src/sksg/Container.d.ts +1 -3
- package/lib/typescript/src/sksg/HostConfig.d.ts +1 -1
- package/lib/typescript/src/sksg/HostConfig2.d.ts +19 -0
- package/lib/typescript/src/sksg/Reconciler.d.ts +2 -3
- package/package.json +9 -10
- package/src/external/reanimated/textures.tsx +4 -5
- package/src/headless/index.ts +2 -2
- package/src/renderer/Canvas.tsx +81 -57
- package/src/renderer/Offscreen.tsx +4 -4
- package/src/renderer/__tests__/Data.spec.tsx +10 -9
- package/src/renderer/__tests__/Drawings.spec.tsx +11 -11
- package/src/renderer/__tests__/FitBox.spec.tsx +10 -10
- package/src/renderer/__tests__/Glyphs.spec.tsx +2 -2
- package/src/renderer/__tests__/Image.spec.tsx +2 -2
- package/src/renderer/__tests__/Paths.spec.tsx +8 -8
- package/src/renderer/__tests__/Picture.spec.tsx +12 -10
- package/src/renderer/__tests__/Simple.spec.tsx +6 -6
- package/src/renderer/__tests__/Surfaces.spec.tsx +2 -2
- package/src/renderer/__tests__/Text.spec.tsx +12 -12
- package/src/renderer/__tests__/Transform.spec.tsx +8 -8
- package/src/renderer/__tests__/documentation/Group.spec.tsx +12 -12
- package/src/renderer/__tests__/documentation/getting-started/HelloWorld.spec.tsx +2 -2
- package/src/renderer/__tests__/documentation/paint/Overview.spec.tsx +8 -8
- package/src/renderer/__tests__/documentation/shapes/Box.spec.tsx +4 -4
- package/src/renderer/__tests__/e2e/Atlas.spec.tsx +3 -3
- package/src/renderer/__tests__/e2e/Offscreen.spec.tsx +1 -1
- package/src/renderer/__tests__/examples/BlendModes.spec.tsx +4 -4
- package/src/renderer/__tests__/setup.tsx +13 -13
- package/src/sksg/Container.ts +1 -9
- package/src/sksg/HostConfig.ts +7 -37
- package/src/sksg/HostConfig2.ts +247 -0
- package/src/sksg/Reconciler.ts +6 -17
- package/src/sksg/__tests__/Simple.spec.tsx +8 -8
- package/cpp/skia/include/gpu/graphite/LogPriority.h +0 -36
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +0 -52
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +0 -48
@@ -12,10 +12,10 @@ import {
|
|
12
12
|
import { height, drawOnNode, width, loadImage, importSkia } from "../setup";
|
13
13
|
|
14
14
|
describe("Test blend modes", () => {
|
15
|
-
it("Should nicely blend the product color to the image",
|
15
|
+
it("Should nicely blend the product color to the image", () => {
|
16
16
|
const image = loadImage("skia/__tests__/assets/product.png");
|
17
17
|
const rect = { x: 0, y: 0, width, height };
|
18
|
-
const surface =
|
18
|
+
const surface = drawOnNode(
|
19
19
|
<Mask mask={<Image image={image} rect={rect} />}>
|
20
20
|
<Image image={image} rect={rect}>
|
21
21
|
<BlendColor color="lightgreen" mode="hue" />
|
@@ -24,12 +24,12 @@ describe("Test blend modes", () => {
|
|
24
24
|
);
|
25
25
|
processResult(surface, "snapshots/demos/product.png");
|
26
26
|
});
|
27
|
-
it("Should nicely blend the product color to the image using a runtime effect",
|
27
|
+
it("Should nicely blend the product color to the image using a runtime effect", () => {
|
28
28
|
const { Skia } = importSkia();
|
29
29
|
const image = loadImage("skia/__tests__/assets/product.png");
|
30
30
|
const rect = { x: 0, y: 0, width, height };
|
31
31
|
const source = Skia.RuntimeEffect.Make(blender)!;
|
32
|
-
const surface =
|
32
|
+
const surface = drawOnNode(
|
33
33
|
<Rect rect={rect}>
|
34
34
|
<Shader
|
35
35
|
source={source}
|
@@ -176,14 +176,14 @@ export const width = 256 * PIXEL_RATIO;
|
|
176
176
|
export const height = 256 * PIXEL_RATIO;
|
177
177
|
export const center = { x: width / 2, y: height / 2 };
|
178
178
|
|
179
|
-
export const drawOnNode =
|
180
|
-
const { surface: ckSurface, draw, root } =
|
181
|
-
|
179
|
+
export const drawOnNode = (element: ReactNode) => {
|
180
|
+
const { surface: ckSurface, draw, root } = mountCanvas(element);
|
181
|
+
draw();
|
182
182
|
root.unmount();
|
183
183
|
return ckSurface;
|
184
184
|
};
|
185
185
|
|
186
|
-
export const mountCanvas =
|
186
|
+
export const mountCanvas = (element: ReactNode) => {
|
187
187
|
const Skia = global.SkiaApi;
|
188
188
|
expect(Skia).toBeDefined();
|
189
189
|
const ckSurface = Skia.Surface.MakeOffscreen(width, height)!;
|
@@ -191,18 +191,18 @@ export const mountCanvas = async (element: ReactNode) => {
|
|
191
191
|
const canvas = ckSurface.getCanvas();
|
192
192
|
|
193
193
|
const root = new SkiaSGRoot(Skia);
|
194
|
+
root.render(element);
|
194
195
|
return {
|
195
196
|
surface: ckSurface,
|
196
197
|
root,
|
197
|
-
draw:
|
198
|
-
await root.render(element);
|
198
|
+
draw: () => {
|
199
199
|
root.drawOnCanvas(canvas);
|
200
200
|
},
|
201
201
|
};
|
202
202
|
};
|
203
203
|
|
204
|
-
export const serialize =
|
205
|
-
const { root } =
|
204
|
+
export const serialize = (element: ReactNode) => {
|
205
|
+
const { root } = mountCanvas(element);
|
206
206
|
const serialized = serializeNode(root.sg);
|
207
207
|
return JSON.stringify(serialized);
|
208
208
|
};
|
@@ -379,11 +379,11 @@ class LocalSurface implements TestingSurface {
|
|
379
379
|
return Promise.resolve(ckSurface.makeImageSnapshot());
|
380
380
|
}
|
381
381
|
|
382
|
-
|
383
|
-
const { surface: ckSurface, draw } =
|
382
|
+
draw(node: ReactNode): Promise<SkImage> {
|
383
|
+
const { surface: ckSurface, draw } = mountCanvas(
|
384
384
|
<Group transform={[{ scale: PIXEL_RATIO }]}>{node}</Group>
|
385
385
|
);
|
386
|
-
|
386
|
+
draw();
|
387
387
|
return Promise.resolve(ckSurface.makeImageSnapshot());
|
388
388
|
}
|
389
389
|
|
@@ -440,8 +440,8 @@ return surface.makeImageSnapshot().encodeToBase64();
|
|
440
440
|
return image;
|
441
441
|
}
|
442
442
|
|
443
|
-
|
444
|
-
return this.handleImageResponse(
|
443
|
+
draw(node: ReactNode) {
|
444
|
+
return this.handleImageResponse(serialize(node));
|
445
445
|
}
|
446
446
|
|
447
447
|
screen(screen: string) {
|
package/src/sksg/Container.ts
CHANGED
@@ -40,20 +40,12 @@ const nativeDrawOnscreen = (nativeId: number, recorder: JsiRecorder) => {
|
|
40
40
|
};
|
41
41
|
|
42
42
|
export abstract class Container {
|
43
|
-
|
43
|
+
public root: Node[] = [];
|
44
44
|
protected recording: Recording | null = null;
|
45
45
|
protected unmounted = false;
|
46
46
|
|
47
47
|
constructor(protected Skia: Skia, protected nativeId: number) {}
|
48
48
|
|
49
|
-
get root() {
|
50
|
-
return this._root;
|
51
|
-
}
|
52
|
-
|
53
|
-
set root(value: Node[]) {
|
54
|
-
this._root = value;
|
55
|
-
}
|
56
|
-
|
57
49
|
unmount() {
|
58
50
|
this.unmounted = true;
|
59
51
|
}
|
package/src/sksg/HostConfig.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
/*global NodeJS*/
|
2
|
-
import { createContext } from "react";
|
3
2
|
import type { Fiber, HostConfig } from "react-reconciler";
|
4
3
|
import { DefaultEventPriority } from "react-reconciler/constants";
|
5
4
|
|
@@ -9,9 +8,6 @@ import { shallowEq } from "../renderer/typeddash";
|
|
9
8
|
import type { Node } from "./Node";
|
10
9
|
import type { Container } from "./Container";
|
11
10
|
|
12
|
-
type EventPriority = number;
|
13
|
-
const NoEventPriority = 0;
|
14
|
-
|
15
11
|
const DEBUG = false;
|
16
12
|
export const debug = (...args: Parameters<typeof console.log>) => {
|
17
13
|
if (DEBUG) {
|
@@ -26,7 +22,7 @@ type TextInstance = Node;
|
|
26
22
|
type SuspenseInstance = Instance;
|
27
23
|
type HydratableInstance = Instance;
|
28
24
|
type PublicInstance = Instance;
|
29
|
-
type HostContext =
|
25
|
+
type HostContext = null;
|
30
26
|
type UpdatePayload = Container;
|
31
27
|
type ChildSet = Node[];
|
32
28
|
type TimeoutHandle = NodeJS.Timeout;
|
@@ -47,7 +43,6 @@ type SkiaHostConfig = HostConfig<
|
|
47
43
|
TimeoutHandle,
|
48
44
|
NoTimeout
|
49
45
|
>;
|
50
|
-
let currentUpdatePriority: EventPriority = NoEventPriority;
|
51
46
|
|
52
47
|
export const sksgHostConfig: SkiaHostConfig = {
|
53
48
|
/**
|
@@ -64,12 +59,12 @@ export const sksgHostConfig: SkiaHostConfig = {
|
|
64
59
|
|
65
60
|
getRootHostContext: (_rootContainerInstance: Container) => {
|
66
61
|
debug("getRootHostContext");
|
67
|
-
return
|
62
|
+
return null;
|
68
63
|
},
|
69
64
|
|
70
65
|
getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {
|
71
66
|
debug("getChildHostContext");
|
72
|
-
return
|
67
|
+
return null;
|
73
68
|
},
|
74
69
|
|
75
70
|
shouldSetTextContent(_type, _props) {
|
@@ -130,8 +125,9 @@ export const sksgHostConfig: SkiaHostConfig = {
|
|
130
125
|
return null;
|
131
126
|
},
|
132
127
|
|
133
|
-
resetAfterCommit(
|
128
|
+
resetAfterCommit(container) {
|
134
129
|
debug("resetAfterCommit");
|
130
|
+
container.redraw();
|
135
131
|
},
|
136
132
|
|
137
133
|
getPublicInstance(node: Instance) {
|
@@ -173,15 +169,16 @@ export const sksgHostConfig: SkiaHostConfig = {
|
|
173
169
|
|
174
170
|
cloneInstance(
|
175
171
|
instance,
|
172
|
+
_updatePayload,
|
176
173
|
_type,
|
177
174
|
_oldProps,
|
178
175
|
newProps,
|
179
|
-
_updatePayload,
|
180
176
|
_internalInstanceHandle,
|
181
177
|
keepChildren: boolean,
|
182
178
|
_recyclableInstance: null | Instance
|
183
179
|
) {
|
184
180
|
debug("cloneInstance");
|
181
|
+
|
185
182
|
return {
|
186
183
|
type: instance.type,
|
187
184
|
props: newProps,
|
@@ -237,31 +234,4 @@ export const sksgHostConfig: SkiaHostConfig = {
|
|
237
234
|
getInstanceFromScope: function (_scopeInstance): Instance | null {
|
238
235
|
throw new Error("Function not implemented.");
|
239
236
|
},
|
240
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
241
|
-
// @ts-expect-error
|
242
|
-
shouldAttemptEagerTransition: () => false,
|
243
|
-
trackSchedulerEvent: () => {},
|
244
|
-
resolveEventType: () => null,
|
245
|
-
resolveEventTimeStamp: () => -1.1,
|
246
|
-
requestPostPaintCallback() {},
|
247
|
-
maySuspendCommit: () => false,
|
248
|
-
preloadInstance: () => true, // true indicates already loaded
|
249
|
-
startSuspendingCommit() {},
|
250
|
-
suspendInstance() {},
|
251
|
-
waitForCommitToBeReady: () => null,
|
252
|
-
NotPendingTransition: null,
|
253
|
-
HostTransitionContext: createContext(null),
|
254
|
-
setCurrentUpdatePriority(newPriority: number) {
|
255
|
-
currentUpdatePriority = newPriority;
|
256
|
-
},
|
257
|
-
getCurrentUpdatePriority() {
|
258
|
-
return currentUpdatePriority;
|
259
|
-
},
|
260
|
-
resolveUpdatePriority() {
|
261
|
-
if (currentUpdatePriority !== NoEventPriority) {
|
262
|
-
return currentUpdatePriority;
|
263
|
-
}
|
264
|
-
return DefaultEventPriority;
|
265
|
-
},
|
266
|
-
resetFormInstance() {},
|
267
237
|
};
|
@@ -0,0 +1,247 @@
|
|
1
|
+
/*global NodeJS*/
|
2
|
+
import type { Fiber, HostConfig } from "react-reconciler";
|
3
|
+
import { DefaultEventPriority } from "react-reconciler/constants";
|
4
|
+
|
5
|
+
import type { NodeType } from "../dom/types";
|
6
|
+
import { shallowEq } from "../renderer/typeddash";
|
7
|
+
|
8
|
+
import type { Container } from "./Container";
|
9
|
+
import type { Node } from "./Node";
|
10
|
+
|
11
|
+
const DEBUG = false;
|
12
|
+
export const debug = (...args: Parameters<typeof console.log>) => {
|
13
|
+
if (DEBUG) {
|
14
|
+
console.log(...args);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
type Instance = Node<unknown>;
|
19
|
+
|
20
|
+
type Props = object;
|
21
|
+
type TextInstance = Node<unknown>;
|
22
|
+
type SuspenseInstance = Instance;
|
23
|
+
type HydratableInstance = Instance;
|
24
|
+
type PublicInstance = Instance;
|
25
|
+
type HostContext = null;
|
26
|
+
type UpdatePayload = Container;
|
27
|
+
type ChildSet = unknown;
|
28
|
+
type TimeoutHandle = NodeJS.Timeout;
|
29
|
+
type NoTimeout = -1;
|
30
|
+
|
31
|
+
type SkiaHostConfig = HostConfig<
|
32
|
+
NodeType,
|
33
|
+
Props,
|
34
|
+
Container,
|
35
|
+
Instance,
|
36
|
+
TextInstance,
|
37
|
+
SuspenseInstance,
|
38
|
+
HydratableInstance,
|
39
|
+
PublicInstance,
|
40
|
+
HostContext,
|
41
|
+
UpdatePayload,
|
42
|
+
ChildSet,
|
43
|
+
TimeoutHandle,
|
44
|
+
NoTimeout
|
45
|
+
>;
|
46
|
+
|
47
|
+
const appendNode = (parent: Node<unknown>, child: Node<unknown>) => {
|
48
|
+
parent.children.push(child);
|
49
|
+
};
|
50
|
+
|
51
|
+
const removeNode = (parent: Node<unknown>, child: Node<unknown>) => {
|
52
|
+
parent.children.splice(parent.children.indexOf(child), 1);
|
53
|
+
};
|
54
|
+
|
55
|
+
const insertBefore = (
|
56
|
+
parent: Node<unknown>,
|
57
|
+
child: Node<unknown>,
|
58
|
+
before: Node<unknown>
|
59
|
+
) => {
|
60
|
+
parent.children.splice(parent.children.indexOf(before), 0, child);
|
61
|
+
};
|
62
|
+
|
63
|
+
export const sksgHostConfig: SkiaHostConfig = {
|
64
|
+
/**
|
65
|
+
* This function is used by the reconciler in order to calculate current time for prioritising work.
|
66
|
+
*/
|
67
|
+
supportsMutation: true,
|
68
|
+
isPrimaryRenderer: false,
|
69
|
+
supportsPersistence: false,
|
70
|
+
supportsHydration: false,
|
71
|
+
//supportsMicrotask: true,
|
72
|
+
|
73
|
+
scheduleTimeout: setTimeout,
|
74
|
+
cancelTimeout: clearTimeout,
|
75
|
+
noTimeout: -1,
|
76
|
+
|
77
|
+
appendChildToContainer(container, child) {
|
78
|
+
debug("appendChildToContainer");
|
79
|
+
container.root.push(child);
|
80
|
+
},
|
81
|
+
|
82
|
+
appendChild(parent, child) {
|
83
|
+
debug("appendChild", parent, child);
|
84
|
+
appendNode(parent, child);
|
85
|
+
},
|
86
|
+
|
87
|
+
getRootHostContext: (_rootContainerInstance: Container) => {
|
88
|
+
debug("getRootHostContext");
|
89
|
+
return null;
|
90
|
+
},
|
91
|
+
|
92
|
+
getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {
|
93
|
+
debug("getChildHostContext");
|
94
|
+
return null;
|
95
|
+
},
|
96
|
+
|
97
|
+
shouldSetTextContent(_type, _props) {
|
98
|
+
return false;
|
99
|
+
},
|
100
|
+
|
101
|
+
createTextInstance(
|
102
|
+
_text,
|
103
|
+
_rootContainerInstance,
|
104
|
+
_hostContext,
|
105
|
+
_internalInstanceHandle
|
106
|
+
) {
|
107
|
+
debug("createTextInstance");
|
108
|
+
// return SpanNode({}, text) as SkNode;
|
109
|
+
throw new Error("Text nodes are not supported yet");
|
110
|
+
},
|
111
|
+
|
112
|
+
createInstance(
|
113
|
+
type,
|
114
|
+
propsWithChildren,
|
115
|
+
_container,
|
116
|
+
_hostContext,
|
117
|
+
_internalInstanceHandle
|
118
|
+
) {
|
119
|
+
debug("createInstance", type);
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
121
|
+
const { children, ...props } = propsWithChildren as any;
|
122
|
+
debug("createInstance", type);
|
123
|
+
const instance = {
|
124
|
+
type,
|
125
|
+
props,
|
126
|
+
children: [],
|
127
|
+
};
|
128
|
+
return instance;
|
129
|
+
},
|
130
|
+
|
131
|
+
appendInitialChild(parentInstance, child) {
|
132
|
+
debug("appendInitialChild");
|
133
|
+
appendNode(parentInstance, child);
|
134
|
+
},
|
135
|
+
|
136
|
+
finalizeInitialChildren(
|
137
|
+
parentInstance,
|
138
|
+
_type,
|
139
|
+
_props,
|
140
|
+
_rootContainerInstance,
|
141
|
+
_hostContext
|
142
|
+
) {
|
143
|
+
debug("finalizeInitialChildren", parentInstance);
|
144
|
+
return false;
|
145
|
+
},
|
146
|
+
|
147
|
+
commitMount() {
|
148
|
+
// if finalizeInitialChildren = true
|
149
|
+
debug("commitMount");
|
150
|
+
},
|
151
|
+
|
152
|
+
prepareForCommit(_containerInfo) {
|
153
|
+
debug("prepareForCommit");
|
154
|
+
return null;
|
155
|
+
},
|
156
|
+
|
157
|
+
resetAfterCommit(container) {
|
158
|
+
debug("resetAfterCommit");
|
159
|
+
container.redraw();
|
160
|
+
},
|
161
|
+
|
162
|
+
getPublicInstance(node: Instance) {
|
163
|
+
debug("getPublicInstance");
|
164
|
+
return node;
|
165
|
+
},
|
166
|
+
|
167
|
+
prepareUpdate: (
|
168
|
+
_instance,
|
169
|
+
type,
|
170
|
+
oldProps,
|
171
|
+
newProps,
|
172
|
+
rootContainerInstance,
|
173
|
+
_hostContext
|
174
|
+
) => {
|
175
|
+
debug("prepareUpdate");
|
176
|
+
const propsAreEqual = shallowEq(oldProps, newProps);
|
177
|
+
if (propsAreEqual) {
|
178
|
+
return null;
|
179
|
+
}
|
180
|
+
debug("update ", type);
|
181
|
+
return rootContainerInstance;
|
182
|
+
},
|
183
|
+
|
184
|
+
commitUpdate(
|
185
|
+
instance,
|
186
|
+
_updatePayload,
|
187
|
+
type,
|
188
|
+
prevProps,
|
189
|
+
nextProps,
|
190
|
+
_internalHandle
|
191
|
+
) {
|
192
|
+
debug("commitUpdate: ", type);
|
193
|
+
if (shallowEq(prevProps, nextProps)) {
|
194
|
+
return;
|
195
|
+
}
|
196
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
197
|
+
const { children, ...props } = nextProps as any;
|
198
|
+
instance.props = props;
|
199
|
+
},
|
200
|
+
|
201
|
+
commitTextUpdate: (
|
202
|
+
_textInstance: TextInstance,
|
203
|
+
_oldText: string,
|
204
|
+
_newText: string
|
205
|
+
) => {
|
206
|
+
// textInstance.instance = newText;
|
207
|
+
},
|
208
|
+
|
209
|
+
clearContainer: (container) => {
|
210
|
+
debug("clearContainer");
|
211
|
+
container.root = [];
|
212
|
+
},
|
213
|
+
|
214
|
+
preparePortalMount: () => {
|
215
|
+
debug("preparePortalMount");
|
216
|
+
},
|
217
|
+
|
218
|
+
removeChild: (parent, child) => {
|
219
|
+
removeNode(parent, child);
|
220
|
+
},
|
221
|
+
|
222
|
+
removeChildFromContainer: (container, child) => {
|
223
|
+
container.root.splice(container.root.indexOf(child), 1);
|
224
|
+
},
|
225
|
+
|
226
|
+
insertInContainerBefore: (container, child, before) => {
|
227
|
+
container.root.splice(container.root.indexOf(before), 0, child);
|
228
|
+
},
|
229
|
+
|
230
|
+
insertBefore: (parent, child, before) => {
|
231
|
+
insertBefore(parent, child, before);
|
232
|
+
},
|
233
|
+
|
234
|
+
// see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
|
235
|
+
getCurrentEventPriority: () => DefaultEventPriority,
|
236
|
+
beforeActiveInstanceBlur: () => {},
|
237
|
+
afterActiveInstanceBlur: () => {},
|
238
|
+
detachDeletedInstance: () => {},
|
239
|
+
|
240
|
+
getInstanceFromNode: function (_node): Fiber | null | undefined {
|
241
|
+
return null;
|
242
|
+
},
|
243
|
+
prepareScopeUpdate: function (_scopeInstance, _instance): void {},
|
244
|
+
getInstanceFromScope: function (_scopeInstance): Instance | null {
|
245
|
+
return null;
|
246
|
+
},
|
247
|
+
};
|
package/src/sksg/Reconciler.ts
CHANGED
@@ -41,21 +41,13 @@ export class SkiaSGRoot {
|
|
41
41
|
return { type: NodeType.Group, props: {}, children, isDeclaration: false };
|
42
42
|
}
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
debug("updateContainer");
|
49
|
-
resolve(true);
|
50
|
-
});
|
44
|
+
render(element: ReactNode) {
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
46
|
+
skiaReconciler.updateContainer(element as any, this.root, null, () => {
|
47
|
+
debug("updateContainer");
|
51
48
|
});
|
52
49
|
}
|
53
50
|
|
54
|
-
async render(element: ReactNode) {
|
55
|
-
await this.updateContainer(element);
|
56
|
-
this.container.redraw();
|
57
|
-
}
|
58
|
-
|
59
51
|
drawOnCanvas(canvas: SkCanvas) {
|
60
52
|
this.container.drawOnCanvas(canvas);
|
61
53
|
}
|
@@ -69,11 +61,8 @@ export class SkiaSGRoot {
|
|
69
61
|
|
70
62
|
unmount() {
|
71
63
|
this.container.unmount();
|
72
|
-
|
73
|
-
|
74
|
-
debug("unmountContainer");
|
75
|
-
resolve(true);
|
76
|
-
});
|
64
|
+
skiaReconciler.updateContainer(null, this.root, null, () => {
|
65
|
+
debug("unmountContainer");
|
77
66
|
});
|
78
67
|
}
|
79
68
|
}
|
@@ -39,10 +39,10 @@ const Ring = ({ index, progress, width, center }: RingProps) => {
|
|
39
39
|
};
|
40
40
|
|
41
41
|
describe("Simple", () => {
|
42
|
-
it("should have a simple render (1)",
|
42
|
+
it("should have a simple render (1)", () => {
|
43
43
|
const { Skia } = importSkia();
|
44
44
|
const root = new SkiaSGRoot(Skia);
|
45
|
-
|
45
|
+
root.render(<skCircle r={128} color="cyan" />);
|
46
46
|
const surface = Skia.Surface.Make(768, 768)!;
|
47
47
|
expect(surface).toBeDefined();
|
48
48
|
const canvas = surface.getCanvas();
|
@@ -52,10 +52,10 @@ describe("Simple", () => {
|
|
52
52
|
expect(image).toBeDefined();
|
53
53
|
checkImage(image, "snapshots/sksg/simple.png");
|
54
54
|
});
|
55
|
-
it("should have a simple render (2)",
|
55
|
+
it("should have a simple render (2)", () => {
|
56
56
|
const { Skia } = importSkia();
|
57
57
|
const root = new SkiaSGRoot(Skia);
|
58
|
-
|
58
|
+
root.render(
|
59
59
|
<>
|
60
60
|
<skFill color="magenta" />
|
61
61
|
<skCircle r={128} cx={768 / 2} cy={768 / 2} color="cyan" />
|
@@ -70,7 +70,7 @@ describe("Simple", () => {
|
|
70
70
|
expect(image).toBeDefined();
|
71
71
|
checkImage(image, "snapshots/sksg/simple2.png");
|
72
72
|
});
|
73
|
-
it("simple demo",
|
73
|
+
it("simple demo", () => {
|
74
74
|
const { Skia } = importSkia();
|
75
75
|
const root = new SkiaSGRoot(Skia);
|
76
76
|
const width = 768;
|
@@ -78,7 +78,7 @@ describe("Simple", () => {
|
|
78
78
|
const center = { x: width / 2, y: height / 2 };
|
79
79
|
const progress = 0.5;
|
80
80
|
const transform = (() => [{ rotate: mix(progress, -Math.PI, 0) }])();
|
81
|
-
|
81
|
+
root.render(
|
82
82
|
<>
|
83
83
|
<skFill color="rgb(36,43,56)" />
|
84
84
|
<skGroup blendMode="screen" origin={center} transform={transform}>
|
@@ -108,7 +108,7 @@ describe("Simple", () => {
|
|
108
108
|
checkImage(image, "snapshots/sksg/breathe.png");
|
109
109
|
});
|
110
110
|
|
111
|
-
it("simple demo (2)",
|
111
|
+
it("simple demo (2)", () => {
|
112
112
|
const { Skia } = importSkia();
|
113
113
|
const root = new SkiaSGRoot(Skia);
|
114
114
|
const width = 768;
|
@@ -116,7 +116,7 @@ describe("Simple", () => {
|
|
116
116
|
const center = { x: width / 2, y: height / 2 };
|
117
117
|
const progress = 0;
|
118
118
|
const transform = (() => [{ rotate: mix(progress, -Math.PI, 0) }])();
|
119
|
-
|
119
|
+
root.render(
|
120
120
|
<>
|
121
121
|
<skFill color="rgb(36,43,56)" />
|
122
122
|
<skGroup blendMode="screen" origin={center} transform={transform}>
|
@@ -1,36 +0,0 @@
|
|
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
|
@@ -1,52 +0,0 @@
|
|
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
|