@shopify/react-native-skia 1.0.3 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/android/README.md +14 -0
- package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +16 -1
- package/cpp/skia/include/private/base/README.md +4 -0
- package/cpp/skia/include/third_party/vulkan/LICENSE +29 -0
- package/cpp/skia/modules/skcms/README.chromium +6 -0
- package/cpp/skia/readme.txt +1 -0
- package/lib/commonjs/external/reanimated/buffers.js +6 -6
- package/lib/commonjs/external/reanimated/buffers.js.map +1 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +1 -0
- package/lib/commonjs/external/reanimated/moduleWrapper.js +4 -3
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/commonjs/headless/index.d.ts +4 -2
- package/lib/commonjs/headless/index.js +11 -18
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.js +1 -0
- package/lib/commonjs/renderer/Offscreen.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +27 -2
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js +5 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +13 -2
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/external/reanimated/buffers.js +7 -7
- package/lib/module/external/reanimated/buffers.js.map +1 -1
- package/lib/module/external/reanimated/moduleWrapper.d.ts +1 -0
- package/lib/module/external/reanimated/moduleWrapper.js +3 -2
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/module/headless/index.d.ts +4 -2
- package/lib/module/headless/index.js +9 -3
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/renderer/Offscreen.js +1 -0
- package/lib/module/renderer/Offscreen.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.d.ts +2 -1
- package/lib/module/skia/web/JsiSkImage.js +27 -2
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.d.ts +2 -1
- package/lib/module/skia/web/JsiSkSurface.js +5 -1
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +13 -2
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +1 -0
- package/lib/typescript/src/headless/index.d.ts +4 -2
- package/lib/typescript/src/skia/web/JsiSkImage.d.ts +2 -1
- package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +2 -1
- package/package.json +2 -3
- package/react-native-skia.podspec +1 -1
- package/src/external/reanimated/buffers.ts +11 -9
- package/src/external/reanimated/moduleWrapper.ts +2 -0
- package/src/headless/index.ts +9 -4
- package/src/renderer/Offscreen.tsx +1 -0
- package/src/skia/web/JsiSkImage.ts +36 -5
- package/src/skia/web/JsiSkSurface.ts +8 -1
- package/src/skia/web/JsiSkSurfaceFactory.ts +17 -2
@@ -11,12 +11,19 @@ export class JsiSkSurface
|
|
11
11
|
extends HostObject<Surface, "Surface">
|
12
12
|
implements SkSurface
|
13
13
|
{
|
14
|
-
constructor(
|
14
|
+
constructor(
|
15
|
+
CanvasKit: CanvasKit,
|
16
|
+
ref: Surface,
|
17
|
+
private releaseCtx?: () => void
|
18
|
+
) {
|
15
19
|
super(CanvasKit, ref, "Surface");
|
16
20
|
}
|
17
21
|
|
18
22
|
dispose = () => {
|
19
23
|
this.ref.delete();
|
24
|
+
if (this.releaseCtx) {
|
25
|
+
this.releaseCtx();
|
26
|
+
}
|
20
27
|
};
|
21
28
|
|
22
29
|
flush() {
|
@@ -11,11 +11,26 @@ export class JsiSkSurfaceFactory extends Host implements SurfaceFactory {
|
|
11
11
|
}
|
12
12
|
|
13
13
|
Make(width: number, height: number) {
|
14
|
-
|
14
|
+
var pixelLen = width * height * 4;
|
15
|
+
const pixelPtr = this.CanvasKit.Malloc(Uint8Array, pixelLen);
|
16
|
+
const surface = this.CanvasKit.MakeRasterDirectSurface(
|
17
|
+
{
|
18
|
+
width: width,
|
19
|
+
height: height,
|
20
|
+
colorType: this.CanvasKit.ColorType.RGBA_8888,
|
21
|
+
alphaType: this.CanvasKit.AlphaType.Unpremul,
|
22
|
+
colorSpace: this.CanvasKit.ColorSpace.SRGB,
|
23
|
+
},
|
24
|
+
pixelPtr,
|
25
|
+
width * 4
|
26
|
+
);
|
15
27
|
if (!surface) {
|
16
28
|
return null;
|
17
29
|
}
|
18
|
-
|
30
|
+
surface.getCanvas().clear(this.CanvasKit.TRANSPARENT);
|
31
|
+
return new JsiSkSurface(this.CanvasKit, surface, () => {
|
32
|
+
this.CanvasKit.Free(pixelPtr);
|
33
|
+
});
|
19
34
|
}
|
20
35
|
|
21
36
|
MakeOffscreen(width: number, height: number) {
|