@nativescript/canvas 2.0.0-alpha.24 → 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.
Files changed (24) hide show
  1. package/package.json +1 -1
  2. package/platforms/android/canvas-release.aar +0 -0
  3. package/platforms/ios/CanvasNative.xcframework/Info.plist +5 -5
  4. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  5. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +19 -0
  6. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  7. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  8. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +19 -0
  9. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +2 -2
  10. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  11. package/platforms/ios/src/cpp/CanvasJSIModule.cpp +13 -62
  12. package/platforms/ios/src/cpp/ImageBitmapImpl.h +15 -3
  13. package/platforms/ios/src/cpp/OneByteStringResource.cpp +26 -2
  14. package/platforms/ios/src/cpp/OneByteStringResource.h +14 -3
  15. package/platforms/ios/src/cpp/TextDecoderImpl.cpp +8 -9
  16. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +257 -268
  17. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +8 -2
  18. package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +1 -1
  19. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +72 -94
  20. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.cpp +2 -2
  21. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.h +4 -3
  22. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.cpp +1 -5
  23. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.h +5 -5
  24. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +103 -113
@@ -84,13 +84,11 @@ WebGL2RenderingContext::BeginTransformFeedback(const v8::FunctionCallbackInfo<v8
84
84
  auto isolate = args.GetIsolate();
85
85
  auto context = isolate->GetCurrentContext();
86
86
 
87
- auto value = args[0];
88
- if (value->IsNumber()) {
89
- canvas_native_webgl2_begin_transform_feedback(
90
- args[0]->Uint32Value(context).ToChecked(),
91
- ptr->GetState()
92
- );
93
- }
87
+ auto value = args[0]->Uint32Value(context).ToChecked();
88
+ canvas_native_webgl2_begin_transform_feedback(
89
+ value,
90
+ ptr->GetState()
91
+ );
94
92
  }
95
93
 
96
94
  void WebGL2RenderingContext::BindBufferBase(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -131,7 +129,7 @@ void WebGL2RenderingContext::BindBufferRange(const v8::FunctionCallbackInfo<v8::
131
129
 
132
130
  auto bufferValue = args[2];
133
131
  auto type = GetNativeType(isolate, bufferValue);
134
- if (args.Length() > 4 && type == NativeType::WebGLBuffer) {
132
+ if (type == NativeType::WebGLBuffer) {
135
133
  auto target = args[0]->Uint32Value(context).ToChecked();
136
134
  auto index = args[1]->Uint32Value(context).ToChecked();
137
135
  auto offset = args[3]->NumberValue(context).ToChecked();
@@ -236,35 +234,33 @@ void WebGL2RenderingContext::BlitFramebuffer(const v8::FunctionCallbackInfo<v8::
236
234
  auto isolate = args.GetIsolate();
237
235
  auto context = isolate->GetCurrentContext();
238
236
 
239
- if (args.Length() > 9) {
240
- auto srcX0 = args[0]->Int32Value(context).ToChecked();
241
- auto srcY0 = args[1]->Int32Value(context).ToChecked();
242
-
243
- auto srcX1 = args[2]->Int32Value(context).ToChecked();
244
- auto srcY1 = args[3]->Int32Value(context).ToChecked();
245
-
246
- auto dstX0 = args[4]->Int32Value(context).ToChecked();
247
- auto dstY0 = args[5]->Int32Value(context).ToChecked();
248
-
249
- auto dstX1 = args[6]->Int32Value(context).ToChecked();
250
- auto dstY1 = args[7]->Int32Value(context).ToChecked();
251
-
252
- auto mask = args[8]->Uint32Value(context).ToChecked();
253
- auto filter = args[9]->Uint32Value(context).ToChecked();
254
- canvas_native_webgl2_blit_framebuffer(
255
- srcX0,
256
- srcY0,
257
- srcX1,
258
- srcY1,
259
- dstX0,
260
- dstY0,
261
- dstX1,
262
- dstY1,
263
- mask,
264
- filter,
265
- ptr->GetState()
266
- );
267
- }
237
+ auto srcX0 = args[0]->Int32Value(context).ToChecked();
238
+ auto srcY0 = args[1]->Int32Value(context).ToChecked();
239
+
240
+ auto srcX1 = args[2]->Int32Value(context).ToChecked();
241
+ auto srcY1 = args[3]->Int32Value(context).ToChecked();
242
+
243
+ auto dstX0 = args[4]->Int32Value(context).ToChecked();
244
+ auto dstY0 = args[5]->Int32Value(context).ToChecked();
245
+
246
+ auto dstX1 = args[6]->Int32Value(context).ToChecked();
247
+ auto dstY1 = args[7]->Int32Value(context).ToChecked();
248
+
249
+ auto mask = args[8]->Uint32Value(context).ToChecked();
250
+ auto filter = args[9]->Uint32Value(context).ToChecked();
251
+ canvas_native_webgl2_blit_framebuffer(
252
+ srcX0,
253
+ srcY0,
254
+ srcX1,
255
+ srcY1,
256
+ dstX0,
257
+ dstY0,
258
+ dstX1,
259
+ dstY1,
260
+ mask,
261
+ filter,
262
+ ptr->GetState()
263
+ );
268
264
  }
269
265
 
270
266
  void WebGL2RenderingContext::ClearBufferfv(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -573,21 +569,19 @@ void WebGL2RenderingContext::CopyBufferSubData(const v8::FunctionCallbackInfo<v8
573
569
  auto isolate = args.GetIsolate();
574
570
  auto context = isolate->GetCurrentContext();
575
571
 
576
- if (args.Length() > 4) {
577
- auto readTarget = args[0]->Uint32Value(context).ToChecked();
578
- auto writeTarget = args[1]->Uint32Value(context).ToChecked();
579
- auto readOffset = args[2]->NumberValue(context).ToChecked();
580
- auto writeOffset = args[3]->NumberValue(context).ToChecked();
581
- auto size = args[4]->NumberValue(context).ToChecked();
582
- canvas_native_webgl2_copy_buffer_sub_data(
583
- readTarget,
584
- writeTarget,
585
- static_cast<ssize_t>(readOffset),
586
- static_cast<ssize_t>(writeOffset),
587
- static_cast<ssize_t>(size),
588
- ptr->GetState()
589
- );
590
- }
572
+ auto readTarget = args[0]->Uint32Value(context).ToChecked();
573
+ auto writeTarget = args[1]->Uint32Value(context).ToChecked();
574
+ auto readOffset = args[2]->NumberValue(context).ToChecked();
575
+ auto writeOffset = args[3]->NumberValue(context).ToChecked();
576
+ auto size = args[4]->NumberValue(context).ToChecked();
577
+ canvas_native_webgl2_copy_buffer_sub_data(
578
+ readTarget,
579
+ writeTarget,
580
+ static_cast<ssize_t>(readOffset),
581
+ static_cast<ssize_t>(writeOffset),
582
+ static_cast<ssize_t>(size),
583
+ ptr->GetState()
584
+ );
591
585
  }
592
586
 
593
587
  void WebGL2RenderingContext::CopyTexSubImage3D(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -599,29 +593,27 @@ void WebGL2RenderingContext::CopyTexSubImage3D(const v8::FunctionCallbackInfo<v8
599
593
  auto isolate = args.GetIsolate();
600
594
  auto context = isolate->GetCurrentContext();
601
595
 
602
- if (args.Length() > 8) {
603
- auto target = args[0]->Uint32Value(context).ToChecked();
604
- auto level = args[1]->Int32Value(context).ToChecked();
605
- auto xoffset = args[2]->Int32Value(context).ToChecked();
606
- auto yoffset = args[3]->Int32Value(context).ToChecked();
607
- auto zoffset = args[4]->Int32Value(context).ToChecked();
608
- auto x = args[5]->Int32Value(context).ToChecked();
609
- auto y = args[6]->Int32Value(context).ToChecked();
610
- auto width = args[7]->Int32Value(context).ToChecked();
611
- auto height = args[8]->Int32Value(context).ToChecked();
612
- canvas_native_webgl2_copy_tex_sub_image3d(
613
- target,
614
- level,
615
- xoffset,
616
- yoffset,
617
- zoffset,
618
- x,
619
- y,
620
- width,
621
- height,
622
- ptr->GetState()
623
- );
624
- }
596
+ auto target = args[0]->Uint32Value(context).ToChecked();
597
+ auto level = args[1]->Int32Value(context).ToChecked();
598
+ auto xoffset = args[2]->Int32Value(context).ToChecked();
599
+ auto yoffset = args[3]->Int32Value(context).ToChecked();
600
+ auto zoffset = args[4]->Int32Value(context).ToChecked();
601
+ auto x = args[5]->Int32Value(context).ToChecked();
602
+ auto y = args[6]->Int32Value(context).ToChecked();
603
+ auto width = args[7]->Int32Value(context).ToChecked();
604
+ auto height = args[8]->Int32Value(context).ToChecked();
605
+ canvas_native_webgl2_copy_tex_sub_image3d(
606
+ target,
607
+ level,
608
+ xoffset,
609
+ yoffset,
610
+ zoffset,
611
+ x,
612
+ y,
613
+ width,
614
+ height,
615
+ ptr->GetState()
616
+ );
625
617
  }
626
618
 
627
619
  void WebGL2RenderingContext::CreateQuery(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -900,14 +892,14 @@ void WebGL2RenderingContext::DrawRangeElements(const v8::FunctionCallbackInfo<v8
900
892
  auto mode = args[0]->Uint32Value(context).ToChecked();
901
893
  auto start = args[1]->Uint32Value(context).ToChecked();
902
894
  auto end = args[2]->Uint32Value(context).ToChecked();
903
- auto count_ = args[3]->Int32Value(context).ToChecked();
895
+ auto count = args[3]->Int32Value(context).ToChecked();
904
896
  auto type = args[4]->Uint32Value(context).ToChecked();
905
897
  auto offset = args[5]->NumberValue(context).ToChecked();
906
898
  canvas_native_webgl2_draw_range_elements(
907
899
  mode,
908
900
  start,
909
901
  end,
910
- count_,
902
+ count,
911
903
  type,
912
904
  static_cast<ssize_t>(offset),
913
905
  ptr->GetState()
@@ -925,11 +917,9 @@ void WebGL2RenderingContext::EndQuery(const v8::FunctionCallbackInfo<v8::Value>
925
917
  auto isolate = args.GetIsolate();
926
918
  auto context = isolate->GetCurrentContext();
927
919
 
928
- if (args[0]->IsNumber()) {
929
- auto target = args[0]->Uint32Value(context).ToChecked();
930
- canvas_native_webgl2_end_query(target,
931
- ptr->GetState());
932
- }
920
+ auto target = args[0]->Uint32Value(context).ToChecked();
921
+ canvas_native_webgl2_end_query(target,
922
+ ptr->GetState());
933
923
  }
934
924
 
935
925
  void WebGL2RenderingContext::EndTransformFeedback(const v8::FunctionCallbackInfo<v8::Value> &args) {
@@ -2898,42 +2888,42 @@ void WebGL2RenderingContext::Uniform4uiv(const v8::FunctionCallbackInfo<v8::Valu
2898
2888
  if (type == NativeType::WebGLUniformLocation) {
2899
2889
  auto location = WebGLUniformLocation::GetPointer(locationValue.As<v8::Object>());
2900
2890
  auto dataValue = args[1];
2901
- if (location != nullptr &&
2902
- dataValue->IsUint32Array()) {
2903
- auto buf = dataValue.As<v8::Uint32Array>();
2891
+ if(location != nullptr){
2892
+ if (dataValue->IsUint32Array()) {
2893
+ auto buf = dataValue.As<v8::Uint32Array>();
2904
2894
 
2905
- auto array = buf->Buffer();
2906
- auto offset = buf->ByteOffset();
2907
- auto size = buf->Length();
2908
- auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
2909
- auto data = static_cast<uint32_t *>((void *) data_ptr);
2895
+ auto array = buf->Buffer();
2896
+ auto offset = buf->ByteOffset();
2897
+ auto size = buf->Length();
2898
+ auto data_ptr = static_cast<uint8_t *>(array->GetBackingStore()->Data()) + offset;
2899
+ auto data = static_cast<uint32_t *>((void *) data_ptr);
2910
2900
 
2911
2901
 
2912
- canvas_native_webgl2_uniform4uiv(
2913
- location->GetUniformLocation(),
2914
- data, size,
2915
- ptr->GetState()
2916
- );
2917
- } else {
2918
- std::vector<uint32_t> buf;
2919
- auto array = dataValue.As<v8::Array>();
2920
- auto len = array->Length();
2921
- buf.reserve(len);
2922
- for (int i = 0; i < len; i++) {
2923
- auto item = array->Get(
2924
- context,
2925
- i).ToLocalChecked()->Uint32Value(
2926
- context).ToChecked();
2927
- buf.push_back(item);
2928
- }
2902
+ canvas_native_webgl2_uniform4uiv(
2903
+ location->GetUniformLocation(),
2904
+ data, size,
2905
+ ptr->GetState()
2906
+ );
2907
+ } else {
2908
+ std::vector<uint32_t> buf;
2909
+ auto array = dataValue.As<v8::Array>();
2910
+ auto len = array->Length();
2911
+ buf.reserve(len);
2912
+ for (int i = 0; i < len; i++) {
2913
+ auto item = array->Get(
2914
+ context,
2915
+ i).ToLocalChecked()->Uint32Value(
2916
+ context).ToChecked();
2917
+ buf.push_back(item);
2918
+ }
2929
2919
 
2930
- canvas_native_webgl2_uniform4uiv(
2931
- location->GetUniformLocation(),
2932
- buf.data(), buf.size(),
2933
- ptr->GetState()
2934
- );
2920
+ canvas_native_webgl2_uniform4uiv(
2921
+ location->GetUniformLocation(),
2922
+ buf.data(), buf.size(),
2923
+ ptr->GetState()
2924
+ );
2925
+ }
2935
2926
  }
2936
-
2937
2927
  }
2938
2928
 
2939
2929
  }