@shopify/react-native-skia 0.1.175 → 0.1.176
Sign up to get free protection for your applications and to get access to all the features.
- package/android/build.gradle +2 -1
- package/cpp/rnskia/RNSkJsView.cpp +1 -1
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +12 -8
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +8 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +8 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/Info.plist +5 -5
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libsksg.xcframework/Info.plist +5 -5
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/react-native-skia.podspec +7 -26
- package/src/skia/web/JsiSkSurfaceFactory.ts +6 -3
package/android/build.gradle
CHANGED
@@ -266,8 +266,9 @@ task extractJNIFiles {
|
|
266
266
|
extractJNIFiles.mustRunAfter extractAARHeaders
|
267
267
|
|
268
268
|
if (ENABLE_PREFAB) {
|
269
|
+
// Package everything with the original file structure
|
269
270
|
task prepareHeaders(type: Copy) {
|
270
|
-
from
|
271
|
+
from('./cpp')
|
271
272
|
into "${project.buildDir}/headers/rnskia/"
|
272
273
|
includeEmptyDirs = false
|
273
274
|
}
|
@@ -8,7 +8,7 @@ RNSkJsRenderer::RNSkJsRenderer(std::function<void()> requestRedraw,
|
|
8
8
|
std::shared_ptr<RNSkPlatformContext> context)
|
9
9
|
: RNSkRenderer(requestRedraw),
|
10
10
|
_jsiCanvas(std::make_shared<JsiSkCanvas>(context)),
|
11
|
-
_platformContext(
|
11
|
+
_platformContext(context),
|
12
12
|
_infoObject(std::make_shared<RNSkInfoObject>()),
|
13
13
|
_jsDrawingLock(std::make_shared<std::timed_mutex>()),
|
14
14
|
_gpuDrawingLock(std::make_shared<std::timed_mutex>()),
|
@@ -73,14 +73,18 @@ void RNSkMetalCanvasProvider::renderToCanvas(
|
|
73
73
|
// background or inactive. This will cause an error that might clear the
|
74
74
|
// CAMetalLayer so that the canvas is empty when the app receives focus again.
|
75
75
|
// Reference: https://github.com/Shopify/react-native-skia/issues/1257
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
76
|
+
// NOTE: UIApplication.sharedApplication.applicationState can only be
|
77
|
+
// accessed from the main thread so we need to check here.
|
78
|
+
if ([[NSThread currentThread] isMainThread]) {
|
79
|
+
auto state = UIApplication.sharedApplication.applicationState;
|
80
|
+
if (state == UIApplicationStateBackground ||
|
81
|
+
state == UIApplicationStateInactive) {
|
82
|
+
// Request a redraw in the next run loop callback
|
83
|
+
_requestRedraw();
|
84
|
+
// and don't draw now since it might cause errors in the metal renderer if
|
85
|
+
// we try to render while in the background. (see above issue)
|
86
|
+
return;
|
87
|
+
}
|
84
88
|
}
|
85
89
|
|
86
90
|
// Get render context for current thread
|
@@ -34,7 +34,14 @@ class JsiSkSurfaceFactory extends _Host.Host {
|
|
34
34
|
surface = this.CanvasKit.MakeSurface(width, height);
|
35
35
|
} else {
|
36
36
|
const offscreen = new OC(width, height);
|
37
|
-
|
37
|
+
const webglContext = this.CanvasKit.GetWebGLContext(offscreen);
|
38
|
+
const grContext = this.CanvasKit.MakeWebGLContext(webglContext);
|
39
|
+
|
40
|
+
if (!grContext) {
|
41
|
+
throw new Error("Could not make a graphics context");
|
42
|
+
}
|
43
|
+
|
44
|
+
surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);
|
38
45
|
}
|
39
46
|
|
40
47
|
if (!surface) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkSurfaceFactory","Host","constructor","CanvasKit","Make","width","height","surface","MakeSurface","JsiSkSurface","MakeOffscreen","OC","globalThis","OffscreenCanvas","undefined","offscreen","
|
1
|
+
{"version":3,"names":["JsiSkSurfaceFactory","Host","constructor","CanvasKit","Make","width","height","surface","MakeSurface","JsiSkSurface","MakeOffscreen","OC","globalThis","OffscreenCanvas","undefined","offscreen","webglContext","GetWebGLContext","grContext","MakeWebGLContext","Error","MakeRenderTarget"],"sources":["JsiSkSurfaceFactory.ts"],"sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { SurfaceFactory } from \"../types\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkSurface } from \"./JsiSkSurface\";\n\nexport class JsiSkSurfaceFactory extends Host implements SurfaceFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n Make(width: number, height: number) {\n const surface = this.CanvasKit.MakeSurface(width, height);\n if (!surface) {\n return null;\n }\n return new JsiSkSurface(this.CanvasKit, surface);\n }\n\n MakeOffscreen(width: number, height: number) {\n // OffscreenCanvas may be unvailable in some environments.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const OC = (globalThis as any).OffscreenCanvas;\n let surface: Surface | null;\n if (OC === undefined) {\n surface = this.CanvasKit.MakeSurface(width, height);\n } else {\n const offscreen = new OC(width, height);\n const webglContext = this.CanvasKit.GetWebGLContext(offscreen);\n const grContext = this.CanvasKit.MakeWebGLContext(webglContext);\n if (!grContext) {\n throw new Error(\"Could not make a graphics context\");\n }\n surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);\n }\n if (!surface) {\n return null;\n }\n return new JsiSkSurface(this.CanvasKit, surface);\n }\n}\n"],"mappings":";;;;;;;AAIA;;AACA;;AAEO,MAAMA,mBAAN,SAAkCC,UAAlC,CAAiE;EACtEC,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,IAAI,CAACC,KAAD,EAAgBC,MAAhB,EAAgC;IAClC,MAAMC,OAAO,GAAG,KAAKJ,SAAL,CAAeK,WAAf,CAA2BH,KAA3B,EAAkCC,MAAlC,CAAhB;;IACA,IAAI,CAACC,OAAL,EAAc;MACZ,OAAO,IAAP;IACD;;IACD,OAAO,IAAIE,0BAAJ,CAAiB,KAAKN,SAAtB,EAAiCI,OAAjC,CAAP;EACD;;EAEDG,aAAa,CAACL,KAAD,EAAgBC,MAAhB,EAAgC;IAC3C;IACA;IACA,MAAMK,EAAE,GAAIC,UAAD,CAAoBC,eAA/B;IACA,IAAIN,OAAJ;;IACA,IAAII,EAAE,KAAKG,SAAX,EAAsB;MACpBP,OAAO,GAAG,KAAKJ,SAAL,CAAeK,WAAf,CAA2BH,KAA3B,EAAkCC,MAAlC,CAAV;IACD,CAFD,MAEO;MACL,MAAMS,SAAS,GAAG,IAAIJ,EAAJ,CAAON,KAAP,EAAcC,MAAd,CAAlB;MACA,MAAMU,YAAY,GAAG,KAAKb,SAAL,CAAec,eAAf,CAA+BF,SAA/B,CAArB;MACA,MAAMG,SAAS,GAAG,KAAKf,SAAL,CAAegB,gBAAf,CAAgCH,YAAhC,CAAlB;;MACA,IAAI,CAACE,SAAL,EAAgB;QACd,MAAM,IAAIE,KAAJ,CAAU,mCAAV,CAAN;MACD;;MACDb,OAAO,GAAG,KAAKJ,SAAL,CAAekB,gBAAf,CAAgCH,SAAhC,EAA2Cb,KAA3C,EAAkDC,MAAlD,CAAV;IACD;;IACD,IAAI,CAACC,OAAL,EAAc;MACZ,OAAO,IAAP;IACD;;IACD,OAAO,IAAIE,0BAAJ,CAAiB,KAAKN,SAAtB,EAAiCI,OAAjC,CAAP;EACD;;AAjCqE"}
|
@@ -25,7 +25,14 @@ export class JsiSkSurfaceFactory extends Host {
|
|
25
25
|
surface = this.CanvasKit.MakeSurface(width, height);
|
26
26
|
} else {
|
27
27
|
const offscreen = new OC(width, height);
|
28
|
-
|
28
|
+
const webglContext = this.CanvasKit.GetWebGLContext(offscreen);
|
29
|
+
const grContext = this.CanvasKit.MakeWebGLContext(webglContext);
|
30
|
+
|
31
|
+
if (!grContext) {
|
32
|
+
throw new Error("Could not make a graphics context");
|
33
|
+
}
|
34
|
+
|
35
|
+
surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);
|
29
36
|
}
|
30
37
|
|
31
38
|
if (!surface) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Host","JsiSkSurface","JsiSkSurfaceFactory","constructor","CanvasKit","Make","width","height","surface","MakeSurface","MakeOffscreen","OC","globalThis","OffscreenCanvas","undefined","offscreen","
|
1
|
+
{"version":3,"names":["Host","JsiSkSurface","JsiSkSurfaceFactory","constructor","CanvasKit","Make","width","height","surface","MakeSurface","MakeOffscreen","OC","globalThis","OffscreenCanvas","undefined","offscreen","webglContext","GetWebGLContext","grContext","MakeWebGLContext","Error","MakeRenderTarget"],"sources":["JsiSkSurfaceFactory.ts"],"sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { SurfaceFactory } from \"../types\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkSurface } from \"./JsiSkSurface\";\n\nexport class JsiSkSurfaceFactory extends Host implements SurfaceFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n Make(width: number, height: number) {\n const surface = this.CanvasKit.MakeSurface(width, height);\n if (!surface) {\n return null;\n }\n return new JsiSkSurface(this.CanvasKit, surface);\n }\n\n MakeOffscreen(width: number, height: number) {\n // OffscreenCanvas may be unvailable in some environments.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const OC = (globalThis as any).OffscreenCanvas;\n let surface: Surface | null;\n if (OC === undefined) {\n surface = this.CanvasKit.MakeSurface(width, height);\n } else {\n const offscreen = new OC(width, height);\n const webglContext = this.CanvasKit.GetWebGLContext(offscreen);\n const grContext = this.CanvasKit.MakeWebGLContext(webglContext);\n if (!grContext) {\n throw new Error(\"Could not make a graphics context\");\n }\n surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);\n }\n if (!surface) {\n return null;\n }\n return new JsiSkSurface(this.CanvasKit, surface);\n }\n}\n"],"mappings":"AAIA,SAASA,IAAT,QAAqB,QAArB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,OAAO,MAAMC,mBAAN,SAAkCF,IAAlC,CAAiE;EACtEG,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,IAAI,CAACC,KAAD,EAAgBC,MAAhB,EAAgC;IAClC,MAAMC,OAAO,GAAG,KAAKJ,SAAL,CAAeK,WAAf,CAA2BH,KAA3B,EAAkCC,MAAlC,CAAhB;;IACA,IAAI,CAACC,OAAL,EAAc;MACZ,OAAO,IAAP;IACD;;IACD,OAAO,IAAIP,YAAJ,CAAiB,KAAKG,SAAtB,EAAiCI,OAAjC,CAAP;EACD;;EAEDE,aAAa,CAACJ,KAAD,EAAgBC,MAAhB,EAAgC;IAC3C;IACA;IACA,MAAMI,EAAE,GAAIC,UAAD,CAAoBC,eAA/B;IACA,IAAIL,OAAJ;;IACA,IAAIG,EAAE,KAAKG,SAAX,EAAsB;MACpBN,OAAO,GAAG,KAAKJ,SAAL,CAAeK,WAAf,CAA2BH,KAA3B,EAAkCC,MAAlC,CAAV;IACD,CAFD,MAEO;MACL,MAAMQ,SAAS,GAAG,IAAIJ,EAAJ,CAAOL,KAAP,EAAcC,MAAd,CAAlB;MACA,MAAMS,YAAY,GAAG,KAAKZ,SAAL,CAAea,eAAf,CAA+BF,SAA/B,CAArB;MACA,MAAMG,SAAS,GAAG,KAAKd,SAAL,CAAee,gBAAf,CAAgCH,YAAhC,CAAlB;;MACA,IAAI,CAACE,SAAL,EAAgB;QACd,MAAM,IAAIE,KAAJ,CAAU,mCAAV,CAAN;MACD;;MACDZ,OAAO,GAAG,KAAKJ,SAAL,CAAeiB,gBAAf,CAAgCH,SAAhC,EAA2CZ,KAA3C,EAAkDC,MAAlD,CAAV;IACD;;IACD,IAAI,CAACC,OAAL,EAAc;MACZ,OAAO,IAAP;IACD;;IACD,OAAO,IAAIP,YAAJ,CAAiB,KAAKG,SAAtB,EAAiCI,OAAjC,CAAP;EACD;;AAjCqE"}
|
@@ -6,32 +6,32 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>LibraryIdentifier</key>
|
9
|
-
<string>ios-
|
9
|
+
<string>ios-arm64_arm64e</string>
|
10
10
|
<key>LibraryPath</key>
|
11
11
|
<string>libskia.a</string>
|
12
12
|
<key>SupportedArchitectures</key>
|
13
13
|
<array>
|
14
14
|
<string>arm64</string>
|
15
15
|
<string>arm64e</string>
|
16
|
-
<string>x86_64</string>
|
17
16
|
</array>
|
18
17
|
<key>SupportedPlatform</key>
|
19
18
|
<string>ios</string>
|
20
|
-
<key>SupportedPlatformVariant</key>
|
21
|
-
<string>simulator</string>
|
22
19
|
</dict>
|
23
20
|
<dict>
|
24
21
|
<key>LibraryIdentifier</key>
|
25
|
-
<string>ios-
|
22
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
26
23
|
<key>LibraryPath</key>
|
27
24
|
<string>libskia.a</string>
|
28
25
|
<key>SupportedArchitectures</key>
|
29
26
|
<array>
|
30
27
|
<string>arm64</string>
|
31
28
|
<string>arm64e</string>
|
29
|
+
<string>x86_64</string>
|
32
30
|
</array>
|
33
31
|
<key>SupportedPlatform</key>
|
34
32
|
<string>ios</string>
|
33
|
+
<key>SupportedPlatformVariant</key>
|
34
|
+
<string>simulator</string>
|
35
35
|
</dict>
|
36
36
|
</array>
|
37
37
|
<key>CFBundlePackageType</key>
|
Binary file
|
Binary file
|
@@ -6,32 +6,32 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>LibraryIdentifier</key>
|
9
|
-
<string>ios-
|
9
|
+
<string>ios-arm64_arm64e</string>
|
10
10
|
<key>LibraryPath</key>
|
11
11
|
<string>libskottie.a</string>
|
12
12
|
<key>SupportedArchitectures</key>
|
13
13
|
<array>
|
14
14
|
<string>arm64</string>
|
15
15
|
<string>arm64e</string>
|
16
|
-
<string>x86_64</string>
|
17
16
|
</array>
|
18
17
|
<key>SupportedPlatform</key>
|
19
18
|
<string>ios</string>
|
20
|
-
<key>SupportedPlatformVariant</key>
|
21
|
-
<string>simulator</string>
|
22
19
|
</dict>
|
23
20
|
<dict>
|
24
21
|
<key>LibraryIdentifier</key>
|
25
|
-
<string>ios-
|
22
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
26
23
|
<key>LibraryPath</key>
|
27
24
|
<string>libskottie.a</string>
|
28
25
|
<key>SupportedArchitectures</key>
|
29
26
|
<array>
|
30
27
|
<string>arm64</string>
|
31
28
|
<string>arm64e</string>
|
29
|
+
<string>x86_64</string>
|
32
30
|
</array>
|
33
31
|
<key>SupportedPlatform</key>
|
34
32
|
<string>ios</string>
|
33
|
+
<key>SupportedPlatformVariant</key>
|
34
|
+
<string>simulator</string>
|
35
35
|
</dict>
|
36
36
|
</array>
|
37
37
|
<key>CFBundlePackageType</key>
|
Binary file
|
Binary file
|
@@ -6,32 +6,32 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>LibraryIdentifier</key>
|
9
|
-
<string>ios-
|
9
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
10
10
|
<key>LibraryPath</key>
|
11
11
|
<string>libsksg.a</string>
|
12
12
|
<key>SupportedArchitectures</key>
|
13
13
|
<array>
|
14
14
|
<string>arm64</string>
|
15
15
|
<string>arm64e</string>
|
16
|
+
<string>x86_64</string>
|
16
17
|
</array>
|
17
18
|
<key>SupportedPlatform</key>
|
18
19
|
<string>ios</string>
|
20
|
+
<key>SupportedPlatformVariant</key>
|
21
|
+
<string>simulator</string>
|
19
22
|
</dict>
|
20
23
|
<dict>
|
21
24
|
<key>LibraryIdentifier</key>
|
22
|
-
<string>ios-
|
25
|
+
<string>ios-arm64_arm64e</string>
|
23
26
|
<key>LibraryPath</key>
|
24
27
|
<string>libsksg.a</string>
|
25
28
|
<key>SupportedArchitectures</key>
|
26
29
|
<array>
|
27
30
|
<string>arm64</string>
|
28
31
|
<string>arm64e</string>
|
29
|
-
<string>x86_64</string>
|
30
32
|
</array>
|
31
33
|
<key>SupportedPlatform</key>
|
32
34
|
<string>ios</string>
|
33
|
-
<key>SupportedPlatformVariant</key>
|
34
|
-
<string>simulator</string>
|
35
35
|
</dict>
|
36
36
|
</array>
|
37
37
|
<key>CFBundlePackageType</key>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
package/package.json
CHANGED
@@ -24,7 +24,12 @@ Pod::Spec.new do |s|
|
|
24
24
|
s.pod_target_xcconfig = {
|
25
25
|
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SK_GL=1 SK_METAL=1',
|
26
26
|
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
27
|
-
'DEFINES_MODULE' => 'YES'
|
27
|
+
'DEFINES_MODULE' => 'YES',
|
28
|
+
"HEADER_SEARCH_PATHS" => '"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/" ' +
|
29
|
+
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/api/" ' +
|
30
|
+
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/rnskia/" ' +
|
31
|
+
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/rnskia/dom/" ' +
|
32
|
+
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/skia/"'
|
28
33
|
}
|
29
34
|
|
30
35
|
s.frameworks = 'GLKit', 'MetalKit'
|
@@ -40,33 +45,9 @@ Pod::Spec.new do |s|
|
|
40
45
|
# All iOS cpp/h files
|
41
46
|
s.source_files = [
|
42
47
|
"ios/**/*.{h,c,cc,cpp,m,mm,swift}",
|
48
|
+
"cpp/**/*.{h,cpp}"
|
43
49
|
]
|
44
50
|
|
45
|
-
s.subspec 'SkiaHeaders' do |ss|
|
46
|
-
ss.header_mappings_dir = 'cpp/skia'
|
47
|
-
ss.source_files = "cpp/skia/**/*.{h,cpp}"
|
48
|
-
end
|
49
|
-
|
50
|
-
s.subspec 'Utils' do |ss|
|
51
|
-
ss.header_mappings_dir = 'cpp/utils'
|
52
|
-
ss.source_files = "cpp/utils/**/*.{h,cpp}"
|
53
|
-
end
|
54
|
-
|
55
|
-
s.subspec 'Jsi' do |ss|
|
56
|
-
ss.header_mappings_dir = 'cpp/jsi'
|
57
|
-
ss.source_files = "cpp/jsi/**/*.{h,cpp}"
|
58
|
-
end
|
59
|
-
|
60
|
-
s.subspec 'Api' do |ss|
|
61
|
-
ss.header_mappings_dir = 'cpp/api'
|
62
|
-
ss.source_files = "cpp/api/**/*.{h,cpp}"
|
63
|
-
end
|
64
|
-
|
65
|
-
s.subspec 'RNSkia' do |ss|
|
66
|
-
ss.header_mappings_dir = 'cpp/rnskia'
|
67
|
-
ss.source_files = "cpp/rnskia/**/*.{h,cpp}"
|
68
|
-
end
|
69
|
-
|
70
51
|
s.dependency "React"
|
71
52
|
s.dependency "React-callinvoker"
|
72
53
|
s.dependency "React-Core"
|
@@ -27,9 +27,12 @@ export class JsiSkSurfaceFactory extends Host implements SurfaceFactory {
|
|
27
27
|
surface = this.CanvasKit.MakeSurface(width, height);
|
28
28
|
} else {
|
29
29
|
const offscreen = new OC(width, height);
|
30
|
-
|
31
|
-
|
32
|
-
)
|
30
|
+
const webglContext = this.CanvasKit.GetWebGLContext(offscreen);
|
31
|
+
const grContext = this.CanvasKit.MakeWebGLContext(webglContext);
|
32
|
+
if (!grContext) {
|
33
|
+
throw new Error("Could not make a graphics context");
|
34
|
+
}
|
35
|
+
surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);
|
33
36
|
}
|
34
37
|
if (!surface) {
|
35
38
|
return null;
|