@nativescript/canvas 2.0.0-alpha.23 → 2.0.0-alpha.25
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/Canvas/common.d.ts +199 -25
- package/Canvas/common.js +624 -489
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.js +19 -9
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.ios.js +13 -12
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.d.ts +0 -1
- package/Canvas2D/CanvasRenderingContext2D/index.js +9 -121
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/WebGL/WebGLExtensions/index.d.ts +4 -3
- package/WebGL/WebGLExtensions/index.js +10 -3
- package/WebGL/WebGLExtensions/index.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.d.ts +15 -15
- package/WebGL/WebGLRenderingContext/index.js +15 -277
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.js +0 -86
- package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/canvas-release.aar +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +19 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +1035 -83
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +4 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +19 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +1035 -83
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +1035 -83
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +24 -24
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +13 -62
- package/platforms/ios/src/cpp/ImageBitmapImpl.h +15 -3
- package/platforms/ios/src/cpp/OneByteStringResource.cpp +26 -2
- package/platforms/ios/src/cpp/OneByteStringResource.h +14 -3
- package/platforms/ios/src/cpp/TextDecoderImpl.cpp +8 -9
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +257 -268
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +8 -2
- package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +72 -94
- package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.cpp +2 -2
- package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.h +4 -3
- package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.cpp +1 -5
- package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.h +5 -5
- package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +103 -113
|
@@ -10,6 +10,7 @@ import GLKit
|
|
|
10
10
|
import OpenGLES
|
|
11
11
|
import Swift
|
|
12
12
|
import UIKit
|
|
13
|
+
import WebKit
|
|
13
14
|
import _Concurrency
|
|
14
15
|
import _StringProcessing
|
|
15
16
|
@objc(NSCCanvasListener) public protocol NSCCanvasListener {
|
|
@@ -75,6 +76,7 @@ import _StringProcessing
|
|
|
75
76
|
@_Concurrency.MainActor(unsafe) public func render() -> Swift.Bool
|
|
76
77
|
@objc @_Concurrency.MainActor(unsafe) public func context2DTest(_ context: Swift.Int64)
|
|
77
78
|
@objc @_Concurrency.MainActor(unsafe) public func context2DTestToDataURL(_ context: Swift.Int64) -> Swift.String
|
|
79
|
+
@objc @_Concurrency.MainActor(unsafe) public var touchEventListener: ((Swift.String, UIKit.UIGestureRecognizer) -> Swift.Void)?
|
|
78
80
|
@_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreFoundation.CGRect)
|
|
79
81
|
@objc @_Concurrency.MainActor(unsafe) public func setListener(_ listener: (any CanvasNative.NSCCanvasListener)?)
|
|
80
82
|
@_Concurrency.MainActor(unsafe) @objc override dynamic public func layoutSubviews()
|
|
@@ -10,6 +10,7 @@ import GLKit
|
|
|
10
10
|
import OpenGLES
|
|
11
11
|
import Swift
|
|
12
12
|
import UIKit
|
|
13
|
+
import WebKit
|
|
13
14
|
import _Concurrency
|
|
14
15
|
import _StringProcessing
|
|
15
16
|
@objc(NSCCanvasListener) public protocol NSCCanvasListener {
|
|
@@ -75,6 +76,7 @@ import _StringProcessing
|
|
|
75
76
|
@_Concurrency.MainActor(unsafe) public func render() -> Swift.Bool
|
|
76
77
|
@objc @_Concurrency.MainActor(unsafe) public func context2DTest(_ context: Swift.Int64)
|
|
77
78
|
@objc @_Concurrency.MainActor(unsafe) public func context2DTestToDataURL(_ context: Swift.Int64) -> Swift.String
|
|
79
|
+
@objc @_Concurrency.MainActor(unsafe) public var touchEventListener: ((Swift.String, UIKit.UIGestureRecognizer) -> Swift.Void)?
|
|
78
80
|
@_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreFoundation.CGRect)
|
|
79
81
|
@objc @_Concurrency.MainActor(unsafe) public func setListener(_ listener: (any CanvasNative.NSCCanvasListener)?)
|
|
80
82
|
@_Concurrency.MainActor(unsafe) @objc override dynamic public func layoutSubviews()
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Headers/CanvasNative-Swift.h</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
jBOElM+jdlIX0KyletM2kVHDEyA=
|
|
10
10
|
</data>
|
|
11
11
|
<key>Headers/CanvasNative.h</key>
|
|
12
12
|
<data>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</data>
|
|
19
19
|
<key>Headers/canvas_native.h</key>
|
|
20
20
|
<data>
|
|
21
|
-
|
|
21
|
+
0JjcreRw0wOPRjXB8+82Lb40u0s=
|
|
22
22
|
</data>
|
|
23
23
|
<key>Info.plist</key>
|
|
24
24
|
<data>
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
</data>
|
|
27
27
|
<key>Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo</key>
|
|
28
28
|
<data>
|
|
29
|
-
|
|
29
|
+
3Kc4otquL0KPSV5dFXqL2IxOC34=
|
|
30
30
|
</data>
|
|
31
31
|
<key>Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key>
|
|
32
32
|
<data>
|
|
33
|
-
|
|
33
|
+
RHn8aO+9BfgF2nhok70XTkh6yV8=
|
|
34
34
|
</data>
|
|
35
35
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
36
36
|
<data>
|
|
37
|
-
|
|
37
|
+
gw9C2PHsEzwxqSPCYQqiUPRuxGo=
|
|
38
38
|
</data>
|
|
39
39
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
40
40
|
<data>
|
|
41
|
-
|
|
41
|
+
8CpdKtWaXRIZ0Mt3B9N22LcdcCA=
|
|
42
42
|
</data>
|
|
43
43
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
44
44
|
<data>
|
|
@@ -46,19 +46,19 @@
|
|
|
46
46
|
</data>
|
|
47
47
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
48
48
|
<data>
|
|
49
|
-
|
|
49
|
+
8CpdKtWaXRIZ0Mt3B9N22LcdcCA=
|
|
50
50
|
</data>
|
|
51
51
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
52
52
|
<data>
|
|
53
|
-
|
|
53
|
+
4stDgW5zGl0sCT6AtIibk5cZuG4=
|
|
54
54
|
</data>
|
|
55
55
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
56
56
|
<data>
|
|
57
|
-
|
|
57
|
+
gw9C2PHsEzwxqSPCYQqiUPRuxGo=
|
|
58
58
|
</data>
|
|
59
59
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
60
60
|
<data>
|
|
61
|
-
|
|
61
|
+
LKgkDnlIui/KO7HrzvFsIOCGGOU=
|
|
62
62
|
</data>
|
|
63
63
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
64
64
|
<data>
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
</data>
|
|
67
67
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
68
68
|
<data>
|
|
69
|
-
|
|
69
|
+
LKgkDnlIui/KO7HrzvFsIOCGGOU=
|
|
70
70
|
</data>
|
|
71
71
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
72
72
|
<data>
|
|
73
|
-
|
|
73
|
+
Vnye8Ktr8zC4WOc7PhaANB9z4Ek=
|
|
74
74
|
</data>
|
|
75
75
|
<key>Modules/module.modulemap</key>
|
|
76
76
|
<data>
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
<dict>
|
|
88
88
|
<key>hash2</key>
|
|
89
89
|
<data>
|
|
90
|
-
|
|
90
|
+
K0l9y/j8HRX0lG/sTxVBwtoZTXSR+GKUmOMTuO5rfYI=
|
|
91
91
|
</data>
|
|
92
92
|
</dict>
|
|
93
93
|
<key>Headers/CanvasNative.h</key>
|
|
@@ -108,35 +108,35 @@
|
|
|
108
108
|
<dict>
|
|
109
109
|
<key>hash2</key>
|
|
110
110
|
<data>
|
|
111
|
-
|
|
111
|
+
zWqFhnejCTn0DtFssxe5T9TrSIbwRJEpJPfV/T1dtK0=
|
|
112
112
|
</data>
|
|
113
113
|
</dict>
|
|
114
114
|
<key>Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo</key>
|
|
115
115
|
<dict>
|
|
116
116
|
<key>hash2</key>
|
|
117
117
|
<data>
|
|
118
|
-
|
|
118
|
+
c1Z8MNIbhelklIkhG59n31ahdFEVjSW9rF6Kj1XtKT4=
|
|
119
119
|
</data>
|
|
120
120
|
</dict>
|
|
121
121
|
<key>Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key>
|
|
122
122
|
<dict>
|
|
123
123
|
<key>hash2</key>
|
|
124
124
|
<data>
|
|
125
|
-
|
|
125
|
+
Ug4eFaEMW/gKLMvWCht7Y6rzE5p21gBiD7ahdYuFwKs=
|
|
126
126
|
</data>
|
|
127
127
|
</dict>
|
|
128
128
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
129
129
|
<dict>
|
|
130
130
|
<key>hash2</key>
|
|
131
131
|
<data>
|
|
132
|
-
|
|
132
|
+
ZBub4yj+4HOe9+wZz/hu40urzvQAbvP5q7S/peQLoYo=
|
|
133
133
|
</data>
|
|
134
134
|
</dict>
|
|
135
135
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
136
136
|
<dict>
|
|
137
137
|
<key>hash2</key>
|
|
138
138
|
<data>
|
|
139
|
-
|
|
139
|
+
G8hvx62UwxyH3+RfdPMzA7CcH5+gJETa0eOp+HaboV4=
|
|
140
140
|
</data>
|
|
141
141
|
</dict>
|
|
142
142
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
@@ -150,28 +150,28 @@
|
|
|
150
150
|
<dict>
|
|
151
151
|
<key>hash2</key>
|
|
152
152
|
<data>
|
|
153
|
-
|
|
153
|
+
G8hvx62UwxyH3+RfdPMzA7CcH5+gJETa0eOp+HaboV4=
|
|
154
154
|
</data>
|
|
155
155
|
</dict>
|
|
156
156
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
157
157
|
<dict>
|
|
158
158
|
<key>hash2</key>
|
|
159
159
|
<data>
|
|
160
|
-
|
|
160
|
+
k3DzwzFOeqHIpIHBgLAo2XkLrwVZTd4lAMh/IELRLKg=
|
|
161
161
|
</data>
|
|
162
162
|
</dict>
|
|
163
163
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
164
164
|
<dict>
|
|
165
165
|
<key>hash2</key>
|
|
166
166
|
<data>
|
|
167
|
-
|
|
167
|
+
ZBub4yj+4HOe9+wZz/hu40urzvQAbvP5q7S/peQLoYo=
|
|
168
168
|
</data>
|
|
169
169
|
</dict>
|
|
170
170
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
171
171
|
<dict>
|
|
172
172
|
<key>hash2</key>
|
|
173
173
|
<data>
|
|
174
|
-
|
|
174
|
+
V8ldmwmeuG48TOf6ONRVDNKgln5igjJ4WEQzSgO76jY=
|
|
175
175
|
</data>
|
|
176
176
|
</dict>
|
|
177
177
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
@@ -185,14 +185,14 @@
|
|
|
185
185
|
<dict>
|
|
186
186
|
<key>hash2</key>
|
|
187
187
|
<data>
|
|
188
|
-
|
|
188
|
+
V8ldmwmeuG48TOf6ONRVDNKgln5igjJ4WEQzSgO76jY=
|
|
189
189
|
</data>
|
|
190
190
|
</dict>
|
|
191
191
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
192
192
|
<dict>
|
|
193
193
|
<key>hash2</key>
|
|
194
194
|
<data>
|
|
195
|
-
|
|
195
|
+
DiYhme2U+0pQL+A91zGlJBaDmGtICkHvXN/K2+Cx/jI=
|
|
196
196
|
</data>
|
|
197
197
|
</dict>
|
|
198
198
|
<key>Modules/module.modulemap</key>
|
|
Binary file
|
|
@@ -193,13 +193,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
193
193
|
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
194
194
|
v8::Context::Scope context_scope(context);
|
|
195
195
|
|
|
196
|
-
auto ret = ImageBitmapImpl::
|
|
197
|
-
context).ToLocalChecked()->NewInstance(
|
|
198
|
-
context).ToLocalChecked();
|
|
199
|
-
|
|
200
|
-
SetNativeType(isolate, ret, NativeType::ImageBitmap);
|
|
201
|
-
|
|
202
|
-
ret->SetInternalField(0, cbData);
|
|
196
|
+
auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
|
|
203
197
|
|
|
204
198
|
v8::Local<v8::Value> args[2];
|
|
205
199
|
|
|
@@ -304,7 +298,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
304
298
|
auto store = arrayBuffer->GetBackingStore();
|
|
305
299
|
auto dataBuffer = (uint8_t *) store->Data();
|
|
306
300
|
v8::Global<v8::ArrayBuffer> ab(isolate, arrayBuffer);
|
|
307
|
-
|
|
301
|
+
|
|
308
302
|
std::thread thread(
|
|
309
303
|
[&dataBuffer, jsi_callback, &options, store, shared_asset, current_queue](
|
|
310
304
|
v8::Global<v8::ArrayBuffer> ab, size_t size
|
|
@@ -325,7 +319,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
325
319
|
|
|
326
320
|
auto main_task = [jsi_callback, current_queue, done]() {
|
|
327
321
|
|
|
328
|
-
|
|
322
|
+
|
|
329
323
|
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
330
324
|
v8::Locker locker(isolate);
|
|
331
325
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
@@ -336,13 +330,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
336
330
|
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
337
331
|
v8::Context::Scope context_scope(context);
|
|
338
332
|
|
|
339
|
-
auto ret = ImageBitmapImpl::
|
|
340
|
-
context).ToLocalChecked()->NewInstance(
|
|
341
|
-
context).ToLocalChecked();
|
|
342
|
-
|
|
343
|
-
SetNativeType(isolate, ret, NativeType::ImageBitmap);
|
|
344
|
-
|
|
345
|
-
ret->SetInternalField(0, cbData);
|
|
333
|
+
auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
|
|
346
334
|
|
|
347
335
|
v8::Local<v8::Value> args[2];
|
|
348
336
|
|
|
@@ -358,7 +346,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
358
346
|
|
|
359
347
|
|
|
360
348
|
callback->Call(context, context->Global(), 2, args);
|
|
361
|
-
|
|
349
|
+
|
|
362
350
|
|
|
363
351
|
delete jsi_callback;
|
|
364
352
|
delete current_queue;
|
|
@@ -415,13 +403,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
415
403
|
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
416
404
|
v8::Context::Scope context_scope(context);
|
|
417
405
|
|
|
418
|
-
|
|
419
|
-
context).ToLocalChecked()->NewInstance(
|
|
420
|
-
context).ToLocalChecked();
|
|
421
|
-
|
|
422
|
-
SetNativeType(isolate, ret, NativeType::ImageBitmap);
|
|
423
|
-
|
|
424
|
-
ret->SetInternalField(0, cbData);
|
|
406
|
+
auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
|
|
425
407
|
|
|
426
408
|
v8::Local<v8::Value> args[2];
|
|
427
409
|
|
|
@@ -489,13 +471,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
489
471
|
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
490
472
|
v8::Context::Scope context_scope(context);
|
|
491
473
|
|
|
492
|
-
auto ret = ImageBitmapImpl::
|
|
493
|
-
context).ToLocalChecked()->NewInstance(
|
|
494
|
-
context).ToLocalChecked();
|
|
495
|
-
|
|
496
|
-
SetNativeType(isolate, ret, NativeType::ImageBitmap);
|
|
497
|
-
|
|
498
|
-
ret->SetInternalField(0, cbData);
|
|
474
|
+
auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
|
|
499
475
|
|
|
500
476
|
v8::Local<v8::Value> args[2];
|
|
501
477
|
|
|
@@ -749,13 +725,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
749
725
|
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
750
726
|
v8::Context::Scope context_scope(context);
|
|
751
727
|
|
|
752
|
-
|
|
753
|
-
context).ToLocalChecked()->NewInstance(
|
|
754
|
-
context).ToLocalChecked();
|
|
755
|
-
|
|
756
|
-
SetNativeType(isolate, ret, NativeType::ImageBitmap);
|
|
757
|
-
|
|
758
|
-
ret->SetInternalField(0, cbData);
|
|
728
|
+
auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
|
|
759
729
|
|
|
760
730
|
v8::Local<v8::Value> args[2];
|
|
761
731
|
|
|
@@ -821,12 +791,8 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
821
791
|
|
|
822
792
|
auto bitmap = new ImageBitmapImpl(ret);
|
|
823
793
|
auto data = v8::External::New(isolate, bitmap);
|
|
824
|
-
auto object = ImageBitmapImpl::GetCtor(isolate)->GetFunction(
|
|
825
|
-
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
826
|
-
|
|
827
|
-
object->SetInternalField(0, data);
|
|
828
794
|
|
|
829
|
-
|
|
795
|
+
auto object = ImageBitmapImpl::NewInstance(isolate, data);
|
|
830
796
|
|
|
831
797
|
retArgs[1] = object;
|
|
832
798
|
}
|
|
@@ -845,12 +811,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
845
811
|
|
|
846
812
|
auto bitmap = new ImageBitmapImpl(ret);
|
|
847
813
|
auto data = v8::External::New(isolate, bitmap);
|
|
848
|
-
auto object = ImageBitmapImpl::
|
|
849
|
-
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
850
|
-
|
|
851
|
-
object->SetInternalField(0, data);
|
|
852
|
-
|
|
853
|
-
SetNativeType(isolate, object, NativeType::ImageBitmap);
|
|
814
|
+
auto object = ImageBitmapImpl::NewInstance(isolate, data);
|
|
854
815
|
|
|
855
816
|
retArgs[1] = object;
|
|
856
817
|
|
|
@@ -892,12 +853,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
892
853
|
|
|
893
854
|
auto bitmap = new ImageBitmapImpl(ret);
|
|
894
855
|
auto data = v8::External::New(isolate, bitmap);
|
|
895
|
-
auto object = ImageBitmapImpl::
|
|
896
|
-
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
897
|
-
|
|
898
|
-
object->SetInternalField(0, data);
|
|
899
|
-
|
|
900
|
-
SetNativeType(isolate, object, NativeType::ImageBitmap);
|
|
856
|
+
auto object = ImageBitmapImpl::NewInstance(isolate, data);
|
|
901
857
|
|
|
902
858
|
retArgs[1] = object;
|
|
903
859
|
}
|
|
@@ -920,12 +876,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
920
876
|
|
|
921
877
|
auto bitmap = new ImageBitmapImpl(ret);
|
|
922
878
|
auto data = v8::External::New(isolate, bitmap);
|
|
923
|
-
auto object = ImageBitmapImpl::
|
|
924
|
-
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
925
|
-
|
|
926
|
-
object->SetInternalField(0, data);
|
|
927
|
-
|
|
928
|
-
SetNativeType(isolate, object, NativeType::ImageBitmap);
|
|
879
|
+
auto object = ImageBitmapImpl::NewInstance(isolate, data);
|
|
929
880
|
|
|
930
881
|
retArgs[1] = object;
|
|
931
882
|
|
|
@@ -1130,7 +1081,7 @@ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
1130
1081
|
|
|
1131
1082
|
|
|
1132
1083
|
auto buf = (void*)canvas_native_u8_buffer_get_bytes_mut(vec);
|
|
1133
|
-
|
|
1084
|
+
|
|
1134
1085
|
auto size = (size_t)canvas_native_u8_buffer_get_length(vec);
|
|
1135
1086
|
|
|
1136
1087
|
auto store = v8::ArrayBuffer::NewBackingStore(buf, size,
|
|
@@ -20,12 +20,24 @@ struct Options {
|
|
|
20
20
|
|
|
21
21
|
class ImageBitmapImpl {
|
|
22
22
|
public:
|
|
23
|
-
ImageBitmapImpl(ImageAsset*
|
|
23
|
+
ImageBitmapImpl(ImageAsset *asset);
|
|
24
|
+
|
|
24
25
|
~ImageBitmapImpl();
|
|
25
26
|
|
|
27
|
+
|
|
28
|
+
static v8::Local<v8::Object> NewInstance(v8::Isolate *isolate, v8::Local<v8::External> asset) {
|
|
29
|
+
auto context = isolate->GetCurrentContext();
|
|
30
|
+
v8::EscapableHandleScope scope(isolate);
|
|
31
|
+
auto object = ImageBitmapImpl::GetCtor(isolate)->GetFunction(
|
|
32
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
33
|
+
SetNativeType(isolate, object, NativeType::ImageBitmap);
|
|
34
|
+
object->SetInternalField(0, asset);
|
|
35
|
+
return scope.Escape(object);
|
|
36
|
+
}
|
|
37
|
+
|
|
26
38
|
static Options HandleOptions(v8::Isolate *isolate, const v8::Local<v8::Value> &options);
|
|
27
39
|
|
|
28
|
-
ImageAsset*
|
|
40
|
+
ImageAsset *GetImageAsset();
|
|
29
41
|
|
|
30
42
|
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
31
43
|
|
|
@@ -42,6 +54,6 @@ public:
|
|
|
42
54
|
static void Close(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
43
55
|
|
|
44
56
|
private:
|
|
45
|
-
ImageAsset*
|
|
57
|
+
ImageAsset *bitmap_;
|
|
46
58
|
bool closed_ = false;
|
|
47
59
|
};
|
|
@@ -9,9 +9,32 @@ OneByteStringResource::OneByteStringResource(char *string) : string_(string),
|
|
|
9
9
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
OneByteStringResource::OneByteStringResource(U8Buffer *buffer) : buffer_(buffer) {
|
|
13
|
+
string_ = (char *) canvas_native_u8_buffer_get_bytes(buffer);
|
|
14
|
+
length_ = canvas_native_u8_buffer_get_length(buffer);
|
|
15
|
+
usingBuffer_ = true;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
OneByteStringResource::OneByteStringResource(CCow *cow) : cow_(cow) {
|
|
19
|
+
string_ = (char *) canvas_native_ccow_get_bytes(cow);
|
|
20
|
+
length_ = canvas_native_ccow_get_length(cow);
|
|
21
|
+
usingCow_ = true;
|
|
22
|
+
}
|
|
23
|
+
|
|
12
24
|
OneByteStringResource::~OneByteStringResource() {
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
if (usingBuffer_) {
|
|
26
|
+
canvas_native_u8_buffer_destroy(buffer_);
|
|
27
|
+
this->string_ = nullptr;
|
|
28
|
+
this->length_ = 0;
|
|
29
|
+
}else if(usingCow_){
|
|
30
|
+
canvas_native_ccow_destroy(cow_);
|
|
31
|
+
this->string_ = nullptr;
|
|
32
|
+
this->length_ = 0;
|
|
33
|
+
} else {
|
|
34
|
+
canvas_native_string_destroy((char *) this->string_);
|
|
35
|
+
this->string_ = nullptr;
|
|
36
|
+
this->length_ = 0;
|
|
37
|
+
}
|
|
15
38
|
}
|
|
16
39
|
|
|
17
40
|
const char *OneByteStringResource::data() const {
|
|
@@ -23,3 +46,4 @@ size_t OneByteStringResource::length() const {
|
|
|
23
46
|
}
|
|
24
47
|
|
|
25
48
|
|
|
49
|
+
|
|
@@ -3,19 +3,30 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
#pragma once
|
|
6
|
+
|
|
6
7
|
#include "Common.h"
|
|
7
8
|
|
|
8
9
|
class OneByteStringResource : public v8::String::ExternalOneByteStringResource {
|
|
9
10
|
public:
|
|
10
|
-
OneByteStringResource(char*
|
|
11
|
+
OneByteStringResource(char *string);
|
|
12
|
+
|
|
13
|
+
OneByteStringResource(U8Buffer *buffer);
|
|
11
14
|
|
|
15
|
+
OneByteStringResource(CCow *cow);
|
|
16
|
+
|
|
12
17
|
~OneByteStringResource();
|
|
13
18
|
|
|
14
|
-
const char*
|
|
19
|
+
const char *data() const override;
|
|
20
|
+
|
|
15
21
|
size_t length() const override;
|
|
16
22
|
|
|
17
23
|
private:
|
|
18
|
-
const char*
|
|
24
|
+
const char *string_;
|
|
19
25
|
size_t length_;
|
|
26
|
+
U8Buffer *buffer_ = nullptr;
|
|
27
|
+
CCow *cow_ = nullptr;
|
|
28
|
+
// todo enum
|
|
29
|
+
bool usingBuffer_ = false;
|
|
30
|
+
bool usingCow_ = false;
|
|
20
31
|
};
|
|
21
32
|
|
|
@@ -109,7 +109,6 @@ void TextDecoderImpl::Decode(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
auto isolate = args.GetIsolate();
|
|
112
|
-
auto context = isolate->GetCurrentContext();
|
|
113
112
|
|
|
114
113
|
if (args.Length() == 1) {
|
|
115
114
|
auto value = args[0];
|
|
@@ -146,13 +145,13 @@ void TextDecoderImpl::Decode(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
146
145
|
if (buf->IsArrayBufferView()) {
|
|
147
146
|
|
|
148
147
|
auto buffer = buf.As<v8::ArrayBufferView>();
|
|
149
|
-
|
|
148
|
+
|
|
150
149
|
|
|
151
150
|
auto store = buffer->Buffer()->GetBackingStore();
|
|
152
151
|
auto buffer_data = static_cast<uint8_t *>(store->Data()) + buffer->ByteOffset();
|
|
153
|
-
|
|
152
|
+
|
|
154
153
|
auto len = buffer->ByteLength();
|
|
155
|
-
|
|
154
|
+
|
|
156
155
|
// v8::Local<v8::Value> size;
|
|
157
156
|
//
|
|
158
157
|
// buf->Get(context, ConvertToV8String(isolate, "BYTES_PER_ELEMENT")).ToLocal(&size);
|
|
@@ -162,16 +161,16 @@ void TextDecoderImpl::Decode(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
162
161
|
// if(!size.IsEmpty()){
|
|
163
162
|
// len = buffer->Length() * (size_t)size->NumberValue(context).FromMaybe(0);
|
|
164
163
|
// }
|
|
165
|
-
|
|
164
|
+
|
|
166
165
|
// auto len = buffer->ByteLength();
|
|
167
|
-
|
|
168
|
-
auto decoded =
|
|
166
|
+
|
|
167
|
+
auto decoded = canvas_native_text_decoder_decode_as_cow(
|
|
169
168
|
ptr->GetTextDecoder(),
|
|
170
169
|
buffer_data, len);
|
|
171
|
-
|
|
170
|
+
|
|
172
171
|
|
|
173
172
|
// args.GetReturnValue().Set(ConvertToV8String(isolate, decoded.c_str()));
|
|
174
|
-
auto returnValue = new OneByteStringResource(
|
|
173
|
+
auto returnValue = new OneByteStringResource(decoded);
|
|
175
174
|
auto ret = v8::String::NewExternalOneByte(isolate, returnValue);
|
|
176
175
|
args.GetReturnValue().Set(ret.ToLocalChecked());
|
|
177
176
|
return;
|