@nativescript/canvas 2.0.0-beta.2 → 2.0.0-beta.21
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
|
@@ -754,7 +754,7 @@ v8::Local<v8::Value> WebGLRenderingContext::GetParameterInternal(v8::Isolate *is
|
|
|
754
754
|
auto array = v8::Array::New(isolate, (int) len);
|
|
755
755
|
|
|
756
756
|
for (int j = 0; j < len; ++j) {
|
|
757
|
-
array->Set(context, j, v8::Boolean::New(isolate, buf[j] == 1));
|
|
757
|
+
array->Set(context, j, v8::Boolean::New(isolate, buf[j] == 1)).FromJust();
|
|
758
758
|
}
|
|
759
759
|
return scope.Escape(array);
|
|
760
760
|
}
|
|
@@ -894,8 +894,6 @@ void WebGLRenderingContext::AttachShader(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
894
894
|
return;
|
|
895
895
|
}
|
|
896
896
|
|
|
897
|
-
auto isolate = args.GetIsolate();
|
|
898
|
-
|
|
899
897
|
auto programValue = args[0];
|
|
900
898
|
auto shaderValue = args[1];
|
|
901
899
|
|
|
@@ -1200,59 +1198,24 @@ void WebGLRenderingContext::BufferData(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
1200
1198
|
auto usage = args[2]->Uint32Value(context).ToChecked();
|
|
1201
1199
|
|
|
1202
1200
|
if (args[1]->IsObject()) {
|
|
1203
|
-
|
|
1204
1201
|
auto sizeOrBuf = args[1];
|
|
1205
1202
|
if (sizeOrBuf->IsArrayBufferView()) {
|
|
1206
|
-
|
|
1207
|
-
auto buf = sizeOrBuf.As<v8::Uint16Array>();
|
|
1208
|
-
|
|
1209
|
-
auto array = buf->Buffer();
|
|
1210
|
-
auto offset = buf->ByteOffset();
|
|
1211
|
-
auto size = buf->Length();
|
|
1212
|
-
auto data_ptr =
|
|
1213
|
-
static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
1214
|
-
auto data = static_cast<uint16_t *>((void *) data_ptr);
|
|
1215
|
-
|
|
1216
|
-
canvas_native_webgl_buffer_data_u16(
|
|
1217
|
-
target,
|
|
1218
|
-
data, size,
|
|
1219
|
-
usage,
|
|
1220
|
-
ptr->GetState()
|
|
1221
|
-
);
|
|
1222
|
-
} else if (sizeOrBuf->IsFloat32Array()) {
|
|
1223
|
-
auto buf = sizeOrBuf.As<v8::Float32Array>();
|
|
1224
|
-
|
|
1225
|
-
auto array = buf->Buffer();
|
|
1226
|
-
auto offset = buf->ByteOffset();
|
|
1227
|
-
auto size = buf->Length();
|
|
1228
|
-
auto data_ptr =
|
|
1229
|
-
static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
1230
|
-
auto data = static_cast<float *>((void *) data_ptr);
|
|
1231
|
-
|
|
1232
|
-
canvas_native_webgl_buffer_data_f32(
|
|
1233
|
-
target,
|
|
1234
|
-
data, size,
|
|
1235
|
-
usage,
|
|
1236
|
-
ptr->GetState()
|
|
1237
|
-
);
|
|
1238
|
-
} else {
|
|
1239
|
-
auto buf = sizeOrBuf.As<v8::ArrayBufferView>();
|
|
1203
|
+
auto buf = sizeOrBuf.As<v8::ArrayBufferView>();
|
|
1240
1204
|
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1205
|
+
auto array = buf->Buffer();
|
|
1206
|
+
auto offset = buf->ByteOffset();
|
|
1207
|
+
auto size = buf->ByteLength();
|
|
1208
|
+
auto data_ptr =
|
|
1209
|
+
static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
1210
|
+
auto data = static_cast<uint8_t *>((void *) data_ptr);
|
|
1247
1211
|
|
|
1248
1212
|
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
}
|
|
1213
|
+
canvas_native_webgl_buffer_data(
|
|
1214
|
+
target,
|
|
1215
|
+
data, size,
|
|
1216
|
+
usage,
|
|
1217
|
+
ptr->GetState()
|
|
1218
|
+
);
|
|
1256
1219
|
} else if (sizeOrBuf->IsArrayBuffer()) {
|
|
1257
1220
|
auto array = sizeOrBuf.As<v8::ArrayBuffer>();
|
|
1258
1221
|
|
|
@@ -1524,8 +1487,7 @@ void WebGLRenderingContext::CompressedTexImage2D(const v8::FunctionCallbackInfo<
|
|
|
1524
1487
|
auto array = buf->Buffer();
|
|
1525
1488
|
auto offset = buf->ByteOffset();
|
|
1526
1489
|
auto size = buf->ByteLength();
|
|
1527
|
-
auto
|
|
1528
|
-
auto data = static_cast<uint8_t *>((void *) data_ptr);
|
|
1490
|
+
auto data = static_cast<const uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
1529
1491
|
|
|
1530
1492
|
|
|
1531
1493
|
canvas_native_webgl_compressed_tex_image2d(
|
|
@@ -1583,8 +1545,7 @@ WebGLRenderingContext::CompressedTexSubImage2D(const v8::FunctionCallbackInfo<v8
|
|
|
1583
1545
|
auto array = buf->Buffer();
|
|
1584
1546
|
auto offset = buf->ByteOffset();
|
|
1585
1547
|
auto size = array->ByteLength();
|
|
1586
|
-
auto
|
|
1587
|
-
auto data = static_cast<uint8_t *>((void *) data_ptr);
|
|
1548
|
+
auto data = static_cast<const uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
1588
1549
|
|
|
1589
1550
|
canvas_native_webgl_compressed_tex_sub_image2d(
|
|
1590
1551
|
target,
|
|
@@ -1854,9 +1815,6 @@ void WebGLRenderingContext::DeleteBuffer(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1854
1815
|
return;
|
|
1855
1816
|
}
|
|
1856
1817
|
|
|
1857
|
-
auto isolate = args.GetIsolate();
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
1818
|
auto value = args[0];
|
|
1861
1819
|
auto type = GetNativeType(value);
|
|
1862
1820
|
if (type == NativeType::WebGLBuffer) {
|
|
@@ -1877,8 +1835,6 @@ void WebGLRenderingContext::DeleteFramebuffer(const v8::FunctionCallbackInfo<v8:
|
|
|
1877
1835
|
return;
|
|
1878
1836
|
}
|
|
1879
1837
|
|
|
1880
|
-
auto isolate = args.GetIsolate();
|
|
1881
|
-
|
|
1882
1838
|
auto value = args[0];
|
|
1883
1839
|
auto type = GetNativeType(value);
|
|
1884
1840
|
if (type == NativeType::WebGLFramebuffer) {
|
|
@@ -1899,8 +1855,6 @@ void WebGLRenderingContext::DeleteProgram(const v8::FunctionCallbackInfo<v8::Val
|
|
|
1899
1855
|
return;
|
|
1900
1856
|
}
|
|
1901
1857
|
|
|
1902
|
-
auto isolate = args.GetIsolate();
|
|
1903
|
-
|
|
1904
1858
|
auto value = args[0];
|
|
1905
1859
|
auto type = GetNativeType(value);
|
|
1906
1860
|
|
|
@@ -1923,8 +1877,6 @@ void WebGLRenderingContext::DeleteRenderbuffer(const v8::FunctionCallbackInfo<v8
|
|
|
1923
1877
|
return;
|
|
1924
1878
|
}
|
|
1925
1879
|
|
|
1926
|
-
auto isolate = args.GetIsolate();
|
|
1927
|
-
|
|
1928
1880
|
|
|
1929
1881
|
auto value = args[0];
|
|
1930
1882
|
auto type = GetNativeType(value);
|
|
@@ -1948,8 +1900,6 @@ void WebGLRenderingContext::DeleteShader(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1948
1900
|
return;
|
|
1949
1901
|
}
|
|
1950
1902
|
|
|
1951
|
-
auto isolate = args.GetIsolate();
|
|
1952
|
-
|
|
1953
1903
|
|
|
1954
1904
|
auto value = args[0];
|
|
1955
1905
|
auto type = GetNativeType(value);
|
|
@@ -1971,8 +1921,6 @@ void WebGLRenderingContext::DeleteTexture(const v8::FunctionCallbackInfo<v8::Val
|
|
|
1971
1921
|
return;
|
|
1972
1922
|
}
|
|
1973
1923
|
|
|
1974
|
-
auto isolate = args.GetIsolate();
|
|
1975
|
-
|
|
1976
1924
|
|
|
1977
1925
|
auto value = args[0];
|
|
1978
1926
|
auto type = GetNativeType(value);
|
|
@@ -2049,8 +1997,6 @@ void WebGLRenderingContext::DetachShader(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2049
1997
|
return;
|
|
2050
1998
|
}
|
|
2051
1999
|
|
|
2052
|
-
auto isolate = args.GetIsolate();
|
|
2053
|
-
|
|
2054
2000
|
|
|
2055
2001
|
auto programValue = args[0];
|
|
2056
2002
|
auto shaderValue = args[1];
|
|
@@ -2398,7 +2344,7 @@ void WebGLRenderingContext::GetAttachedShaders(const v8::FunctionCallbackInfo<v8
|
|
|
2398
2344
|
for (int i = 0; i < len; ++i) {
|
|
2399
2345
|
auto shader = WebGLShader::NewInstance(isolate, new WebGLShader(
|
|
2400
2346
|
buf[i]));
|
|
2401
|
-
array->Set(context, i, shader);
|
|
2347
|
+
array->Set(context, i, shader).FromJust();
|
|
2402
2348
|
}
|
|
2403
2349
|
args.GetReturnValue().Set(array);
|
|
2404
2350
|
|
|
@@ -2484,63 +2430,81 @@ void WebGLRenderingContext::GetContextAttributes(const v8::FunctionCallbackInfo<
|
|
|
2484
2430
|
attr);
|
|
2485
2431
|
|
|
2486
2432
|
|
|
2487
|
-
ret->Set(context, ConvertToV8String(isolate, "alpha"),
|
|
2433
|
+
ret->Set(context, ConvertToV8String(isolate, "alpha"),
|
|
2434
|
+
v8::Boolean::New(isolate, alpha)).FromJust();
|
|
2488
2435
|
|
|
2489
2436
|
auto antialias = canvas_native_webgl_context_attribute_get_get_antialias(
|
|
2490
2437
|
attr);
|
|
2491
2438
|
|
|
2492
2439
|
ret->Set(context, ConvertToV8String(isolate, "antialias"),
|
|
2493
|
-
v8::Boolean::New(isolate, antialias));
|
|
2440
|
+
v8::Boolean::New(isolate, antialias)).FromJust();
|
|
2494
2441
|
|
|
2495
2442
|
auto depth = canvas_native_webgl_context_attribute_get_get_depth(
|
|
2496
2443
|
attr);
|
|
2497
2444
|
|
|
2498
|
-
ret->Set(context, ConvertToV8String(isolate, "depth"),
|
|
2445
|
+
ret->Set(context, ConvertToV8String(isolate, "depth"),
|
|
2446
|
+
v8::Boolean::New(isolate, depth)).FromJust();
|
|
2499
2447
|
|
|
2500
2448
|
auto fail_if_major_performance_caveat = canvas_native_webgl_context_attribute_get_get_fail_if_major_performance_caveat(
|
|
2501
2449
|
attr);
|
|
2502
2450
|
|
|
2503
2451
|
ret->Set(context,
|
|
2504
2452
|
ConvertToV8String(isolate, "failIfMajorPerformanceCaveat"),
|
|
2505
|
-
v8::Boolean::New(isolate, fail_if_major_performance_caveat));
|
|
2453
|
+
v8::Boolean::New(isolate, fail_if_major_performance_caveat)).FromJust();
|
|
2506
2454
|
|
|
2507
2455
|
auto power_preference = canvas_native_webgl_context_attribute_get_get_power_preference(
|
|
2508
2456
|
attr);
|
|
2509
2457
|
|
|
2458
|
+
std::string powerp;
|
|
2459
|
+
switch (power_preference) {
|
|
2460
|
+
case 0:
|
|
2461
|
+
powerp = std::string("default");
|
|
2462
|
+
break;
|
|
2463
|
+
case 1:
|
|
2464
|
+
powerp = std::string("high-performance");
|
|
2465
|
+
break;
|
|
2466
|
+
case 2:
|
|
2467
|
+
powerp = std::string("low-power");
|
|
2468
|
+
break;
|
|
2469
|
+
default:
|
|
2470
|
+
break;
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2510
2473
|
ret->Set(context, ConvertToV8String(isolate, "powerPreference"),
|
|
2511
|
-
|
|
2474
|
+
ConvertToV8String(isolate, powerp.c_str())).FromJust();
|
|
2475
|
+
|
|
2512
2476
|
|
|
2513
2477
|
auto premultiplied_alpha = canvas_native_webgl_context_attribute_get_get_premultiplied_alpha(
|
|
2514
2478
|
attr);
|
|
2515
2479
|
|
|
2516
2480
|
ret->Set(context,
|
|
2517
2481
|
ConvertToV8String(isolate, "premultipliedAlpha"),
|
|
2518
|
-
v8::Boolean::New(isolate, premultiplied_alpha));
|
|
2482
|
+
v8::Boolean::New(isolate, premultiplied_alpha)).FromJust();
|
|
2519
2483
|
|
|
2520
2484
|
auto preserve_drawing_buffer = canvas_native_webgl_context_attribute_get_get_preserve_drawing_buffer(
|
|
2521
2485
|
attr);
|
|
2522
2486
|
|
|
2523
2487
|
ret->Set(context,
|
|
2524
2488
|
ConvertToV8String(isolate, "preserveDrawingBuffer"),
|
|
2525
|
-
v8::Boolean::New(isolate, preserve_drawing_buffer));
|
|
2489
|
+
v8::Boolean::New(isolate, preserve_drawing_buffer)).FromJust();
|
|
2526
2490
|
|
|
2527
2491
|
auto stencil = canvas_native_webgl_context_attribute_get_get_stencil(
|
|
2528
2492
|
attr);
|
|
2529
2493
|
|
|
2530
2494
|
ret->Set(context, ConvertToV8String(isolate, "stencil"),
|
|
2531
|
-
v8::Boolean::New(isolate, stencil));
|
|
2495
|
+
v8::Boolean::New(isolate, stencil)).FromJust();
|
|
2532
2496
|
|
|
2533
2497
|
auto desynchronized = canvas_native_webgl_context_attribute_get_get_desynchronized(
|
|
2534
2498
|
attr);
|
|
2535
2499
|
|
|
2536
2500
|
ret->Set(context, ConvertToV8String(isolate, "desynchronized"),
|
|
2537
|
-
v8::Boolean::New(isolate, desynchronized));
|
|
2501
|
+
v8::Boolean::New(isolate, desynchronized)).FromJust();
|
|
2538
2502
|
|
|
2539
2503
|
auto xr_compatible = canvas_native_webgl_context_attribute_get_get_xr_compatible(
|
|
2540
2504
|
attr);
|
|
2541
2505
|
|
|
2542
2506
|
ret->Set(context, ConvertToV8String(isolate, "xrCompatible"),
|
|
2543
|
-
v8::Boolean::New(isolate, xr_compatible));
|
|
2507
|
+
v8::Boolean::New(isolate, xr_compatible)).FromJust();
|
|
2544
2508
|
|
|
2545
2509
|
canvas_native_context_attributes_destroy(attr);
|
|
2546
2510
|
|
|
@@ -2622,7 +2586,6 @@ void WebGLRenderingContext::GetExtension(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2622
2586
|
ret));
|
|
2623
2587
|
|
|
2624
2588
|
args.GetReturnValue().Set(query);
|
|
2625
|
-
canvas_native_webgl_extension_destroy(ext);
|
|
2626
2589
|
return;
|
|
2627
2590
|
}
|
|
2628
2591
|
case WebGLExtensionType::WebGLExtensionTypeEXT_sRGB: {
|
|
@@ -2692,7 +2655,6 @@ void WebGLRenderingContext::GetExtension(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2692
2655
|
new OES_vertex_array_objectImpl(
|
|
2693
2656
|
ret));
|
|
2694
2657
|
args.GetReturnValue().Set(array);
|
|
2695
|
-
canvas_native_webgl_extension_destroy(ext);
|
|
2696
2658
|
return;
|
|
2697
2659
|
}
|
|
2698
2660
|
case WebGLExtensionType::WebGLExtensionTypeWEBGL_color_buffer_float: {
|
|
@@ -2701,7 +2663,7 @@ void WebGLRenderingContext::GetExtension(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2701
2663
|
if (ptr->GetVersion() ==
|
|
2702
2664
|
WebGLRenderingVersion::V2) {
|
|
2703
2665
|
ret->Set(context, ConvertToV8String(isolate, "ext_name"),
|
|
2704
|
-
ConvertToV8String(isolate, "EXT_color_buffer_float"));
|
|
2666
|
+
ConvertToV8String(isolate, "EXT_color_buffer_float")).FromJust();
|
|
2705
2667
|
}
|
|
2706
2668
|
args.GetReturnValue().Set(ret);
|
|
2707
2669
|
canvas_native_webgl_extension_destroy(ext);
|
|
@@ -2755,8 +2717,6 @@ void WebGLRenderingContext::GetExtension(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2755
2717
|
new WEBGL_lose_contextImpl(ret));
|
|
2756
2718
|
|
|
2757
2719
|
args.GetReturnValue().Set(ctx);
|
|
2758
|
-
|
|
2759
|
-
canvas_native_webgl_extension_destroy(ext);
|
|
2760
2720
|
return;
|
|
2761
2721
|
}
|
|
2762
2722
|
case WebGLExtensionType::WebGLExtensionTypeANGLE_instanced_arrays: {
|
|
@@ -2766,7 +2726,6 @@ void WebGLRenderingContext::GetExtension(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2766
2726
|
ret));
|
|
2767
2727
|
|
|
2768
2728
|
args.GetReturnValue().Set(instance);
|
|
2769
|
-
canvas_native_webgl_extension_destroy(ext);
|
|
2770
2729
|
return;
|
|
2771
2730
|
}
|
|
2772
2731
|
case WebGLExtensionType::WebGLExtensionTypeWEBGL_depth_texture: {
|
|
@@ -2782,8 +2741,6 @@ void WebGLRenderingContext::GetExtension(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2782
2741
|
new WEBGL_draw_buffersImpl(ret));
|
|
2783
2742
|
|
|
2784
2743
|
args.GetReturnValue().Set(buffers);
|
|
2785
|
-
|
|
2786
|
-
canvas_native_webgl_extension_destroy(ext);
|
|
2787
2744
|
return;
|
|
2788
2745
|
|
|
2789
2746
|
|
|
@@ -2846,7 +2803,7 @@ void WebGLRenderingContext::GetFramebufferAttachmentParameter(
|
|
|
2846
2803
|
object->Set(context,
|
|
2847
2804
|
ConvertToV8String(isolate, "isRenderbuffer"),
|
|
2848
2805
|
v8::Boolean::New(isolate,
|
|
2849
|
-
true));
|
|
2806
|
+
true)).FromJust();
|
|
2850
2807
|
args.GetReturnValue().Set(object);
|
|
2851
2808
|
|
|
2852
2809
|
canvas_native_webgl_framebuffer_attachment_parameter_destroy(ret);
|
|
@@ -2906,7 +2863,6 @@ void WebGLRenderingContext::GetProgramInfoLog(const v8::FunctionCallbackInfo<v8:
|
|
|
2906
2863
|
|
|
2907
2864
|
if (strlen(log) == 0) {
|
|
2908
2865
|
args.GetReturnValue().SetEmptyString();
|
|
2909
|
-
canvas_native_string_destroy((char *) log);
|
|
2910
2866
|
return;
|
|
2911
2867
|
}
|
|
2912
2868
|
|
|
@@ -3015,7 +2971,6 @@ void WebGLRenderingContext::GetShaderInfoLog(const v8::FunctionCallbackInfo<v8::
|
|
|
3015
2971
|
|
|
3016
2972
|
if (strlen(log) == 0) {
|
|
3017
2973
|
args.GetReturnValue().SetEmptyString();
|
|
3018
|
-
canvas_native_string_destroy((char *) log);
|
|
3019
2974
|
return;
|
|
3020
2975
|
}
|
|
3021
2976
|
|
|
@@ -3131,7 +3086,6 @@ void WebGLRenderingContext::GetShaderSource(const v8::FunctionCallbackInfo<v8::V
|
|
|
3131
3086
|
|
|
3132
3087
|
if (strlen(source) == 0) {
|
|
3133
3088
|
args.GetReturnValue().SetEmptyString();
|
|
3134
|
-
canvas_native_string_destroy((char *) source);
|
|
3135
3089
|
return;
|
|
3136
3090
|
}
|
|
3137
3091
|
|
|
@@ -3164,7 +3118,7 @@ WebGLRenderingContext::GetSupportedExtensions(const v8::FunctionCallbackInfo<v8:
|
|
|
3164
3118
|
for (int i = 0; i < len; ++i) {
|
|
3165
3119
|
auto item = canvas_native_string_buffer_get_value_at(exts, i);
|
|
3166
3120
|
if (item != nullptr) {
|
|
3167
|
-
array->Set(context, i, ConvertToV8OneByteString(isolate, (char *) item));
|
|
3121
|
+
array->Set(context, i, ConvertToV8OneByteString(isolate, (char *) item)).FromJust();
|
|
3168
3122
|
}
|
|
3169
3123
|
|
|
3170
3124
|
}
|
|
@@ -3314,7 +3268,7 @@ WebGLRenderingContext::GetUniform(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
3314
3268
|
context, i,
|
|
3315
3269
|
v8::Boolean::New(isolate,
|
|
3316
3270
|
item ==
|
|
3317
|
-
1));
|
|
3271
|
+
1)).FromJust();
|
|
3318
3272
|
}
|
|
3319
3273
|
args.GetReturnValue().Set(array);
|
|
3320
3274
|
canvas_native_webgl_WebGLResult_destroy(val);
|
|
@@ -3560,7 +3514,6 @@ WebGLRenderingContext::IsBuffer(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
3560
3514
|
return;
|
|
3561
3515
|
}
|
|
3562
3516
|
|
|
3563
|
-
auto isolate = args.GetIsolate();
|
|
3564
3517
|
|
|
3565
3518
|
auto value = args[0];
|
|
3566
3519
|
auto type = GetNativeType(value);
|
|
@@ -3619,8 +3572,6 @@ WebGLRenderingContext::IsFramebuffer(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
3619
3572
|
return;
|
|
3620
3573
|
}
|
|
3621
3574
|
|
|
3622
|
-
auto isolate = args.GetIsolate();
|
|
3623
|
-
|
|
3624
3575
|
auto value = args[0];
|
|
3625
3576
|
auto type = GetNativeType(value);
|
|
3626
3577
|
if (type == NativeType::WebGLFramebuffer) {
|
|
@@ -3642,12 +3593,10 @@ void
|
|
|
3642
3593
|
WebGLRenderingContext::IsProgram(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
3643
3594
|
WebGLRenderingContext *ptr = GetPointer(args.This());
|
|
3644
3595
|
if (ptr == nullptr) {
|
|
3645
|
-
args.GetReturnValue().
|
|
3596
|
+
args.GetReturnValue().Set(false);
|
|
3646
3597
|
return;
|
|
3647
3598
|
}
|
|
3648
3599
|
|
|
3649
|
-
auto isolate = args.GetIsolate();
|
|
3650
|
-
|
|
3651
3600
|
auto value = args[0];
|
|
3652
3601
|
auto type = GetNativeType(value);
|
|
3653
3602
|
if (type == NativeType::WebGLProgram) {
|
|
@@ -3674,8 +3623,6 @@ WebGLRenderingContext::IsRenderbuffer(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
3674
3623
|
return;
|
|
3675
3624
|
}
|
|
3676
3625
|
|
|
3677
|
-
auto isolate = args.GetIsolate();
|
|
3678
|
-
|
|
3679
3626
|
auto value = args[0];
|
|
3680
3627
|
auto type = GetNativeType(value);
|
|
3681
3628
|
if (type == NativeType::WebGLRenderbuffer) {
|
|
@@ -3702,8 +3649,6 @@ WebGLRenderingContext::IsShader(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
3702
3649
|
return;
|
|
3703
3650
|
}
|
|
3704
3651
|
|
|
3705
|
-
auto isolate = args.GetIsolate();
|
|
3706
|
-
|
|
3707
3652
|
auto value = args[0];
|
|
3708
3653
|
auto type = GetNativeType(value);
|
|
3709
3654
|
if (type == NativeType::WebGLShader) {
|
|
@@ -3729,8 +3674,6 @@ WebGLRenderingContext::IsTexture(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
3729
3674
|
return;
|
|
3730
3675
|
}
|
|
3731
3676
|
|
|
3732
|
-
auto isolate = args.GetIsolate();
|
|
3733
|
-
|
|
3734
3677
|
auto value = args[0];
|
|
3735
3678
|
auto type = GetNativeType(value);
|
|
3736
3679
|
if (type == NativeType::WebGLTexture) {
|
|
@@ -3773,7 +3716,6 @@ WebGLRenderingContext::LinkProgram(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
3773
3716
|
return;
|
|
3774
3717
|
}
|
|
3775
3718
|
|
|
3776
|
-
auto isolate = args.GetIsolate();
|
|
3777
3719
|
auto value = args[0];
|
|
3778
3720
|
auto type = GetNativeType(value);
|
|
3779
3721
|
if (type == NativeType::WebGLProgram) {
|
|
@@ -4215,7 +4157,6 @@ WebGLRenderingContext::TexImage2D(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4215
4157
|
if (image_asset !=
|
|
4216
4158
|
nullptr) {
|
|
4217
4159
|
|
|
4218
|
-
|
|
4219
4160
|
canvas_native_webgl_tex_image2d_image_asset(
|
|
4220
4161
|
target,
|
|
4221
4162
|
level,
|
|
@@ -4279,6 +4220,30 @@ WebGLRenderingContext::TexImage2D(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4279
4220
|
}
|
|
4280
4221
|
return;
|
|
4281
4222
|
}
|
|
4223
|
+
case NativeType::ImageData: {
|
|
4224
|
+
auto image_data = ImageDataImpl::GetPointer(pixels.As<v8::Object>());
|
|
4225
|
+
if (image_data != nullptr) {
|
|
4226
|
+
auto width = canvas_native_image_data_get_width(image_data->GetImageData());
|
|
4227
|
+
auto height = canvas_native_image_data_get_height(image_data->GetImageData());
|
|
4228
|
+
auto buffer = canvas_native_image_data_get_data(image_data->GetImageData());
|
|
4229
|
+
auto size = canvas_native_u8_buffer_get_length(buffer);
|
|
4230
|
+
auto data = canvas_native_u8_buffer_get_bytes(buffer);
|
|
4231
|
+
canvas_native_webgl_tex_image2d(
|
|
4232
|
+
target,
|
|
4233
|
+
level,
|
|
4234
|
+
internalformat,
|
|
4235
|
+
width,
|
|
4236
|
+
height,
|
|
4237
|
+
format,
|
|
4238
|
+
type,
|
|
4239
|
+
GL_RGBA,
|
|
4240
|
+
data,
|
|
4241
|
+
size,
|
|
4242
|
+
ptr->GetState()
|
|
4243
|
+
);
|
|
4244
|
+
}
|
|
4245
|
+
|
|
4246
|
+
}
|
|
4282
4247
|
default:
|
|
4283
4248
|
break;
|
|
4284
4249
|
}
|
|
@@ -4348,8 +4313,7 @@ WebGLRenderingContext::TexImage2D(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
4348
4313
|
auto array = buf->Buffer();
|
|
4349
4314
|
auto offset = buf->ByteOffset();
|
|
4350
4315
|
auto size = array->ByteLength();
|
|
4351
|
-
auto
|
|
4352
|
-
auto data = static_cast<uint8_t *>((void *) data_ptr);
|
|
4316
|
+
auto data = static_cast<const uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
4353
4317
|
|
|
4354
4318
|
|
|
4355
4319
|
canvas_native_webgl_tex_image2d(
|
|
@@ -4538,6 +4502,30 @@ WebGLRenderingContext::TexSubImage2D(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
4538
4502
|
}
|
|
4539
4503
|
return;
|
|
4540
4504
|
}
|
|
4505
|
+
case NativeType::ImageData: {
|
|
4506
|
+
auto image_data = ImageDataImpl::GetPointer(pixels.As<v8::Object>());
|
|
4507
|
+
if (image_data != nullptr) {
|
|
4508
|
+
auto width = canvas_native_image_data_get_width(image_data->GetImageData());
|
|
4509
|
+
auto height = canvas_native_image_data_get_height(image_data->GetImageData());
|
|
4510
|
+
auto buffer = canvas_native_image_data_get_data(image_data->GetImageData());
|
|
4511
|
+
auto size = canvas_native_u8_buffer_get_length(buffer);
|
|
4512
|
+
auto data = canvas_native_u8_buffer_get_bytes(buffer);
|
|
4513
|
+
canvas_native_webgl_tex_sub_image2d(
|
|
4514
|
+
target,
|
|
4515
|
+
level,
|
|
4516
|
+
xoffset,
|
|
4517
|
+
yoffset,
|
|
4518
|
+
width,
|
|
4519
|
+
height,
|
|
4520
|
+
format,
|
|
4521
|
+
GL_RGBA,
|
|
4522
|
+
data,
|
|
4523
|
+
size,
|
|
4524
|
+
ptr->GetState()
|
|
4525
|
+
);
|
|
4526
|
+
}
|
|
4527
|
+
|
|
4528
|
+
}
|
|
4541
4529
|
default:
|
|
4542
4530
|
break;
|
|
4543
4531
|
}
|
|
@@ -4569,8 +4557,7 @@ WebGLRenderingContext::TexSubImage2D(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
4569
4557
|
auto array = buf->Buffer();
|
|
4570
4558
|
auto offset = buf->ByteOffset();
|
|
4571
4559
|
auto size = array->ByteLength();
|
|
4572
|
-
auto
|
|
4573
|
-
auto data = static_cast<uint8_t *>((void *) data_ptr);
|
|
4560
|
+
auto data = static_cast<const uint8_t *>(array->GetBackingStore()->Data()) + offset;
|
|
4574
4561
|
|
|
4575
4562
|
|
|
4576
4563
|
canvas_native_webgl_tex_sub_image2d(
|
|
@@ -4717,7 +4704,6 @@ WebGLRenderingContext::VertexAttrib1fv(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
4717
4704
|
auto value = args[1];
|
|
4718
4705
|
if (value->IsFloat32Array()) {
|
|
4719
4706
|
auto buf = value.As<v8::Float32Array>();
|
|
4720
|
-
|
|
4721
4707
|
auto array = buf->Buffer();
|
|
4722
4708
|
auto offset = buf->ByteOffset();
|
|
4723
4709
|
auto size = buf->Length();
|
|
@@ -5705,10 +5691,8 @@ WebGLRenderingContext::UseProgram(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
5705
5691
|
return;
|
|
5706
5692
|
}
|
|
5707
5693
|
|
|
5708
|
-
auto isolate = args.GetIsolate();
|
|
5709
|
-
|
|
5710
5694
|
auto value = args[0];
|
|
5711
|
-
if (value->
|
|
5695
|
+
if (value->IsNullOrUndefined()) {
|
|
5712
5696
|
canvas_native_webgl_use_program(0,
|
|
5713
5697
|
ptr->GetState());
|
|
5714
5698
|
|
|
@@ -5735,8 +5719,6 @@ WebGLRenderingContext::ValidateProgram(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
5735
5719
|
return;
|
|
5736
5720
|
}
|
|
5737
5721
|
|
|
5738
|
-
auto isolate = args.GetIsolate();
|
|
5739
|
-
|
|
5740
5722
|
auto value = args[0];
|
|
5741
5723
|
auto type = GetNativeType(value);
|
|
5742
5724
|
if (type == NativeType::WebGLProgram) {
|
|
@@ -6302,6 +6284,10 @@ WebGLRenderingContext::SetMethods(v8::Isolate *isolate, const v8::Local<v8::Obje
|
|
|
6302
6284
|
v8::Local<v8::Value>());
|
|
6303
6285
|
|
|
6304
6286
|
|
|
6287
|
+
tmpl->SetAccessor(ConvertToV8String(isolate, "continuousRenderMode"), GetContinuousRenderMode,
|
|
6288
|
+
SetContinuousRenderMode);
|
|
6289
|
+
|
|
6290
|
+
|
|
6305
6291
|
// todo
|
|
6306
6292
|
tmpl->Set(ConvertToV8String(isolate, "__toDataURL"),
|
|
6307
6293
|
v8::FunctionTemplate::New(isolate, &__ToDataURL));
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
WebGLRenderingContextBase::WebGLRenderingContextBase(WebGLState* state,
|
|
8
8
|
WebGLRenderingVersion version)
|
|
9
9
|
: state_(state), version_(version) {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
|
|
11
|
+
|
|
12
12
|
auto ctx_ptr = reinterpret_cast<intptr_t>(reinterpret_cast<intptr_t *>(this));
|
|
13
13
|
auto raf_callback = new OnRafCallback(
|
|
14
14
|
ctx_ptr,
|
|
@@ -19,13 +19,44 @@ WebGLRenderingContextBase::WebGLRenderingContextBase(WebGLState* state,
|
|
|
19
19
|
std::make_shared<RafImpl>(
|
|
20
20
|
raf_callback,
|
|
21
21
|
raf_callback_ptr, raf));
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
auto _raf = this->GetRaf();
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
if (_raf != nullptr) {
|
|
26
26
|
canvas_native_raf_start(_raf->GetRaf());
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
void WebGLRenderingContextBase::GetContinuousRenderMode(v8::Local<v8::String> property,
|
|
33
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
34
|
+
WebGLRenderingContextBase *ptr = GetPointer(info.This());
|
|
35
|
+
if (ptr == nullptr) {
|
|
36
|
+
info.GetReturnValue().Set(false);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
info.GetReturnValue().Set(ptr->continuousRender_);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
void WebGLRenderingContextBase::SetContinuousRenderMode(v8::Local<v8::String> property,
|
|
43
|
+
v8::Local<v8::Value> value,
|
|
44
|
+
const v8::PropertyCallbackInfo<void> &info) {
|
|
45
|
+
WebGLRenderingContextBase *ptr = GetPointer(info.This());
|
|
46
|
+
if (ptr == nullptr) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
auto isolate = info.GetIsolate();
|
|
50
|
+
auto val = value->BooleanValue(isolate);
|
|
51
|
+
if (val == ptr->continuousRender_) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (val) {
|
|
55
|
+
ptr->StartRaf();
|
|
56
|
+
} else {
|
|
57
|
+
ptr->StopRaf();
|
|
58
|
+
}
|
|
59
|
+
ptr->continuousRender_ = val;
|
|
29
60
|
}
|
|
30
61
|
|
|
31
62
|
|
|
@@ -64,8 +95,7 @@ void WebGLRenderingContextBase::Flush() {
|
|
|
64
95
|
auto state = this->GetInvalidateState() & (int) InvalidateState::InvalidateStatePending;
|
|
65
96
|
if (state == (int) InvalidateState::InvalidateStatePending) {
|
|
66
97
|
this->SetInvalidateState((int) InvalidateState::InvalidateStateInvalidating);
|
|
67
|
-
|
|
68
|
-
canvas_native_webgl_swap_buffers(this->GetState());
|
|
98
|
+
canvas_native_webgl_make_current_and_swap_buffers(this->GetState());
|
|
69
99
|
this->SetInvalidateState((int) InvalidateState::InvalidateStateNone);
|
|
70
100
|
}
|
|
71
101
|
}
|
|
@@ -32,6 +32,14 @@ public:
|
|
|
32
32
|
return static_cast<WebGLRenderingContextBase *>(ptr);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
|
|
36
|
+
static void GetContinuousRenderMode(v8::Local<v8::String> property,
|
|
37
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
38
|
+
|
|
39
|
+
static void SetContinuousRenderMode(v8::Local<v8::String> property,
|
|
40
|
+
v8::Local<v8::Value> value,
|
|
41
|
+
const v8::PropertyCallbackInfo<void> &info);
|
|
42
|
+
|
|
35
43
|
~WebGLRenderingContextBase();
|
|
36
44
|
|
|
37
45
|
void UpdateInvalidateState();
|
|
@@ -66,5 +74,7 @@ private:
|
|
|
66
74
|
int invalidateState_ = static_cast<int>(InvalidateState::InvalidateStateNone);
|
|
67
75
|
|
|
68
76
|
std::shared_ptr<RafImpl> raf_;
|
|
77
|
+
|
|
78
|
+
bool continuousRender_ = true;
|
|
69
79
|
};
|
|
70
80
|
|