@nativescript/canvas 2.0.0-alpha.19 → 2.0.0-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript/canvas",
3
- "version": "2.0.0-alpha.19",
3
+ "version": "2.0.0-alpha.20",
4
4
  "description": "DOM Canvas API for NativeScript",
5
5
  "main": "index",
6
6
  "typings": "index.d.ts",
@@ -2384,7 +2384,7 @@ jsi::Value WebGL2RenderingContext::get(jsi::Runtime &runtime, const jsi::PropNam
2384
2384
  } else if (methodName == "getBufferSubData") {
2385
2385
  return jsi::Function::createFromHostFunction(runtime,
2386
2386
  jsi::PropNameID::forAscii(runtime, methodName),
2387
- 4,
2387
+ 5,
2388
2388
  [this](jsi::Runtime &runtime,
2389
2389
  const jsi::Value &thisValue,
2390
2390
  const jsi::Value *arguments,
@@ -2400,18 +2400,24 @@ jsi::Value WebGL2RenderingContext::get(jsi::Runtime &runtime, const jsi::PropNam
2400
2400
 
2401
2401
  if (dstDataObject.isTypedArray(
2402
2402
  runtime)) {
2403
- ssize_t dstOffsetValue = 0;
2404
- if (arguments[3].isNumber()) {
2405
- dstOffsetValue = static_cast<ssize_t>(arguments[3].asNumber());
2406
- }
2407
-
2408
- ssize_t lengthValue = 0;
2409
- if (arguments[4].isNumber()) {
2410
- lengthValue = static_cast<ssize_t>(arguments[4].asNumber());
2411
- }
2412
-
2413
- auto array = dstDataObject.getTypedArray(
2414
- runtime);
2403
+
2404
+
2405
+ auto array = dstDataObject.getTypedArray(
2406
+ runtime);
2407
+
2408
+ auto size = array.size(runtime) / array.length(runtime);
2409
+
2410
+ ssize_t dstOffsetValue = 0;
2411
+ if (arguments[3].isNumber()) {
2412
+ dstOffsetValue = static_cast<ssize_t>(arguments[3].asNumber()) * size;
2413
+ }
2414
+
2415
+ ssize_t lengthValue = 0;
2416
+ if (arguments[4].isNumber()) {
2417
+ lengthValue = static_cast<ssize_t>(arguments[4].asNumber()) * size;
2418
+ }
2419
+
2420
+
2415
2421
  auto slice = GetTypedArrayData<uint8_t>(
2416
2422
  runtime, array);
2417
2423