@shopify/react-native-skia 2.3.8 → 2.3.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/cpp/api/JsiNativeBuffer.h +4 -0
- package/cpp/api/JsiSkAnimatedImage.h +70 -1
- package/cpp/api/JsiSkAnimatedImageFactory.h +4 -0
- package/cpp/api/JsiSkApi.h +2 -0
- package/cpp/api/JsiSkCanvas.h +2 -0
- package/cpp/api/JsiSkColorFilter.h +2 -0
- package/cpp/api/JsiSkColorFilterFactory.h +4 -0
- package/cpp/api/JsiSkContourMeasure.h +2 -0
- package/cpp/api/JsiSkContourMeasureIter.h +4 -0
- package/cpp/api/JsiSkData.h +2 -0
- package/cpp/api/JsiSkDataFactory.h +2 -0
- package/cpp/api/JsiSkFont.h +2 -0
- package/cpp/api/JsiSkFontMgr.h +2 -0
- package/cpp/api/JsiSkFontMgrFactory.h +2 -0
- package/cpp/api/JsiSkFontStyle.h +2 -0
- package/cpp/api/JsiSkHostObjects.h +50 -0
- package/cpp/api/JsiSkImage.h +3 -1
- package/cpp/api/JsiSkImageFactory.h +2 -0
- package/cpp/api/JsiSkImageFilter.h +3 -1
- package/cpp/api/JsiSkImageFilterFactory.h +4 -0
- package/cpp/api/JsiSkImageInfo.h +2 -0
- package/cpp/api/JsiSkMaskFilter.h +2 -0
- package/cpp/api/JsiSkMaskFilterFactory.h +4 -0
- package/cpp/api/JsiSkMatrix.h +2 -0
- package/cpp/api/JsiSkPaint.h +2 -0
- package/cpp/api/JsiSkParagraph.h +3 -1
- package/cpp/api/JsiSkParagraphBuilder.h +3 -1
- package/cpp/api/JsiSkParagraphBuilderFactory.h +5 -1
- package/cpp/api/JsiSkPath.h +2 -0
- package/cpp/api/JsiSkPathEffect.h +2 -0
- package/cpp/api/JsiSkPathEffectFactory.h +4 -0
- package/cpp/api/JsiSkPathFactory.h +2 -0
- package/cpp/api/JsiSkPicture.h +2 -0
- package/cpp/api/JsiSkPictureFactory.h +10 -0
- package/cpp/api/JsiSkPictureRecorder.h +3 -3
- package/cpp/api/JsiSkPoint.h +2 -0
- package/cpp/api/JsiSkRRect.h +2 -0
- package/cpp/api/JsiSkRSXform.h +2 -0
- package/cpp/api/JsiSkRect.h +2 -0
- package/cpp/api/JsiSkRuntimeEffect.h +2 -0
- package/cpp/api/JsiSkRuntimeEffectFactory.h +4 -0
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +4 -0
- package/cpp/api/JsiSkSVG.h +2 -0
- package/cpp/api/JsiSkSVGFactory.h +2 -0
- package/cpp/api/JsiSkShader.h +3 -1
- package/cpp/api/JsiSkShaderFactory.h +2 -0
- package/cpp/api/JsiSkSkottie.h +2 -0
- package/cpp/api/JsiSkSurface.h +51 -7
- package/cpp/api/JsiSkSurfaceFactory.h +2 -0
- package/cpp/api/JsiSkTextBlob.h +2 -0
- package/cpp/api/JsiSkTextBlobFactory.h +2 -0
- package/cpp/api/JsiSkTypeface.h +2 -0
- package/cpp/api/JsiSkTypefaceFactory.h +2 -0
- package/cpp/api/JsiSkTypefaceFontProvider.h +4 -0
- package/cpp/api/JsiSkTypefaceFontProviderFactory.h +4 -0
- package/cpp/api/JsiSkVertices.h +2 -0
- package/cpp/api/JsiSkiaContext.h +3 -1
- package/cpp/api/JsiSkottieFactory.h +2 -0
- package/cpp/api/JsiVideo.h +2 -0
- package/cpp/api/recorder/JsiRecorder.h +42 -7
- package/cpp/jsi/ViewProperty.h +3 -39
- package/cpp/rnskia/RNSkJsiViewApi.h +0 -5
- package/cpp/rnskia/RNSkPictureView.h +1 -24
- package/cpp/rnskia/RNSkView.h +0 -7
- package/lib/commonjs/renderer/Canvas.js +19 -14
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/types/Picture/PictureFactory.d.ts +1 -1
- package/lib/commonjs/skia/types/Picture/PictureFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Recorder.d.ts +2 -1
- package/lib/commonjs/skia/types/Recorder.js.map +1 -1
- package/lib/commonjs/sksg/Container.native.d.ts +4 -0
- package/lib/commonjs/sksg/Container.native.js +18 -6
- package/lib/commonjs/sksg/Container.native.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
- package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js +4 -0
- package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/module/renderer/Canvas.js +19 -14
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/types/Picture/PictureFactory.d.ts +1 -1
- package/lib/module/skia/types/Picture/PictureFactory.js.map +1 -1
- package/lib/module/skia/types/Recorder.d.ts +2 -1
- package/lib/module/skia/types/Recorder.js.map +1 -1
- package/lib/module/sksg/Container.native.d.ts +4 -0
- package/lib/module/sksg/Container.native.js +18 -6
- package/lib/module/sksg/Container.native.js.map +1 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js +4 -0
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/typescript/lib/commonjs/sksg/Container.native.d.ts +5 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Container.native.d.ts +5 -0
- package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
- package/lib/typescript/src/skia/types/Picture/PictureFactory.d.ts +1 -1
- package/lib/typescript/src/skia/types/Recorder.d.ts +2 -1
- package/lib/typescript/src/sksg/Container.native.d.ts +4 -0
- package/lib/typescript/src/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
- package/package.json +1 -1
- package/src/renderer/Canvas.tsx +16 -15
- package/src/skia/types/Picture/PictureFactory.ts +1 -1
- package/src/skia/types/Recorder.ts +2 -1
- package/src/sksg/Container.native.ts +25 -7
- package/src/sksg/Recorder/ReanimatedRecorder.ts +5 -0
|
@@ -15,11 +15,11 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
15
15
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
17
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
-
const nativeDrawOnscreen = (nativeId, recorder) => {
|
|
18
|
+
const nativeDrawOnscreen = (nativeId, recorder, picture) => {
|
|
19
19
|
"worklet";
|
|
20
20
|
|
|
21
21
|
//const start = performance.now();
|
|
22
|
-
|
|
22
|
+
recorder.play(picture);
|
|
23
23
|
//const end = performance.now();
|
|
24
24
|
//console.log("Recording time: ", end - start);
|
|
25
25
|
SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
|
|
@@ -29,6 +29,14 @@ class NativeReanimatedContainer extends _StaticContainer.Container {
|
|
|
29
29
|
super(Skia);
|
|
30
30
|
this.nativeId = nativeId;
|
|
31
31
|
_defineProperty(this, "mapperId", null);
|
|
32
|
+
_defineProperty(this, "picture", void 0);
|
|
33
|
+
_defineProperty(this, "recorderA", void 0);
|
|
34
|
+
_defineProperty(this, "recorderB", void 0);
|
|
35
|
+
_defineProperty(this, "currentRecorder", void 0);
|
|
36
|
+
this.recorderA = new _ReanimatedRecorder.ReanimatedRecorder(Skia);
|
|
37
|
+
this.recorderB = new _ReanimatedRecorder.ReanimatedRecorder(Skia);
|
|
38
|
+
this.currentRecorder = this.recorderA;
|
|
39
|
+
this.picture = Skia.Picture.MakePicture(null);
|
|
32
40
|
}
|
|
33
41
|
redraw() {
|
|
34
42
|
if (this.mapperId !== null) {
|
|
@@ -37,25 +45,29 @@ class NativeReanimatedContainer extends _StaticContainer.Container {
|
|
|
37
45
|
if (this.unmounted) {
|
|
38
46
|
return;
|
|
39
47
|
}
|
|
48
|
+
|
|
49
|
+
// Swap to the next recorder (double buffering)
|
|
50
|
+
const recorder = this.currentRecorder;
|
|
51
|
+
this.currentRecorder = this.currentRecorder === this.recorderA ? this.recorderB : this.recorderA;
|
|
40
52
|
const {
|
|
41
53
|
nativeId,
|
|
42
|
-
|
|
54
|
+
picture
|
|
43
55
|
} = this;
|
|
44
|
-
|
|
56
|
+
recorder.reset();
|
|
45
57
|
(0, _Visitor.visit)(recorder, this.root);
|
|
46
58
|
const sharedValues = recorder.getSharedValues();
|
|
47
59
|
const sharedRecorder = recorder.getRecorder();
|
|
48
60
|
_ReanimatedProxy.default.runOnUI(() => {
|
|
49
61
|
"worklet";
|
|
50
62
|
|
|
51
|
-
nativeDrawOnscreen(nativeId, sharedRecorder);
|
|
63
|
+
nativeDrawOnscreen(nativeId, sharedRecorder, picture);
|
|
52
64
|
})();
|
|
53
65
|
if (sharedValues.length > 0) {
|
|
54
66
|
this.mapperId = _ReanimatedProxy.default.startMapper(() => {
|
|
55
67
|
"worklet";
|
|
56
68
|
|
|
57
69
|
sharedRecorder.applyUpdates(sharedValues);
|
|
58
|
-
nativeDrawOnscreen(nativeId, sharedRecorder);
|
|
70
|
+
nativeDrawOnscreen(nativeId, sharedRecorder, picture);
|
|
59
71
|
}, sharedValues);
|
|
60
72
|
}
|
|
61
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","_renderHelpers","_ReanimatedRecorder","_StaticContainer","_Visitor","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","nativeDrawOnscreen","nativeId","recorder","picture","play","SkiaViewApi","setJsiProperty","NativeReanimatedContainer","Container","constructor","Skia","redraw","mapperId","Rea","stopMapper","unmounted","
|
|
1
|
+
{"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","_renderHelpers","_ReanimatedRecorder","_StaticContainer","_Visitor","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","nativeDrawOnscreen","nativeId","recorder","picture","play","SkiaViewApi","setJsiProperty","NativeReanimatedContainer","Container","constructor","Skia","recorderA","ReanimatedRecorder","recorderB","currentRecorder","Picture","MakePicture","redraw","mapperId","Rea","stopMapper","unmounted","reset","visit","root","sharedValues","getSharedValues","sharedRecorder","getRecorder","runOnUI","length","startMapper","applyUpdates","createContainer","HAS_REANIMATED_3","StaticContainer","exports"],"sources":["Container.native.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkPicture } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\nimport { Container, StaticContainer } from \"./StaticContainer\";\nimport { visit } from \"./Recorder/Visitor\";\n\nimport \"../skia/NativeSetup\";\nimport \"../views/api\";\n\nconst nativeDrawOnscreen = (\n nativeId: number,\n recorder: JsiRecorder,\n picture: SkPicture\n) => {\n \"worklet\";\n\n //const start = performance.now();\n recorder.play(picture);\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n private picture: SkPicture;\n private recorderA: ReanimatedRecorder;\n private recorderB: ReanimatedRecorder;\n private currentRecorder: ReanimatedRecorder;\n\n constructor(\n Skia: Skia,\n private nativeId: number\n ) {\n super(Skia);\n this.recorderA = new ReanimatedRecorder(Skia);\n this.recorderB = new ReanimatedRecorder(Skia);\n this.currentRecorder = this.recorderA;\n this.picture = Skia.Picture.MakePicture(null)!;\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n\n // Swap to the next recorder (double buffering)\n const recorder = this.currentRecorder;\n this.currentRecorder =\n this.currentRecorder === this.recorderA ? this.recorderB : this.recorderA;\n\n const { nativeId, picture } = this;\n recorder.reset();\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n Rea.runOnUI(() => {\n \"worklet\";\n nativeDrawOnscreen(nativeId, sharedRecorder, picture);\n })();\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(nativeId, sharedRecorder, picture);\n }, sharedValues);\n }\n }\n}\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n if (HAS_REANIMATED_3 && nativeId !== -1) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEAA,OAAA;AACAA,OAAA;AAAsB,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAA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ACtD,CAAC,MAAM;IACL,OAAO,IAAIkC,gCAAe,CAACzB,IAAI,EAAET,QAAQ,CAAC;EAC5C;AACF,CAAC;AAACmC,OAAA,CAAAH,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ export declare class ReanimatedRecorder implements BaseRecorder {
|
|
|
10
10
|
private values;
|
|
11
11
|
private recorder;
|
|
12
12
|
constructor(Skia: Skia);
|
|
13
|
+
reset(): void;
|
|
13
14
|
private processAnimationValues;
|
|
14
15
|
getRecorder(): JsiRecorder;
|
|
15
16
|
getSharedValues(): SharedValue<unknown>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_utils","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ReanimatedRecorder","constructor","Skia","Set","recorder","Recorder","processAnimationValues","props","values","forEach","isSharedValue","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","children","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas","drawSkottie","exports"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n PaintProps,\n NodeType,\n BlurMaskFilterProps,\n CTMProps,\n BoxProps,\n BoxShadowProps,\n ImageProps,\n CircleProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\n/**\n * Currently the recorder only work if the GPU resources (e.g Images) are owned by the main thread.\n * It will crash otherwise on Ganesh (iOS/Android).\n */\nexport class ReanimatedRecorder implements BaseRecorder {\n private values = new Set<SharedValue<unknown>>();\n private recorder: JsiRecorder;\n\n constructor(Skia: Skia) {\n this.recorder = Skia.Recorder();\n }\n\n private processAnimationValues(props?: Record<string, unknown>) {\n if (!props) {\n return;\n }\n Object.values(props).forEach((value) => {\n if (isSharedValue(value) && !this.values.has(value)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n value.name = `variable${this.values.size}`;\n this.values.add(value as SharedValue<unknown>);\n }\n });\n }\n\n getRecorder() {\n return this.recorder;\n }\n\n getSharedValues() {\n return Array.from(this.values);\n }\n\n saveGroup(): void {\n this.recorder.saveGroup();\n }\n\n restoreGroup(): void {\n this.recorder.restoreGroup();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n this.processAnimationValues(props);\n this.recorder.savePaint(props, standalone);\n }\n\n restorePaint(): void {\n this.recorder.restorePaint();\n }\n\n restorePaintDeclaration(): void {\n this.recorder.restorePaintDeclaration();\n }\n\n materializePaint(): void {\n this.recorder.materializePaint();\n }\n\n pushPathEffect(\n pathEffectType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushPathEffect(pathEffectType, props);\n }\n\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushImageFilter(imageFilterType, props);\n }\n\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushColorFilter(colorFilterType, props);\n }\n\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushShader(shaderType, props, children);\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n this.processAnimationValues(props);\n this.recorder.pushBlurMaskFilter(props);\n }\n\n composePathEffect(): void {\n this.recorder.composePathEffect();\n }\n\n composeColorFilter(): void {\n this.recorder.composeColorFilter();\n }\n\n composeImageFilter(): void {\n this.recorder.composeImageFilter();\n }\n\n saveCTM(props: AnimatedProps<CTMProps>): void {\n this.processAnimationValues(props);\n this.recorder.saveCTM(props);\n }\n\n restoreCTM(): void {\n this.recorder.restoreCTM();\n }\n\n drawPaint(): void {\n this.recorder.drawPaint();\n }\n\n saveLayer(): void {\n this.recorder.saveLayer();\n }\n\n saveBackdropFilter(): void {\n this.recorder.saveBackdropFilter();\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n }[]\n ): void {\n this.processAnimationValues(boxProps);\n shadows.forEach((shadow) => {\n this.processAnimationValues(\n shadow.props as AnimatedProps<BoxShadowProps>\n );\n });\n this.recorder.drawBox(\n boxProps,\n // TODO: Fix this type BaseRecorder.drawBox()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shadows.map((s) => s.props)\n );\n }\n\n drawImage(props: AnimatedProps<ImageProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImage(props);\n }\n\n drawCircle(props: AnimatedProps<CircleProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawCircle(props);\n }\n\n drawPoints(props: AnimatedProps<PointsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPoints(props);\n }\n\n drawPath(props: AnimatedProps<PathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPath(props);\n }\n\n drawRect(props: AnimatedProps<RectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRect(props);\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRRect(props);\n }\n\n drawOval(props: AnimatedProps<OvalProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawOval(props);\n }\n\n drawLine(props: AnimatedProps<LineProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawLine(props);\n }\n\n drawPatch(props: AnimatedProps<PatchProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPatch(props);\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawVertices(props);\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawDiffRect(props);\n }\n\n drawText(props: AnimatedProps<TextProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawText(props);\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextPath(props);\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextBlob(props);\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawGlyphs(props);\n }\n\n drawPicture(props: AnimatedProps<PictureProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPicture(props);\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImageSVG(props);\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawParagraph(props);\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawAtlas(props);\n }\n\n drawSkottie(props: AnimatedProps<SkottieProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawSkottie(props);\n }\n}\n"],"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CAAC;IAClC,IAAI,CAACH,QAAQ,CAAC2D,YAAY,CAACxD,KAAK,CAAC;EACnC;EAEAyD,UAAUA,CAACzD,KAAiC,EAAQ;IAClD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAAC4D,UAAU,CAACzD,KAAK,CAAC;EACjC;EAEA0D,WAAWA,CAAC1D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAAC6D,WAAW,CAAC1D,KAAK,CAAC;EAClC;EAEA2D,YAAYA,CAAC3D,KAAmC,EAAQ;IACtD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAAC8D,YAAY,CAAC3D,KAAK,CAAC;EACnC;EAEA4D,aAAaA,CAAC5D,KAAoC,EAAQ;IACxD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAAC+D,aAAa,CAAC5D,KAAK,CAAC;EACpC;EAEA6D,SAASA,CAAC7D,KAAgC,EAAQ;IAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAACgE,SAAS,CAAC7D,KAAK,CAAC;EAChC;EAEA8D,WAAWA,CAAC9D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAACiE,WAAW,CAAC9D,KAAK,CAAC;EAClC;AACF;AAAC+D,OAAA,CAAAtE,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_utils","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ReanimatedRecorder","constructor","Skia","Set","recorder","Recorder","reset","values","clear","processAnimationValues","props","forEach","isSharedValue","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","children","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas","drawSkottie","exports"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n PaintProps,\n NodeType,\n BlurMaskFilterProps,\n CTMProps,\n BoxProps,\n BoxShadowProps,\n ImageProps,\n CircleProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\n/**\n * Currently the recorder only work if the GPU resources (e.g Images) are owned by the main thread.\n * It will crash otherwise on Ganesh (iOS/Android).\n */\nexport class ReanimatedRecorder implements BaseRecorder {\n private values = new Set<SharedValue<unknown>>();\n private recorder: JsiRecorder;\n\n constructor(Skia: Skia) {\n this.recorder = Skia.Recorder();\n }\n\n reset() {\n this.values.clear();\n this.recorder.reset();\n }\n\n private processAnimationValues(props?: Record<string, unknown>) {\n if (!props) {\n return;\n }\n Object.values(props).forEach((value) => {\n if (isSharedValue(value) && !this.values.has(value)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n value.name = `variable${this.values.size}`;\n this.values.add(value as SharedValue<unknown>);\n }\n });\n }\n\n getRecorder() {\n return this.recorder;\n }\n\n getSharedValues() {\n return Array.from(this.values);\n }\n\n saveGroup(): void {\n this.recorder.saveGroup();\n }\n\n restoreGroup(): void {\n this.recorder.restoreGroup();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n this.processAnimationValues(props);\n this.recorder.savePaint(props, standalone);\n }\n\n restorePaint(): void {\n this.recorder.restorePaint();\n }\n\n restorePaintDeclaration(): void {\n this.recorder.restorePaintDeclaration();\n }\n\n materializePaint(): void {\n this.recorder.materializePaint();\n }\n\n pushPathEffect(\n pathEffectType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushPathEffect(pathEffectType, props);\n }\n\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushImageFilter(imageFilterType, props);\n }\n\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushColorFilter(colorFilterType, props);\n }\n\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushShader(shaderType, props, children);\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n this.processAnimationValues(props);\n this.recorder.pushBlurMaskFilter(props);\n }\n\n composePathEffect(): void {\n this.recorder.composePathEffect();\n }\n\n composeColorFilter(): void {\n this.recorder.composeColorFilter();\n }\n\n composeImageFilter(): void {\n this.recorder.composeImageFilter();\n }\n\n saveCTM(props: AnimatedProps<CTMProps>): void {\n this.processAnimationValues(props);\n this.recorder.saveCTM(props);\n }\n\n restoreCTM(): void {\n this.recorder.restoreCTM();\n }\n\n drawPaint(): void {\n this.recorder.drawPaint();\n }\n\n saveLayer(): void {\n this.recorder.saveLayer();\n }\n\n saveBackdropFilter(): void {\n this.recorder.saveBackdropFilter();\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n }[]\n ): void {\n this.processAnimationValues(boxProps);\n shadows.forEach((shadow) => {\n this.processAnimationValues(\n shadow.props as AnimatedProps<BoxShadowProps>\n );\n });\n this.recorder.drawBox(\n boxProps,\n // TODO: Fix this type BaseRecorder.drawBox()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shadows.map((s) => s.props)\n );\n }\n\n drawImage(props: AnimatedProps<ImageProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImage(props);\n }\n\n drawCircle(props: AnimatedProps<CircleProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawCircle(props);\n }\n\n drawPoints(props: AnimatedProps<PointsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPoints(props);\n }\n\n drawPath(props: AnimatedProps<PathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPath(props);\n }\n\n drawRect(props: AnimatedProps<RectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRect(props);\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRRect(props);\n }\n\n drawOval(props: AnimatedProps<OvalProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawOval(props);\n }\n\n drawLine(props: AnimatedProps<LineProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawLine(props);\n }\n\n drawPatch(props: AnimatedProps<PatchProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPatch(props);\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawVertices(props);\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawDiffRect(props);\n }\n\n drawText(props: AnimatedProps<TextProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawText(props);\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextPath(props);\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextBlob(props);\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawGlyphs(props);\n }\n\n drawPicture(props: AnimatedProps<PictureProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPicture(props);\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImageSVG(props);\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawParagraph(props);\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawAtlas(props);\n }\n\n drawSkottie(props: AnimatedProps<SkottieProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawSkottie(props);\n }\n}\n"],"mappings":";;;;;;AAgCA,IAAAA,MAAA,GAAAC,OAAA;AAAyC,SAAAC,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WA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sB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACgE,YAAY,CAAC1D,KAAK,CAAC;EACnC;EAEA2D,aAAaA,CAAC3D,KAAoC,EAAQ;IACxD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACiE,aAAa,CAAC3D,KAAK,CAAC;EACpC;EAEA4D,SAASA,CAAC5D,KAAgC,EAAQ;IAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACkE,SAAS,CAAC5D,KAAK,CAAC;EAChC;EAEA6D,WAAWA,CAAC7D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACmE,WAAW,CAAC7D,KAAK,CAAC;EAClC;AACF;AAAC8D,OAAA,CAAAxE,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -10,6 +10,8 @@ import { Platform } from "../Platform";
|
|
|
10
10
|
import { HAS_REANIMATED_3 } from "../external";
|
|
11
11
|
export const useCanvasRef = () => useRef(null);
|
|
12
12
|
const useReanimatedFrame = !HAS_REANIMATED_3 ? () => {} : Rea.useFrameCallback;
|
|
13
|
+
const measure = !HAS_REANIMATED_3 ? null : Rea.measure;
|
|
14
|
+
const useCanvasRefPriv = !HAS_REANIMATED_3 ? useRef : Rea.useAnimatedRef;
|
|
13
15
|
export const useCanvasSize = userRef => {
|
|
14
16
|
const ourRef = useCanvasRef();
|
|
15
17
|
const ref = userRef !== null && userRef !== void 0 ? userRef : ourRef;
|
|
@@ -52,7 +54,7 @@ export const Canvas = ({
|
|
|
52
54
|
if (onLayout && isFabric) {
|
|
53
55
|
console.error("<Canvas onLayout={onLayout} /> is not supported on the new architecture, to fix the issue, see: https://shopify.github.io/react-native-skia/docs/canvas/overview/#getting-the-canvas-size");
|
|
54
56
|
}
|
|
55
|
-
const viewRef =
|
|
57
|
+
const viewRef = useCanvasRefPriv(null);
|
|
56
58
|
// Native ID
|
|
57
59
|
const nativeId = useMemo(() => {
|
|
58
60
|
return SkiaViewNativeId.current++;
|
|
@@ -62,20 +64,23 @@ export const Canvas = ({
|
|
|
62
64
|
const root = useMemo(() => new SkiaSGRoot(Skia, nativeId), [nativeId]);
|
|
63
65
|
useReanimatedFrame(() => {
|
|
64
66
|
"worklet";
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
|
|
68
|
+
if (onSize && measure) {
|
|
69
|
+
const result = measure(viewRef);
|
|
70
|
+
if (result) {
|
|
71
|
+
const {
|
|
72
|
+
width,
|
|
73
|
+
height
|
|
74
|
+
} = result;
|
|
75
|
+
if (onSize.value.width !== width || onSize.value.height !== height) {
|
|
76
|
+
onSize.value = {
|
|
77
|
+
width,
|
|
78
|
+
height
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
|
-
|
|
78
|
-
}, [onSize, nativeId]);
|
|
83
|
+
}, !!onSize);
|
|
79
84
|
|
|
80
85
|
// Render effects
|
|
81
86
|
useLayoutEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useRef","useState","Rea","SkiaViewNativeId","SkiaPictureViewNativeComponent","SkiaSGRoot","Skia","Platform","HAS_REANIMATED_3","useCanvasRef","useReanimatedFrame","useFrameCallback","useCanvasSize","userRef","ourRef","ref","size","setSize","width","height","current","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useRef","useState","Rea","SkiaViewNativeId","SkiaPictureViewNativeComponent","SkiaSGRoot","Skia","Platform","HAS_REANIMATED_3","useCanvasRef","useReanimatedFrame","useFrameCallback","measure","useCanvasRefPriv","useAnimatedRef","useCanvasSize","userRef","ourRef","ref","size","setSize","width","height","current","_x","_y","isFabric","Boolean","_global","global","nativeFabricUIManager","Canvas","debug","opaque","children","onSize","colorSpace","onLayout","viewProps","console","error","viewRef","nativeId","root","result","value","render","unmount","makeImageSnapshot","rect","SkiaViewApi","makeImageSnapshotAsync","redraw","requestRedraw","getNativeId","callback","_viewRef$current","measureInWindow","_viewRef$current2","onLayoutWeb","e","OS","nativeEvent","layout","createElement","_extends","collapsable","nativeID"],"sources":["Canvas.tsx"],"sourcesContent":["import type { FC, RefObject } from \"react\";\nimport React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type {\n LayoutChangeEvent,\n MeasureInWindowOnSuccessCallback,\n MeasureOnSuccessCallback,\n View,\n ViewProps,\n} from \"react-native\";\nimport type { AnimatedRef, SharedValue } from \"react-native-reanimated\";\n\nimport Rea from \"../external/reanimated/ReanimatedProxy\";\nimport { SkiaViewNativeId } from \"../views/SkiaViewNativeId\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport type { SkImage, SkRect, SkSize } from \"../skia/types\";\nimport { SkiaSGRoot } from \"../sksg/Reconciler\";\nimport { Skia } from \"../skia\";\nimport { Platform } from \"../Platform\";\nimport { HAS_REANIMATED_3 } from \"../external\";\n\nexport interface CanvasRef extends FC<CanvasProps> {\n makeImageSnapshot(rect?: SkRect): SkImage;\n makeImageSnapshotAsync(rect?: SkRect): Promise<SkImage>;\n redraw(): void;\n getNativeId(): number;\n measure(callback: MeasureOnSuccessCallback): void;\n measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;\n}\n\nexport const useCanvasRef = () => useRef<CanvasRef>(null);\n\nconst useReanimatedFrame = !HAS_REANIMATED_3 ? () => {} : Rea.useFrameCallback;\nconst measure = !HAS_REANIMATED_3 ? null : Rea.measure;\n\nconst useCanvasRefPriv: typeof useRef<View> = !HAS_REANIMATED_3\n ? useRef\n : Rea.useAnimatedRef;\n\nexport const useCanvasSize = (userRef?: RefObject<CanvasRef | null>) => {\n const ourRef = useCanvasRef();\n const ref = userRef ?? ourRef;\n const [size, setSize] = useState<SkSize>({ width: 0, height: 0 });\n useLayoutEffect(() => {\n if (ref.current) {\n ref.current.measure((_x, _y, width, height) => {\n setSize({ width, height });\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return { ref, size };\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isFabric = Boolean((global as any)?.nativeFabricUIManager);\n\nexport interface CanvasProps extends Omit<ViewProps, \"onLayout\"> {\n debug?: boolean;\n opaque?: boolean;\n onSize?: SharedValue<SkSize>;\n colorSpace?: \"p3\" | \"srgb\";\n ref?: React.Ref<CanvasRef>;\n __destroyWebGLContextAfterRender?: boolean;\n}\n\nexport const Canvas = ({\n debug,\n opaque,\n children,\n onSize,\n colorSpace = \"p3\",\n ref,\n // Here know this is a type error but this is done on purpose to check it at runtime\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n onLayout,\n ...viewProps\n}: CanvasProps) => {\n if (onLayout && isFabric) {\n console.error(\n \"<Canvas onLayout={onLayout} /> is not supported on the new architecture, to fix the issue, see: https://shopify.github.io/react-native-skia/docs/canvas/overview/#getting-the-canvas-size\"\n );\n }\n const viewRef = useCanvasRefPriv(null);\n // Native ID\n const nativeId = useMemo(() => {\n return SkiaViewNativeId.current++;\n }, []);\n\n // Root\n const root = useMemo(() => new SkiaSGRoot(Skia, nativeId), [nativeId]);\n\n useReanimatedFrame(() => {\n \"worklet\";\n if (onSize && measure) {\n const result = measure(viewRef as AnimatedRef<View>);\n if (result) {\n const { width, height } = result;\n if (onSize.value.width !== width || onSize.value.height !== height) {\n onSize.value = { width, height };\n }\n }\n }\n }, !!onSize);\n\n // Render effects\n useLayoutEffect(() => {\n root.render(children);\n }, [children, root, nativeId]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n // Component methods\n useImperativeHandle(\n ref,\n () =>\n ({\n makeImageSnapshot: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshot(nativeId, rect);\n },\n makeImageSnapshotAsync: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshotAsync(nativeId, rect);\n },\n redraw: () => {\n SkiaViewApi.requestRedraw(nativeId);\n },\n getNativeId: () => {\n return nativeId;\n },\n measure: (callback) => {\n viewRef.current?.measure(callback);\n },\n measureInWindow: (callback) => {\n viewRef.current?.measureInWindow(callback);\n },\n }) as CanvasRef\n );\n\n const onLayoutWeb = useCallback(\n (e: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(e);\n }\n if (Platform.OS === \"web\" && onSize) {\n const { width, height } = e.nativeEvent.layout;\n onSize.value = { width, height };\n }\n },\n [onLayout, onSize]\n );\n\n return (\n <SkiaPictureViewNativeComponent\n ref={viewRef}\n collapsable={false}\n nativeID={`${nativeId}`}\n debug={debug}\n opaque={opaque}\n colorSpace={colorSpace}\n onLayout={onLayoutWeb}\n {...viewProps}\n />\n );\n};\n"],"mappings":";;AACA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AAUd,OAAOC,GAAG,MAAM,wCAAwC;AACxD,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,OAAOC,8BAA8B,MAAM,yCAAyC;AAEpF,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,gBAAgB,QAAQ,aAAa;AAW9C,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAMT,MAAM,CAAY,IAAI,CAAC;AAEzD,MAAMU,kBAAkB,GAAG,CAACF,gBAAgB,GAAG,MAAM,CAAC,CAAC,GAAGN,GAAG,CAACS,gBAAgB;AAC9E,MA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AAY,GAClBrB,SAAS,CACd,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
@@ -4,5 +4,5 @@ export interface PictureFactory {
|
|
|
4
4
|
* Returns an SkPicture which has been serialized previously to the given bytes.
|
|
5
5
|
* @param bytes
|
|
6
6
|
*/
|
|
7
|
-
MakePicture(bytes: Uint8Array | ArrayBuffer): SkPicture | null;
|
|
7
|
+
MakePicture(bytes: Uint8Array | ArrayBuffer | null): SkPicture | null;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["PictureFactory.ts"],"sourcesContent":["import type { SkPicture } from \"./Picture\";\n\nexport interface PictureFactory {\n /**\n * Returns an SkPicture which has been serialized previously to the given bytes.\n * @param bytes\n */\n MakePicture(bytes: Uint8Array | ArrayBuffer): SkPicture | null;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["PictureFactory.ts"],"sourcesContent":["import type { SkPicture } from \"./Picture\";\n\nexport interface PictureFactory {\n /**\n * Returns an SkPicture which has been serialized previously to the given bytes.\n * @param bytes\n */\n MakePicture(bytes: Uint8Array | ArrayBuffer | null): SkPicture | null;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -48,6 +48,7 @@ export interface BaseRecorder {
|
|
|
48
48
|
drawAtlas(props: AnimatedProps<AtlasProps>): void;
|
|
49
49
|
}
|
|
50
50
|
export interface JsiRecorder extends BaseRecorder {
|
|
51
|
-
play():
|
|
51
|
+
play(picture: SkPicture): void;
|
|
52
52
|
applyUpdates(variables: SharedValue<unknown>[]): void;
|
|
53
|
+
reset(): void;
|
|
53
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n TextProps,\n AtlasProps,\n BlurMaskFilterProps,\n BoxProps,\n BoxShadowProps,\n CircleProps,\n CTMProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n NodeType,\n OvalProps,\n PaintProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextBlobProps,\n TextPathProps,\n VerticesProps,\n SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkPicture } from \"./Picture\";\n\nexport interface BaseRecorder {\n saveGroup(): void;\n restoreGroup(): void;\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;\n restorePaint(): void;\n restorePaintDeclaration(): void;\n materializePaint(): void;\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void;\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;\n composePathEffect(): void;\n composeColorFilter(): void;\n composeImageFilter(): void;\n saveCTM(props: AnimatedProps<CTMProps>): void;\n restoreCTM(): void;\n drawPaint(): void;\n saveLayer(): void;\n saveBackdropFilter(): void;\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ): void;\n drawImage(props: AnimatedProps<ImageProps>): void;\n drawCircle(props: AnimatedProps<CircleProps>): void;\n drawPoints(props: AnimatedProps<PointsProps>): void;\n drawPath(props: AnimatedProps<PathProps>): void;\n drawRect(props: AnimatedProps<RectProps>): void;\n drawRRect(props: AnimatedProps<RoundedRectProps>): void;\n drawOval(props: AnimatedProps<OvalProps>): void;\n drawLine(props: AnimatedProps<LineProps>): void;\n drawPatch(props: AnimatedProps<PatchProps>): void;\n drawVertices(props: AnimatedProps<VerticesProps>): void;\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void;\n drawText(props: AnimatedProps<TextProps>): void;\n drawTextPath(props: AnimatedProps<TextPathProps>): void;\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void;\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void;\n drawPicture(props: AnimatedProps<PictureProps>): void;\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;\n drawParagraph(props: AnimatedProps<ParagraphProps>): void;\n drawSkottie(props: AnimatedProps<SkottieProps>): void;\n drawAtlas(props: AnimatedProps<AtlasProps>): void;\n}\n\nexport interface JsiRecorder extends BaseRecorder {\n play():
|
|
1
|
+
{"version":3,"names":[],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n TextProps,\n AtlasProps,\n BlurMaskFilterProps,\n BoxProps,\n BoxShadowProps,\n CircleProps,\n CTMProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n NodeType,\n OvalProps,\n PaintProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextBlobProps,\n TextPathProps,\n VerticesProps,\n SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkPicture } from \"./Picture\";\n\nexport interface BaseRecorder {\n saveGroup(): void;\n restoreGroup(): void;\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;\n restorePaint(): void;\n restorePaintDeclaration(): void;\n materializePaint(): void;\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void;\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;\n composePathEffect(): void;\n composeColorFilter(): void;\n composeImageFilter(): void;\n saveCTM(props: AnimatedProps<CTMProps>): void;\n restoreCTM(): void;\n drawPaint(): void;\n saveLayer(): void;\n saveBackdropFilter(): void;\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ): void;\n drawImage(props: AnimatedProps<ImageProps>): void;\n drawCircle(props: AnimatedProps<CircleProps>): void;\n drawPoints(props: AnimatedProps<PointsProps>): void;\n drawPath(props: AnimatedProps<PathProps>): void;\n drawRect(props: AnimatedProps<RectProps>): void;\n drawRRect(props: AnimatedProps<RoundedRectProps>): void;\n drawOval(props: AnimatedProps<OvalProps>): void;\n drawLine(props: AnimatedProps<LineProps>): void;\n drawPatch(props: AnimatedProps<PatchProps>): void;\n drawVertices(props: AnimatedProps<VerticesProps>): void;\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void;\n drawText(props: AnimatedProps<TextProps>): void;\n drawTextPath(props: AnimatedProps<TextPathProps>): void;\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void;\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void;\n drawPicture(props: AnimatedProps<PictureProps>): void;\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;\n drawParagraph(props: AnimatedProps<ParagraphProps>): void;\n drawSkottie(props: AnimatedProps<SkottieProps>): void;\n drawAtlas(props: AnimatedProps<AtlasProps>): void;\n}\n\nexport interface JsiRecorder extends BaseRecorder {\n play(picture: SkPicture): void;\n applyUpdates(variables: SharedValue<unknown>[]): void;\n reset(): void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -5,6 +5,10 @@ import "../views/api";
|
|
|
5
5
|
declare class NativeReanimatedContainer extends Container {
|
|
6
6
|
private nativeId;
|
|
7
7
|
private mapperId;
|
|
8
|
+
private picture;
|
|
9
|
+
private recorderA;
|
|
10
|
+
private recorderB;
|
|
11
|
+
private currentRecorder;
|
|
8
12
|
constructor(Skia: Skia, nativeId: number);
|
|
9
13
|
redraw(): void;
|
|
10
14
|
}
|
|
@@ -8,11 +8,11 @@ import { Container, StaticContainer } from "./StaticContainer";
|
|
|
8
8
|
import { visit } from "./Recorder/Visitor";
|
|
9
9
|
import "../skia/NativeSetup";
|
|
10
10
|
import "../views/api";
|
|
11
|
-
const nativeDrawOnscreen = (nativeId, recorder) => {
|
|
11
|
+
const nativeDrawOnscreen = (nativeId, recorder, picture) => {
|
|
12
12
|
"worklet";
|
|
13
13
|
|
|
14
14
|
//const start = performance.now();
|
|
15
|
-
|
|
15
|
+
recorder.play(picture);
|
|
16
16
|
//const end = performance.now();
|
|
17
17
|
//console.log("Recording time: ", end - start);
|
|
18
18
|
SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
|
|
@@ -22,6 +22,14 @@ class NativeReanimatedContainer extends Container {
|
|
|
22
22
|
super(Skia);
|
|
23
23
|
this.nativeId = nativeId;
|
|
24
24
|
_defineProperty(this, "mapperId", null);
|
|
25
|
+
_defineProperty(this, "picture", void 0);
|
|
26
|
+
_defineProperty(this, "recorderA", void 0);
|
|
27
|
+
_defineProperty(this, "recorderB", void 0);
|
|
28
|
+
_defineProperty(this, "currentRecorder", void 0);
|
|
29
|
+
this.recorderA = new ReanimatedRecorder(Skia);
|
|
30
|
+
this.recorderB = new ReanimatedRecorder(Skia);
|
|
31
|
+
this.currentRecorder = this.recorderA;
|
|
32
|
+
this.picture = Skia.Picture.MakePicture(null);
|
|
25
33
|
}
|
|
26
34
|
redraw() {
|
|
27
35
|
if (this.mapperId !== null) {
|
|
@@ -30,25 +38,29 @@ class NativeReanimatedContainer extends Container {
|
|
|
30
38
|
if (this.unmounted) {
|
|
31
39
|
return;
|
|
32
40
|
}
|
|
41
|
+
|
|
42
|
+
// Swap to the next recorder (double buffering)
|
|
43
|
+
const recorder = this.currentRecorder;
|
|
44
|
+
this.currentRecorder = this.currentRecorder === this.recorderA ? this.recorderB : this.recorderA;
|
|
33
45
|
const {
|
|
34
46
|
nativeId,
|
|
35
|
-
|
|
47
|
+
picture
|
|
36
48
|
} = this;
|
|
37
|
-
|
|
49
|
+
recorder.reset();
|
|
38
50
|
visit(recorder, this.root);
|
|
39
51
|
const sharedValues = recorder.getSharedValues();
|
|
40
52
|
const sharedRecorder = recorder.getRecorder();
|
|
41
53
|
Rea.runOnUI(() => {
|
|
42
54
|
"worklet";
|
|
43
55
|
|
|
44
|
-
nativeDrawOnscreen(nativeId, sharedRecorder);
|
|
56
|
+
nativeDrawOnscreen(nativeId, sharedRecorder, picture);
|
|
45
57
|
})();
|
|
46
58
|
if (sharedValues.length > 0) {
|
|
47
59
|
this.mapperId = Rea.startMapper(() => {
|
|
48
60
|
"worklet";
|
|
49
61
|
|
|
50
62
|
sharedRecorder.applyUpdates(sharedValues);
|
|
51
|
-
nativeDrawOnscreen(nativeId, sharedRecorder);
|
|
63
|
+
nativeDrawOnscreen(nativeId, sharedRecorder, picture);
|
|
52
64
|
}, sharedValues);
|
|
53
65
|
}
|
|
54
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Rea","HAS_REANIMATED_3","ReanimatedRecorder","Container","StaticContainer","visit","nativeDrawOnscreen","nativeId","recorder","picture","play","SkiaViewApi","setJsiProperty","NativeReanimatedContainer","constructor","Skia","_defineProperty","redraw","mapperId","stopMapper","unmounted","root","sharedValues","getSharedValues","sharedRecorder","getRecorder","runOnUI","length","startMapper","applyUpdates","createContainer"],"sources":["Container.native.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\nimport { Container, StaticContainer } from \"./StaticContainer\";\nimport { visit } from \"./Recorder/Visitor\";\n\nimport \"../skia/NativeSetup\";\nimport \"../views/api\";\n\nconst nativeDrawOnscreen = (nativeId: number
|
|
1
|
+
{"version":3,"names":["Rea","HAS_REANIMATED_3","ReanimatedRecorder","Container","StaticContainer","visit","nativeDrawOnscreen","nativeId","recorder","picture","play","SkiaViewApi","setJsiProperty","NativeReanimatedContainer","constructor","Skia","_defineProperty","recorderA","recorderB","currentRecorder","Picture","MakePicture","redraw","mapperId","stopMapper","unmounted","reset","root","sharedValues","getSharedValues","sharedRecorder","getRecorder","runOnUI","length","startMapper","applyUpdates","createContainer"],"sources":["Container.native.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkPicture } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\nimport { Container, StaticContainer } from \"./StaticContainer\";\nimport { visit } from \"./Recorder/Visitor\";\n\nimport \"../skia/NativeSetup\";\nimport \"../views/api\";\n\nconst nativeDrawOnscreen = (\n nativeId: number,\n recorder: JsiRecorder,\n picture: SkPicture\n) => {\n \"worklet\";\n\n //const start = performance.now();\n recorder.play(picture);\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n private picture: SkPicture;\n private recorderA: ReanimatedRecorder;\n private recorderB: ReanimatedRecorder;\n private currentRecorder: ReanimatedRecorder;\n\n constructor(\n Skia: Skia,\n private nativeId: number\n ) {\n super(Skia);\n this.recorderA = new ReanimatedRecorder(Skia);\n this.recorderB = new ReanimatedRecorder(Skia);\n this.currentRecorder = this.recorderA;\n this.picture = Skia.Picture.MakePicture(null)!;\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n\n // Swap to the next recorder (double buffering)\n const recorder = this.currentRecorder;\n this.currentRecorder =\n this.currentRecorder === this.recorderA ? this.recorderB : this.recorderA;\n\n const { nativeId, picture } = this;\n recorder.reset();\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n Rea.runOnUI(() => {\n \"worklet\";\n nativeDrawOnscreen(nativeId, sharedRecorder, picture);\n })();\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(nativeId, sharedRecorder, picture);\n }, sharedValues);\n }\n }\n}\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n if (HAS_REANIMATED_3 && nativeId !== -1) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAM,wCAAwC;AAExD,SAASC,gBAAgB,QAAQ,sCAAsC;AAGvE,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,SAAS,EAAEC,eAAe,QAAQ,mBAAmB;AAC9D,SAASC,KAAK,QAAQ,oBAAoB;AAE1C,OAAO,qBAAqB;AAC5B,OAAO,cAAc;AAErB,MAAMC,kBAAkB,GAAGA,CACzBC,QAAgB,EAChBC,QAAqB,EACrBC,OAAkB,KACf;EACH,SAAS;;EAET;EACAD,QAAQ,CAACE,IAAI,CAACD,OAAO,CAAC;EACtB;EACA;EACAE,WAAW,CAACC,cAAc,CAACL,QAAQ,EAAE,SAAS,EAAEE,OAAO,CAAC;AAC1D,CAAC;AAED,MAAMI,yBAAyB,SAASV,SAAS,CAAC;EAOhDW,WAAWA,CACTC,IAAU,EACFR,QAAgB,EACxB;IACA,KAAK,CAACQ,IAAI,CAAC;IAAC,KAFJR,QAAgB,GAAhBA,QAAgB;IAAAS,eAAA,mBARQ,IAAI;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAWpC,IAAI,CAACC,SAAS,GAAG,IAAIf,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EAAErB,OAAO,CAAC;MACvD,CAAC,EAAEmB,YAAY,CAAC;IAClB;EACF;AACF;AAEA,OAAO,MAAMQ,eAAe,GAAGA,CAACrB,IAAU,EAAER,QAAgB,KAAK;EAC/D,IAAIN,gBAAgB,IAAIM,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,OAAO,IAAIM,yBAAyB,CAACE,IAAI,EAAER,QAAQ,CAAC;EACtD,CAAC,MAAM;IACL,OAAO,IAAIH,eAAe,CAACW,IAAI,EAAER,QAAQ,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ export declare class ReanimatedRecorder implements BaseRecorder {
|
|
|
10
10
|
private values;
|
|
11
11
|
private recorder;
|
|
12
12
|
constructor(Skia: Skia);
|
|
13
|
+
reset(): void;
|
|
13
14
|
private processAnimationValues;
|
|
14
15
|
getRecorder(): JsiRecorder;
|
|
15
16
|
getSharedValues(): SharedValue<unknown>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isSharedValue","ReanimatedRecorder","constructor","Skia","_defineProperty","Set","recorder","Recorder","processAnimationValues","props","Object","values","forEach","value","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","children","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas","drawSkottie"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n PaintProps,\n NodeType,\n BlurMaskFilterProps,\n CTMProps,\n BoxProps,\n BoxShadowProps,\n ImageProps,\n CircleProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\n/**\n * Currently the recorder only work if the GPU resources (e.g Images) are owned by the main thread.\n * It will crash otherwise on Ganesh (iOS/Android).\n */\nexport class ReanimatedRecorder implements BaseRecorder {\n private values = new Set<SharedValue<unknown>>();\n private recorder: JsiRecorder;\n\n constructor(Skia: Skia) {\n this.recorder = Skia.Recorder();\n }\n\n private processAnimationValues(props?: Record<string, unknown>) {\n if (!props) {\n return;\n }\n Object.values(props).forEach((value) => {\n if (isSharedValue(value) && !this.values.has(value)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n value.name = `variable${this.values.size}`;\n this.values.add(value as SharedValue<unknown>);\n }\n });\n }\n\n getRecorder() {\n return this.recorder;\n }\n\n getSharedValues() {\n return Array.from(this.values);\n }\n\n saveGroup(): void {\n this.recorder.saveGroup();\n }\n\n restoreGroup(): void {\n this.recorder.restoreGroup();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n this.processAnimationValues(props);\n this.recorder.savePaint(props, standalone);\n }\n\n restorePaint(): void {\n this.recorder.restorePaint();\n }\n\n restorePaintDeclaration(): void {\n this.recorder.restorePaintDeclaration();\n }\n\n materializePaint(): void {\n this.recorder.materializePaint();\n }\n\n pushPathEffect(\n pathEffectType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushPathEffect(pathEffectType, props);\n }\n\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushImageFilter(imageFilterType, props);\n }\n\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushColorFilter(colorFilterType, props);\n }\n\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushShader(shaderType, props, children);\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n this.processAnimationValues(props);\n this.recorder.pushBlurMaskFilter(props);\n }\n\n composePathEffect(): void {\n this.recorder.composePathEffect();\n }\n\n composeColorFilter(): void {\n this.recorder.composeColorFilter();\n }\n\n composeImageFilter(): void {\n this.recorder.composeImageFilter();\n }\n\n saveCTM(props: AnimatedProps<CTMProps>): void {\n this.processAnimationValues(props);\n this.recorder.saveCTM(props);\n }\n\n restoreCTM(): void {\n this.recorder.restoreCTM();\n }\n\n drawPaint(): void {\n this.recorder.drawPaint();\n }\n\n saveLayer(): void {\n this.recorder.saveLayer();\n }\n\n saveBackdropFilter(): void {\n this.recorder.saveBackdropFilter();\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n }[]\n ): void {\n this.processAnimationValues(boxProps);\n shadows.forEach((shadow) => {\n this.processAnimationValues(\n shadow.props as AnimatedProps<BoxShadowProps>\n );\n });\n this.recorder.drawBox(\n boxProps,\n // TODO: Fix this type BaseRecorder.drawBox()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shadows.map((s) => s.props)\n );\n }\n\n drawImage(props: AnimatedProps<ImageProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImage(props);\n }\n\n drawCircle(props: AnimatedProps<CircleProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawCircle(props);\n }\n\n drawPoints(props: AnimatedProps<PointsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPoints(props);\n }\n\n drawPath(props: AnimatedProps<PathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPath(props);\n }\n\n drawRect(props: AnimatedProps<RectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRect(props);\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRRect(props);\n }\n\n drawOval(props: AnimatedProps<OvalProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawOval(props);\n }\n\n drawLine(props: AnimatedProps<LineProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawLine(props);\n }\n\n drawPatch(props: AnimatedProps<PatchProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPatch(props);\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawVertices(props);\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawDiffRect(props);\n }\n\n drawText(props: AnimatedProps<TextProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawText(props);\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextPath(props);\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextBlob(props);\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawGlyphs(props);\n }\n\n drawPicture(props: AnimatedProps<PictureProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPicture(props);\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImageSVG(props);\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawParagraph(props);\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawAtlas(props);\n }\n\n drawSkottie(props: AnimatedProps<SkottieProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawSkottie(props);\n }\n}\n"],"mappings":";;;AAgCA,SAASA,aAAa,QAAQ,UAAU;;AAExC;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,CAAyB;EAItDC,WAAWA,CAACC,IAAU,EAAE;IAAAC,eAAA,iBAHP,IAAIC,GAAG,CAAuB,CAAC;IAAAD,eAAA;IAI9C,IAAI,CAACE,QAAQ,GAAGH,IAAI,CAACI,QAAQ,CAAC,CAAC;EACjC;EAEQC,sBAAsBA,CAACC,KAA+B,EAAE;IAC9D,IAAI,CAACA,KAAK,EAAE;MACV;IACF;IACAC,MAAM,CAACC,MAAM,CAACF,KAAK,CAAC,CAACG,OAAO,CAAEC,KAAK,IAAK;MACtC,IAAIb,aAAa,CAACa,KAAK,CAAC,IAAI,CAAC,IAAI,CAACF,MAAM,CAACG,GAAG,CAACD,KAAK,CAAC,EAAE;QACnD;QACA;QACAA,KAAK,CAACE,IAAI,GAAG,WAAW,IAAI,CAACJ,MAAM,CAACK,IAAI,EAAE;QAC1C,IAAI,CAACL,MAAM,CAACM,GAAG,CAACJ,KAA6B,CAAC;MAChD;IACF,CAAC,CAAC;EACJ;EAEAK,WAAWA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACZ,QAAQ;EACtB;EAEAa,eAAeA,CAAA,EAAG;IAChB,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACV,MAAM,CAAC;EAChC;EAEAW,SAASA,CAAA,EAAS;IAChB,IAAI,CAAChB,QAAQ,CAACgB,SAAS,CAAC,CAAC;EAC3B;EAEAC,YAAYA,CAAA,EAAS;IACnB,IAAI,CAACjB,QAAQ,CAACiB,YAAY,CAAC,CAAC;EAC9B;EAEAC,SAASA,CAACf,KAAgC,EAAEgB,UAAmB,EAAQ;IACrE,IAAI,CAACjB,sBAAsB,CAACC,KAAK,CAAC;IACl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AAC;IAClC,IAAI,CAACH,QAAQ,CAACgE,aAAa,CAAC7D,KAAK,CAAC;EACpC;EAEA8D,SAASA,CAAC9D,KAAgC,EAAQ;IAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAACiE,SAAS,CAAC9D,KAAK,CAAC;EAChC;EAEA+D,WAAWA,CAAC/D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAACkE,WAAW,CAAC/D,KAAK,CAAC;EAClC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["isSharedValue","ReanimatedRecorder","constructor","Skia","_defineProperty","Set","recorder","Recorder","reset","values","clear","processAnimationValues","props","Object","forEach","value","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","children","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas","drawSkottie"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n PaintProps,\n NodeType,\n BlurMaskFilterProps,\n CTMProps,\n BoxProps,\n BoxShadowProps,\n ImageProps,\n CircleProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\n/**\n * Currently the recorder only work if the GPU resources (e.g Images) are owned by the main thread.\n * It will crash otherwise on Ganesh (iOS/Android).\n */\nexport class ReanimatedRecorder implements BaseRecorder {\n private values = new Set<SharedValue<unknown>>();\n private recorder: JsiRecorder;\n\n constructor(Skia: Skia) {\n this.recorder = Skia.Recorder();\n }\n\n reset() {\n this.values.clear();\n this.recorder.reset();\n }\n\n private processAnimationValues(props?: Record<string, unknown>) {\n if (!props) {\n return;\n }\n Object.values(props).forEach((value) => {\n if (isSharedValue(value) && !this.values.has(value)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n value.name = `variable${this.values.size}`;\n this.values.add(value as SharedValue<unknown>);\n }\n });\n }\n\n getRecorder() {\n return this.recorder;\n }\n\n getSharedValues() {\n return Array.from(this.values);\n }\n\n saveGroup(): void {\n this.recorder.saveGroup();\n }\n\n restoreGroup(): void {\n this.recorder.restoreGroup();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n this.processAnimationValues(props);\n this.recorder.savePaint(props, standalone);\n }\n\n restorePaint(): void {\n this.recorder.restorePaint();\n }\n\n restorePaintDeclaration(): void {\n this.recorder.restorePaintDeclaration();\n }\n\n materializePaint(): void {\n this.recorder.materializePaint();\n }\n\n pushPathEffect(\n pathEffectType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushPathEffect(pathEffectType, props);\n }\n\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushImageFilter(imageFilterType, props);\n }\n\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushColorFilter(colorFilterType, props);\n }\n\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushShader(shaderType, props, children);\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n this.processAnimationValues(props);\n this.recorder.pushBlurMaskFilter(props);\n }\n\n composePathEffect(): void {\n this.recorder.composePathEffect();\n }\n\n composeColorFilter(): void {\n this.recorder.composeColorFilter();\n }\n\n composeImageFilter(): void {\n this.recorder.composeImageFilter();\n }\n\n saveCTM(props: AnimatedProps<CTMProps>): void {\n this.processAnimationValues(props);\n this.recorder.saveCTM(props);\n }\n\n restoreCTM(): void {\n this.recorder.restoreCTM();\n }\n\n drawPaint(): void {\n this.recorder.drawPaint();\n }\n\n saveLayer(): void {\n this.recorder.saveLayer();\n }\n\n saveBackdropFilter(): void {\n this.recorder.saveBackdropFilter();\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n }[]\n ): void {\n this.processAnimationValues(boxProps);\n shadows.forEach((shadow) => {\n this.processAnimationValues(\n shadow.props as AnimatedProps<BoxShadowProps>\n );\n });\n this.recorder.drawBox(\n boxProps,\n // TODO: Fix this type BaseRecorder.drawBox()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shadows.map((s) => s.props)\n );\n }\n\n drawImage(props: AnimatedProps<ImageProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImage(props);\n }\n\n drawCircle(props: AnimatedProps<CircleProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawCircle(props);\n }\n\n drawPoints(props: AnimatedProps<PointsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPoints(props);\n }\n\n drawPath(props: AnimatedProps<PathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPath(props);\n }\n\n drawRect(props: AnimatedProps<RectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRect(props);\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRRect(props);\n }\n\n drawOval(props: AnimatedProps<OvalProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawOval(props);\n }\n\n drawLine(props: AnimatedProps<LineProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawLine(props);\n }\n\n drawPatch(props: AnimatedProps<PatchProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPatch(props);\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawVertices(props);\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawDiffRect(props);\n }\n\n drawText(props: AnimatedProps<TextProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawText(props);\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextPath(props);\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextBlob(props);\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawGlyphs(props);\n }\n\n drawPicture(props: AnimatedProps<PictureProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPicture(props);\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImageSVG(props);\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawParagraph(props);\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawAtlas(props);\n }\n\n drawSkottie(props: AnimatedProps<SkottieProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawSkottie(props);\n }\n}\n"],"mappings":";;;AAgCA,SAASA,aAAa,QAAQ,UAAU;;AAExC;AACA;AACA;AACA;AACA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AAC;EACpC;EAEA6D,SAASA,CAAC7D,KAAgC,EAAQ;IAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACmE,SAAS,CAAC7D,KAAK,CAAC;EAChC;EAEA8D,WAAWA,CAAC9D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACoE,WAAW,CAAC9D,KAAK,CAAC;EAClC;AACF","ignoreList":[]}
|
|
@@ -4,7 +4,12 @@ import _StaticContainer = require("./StaticContainer");
|
|
|
4
4
|
declare class NativeReanimatedContainer extends _StaticContainer.Container {
|
|
5
5
|
constructor(Skia: any, nativeId: any);
|
|
6
6
|
nativeId: any;
|
|
7
|
+
recorderA: _ReanimatedRecorder.ReanimatedRecorder;
|
|
8
|
+
recorderB: _ReanimatedRecorder.ReanimatedRecorder;
|
|
9
|
+
currentRecorder: _ReanimatedRecorder.ReanimatedRecorder;
|
|
10
|
+
picture: any;
|
|
7
11
|
redraw(): void;
|
|
8
12
|
mapperId: any;
|
|
9
13
|
}
|
|
14
|
+
import _ReanimatedRecorder = require("./Recorder/ReanimatedRecorder");
|
|
10
15
|
export {};
|
|
@@ -3,8 +3,13 @@ import { StaticContainer } from "./StaticContainer";
|
|
|
3
3
|
declare class NativeReanimatedContainer extends Container {
|
|
4
4
|
constructor(Skia: any, nativeId: any);
|
|
5
5
|
nativeId: any;
|
|
6
|
+
recorderA: ReanimatedRecorder;
|
|
7
|
+
recorderB: ReanimatedRecorder;
|
|
8
|
+
currentRecorder: ReanimatedRecorder;
|
|
9
|
+
picture: any;
|
|
6
10
|
redraw(): void;
|
|
7
11
|
mapperId: any;
|
|
8
12
|
}
|
|
9
13
|
import { Container } from "./StaticContainer";
|
|
14
|
+
import { ReanimatedRecorder } from "./Recorder/ReanimatedRecorder";
|
|
10
15
|
export {};
|
|
@@ -4,5 +4,5 @@ export interface PictureFactory {
|
|
|
4
4
|
* Returns an SkPicture which has been serialized previously to the given bytes.
|
|
5
5
|
* @param bytes
|
|
6
6
|
*/
|
|
7
|
-
MakePicture(bytes: Uint8Array | ArrayBuffer): SkPicture | null;
|
|
7
|
+
MakePicture(bytes: Uint8Array | ArrayBuffer | null): SkPicture | null;
|
|
8
8
|
}
|