@nativescript/canvas 2.0.0-beta.2 → 2.0.0-beta.20
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 +23 -15
- package/Canvas/common.js +127 -55
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +1 -0
- package/Canvas/index.android.js +53 -88
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +2 -0
- package/Canvas/index.ios.d.ts +4 -1
- package/Canvas/index.ios.js +58 -52
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.d.ts +14 -0
- package/Canvas2D/CanvasRenderingContext2D/index.js +207 -19
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/Canvas2D/DOMMatrix/index.d.ts +14 -0
- package/Canvas2D/DOMMatrix/index.js +62 -0
- package/Canvas2D/DOMMatrix/index.js.map +1 -1
- package/Canvas2D/ImageData/index.js +4 -6
- package/Canvas2D/ImageData/index.js.map +1 -1
- package/Canvas2D/Path2D/index.d.ts +2 -1
- package/Canvas2D/Path2D/index.js +3 -12
- package/Canvas2D/Path2D/index.js.map +1 -1
- package/Dom/Dom.d.ts +20 -1
- package/Dom/Dom.js +78 -10
- package/Dom/Dom.js.map +1 -1
- package/Dom/Group.d.ts +5 -0
- package/Dom/Group.js +15 -0
- package/Dom/Group.js.map +1 -1
- package/Dom/Image.d.ts +1 -0
- package/Dom/Image.js +20 -0
- package/Dom/Image.js.map +1 -1
- package/Dom/Paint.d.ts +4 -0
- package/Dom/Paint.js +19 -7
- package/Dom/Paint.js.map +1 -1
- package/Dom/Shadow.js +9 -0
- package/Dom/Shadow.js.map +1 -1
- package/Dom/Text.js +11 -1
- package/Dom/Text.js.map +1 -1
- package/Dom/index.d.ts +1 -0
- package/Dom/index.js +1 -0
- package/Dom/index.js.map +1 -1
- package/Dom/shaders/Gradients.d.ts +3 -0
- package/Dom/shaders/Gradients.js +4 -0
- package/Dom/shaders/Gradients.js.map +1 -0
- package/Dom/shaders/LinearGradient.d.ts +14 -0
- package/Dom/shaders/LinearGradient.js +44 -0
- package/Dom/shaders/LinearGradient.js.map +1 -0
- package/Dom/shaders/TwoPointConicalGradient.d.ts +16 -0
- package/Dom/shaders/TwoPointConicalGradient.js +60 -0
- package/Dom/shaders/TwoPointConicalGradient.js.map +1 -0
- package/Dom/shaders/index.d.ts +2 -0
- package/Dom/shaders/index.js +3 -0
- package/Dom/shaders/index.js.map +1 -0
- package/Dom/shapes/Atlas.d.ts +22 -0
- package/Dom/shapes/Atlas.js +60 -0
- package/Dom/shapes/Atlas.js.map +1 -0
- package/Dom/shapes/Circle.js +11 -0
- package/Dom/shapes/Circle.js.map +1 -1
- package/Dom/shapes/Line.d.ts +16 -4
- package/Dom/shapes/Line.js +13 -8
- package/Dom/shapes/Line.js.map +1 -1
- package/Dom/shapes/Oval.d.ts +12 -0
- package/Dom/shapes/Oval.js +87 -0
- package/Dom/shapes/Oval.js.map +1 -0
- package/Dom/shapes/Path.d.ts +19 -2
- package/Dom/shapes/Path.js +68 -4
- package/Dom/shapes/Path.js.map +1 -1
- package/Dom/shapes/Points.js +9 -1
- package/Dom/shapes/Points.js.map +1 -1
- package/Dom/shapes/Rect.js +27 -5
- package/Dom/shapes/Rect.js.map +1 -1
- package/Dom/shapes/RoundedRect.d.ts +2 -1
- package/Dom/shapes/RoundedRect.js +13 -2
- package/Dom/shapes/RoundedRect.js.map +1 -1
- package/Dom/shapes/index.d.ts +17 -0
- package/Dom/shapes/index.js +31 -0
- package/Dom/shapes/index.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.d.ts +1 -0
- package/WebGL/WebGLRenderingContext/index.js +104 -14
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.d.ts +1 -0
- package/WebGL2/WebGL2RenderingContext/index.js +2 -3
- package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
- package/index.d.ts +0 -1
- package/index.js +14 -15
- package/index.js.map +1 -1
- package/package.json +1 -4
- package/platforms/android/canvas-release.aar +0 -0
- package/platforms/ios/CanvasNative.xcframework/Info.plist +4 -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 +35 -25
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +50 -4
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +139 -16
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -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 +982 -3319
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +18 -33
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +18 -33
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/module.modulemap +1 -1
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/NSCCanvas.nib +0 -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/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +622 -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 +70 -50
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +50 -4
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +139 -16
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -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 +982 -3319
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +18 -33
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +18 -33
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +982 -3319
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +18 -33
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +18 -33
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/module.modulemap +1 -1
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/NSCCanvas.nib +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +35 -35
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +624 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +624 -0
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +297 -397
- package/platforms/ios/src/cpp/Helpers.h +3 -4
- package/platforms/ios/src/cpp/ImageAssetImpl.cpp +30 -30
- package/platforms/ios/src/cpp/ImageAssetImpl.h +8 -5
- package/platforms/ios/src/cpp/URLImpl.cpp +73 -0
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +339 -33
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +150 -55
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +409 -3
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +27 -0
- package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +19 -48
- package/platforms/ios/src/cpp/canvas2d/Path2D.h +19 -0
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +105 -119
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.cpp +37 -7
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.h +10 -0
- package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +1766 -1659
- package/src-native/ios/NativeScript.podspec +1 -1
- package/SVG/Circle.d.ts +0 -11
- package/SVG/Circle.js +0 -21
- package/SVG/Circle.js.map +0 -1
- package/SVG/ClipPath.d.ts +0 -4
- package/SVG/ClipPath.js +0 -9
- package/SVG/ClipPath.js.map +0 -1
- package/SVG/Defs.d.ts +0 -4
- package/SVG/Defs.js +0 -9
- package/SVG/Defs.js.map +0 -1
- package/SVG/Ellipse.d.ts +0 -13
- package/SVG/Ellipse.js +0 -26
- package/SVG/Ellipse.js.map +0 -1
- package/SVG/G.d.ts +0 -7
- package/SVG/G.js +0 -9
- package/SVG/G.js.map +0 -1
- package/SVG/Image.d.ts +0 -11
- package/SVG/Image.js +0 -40
- package/SVG/Image.js.map +0 -1
- package/SVG/Line.d.ts +0 -13
- package/SVG/Line.js +0 -26
- package/SVG/Line.js.map +0 -1
- package/SVG/LinearGradient.d.ts +0 -10
- package/SVG/LinearGradient.js +0 -13
- package/SVG/LinearGradient.js.map +0 -1
- package/SVG/Path.d.ts +0 -7
- package/SVG/Path.js +0 -14
- package/SVG/Path.js.map +0 -1
- package/SVG/Pattern.d.ts +0 -4
- package/SVG/Pattern.js +0 -9
- package/SVG/Pattern.js.map +0 -1
- package/SVG/Polygon.d.ts +0 -7
- package/SVG/Polygon.js +0 -14
- package/SVG/Polygon.js.map +0 -1
- package/SVG/Polyline.d.ts +0 -7
- package/SVG/Polyline.js +0 -14
- package/SVG/Polyline.js.map +0 -1
- package/SVG/Rect.d.ts +0 -8
- package/SVG/Rect.js +0 -13
- package/SVG/Rect.js.map +0 -1
- package/SVG/SVG.d.ts +0 -31
- package/SVG/SVG.js +0 -190
- package/SVG/SVG.js.map +0 -1
- package/SVG/SVGItem.d.ts +0 -5
- package/SVG/SVGItem.js +0 -8
- package/SVG/SVGItem.js.map +0 -1
- package/SVG/Stop.d.ts +0 -5
- package/SVG/Stop.js +0 -9
- package/SVG/Stop.js.map +0 -1
- package/SVG/Symbol.d.ts +0 -4
- package/SVG/Symbol.js +0 -9
- package/SVG/Symbol.js.map +0 -1
- package/SVG/Text.d.ts +0 -14
- package/SVG/Text.js +0 -26
- package/SVG/Text.js.map +0 -1
- package/SVG/Use.d.ts +0 -4
- package/SVG/Use.js +0 -9
- package/SVG/Use.js.map +0 -1
- package/SVG/index.d.ts +0 -18
- package/SVG/index.js +0 -19
- package/SVG/index.js.map +0 -1
- package/platforms/ios/src/cpp/PerIsolateData.cpp +0 -49
- package/platforms/ios/src/cpp/PerIsolateData.h +0 -54
|
@@ -7,7 +7,121 @@
|
|
|
7
7
|
#include "JSIRuntime.h"
|
|
8
8
|
#include "JSIReadFileCallback.h"
|
|
9
9
|
#include "Helpers.h"
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
struct GLOptions {
|
|
12
|
+
int32_t version;
|
|
13
|
+
bool alpha;
|
|
14
|
+
bool antialias;
|
|
15
|
+
bool depth;
|
|
16
|
+
bool failIfMajorPerformanceCaveat;
|
|
17
|
+
int32_t powerPreference;
|
|
18
|
+
bool premultipliedAlpha;
|
|
19
|
+
bool preserveDrawingBuffer;
|
|
20
|
+
bool stencil;
|
|
21
|
+
bool desynchronized;
|
|
22
|
+
bool xrCompatible;
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
GLOptions() {
|
|
26
|
+
this->version = 0;
|
|
27
|
+
this->alpha = true;
|
|
28
|
+
this->antialias = true;
|
|
29
|
+
this->depth = true;
|
|
30
|
+
this->failIfMajorPerformanceCaveat = false;
|
|
31
|
+
this->powerPreference = 0;
|
|
32
|
+
this->premultipliedAlpha = true;
|
|
33
|
+
this->preserveDrawingBuffer = false;
|
|
34
|
+
this->stencil = false;
|
|
35
|
+
this->desynchronized = false;
|
|
36
|
+
this->xrCompatible = false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void parseGLOptions(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
40
|
+
auto configValue = args[0];
|
|
41
|
+
|
|
42
|
+
if (!(!configValue->IsNullOrUndefined() && configValue->IsObject())) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
auto isolate = args.GetIsolate();
|
|
47
|
+
auto context = isolate->GetCurrentContext();
|
|
48
|
+
auto config = configValue.As<v8::Object>();
|
|
49
|
+
|
|
50
|
+
v8::Local<v8::Value> versionValue;
|
|
51
|
+
|
|
52
|
+
config->Get(context, ConvertToV8String(isolate, "version")).ToLocal(&versionValue);
|
|
53
|
+
|
|
54
|
+
if (!versionValue.IsEmpty() && versionValue->IsInt32()) {
|
|
55
|
+
versionValue->Int32Value(context).To(&this->version);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
v8::Local<v8::Value> alphaValue;
|
|
59
|
+
|
|
60
|
+
config->Get(context, ConvertToV8String(isolate, "alpha")).ToLocal(&alphaValue);
|
|
61
|
+
if (!alphaValue.IsEmpty() && alphaValue->IsBoolean()) {
|
|
62
|
+
this->alpha = alphaValue->BooleanValue(isolate);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
v8::Local<v8::Value> antialiasValue;
|
|
66
|
+
config->Get(context, ConvertToV8String(isolate, "antialias")).ToLocal(
|
|
67
|
+
&antialiasValue);
|
|
68
|
+
if (!antialiasValue.IsEmpty() && antialiasValue->IsBoolean()) {
|
|
69
|
+
this->antialias = antialiasValue->BooleanValue(isolate);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
v8::Local<v8::Value> failIfMajorPerformanceCaveatValue;
|
|
73
|
+
config->Get(context, ConvertToV8String(isolate, "failIfMajorPerformanceCaveat")).ToLocal(
|
|
74
|
+
&failIfMajorPerformanceCaveatValue);
|
|
75
|
+
if (!failIfMajorPerformanceCaveatValue.IsEmpty() &&
|
|
76
|
+
failIfMajorPerformanceCaveatValue->IsBoolean()) {
|
|
77
|
+
this->failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveatValue->BooleanValue(
|
|
78
|
+
isolate);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
v8::Local<v8::Value> powerPreferenceValue;
|
|
82
|
+
config->Get(context, ConvertToV8String(isolate, "powerPreference")).ToLocal(
|
|
83
|
+
&powerPreferenceValue);
|
|
84
|
+
if (!powerPreferenceValue.IsEmpty() && powerPreferenceValue->IsInt32()) {
|
|
85
|
+
powerPreferenceValue->Int32Value(context).To(&this->powerPreference);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
v8::Local<v8::Value> premultipliedAlphaValue;
|
|
89
|
+
config->Get(context,
|
|
90
|
+
ConvertToV8String(isolate, "premultipliedAlpha")).ToLocal(
|
|
91
|
+
&premultipliedAlphaValue);
|
|
92
|
+
if (!premultipliedAlphaValue.IsEmpty() && premultipliedAlphaValue->IsBoolean()) {
|
|
93
|
+
this->premultipliedAlpha = premultipliedAlphaValue->BooleanValue(isolate);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
v8::Local<v8::Value> preserveDrawingBufferValue;
|
|
97
|
+
config->Get(context,
|
|
98
|
+
ConvertToV8String(isolate, "preserveDrawingBuffer")).ToLocal(
|
|
99
|
+
&preserveDrawingBufferValue);
|
|
100
|
+
if (!preserveDrawingBufferValue.IsEmpty() && preserveDrawingBufferValue->IsBoolean()) {
|
|
101
|
+
this->preserveDrawingBuffer = preserveDrawingBufferValue->BooleanValue(isolate);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
v8::Local<v8::Value> stencilValue;
|
|
105
|
+
config->Get(context, ConvertToV8String(isolate, "stencil")).ToLocal(&stencilValue);
|
|
106
|
+
if (!stencilValue.IsEmpty() && stencilValue->IsBoolean()) {
|
|
107
|
+
this->stencil = stencilValue->BooleanValue(isolate);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
v8::Local<v8::Value> desynchronizedValue;
|
|
111
|
+
config->Get(context, ConvertToV8String(isolate, "desynchronized")).ToLocal(
|
|
112
|
+
&desynchronizedValue);
|
|
113
|
+
if (!desynchronizedValue.IsEmpty() && desynchronizedValue->IsBoolean()) {
|
|
114
|
+
this->desynchronized = desynchronizedValue->BooleanValue(isolate);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
v8::Local<v8::Value> xrCompatibleValue;
|
|
118
|
+
config->Get(context, ConvertToV8String(isolate, "xrCompatible")).ToLocal(
|
|
119
|
+
&xrCompatibleValue);
|
|
120
|
+
if (!xrCompatibleValue.IsEmpty() && xrCompatibleValue->IsBoolean()) {
|
|
121
|
+
this->xrCompatible = xrCompatibleValue->BooleanValue(isolate);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
11
125
|
|
|
12
126
|
void CanvasJSIModule::install(v8::Isolate *isolate) {
|
|
13
127
|
|
|
@@ -37,45 +151,39 @@ void CanvasJSIModule::install(v8::Isolate *isolate) {
|
|
|
37
151
|
TextMetricsImpl::Init(canvasMod, isolate);
|
|
38
152
|
URLImpl::Init(canvasMod, isolate);
|
|
39
153
|
|
|
40
|
-
|
|
41
|
-
auto lastSlot = isolate->GetNumberOfDataSlots() - 1;
|
|
42
|
-
auto data = new PerIsolateData(isolate);
|
|
43
|
-
isolate->SetData(lastSlot, data);
|
|
44
|
-
|
|
45
|
-
v8Global->Set(context, ConvertToV8String(isolate, "CanvasModule"), canvasMod);
|
|
154
|
+
v8Global->Set(context, ConvertToV8String(isolate, "CanvasModule"), canvasMod).FromJust();
|
|
46
155
|
canvasMod->Set(context, ConvertToV8String(isolate, "create2DContext"),
|
|
47
156
|
v8::FunctionTemplate::New(isolate, &Create2DContext)->GetFunction(
|
|
48
|
-
context).ToLocalChecked());
|
|
157
|
+
context).ToLocalChecked()).FromJust();
|
|
49
158
|
canvasMod->Set(context, ConvertToV8String(isolate, "createImageBitmap"),
|
|
50
159
|
v8::FunctionTemplate::New(isolate, &CreateImageBitmap)->GetFunction(
|
|
51
|
-
context).ToLocalChecked());
|
|
160
|
+
context).ToLocalChecked()).FromJust();
|
|
52
161
|
canvasMod->Set(context, ConvertToV8String(isolate, "create2DContextWithPointer"),
|
|
53
162
|
v8::FunctionTemplate::New(isolate, &Create2DContextWithPointer)->GetFunction(
|
|
54
|
-
context).ToLocalChecked());
|
|
163
|
+
context).ToLocalChecked()).FromJust();
|
|
55
164
|
canvasMod->Set(context, ConvertToV8String(isolate, "readFile"),
|
|
56
165
|
v8::FunctionTemplate::New(isolate, &ReadFile)->GetFunction(
|
|
57
|
-
context).ToLocalChecked());
|
|
166
|
+
context).ToLocalChecked()).FromJust();
|
|
58
167
|
|
|
59
168
|
canvasMod->Set(context, ConvertToV8String(isolate, "createWebGLContext"),
|
|
60
169
|
v8::FunctionTemplate::New(isolate, &CreateWebGLContext)->GetFunction(
|
|
61
|
-
context).ToLocalChecked());
|
|
170
|
+
context).ToLocalChecked()).FromJust();
|
|
62
171
|
|
|
63
172
|
canvasMod->Set(context, ConvertToV8String(isolate, "createWebGL2Context"),
|
|
64
173
|
v8::FunctionTemplate::New(isolate, &CreateWebGL2Context)->GetFunction(
|
|
65
|
-
context).ToLocalChecked());
|
|
174
|
+
context).ToLocalChecked()).FromJust();
|
|
66
175
|
|
|
67
176
|
|
|
68
177
|
canvasMod->Set(context, ConvertToV8String(isolate, "__addFontFamily"),
|
|
69
178
|
v8::FunctionTemplate::New(isolate, &AddFontFamily)->GetFunction(
|
|
70
|
-
context).ToLocalChecked());
|
|
179
|
+
context).ToLocalChecked()).FromJust();
|
|
71
180
|
|
|
72
181
|
global->Set(context,
|
|
73
|
-
ConvertToV8String(isolate, "CanvasModule"), canvasMod);
|
|
182
|
+
ConvertToV8String(isolate, "CanvasModule"), canvasMod).FromJust();
|
|
74
183
|
|
|
75
184
|
}
|
|
76
185
|
}
|
|
77
186
|
|
|
78
|
-
|
|
79
187
|
void CanvasJSIModule::AddFontFamily(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
80
188
|
auto isolate = args.GetIsolate();
|
|
81
189
|
auto context = isolate->GetCurrentContext();
|
|
@@ -807,7 +915,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
807
915
|
}
|
|
808
916
|
}
|
|
809
917
|
|
|
810
|
-
auto type = GetNativeType(
|
|
918
|
+
auto type = GetNativeType(image);
|
|
811
919
|
|
|
812
920
|
if (len == 1 || len == 2) {
|
|
813
921
|
if (len == 2) {
|
|
@@ -1190,404 +1298,196 @@ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
1190
1298
|
}
|
|
1191
1299
|
|
|
1192
1300
|
void CanvasJSIModule::CreateWebGLContext(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
1193
|
-
auto configValue = args[0];
|
|
1194
|
-
auto isolate = args.GetIsolate();
|
|
1195
|
-
auto context = isolate->GetCurrentContext();
|
|
1196
|
-
if (!configValue->IsNullOrUndefined() && configValue->IsObject()) {
|
|
1197
|
-
auto config = configValue.As<v8::Object>();
|
|
1198
|
-
std::string version("none");
|
|
1199
|
-
auto alpha = true;
|
|
1200
|
-
auto antialias = true;
|
|
1201
|
-
auto depth = true;
|
|
1202
|
-
auto fail_if_major_performance_caveat = false;
|
|
1203
|
-
std::string power_preference("default");
|
|
1204
|
-
auto premultiplied_alpha = true;
|
|
1205
|
-
auto preserve_drawing_buffer = false;
|
|
1206
|
-
auto stencil = false;
|
|
1207
|
-
auto desynchronized = false;
|
|
1208
|
-
auto xr_compatible = false;
|
|
1209
|
-
|
|
1210
|
-
auto last = isolate->GetNumberOfDataSlots() - 1;
|
|
1211
|
-
auto data = isolate->GetData(last);
|
|
1212
|
-
|
|
1213
|
-
if (data != nullptr) {
|
|
1214
|
-
auto consts = static_cast<PerIsolateData *>(data);
|
|
1215
|
-
|
|
1216
|
-
v8::Local<v8::Value> versionValue;
|
|
1217
|
-
|
|
1218
|
-
config->Get(context, consts->VERSION_PERSISTENT->Get(isolate)).ToLocal(&versionValue);
|
|
1219
|
-
|
|
1220
|
-
if (!versionValue.IsEmpty() && versionValue->IsString()) {
|
|
1221
|
-
version = ConvertFromV8String(isolate, versionValue);
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
v8::Local<v8::Value> alphaValue;
|
|
1225
|
-
|
|
1226
|
-
config->Get(context, consts->ALPHA_PERSISTENT->Get(isolate)).ToLocal(&alphaValue);
|
|
1227
|
-
if (!alphaValue.IsEmpty() && alphaValue->IsBoolean()) {
|
|
1228
|
-
alpha = alphaValue->BooleanValue(isolate);
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
v8::Local<v8::Value> antialiasValue;
|
|
1232
|
-
config->Get(context, consts->ANTIALIAS_PERSISTENT->Get(isolate)).ToLocal(
|
|
1233
|
-
&antialiasValue);
|
|
1234
|
-
if (!antialiasValue.IsEmpty() && antialiasValue->IsBoolean()) {
|
|
1235
|
-
antialias = antialiasValue->BooleanValue(isolate);
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
v8::Local<v8::Value> failIfMajorPerformanceCaveatValue;
|
|
1239
|
-
config->Get(context,
|
|
1240
|
-
consts->FAIL_IF_MAJOR_PERFORMANCE_CAVEAT_PERSISTENT->Get(isolate)).ToLocal(
|
|
1241
|
-
&failIfMajorPerformanceCaveatValue);
|
|
1242
|
-
if (!failIfMajorPerformanceCaveatValue.IsEmpty() &&
|
|
1243
|
-
failIfMajorPerformanceCaveatValue->IsBoolean()) {
|
|
1244
|
-
fail_if_major_performance_caveat = failIfMajorPerformanceCaveatValue->BooleanValue(
|
|
1245
|
-
isolate);
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
v8::Local<v8::Value> powerPreferenceValue;
|
|
1249
|
-
config->Get(context, consts->POWER_PREFERENCE_PERSISTENT->Get(isolate)).ToLocal(
|
|
1250
|
-
&powerPreferenceValue);
|
|
1251
|
-
if (!powerPreferenceValue.IsEmpty() && powerPreferenceValue->IsString()) {
|
|
1252
|
-
power_preference = ConvertFromV8String(isolate, powerPreferenceValue);
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
v8::Local<v8::Value> premultipliedAlphaValue;
|
|
1256
|
-
config->Get(context,
|
|
1257
|
-
consts->PREMULTIPLIED_ALPHA_PERSISTENT->Get(isolate)).ToLocal(
|
|
1258
|
-
&premultipliedAlphaValue);
|
|
1259
|
-
if (!premultipliedAlphaValue.IsEmpty() && premultipliedAlphaValue->IsBoolean()) {
|
|
1260
|
-
premultiplied_alpha = premultipliedAlphaValue->BooleanValue(isolate);
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
v8::Local<v8::Value> preserveDrawingBufferValue;
|
|
1264
|
-
config->Get(context,
|
|
1265
|
-
consts->PRESERVE_DRAWING_BUFFER_PERSISTENT->Get(isolate)).ToLocal(
|
|
1266
|
-
&preserveDrawingBufferValue);
|
|
1267
|
-
if (!preserveDrawingBufferValue.IsEmpty() && preserveDrawingBufferValue->IsBoolean()) {
|
|
1268
|
-
preserve_drawing_buffer = preserveDrawingBufferValue->BooleanValue(isolate);
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
v8::Local<v8::Value> stencilValue;
|
|
1272
|
-
config->Get(context, consts->STENCIL_PERSISTENT->Get(isolate)).ToLocal(&stencilValue);
|
|
1273
|
-
if (!stencilValue.IsEmpty() && stencilValue->IsBoolean()) {
|
|
1274
|
-
stencil = stencilValue->BooleanValue(isolate);
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
v8::Local<v8::Value> desynchronizedValue;
|
|
1278
|
-
config->Get(context, consts->DESYNCHRONIZED_PERSISTENT->Get(isolate)).ToLocal(
|
|
1279
|
-
&desynchronizedValue);
|
|
1280
|
-
if (!desynchronizedValue.IsEmpty() && desynchronizedValue->IsBoolean()) {
|
|
1281
|
-
desynchronized = desynchronizedValue->BooleanValue(isolate);
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
v8::Local<v8::Value> xrCompatibleValue;
|
|
1285
|
-
config->Get(context,
|
|
1286
|
-
consts->XR_COMPATIBLE_PERSISTENT->Get(isolate)).ToLocal(&xrCompatibleValue);
|
|
1287
|
-
if (!xrCompatibleValue.IsEmpty() && xrCompatibleValue->IsBoolean()) {
|
|
1288
|
-
xr_compatible = xrCompatibleValue->BooleanValue(isolate);
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
1301
|
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
args.GetReturnValue().SetNull();
|
|
1296
|
-
return;
|
|
1297
|
-
} else {
|
|
1298
|
-
auto count = args.Length();
|
|
1299
|
-
if (count == 6) {
|
|
1300
|
-
auto ctx = args[1].As<v8::BigInt>()->Int64Value();
|
|
1301
|
-
// auto density = args[2]->NumberValue(context).ToChecked();
|
|
1302
|
-
// auto fontColor = args[3]->NumberValue(context).ToChecked();
|
|
1303
|
-
// auto ppi = args[4]->NumberValue(context).ToChecked();
|
|
1304
|
-
// auto direction = args[5]->NumberValue(context).ToChecked();
|
|
1305
|
-
auto webgl = canvas_native_webgl_create(
|
|
1306
|
-
ctx,
|
|
1307
|
-
version.c_str(),
|
|
1308
|
-
alpha,
|
|
1309
|
-
antialias,
|
|
1310
|
-
depth,
|
|
1311
|
-
fail_if_major_performance_caveat,
|
|
1312
|
-
power_preference.c_str(),
|
|
1313
|
-
premultiplied_alpha,
|
|
1314
|
-
preserve_drawing_buffer,
|
|
1315
|
-
stencil,
|
|
1316
|
-
desynchronized,
|
|
1317
|
-
xr_compatible
|
|
1318
|
-
);
|
|
1319
|
-
|
|
1320
|
-
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1321
|
-
new WebGLRenderingContext(
|
|
1322
|
-
webgl));
|
|
1323
|
-
|
|
1324
|
-
args.GetReturnValue().Set(renderingContext);
|
|
1325
|
-
return;
|
|
1326
|
-
} else if (count == 7) {
|
|
1327
|
-
auto width = args[1]->NumberValue(context).ToChecked();
|
|
1328
|
-
auto height = args[2]->NumberValue(context).ToChecked();
|
|
1329
|
-
// auto density = args[3]->NumberValue(context).ToChecked();
|
|
1330
|
-
// auto fontColor = args[4]->NumberValue(context).ToChecked();
|
|
1331
|
-
// auto ppi = args[5]->NumberValue(context).ToChecked();
|
|
1332
|
-
// auto direction = args[6]->NumberValue(context).ToChecked();
|
|
1333
|
-
auto ctx = canvas_native_webgl_create_no_window(
|
|
1334
|
-
(int32_t) width,
|
|
1335
|
-
(int32_t) height,
|
|
1336
|
-
version.c_str(),
|
|
1337
|
-
alpha,
|
|
1338
|
-
antialias,
|
|
1339
|
-
depth,
|
|
1340
|
-
fail_if_major_performance_caveat,
|
|
1341
|
-
power_preference.c_str(),
|
|
1342
|
-
premultiplied_alpha,
|
|
1343
|
-
preserve_drawing_buffer,
|
|
1344
|
-
stencil,
|
|
1345
|
-
desynchronized,
|
|
1346
|
-
xr_compatible,
|
|
1347
|
-
false
|
|
1348
|
-
);
|
|
1349
|
-
|
|
1350
|
-
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1351
|
-
new WebGLRenderingContext(
|
|
1352
|
-
ctx));
|
|
1353
|
-
|
|
1354
|
-
args.GetReturnValue().Set(renderingContext);
|
|
1355
|
-
return;
|
|
1302
|
+
auto options = GLOptions();
|
|
1303
|
+
options.parseGLOptions(args);
|
|
1356
1304
|
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
auto ctx = canvas_native_webgl_create_no_window(
|
|
1362
|
-
width,
|
|
1363
|
-
height,
|
|
1364
|
-
version.c_str(),
|
|
1365
|
-
alpha,
|
|
1366
|
-
antialias,
|
|
1367
|
-
depth,
|
|
1368
|
-
fail_if_major_performance_caveat,
|
|
1369
|
-
power_preference.c_str(),
|
|
1370
|
-
premultiplied_alpha,
|
|
1371
|
-
preserve_drawing_buffer,
|
|
1372
|
-
stencil,
|
|
1373
|
-
desynchronized,
|
|
1374
|
-
xr_compatible,
|
|
1375
|
-
false
|
|
1376
|
-
);
|
|
1377
|
-
|
|
1378
|
-
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1379
|
-
new WebGLRenderingContext(
|
|
1380
|
-
ctx));
|
|
1381
|
-
|
|
1382
|
-
args.GetReturnValue().Set(renderingContext);
|
|
1383
|
-
return;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
}
|
|
1305
|
+
if (options.version != 1) {
|
|
1306
|
+
args.GetReturnValue().SetNull();
|
|
1307
|
+
return;
|
|
1387
1308
|
}
|
|
1388
|
-
args.GetReturnValue().SetNull();
|
|
1389
|
-
}
|
|
1390
1309
|
|
|
1391
|
-
void CanvasJSIModule::CreateWebGL2Context(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
1392
|
-
auto configValue = args[0];
|
|
1393
1310
|
auto isolate = args.GetIsolate();
|
|
1394
1311
|
auto context = isolate->GetCurrentContext();
|
|
1395
|
-
if (!configValue->IsNullOrUndefined() && configValue->IsObject()) {
|
|
1396
|
-
auto config = configValue.As<v8::Object>();
|
|
1397
|
-
std::string version("none");
|
|
1398
|
-
auto alpha = true;
|
|
1399
|
-
auto antialias = true;
|
|
1400
|
-
auto depth = true;
|
|
1401
|
-
auto fail_if_major_performance_caveat = false;
|
|
1402
|
-
std::string power_preference("default");
|
|
1403
|
-
auto premultiplied_alpha = true;
|
|
1404
|
-
auto preserve_drawing_buffer = false;
|
|
1405
|
-
auto stencil = false;
|
|
1406
|
-
auto desynchronized = false;
|
|
1407
|
-
auto xr_compatible = false;
|
|
1408
1312
|
|
|
1409
1313
|
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1314
|
+
auto count = args.Length();
|
|
1315
|
+
if (count == 6) {
|
|
1316
|
+
auto ctx = args[1].As<v8::BigInt>()->Int64Value();
|
|
1317
|
+
auto webgl = canvas_native_webgl_create(
|
|
1318
|
+
ctx,
|
|
1319
|
+
options.version,
|
|
1320
|
+
options.alpha,
|
|
1321
|
+
options.antialias,
|
|
1322
|
+
options.depth,
|
|
1323
|
+
options.failIfMajorPerformanceCaveat,
|
|
1324
|
+
options.powerPreference,
|
|
1325
|
+
options.premultipliedAlpha,
|
|
1326
|
+
options.preserveDrawingBuffer,
|
|
1327
|
+
options.stencil,
|
|
1328
|
+
options.desynchronized,
|
|
1329
|
+
options.xrCompatible
|
|
1330
|
+
);
|
|
1331
|
+
|
|
1332
|
+
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1333
|
+
new WebGLRenderingContext(
|
|
1334
|
+
webgl));
|
|
1335
|
+
|
|
1336
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1337
|
+
return;
|
|
1338
|
+
} else if (count == 7) {
|
|
1339
|
+
auto width = args[1]->NumberValue(context).ToChecked();
|
|
1340
|
+
auto height = args[2]->NumberValue(context).ToChecked();
|
|
1341
|
+
auto ctx = canvas_native_webgl_create_no_window(
|
|
1342
|
+
(int32_t) width,
|
|
1343
|
+
(int32_t) height,
|
|
1344
|
+
options.version,
|
|
1345
|
+
options.alpha,
|
|
1346
|
+
options.antialias,
|
|
1347
|
+
options.depth,
|
|
1348
|
+
options.failIfMajorPerformanceCaveat,
|
|
1349
|
+
options.powerPreference,
|
|
1350
|
+
options.premultipliedAlpha,
|
|
1351
|
+
options.preserveDrawingBuffer,
|
|
1352
|
+
options.stencil,
|
|
1353
|
+
options.desynchronized,
|
|
1354
|
+
options.xrCompatible,
|
|
1355
|
+
false
|
|
1356
|
+
);
|
|
1357
|
+
|
|
1358
|
+
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1359
|
+
new WebGLRenderingContext(
|
|
1360
|
+
ctx));
|
|
1361
|
+
|
|
1362
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1363
|
+
return;
|
|
1437
1364
|
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1365
|
+
} else {
|
|
1366
|
+
auto width = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
1367
|
+
auto height = (int32_t) args[2]->NumberValue(context).ToChecked();
|
|
1368
|
+
|
|
1369
|
+
auto ctx = canvas_native_webgl_create_no_window(
|
|
1370
|
+
width,
|
|
1371
|
+
height,
|
|
1372
|
+
options.version,
|
|
1373
|
+
options.alpha,
|
|
1374
|
+
options.antialias,
|
|
1375
|
+
options.depth,
|
|
1376
|
+
options.failIfMajorPerformanceCaveat,
|
|
1377
|
+
options.powerPreference,
|
|
1378
|
+
options.premultipliedAlpha,
|
|
1379
|
+
options.preserveDrawingBuffer,
|
|
1380
|
+
options.stencil,
|
|
1381
|
+
options.desynchronized,
|
|
1382
|
+
options.xrCompatible,
|
|
1383
|
+
false
|
|
1384
|
+
);
|
|
1385
|
+
|
|
1386
|
+
auto renderingContext = WebGLRenderingContext::NewInstance(isolate,
|
|
1387
|
+
new WebGLRenderingContext(
|
|
1388
|
+
ctx));
|
|
1389
|
+
|
|
1390
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1447
1394
|
|
|
1448
|
-
|
|
1449
|
-
config->Get(context, consts->POWER_PREFERENCE_PERSISTENT->Get(isolate)).ToLocal(
|
|
1450
|
-
&powerPreferenceValue);
|
|
1451
|
-
if (!powerPreferenceValue.IsEmpty() && powerPreferenceValue->IsString()) {
|
|
1452
|
-
power_preference = ConvertFromV8String(isolate, powerPreferenceValue);
|
|
1453
|
-
}
|
|
1395
|
+
void CanvasJSIModule::CreateWebGL2Context(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
1454
1396
|
|
|
1455
|
-
v8::Local<v8::Value> premultipliedAlphaValue;
|
|
1456
|
-
config->Get(context,
|
|
1457
|
-
consts->PREMULTIPLIED_ALPHA_PERSISTENT->Get(isolate)).ToLocal(
|
|
1458
|
-
&premultipliedAlphaValue);
|
|
1459
|
-
if (!premultipliedAlphaValue.IsEmpty() && premultipliedAlphaValue->IsBoolean()) {
|
|
1460
|
-
premultiplied_alpha = premultipliedAlphaValue->BooleanValue(isolate);
|
|
1461
|
-
}
|
|
1462
1397
|
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
consts->PRESERVE_DRAWING_BUFFER_PERSISTENT->Get(isolate)).ToLocal(
|
|
1466
|
-
&preserveDrawingBufferValue);
|
|
1467
|
-
if (!preserveDrawingBufferValue.IsEmpty() && preserveDrawingBufferValue->IsBoolean()) {
|
|
1468
|
-
preserve_drawing_buffer = preserveDrawingBufferValue->BooleanValue(isolate);
|
|
1469
|
-
}
|
|
1398
|
+
auto options = GLOptions();
|
|
1399
|
+
options.parseGLOptions(args);
|
|
1470
1400
|
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
}
|
|
1401
|
+
if (options.version != 2) {
|
|
1402
|
+
args.GetReturnValue().SetNull();
|
|
1403
|
+
return;
|
|
1404
|
+
}
|
|
1476
1405
|
|
|
1477
|
-
v8::Local<v8::Value> desynchronizedValue;
|
|
1478
|
-
config->Get(context, consts->DESYNCHRONIZED_PERSISTENT->Get(isolate)).ToLocal(
|
|
1479
|
-
&desynchronizedValue);
|
|
1480
|
-
if (!desynchronizedValue.IsEmpty() && desynchronizedValue->IsBoolean()) {
|
|
1481
|
-
desynchronized = desynchronizedValue->BooleanValue(isolate);
|
|
1482
|
-
}
|
|
1483
1406
|
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
consts->XR_COMPATIBLE_PERSISTENT->Get(isolate)).ToLocal(&xrCompatibleValue);
|
|
1487
|
-
if (!xrCompatibleValue.IsEmpty() && xrCompatibleValue->IsBoolean()) {
|
|
1488
|
-
xr_compatible = xrCompatibleValue->BooleanValue(isolate);
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1407
|
+
auto isolate = args.GetIsolate();
|
|
1408
|
+
auto context = isolate->GetCurrentContext();
|
|
1491
1409
|
|
|
1492
1410
|
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
xr_compatible
|
|
1519
|
-
);
|
|
1520
|
-
|
|
1521
|
-
auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
|
|
1522
|
-
new WebGL2RenderingContext(
|
|
1523
|
-
webgl,
|
|
1524
|
-
WebGLRenderingVersion::V2));
|
|
1525
|
-
|
|
1526
|
-
args.GetReturnValue().Set(renderingContext);
|
|
1527
|
-
return;
|
|
1411
|
+
auto count = args.Length();
|
|
1412
|
+
if (count == 6) {
|
|
1413
|
+
auto ctx = args[1].As<v8::BigInt>()->Int64Value();
|
|
1414
|
+
auto webgl = canvas_native_webgl_create(
|
|
1415
|
+
ctx,
|
|
1416
|
+
options.version,
|
|
1417
|
+
options.alpha,
|
|
1418
|
+
options.antialias,
|
|
1419
|
+
options.depth,
|
|
1420
|
+
options.failIfMajorPerformanceCaveat,
|
|
1421
|
+
options.powerPreference,
|
|
1422
|
+
options.premultipliedAlpha,
|
|
1423
|
+
options.preserveDrawingBuffer,
|
|
1424
|
+
options.stencil,
|
|
1425
|
+
options.desynchronized,
|
|
1426
|
+
options.xrCompatible
|
|
1427
|
+
);
|
|
1428
|
+
|
|
1429
|
+
auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
|
|
1430
|
+
new WebGL2RenderingContext(
|
|
1431
|
+
webgl,
|
|
1432
|
+
WebGLRenderingVersion::V2));
|
|
1433
|
+
|
|
1434
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1435
|
+
return;
|
|
1528
1436
|
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
WebGLRenderingVersion::V2));
|
|
1557
|
-
|
|
1558
|
-
args.GetReturnValue().Set(renderingContext);
|
|
1559
|
-
return;
|
|
1437
|
+
} else if (count ==
|
|
1438
|
+
7) {
|
|
1439
|
+
auto width = args[1]->NumberValue(context).ToChecked();
|
|
1440
|
+
auto height = args[2]->NumberValue(context).ToChecked();
|
|
1441
|
+
auto ctx = canvas_native_webgl_create_no_window(
|
|
1442
|
+
(int32_t) width,
|
|
1443
|
+
(int32_t) height,
|
|
1444
|
+
options.version,
|
|
1445
|
+
options.alpha,
|
|
1446
|
+
options.antialias,
|
|
1447
|
+
options.depth,
|
|
1448
|
+
options.failIfMajorPerformanceCaveat,
|
|
1449
|
+
options.powerPreference,
|
|
1450
|
+
options.premultipliedAlpha,
|
|
1451
|
+
options.preserveDrawingBuffer,
|
|
1452
|
+
options.stencil,
|
|
1453
|
+
options.desynchronized,
|
|
1454
|
+
options.xrCompatible,
|
|
1455
|
+
false
|
|
1456
|
+
);
|
|
1457
|
+
auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
|
|
1458
|
+
new WebGL2RenderingContext(
|
|
1459
|
+
ctx,
|
|
1460
|
+
WebGLRenderingVersion::V2));
|
|
1461
|
+
|
|
1462
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1463
|
+
return;
|
|
1560
1464
|
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1465
|
+
} else {
|
|
1466
|
+
auto width = (int32_t) args[1]->NumberValue(context).ToChecked();
|
|
1467
|
+
auto height = (int32_t) args[2]->NumberValue(context).ToChecked();
|
|
1468
|
+
auto ctx = canvas_native_webgl_create_no_window(
|
|
1469
|
+
width,
|
|
1470
|
+
height,
|
|
1471
|
+
options.version,
|
|
1472
|
+
options.alpha,
|
|
1473
|
+
options.antialias,
|
|
1474
|
+
options.depth,
|
|
1475
|
+
options.failIfMajorPerformanceCaveat,
|
|
1476
|
+
options.powerPreference,
|
|
1477
|
+
options.premultipliedAlpha,
|
|
1478
|
+
options.preserveDrawingBuffer,
|
|
1479
|
+
options.stencil,
|
|
1480
|
+
options.desynchronized,
|
|
1481
|
+
options.xrCompatible,
|
|
1482
|
+
false
|
|
1483
|
+
);
|
|
1484
|
+
|
|
1485
|
+
auto renderingContext = WebGL2RenderingContext::NewInstance(isolate,
|
|
1486
|
+
new WebGL2RenderingContext(
|
|
1487
|
+
ctx,
|
|
1488
|
+
WebGLRenderingVersion::V2));
|
|
1489
|
+
|
|
1490
|
+
args.GetReturnValue().Set(renderingContext);
|
|
1491
|
+
return;
|
|
1590
1492
|
}
|
|
1591
|
-
|
|
1592
|
-
args.GetReturnValue().SetNull();
|
|
1593
1493
|
}
|