@nativescript/canvas 2.0.0-alpha.21 → 2.0.0-alpha.23

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 (32) hide show
  1. package/Canvas/index.android.js +1 -3
  2. package/Canvas/index.android.js.map +1 -1
  3. package/WebGL/WebGLRenderingContext/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/platforms/android/canvas-release.aar +0 -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/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  8. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +4 -4
  9. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +291 -302
  10. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.cpp +0 -2
  11. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +1545 -1760
  12. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.cpp +14 -14
  13. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.cpp +2 -2
  14. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.cpp +4 -4
  15. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.cpp +58 -71
  16. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.h +4 -4
  17. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.h +2 -2
  18. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.h +1 -1
  19. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.h +1 -1
  20. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.h +1 -1
  21. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.h +1 -1
  22. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.h +4 -4
  23. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.h +3 -3
  24. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.h +1 -1
  25. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.h +10 -10
  26. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.h +4 -4
  27. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.h +4 -4
  28. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.h +4 -4
  29. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.h +1 -1
  30. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.cpp +5 -13
  31. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.h +40 -39
  32. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +1454 -1586
@@ -8,20 +8,20 @@
8
8
 
9
9
  CanvasRenderingContext2DImpl::CanvasRenderingContext2DImpl(
10
10
  CanvasRenderingContext2D* context) : context_(context) {
11
-
11
+
12
12
  auto ctx_ptr = reinterpret_cast<intptr_t>(reinterpret_cast<intptr_t *>(this));
13
13
  auto raf_callback = new OnRafCallback(ctx_ptr, 0);
14
14
  auto raf_callback_ptr = reinterpret_cast<intptr_t>(reinterpret_cast<intptr_t *>(raf_callback));
15
15
  auto raf = canvas_native_raf_create(raf_callback_ptr, OnRafCallbackOnFrame);
16
-
16
+
17
17
  this->SetRaf(std::make_shared<RafImpl>(raf_callback, raf_callback_ptr, raf));
18
-
18
+
19
19
  auto _raf = this->GetRaf();
20
-
20
+
21
21
  if (_raf != nullptr) {
22
22
  canvas_native_raf_start(_raf->GetRaf());
23
23
  }
24
-
24
+
25
25
  }
26
26
 
27
27
 
@@ -29,11 +29,11 @@ void CanvasRenderingContext2DImpl::Init(v8::Local<v8::Object> canvasModule, v8::
29
29
  v8::Locker locker(isolate);
30
30
  v8::Isolate::Scope isolate_scope(isolate);
31
31
  v8::HandleScope handle_scope(isolate);
32
-
32
+
33
33
  auto ctor = GetCtor(isolate);
34
34
  auto context = isolate->GetCurrentContext();
35
35
  auto func = ctor->GetFunction(context).ToLocalChecked();
36
-
36
+
37
37
  canvasModule->Set(context, ConvertToV8String(isolate, "CanvasRenderingContext2D"), func);
38
38
  }
39
39
 
@@ -52,28 +52,28 @@ v8::Local<v8::FunctionTemplate> CanvasRenderingContext2DImpl::GetCtor(v8::Isolat
52
52
  if (ctor != nullptr) {
53
53
  return ctor->Get(isolate);
54
54
  }
55
-
55
+
56
56
  v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
57
57
  ctorTmpl->InstanceTemplate()->SetInternalFieldCount(1);
58
58
  ctorTmpl->SetClassName(ConvertToV8String(isolate, "CanvasRenderingContext2D"));
59
-
59
+
60
60
  auto tmpl = ctorTmpl->InstanceTemplate();
61
61
  tmpl->SetInternalFieldCount(1);
62
-
62
+
63
63
  tmpl->Set(ConvertToV8String(isolate, "drawPoint"),
64
64
  v8::FunctionTemplate::New(isolate, &DrawPoint));
65
65
  tmpl->Set(ConvertToV8String(isolate, "drawPoints"),
66
66
  v8::FunctionTemplate::New(isolate, &DrawPoints));
67
67
  tmpl->Set(ConvertToV8String(isolate, "drawPaint"),
68
68
  v8::FunctionTemplate::New(isolate, &DrawPaint));
69
-
70
-
69
+
70
+
71
71
  tmpl->Set(ConvertToV8String(isolate, "__makeDirty"),
72
72
  v8::FunctionTemplate::New(isolate, __MakeDirty));
73
73
  tmpl->Set(ConvertToV8String(isolate, "__getPointer"),
74
74
  v8::FunctionTemplate::New(isolate, __GetPointer));
75
75
  tmpl->Set(ConvertToV8String(isolate, "__resize"), v8::FunctionTemplate::New(isolate, __Resize));
76
-
76
+
77
77
  tmpl->SetAccessor(ConvertToV8String(isolate, "filter"), GetFilter, SetFilter);
78
78
  tmpl->SetAccessor(ConvertToV8String(isolate, "font"), GetFont, SetFont);
79
79
  tmpl->SetAccessor(ConvertToV8String(isolate, "globalAlpha"), GetGlobalAlpha, SetGlobalAlpha);
@@ -99,8 +99,8 @@ v8::Local<v8::FunctionTemplate> CanvasRenderingContext2DImpl::GetCtor(v8::Isolat
99
99
  tmpl->SetAccessor(ConvertToV8String(isolate, "strokeStyle"), GetStrokeStyle, SetStrokeStyle);
100
100
  tmpl->SetAccessor(ConvertToV8String(isolate, "lineWidth"), GetLineWidth, SetLineWidth);
101
101
  tmpl->SetAccessor(ConvertToV8String(isolate, "lineDash"), GetLineDash, SetLineDash);
102
-
103
-
102
+
103
+
104
104
  tmpl->Set(ConvertToV8String(isolate, "addHitRegion"),
105
105
  v8::FunctionTemplate::New(isolate, &AddHitRegion));
106
106
  tmpl->Set(ConvertToV8String(isolate, "arc"), v8::FunctionTemplate::New(isolate, &Arc));
@@ -180,7 +180,7 @@ v8::Local<v8::FunctionTemplate> CanvasRenderingContext2DImpl::GetCtor(v8::Isolat
180
180
  v8::FunctionTemplate::New(isolate, &Translate));
181
181
  tmpl->Set(ConvertToV8String(isolate, "__toDataURL"),
182
182
  v8::FunctionTemplate::New(isolate, &__ToDataURL));
183
-
183
+
184
184
  cache->CanvasRenderingContext2DTmpl =
185
185
  std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
186
186
  return ctorTmpl;
@@ -201,14 +201,13 @@ void CanvasRenderingContext2DImpl::DrawPoint(const v8::FunctionCallbackInfo<v8::
201
201
  if (ptr == nullptr) {
202
202
  return;
203
203
  }
204
-
204
+
205
205
  auto isolate = args.GetIsolate();
206
206
  auto context = isolate->GetCurrentContext();
207
-
208
-
207
+
209
208
  auto x = (float) args[0]->NumberValue(context).ToChecked();
210
209
  auto y = (float) args[1]->NumberValue(context).ToChecked();
211
-
210
+
212
211
  canvas_native_context_draw_point(
213
212
  ptr->GetContext(), x, y);
214
213
  ptr->UpdateInvalidateState();
@@ -219,16 +218,16 @@ void CanvasRenderingContext2DImpl::DrawPoints(const v8::FunctionCallbackInfo<v8:
219
218
  if (ptr == nullptr) {
220
219
  return;
221
220
  }
222
-
221
+
223
222
  auto isolate = args.GetIsolate();
224
223
  auto context = isolate->GetCurrentContext();
225
-
226
-
224
+
225
+
227
226
  auto mode = ConvertFromV8String(isolate, args[0]);
228
227
  auto points = args[1].As<v8::Array>();
229
228
  auto size = points->Length();
230
-
231
-
229
+
230
+
232
231
  if ((size % 2) == 0) {
233
232
  int32_t pointMode = -1;
234
233
  if (mode == "points") {
@@ -245,10 +244,10 @@ void CanvasRenderingContext2DImpl::DrawPoints(const v8::FunctionCallbackInfo<v8:
245
244
  store.reserve(size);
246
245
  int next = 0;
247
246
  for (int i = 0; i < size; i++) {
248
-
247
+
249
248
  auto object = points->Get(
250
249
  context, i).ToLocalChecked().As<v8::Object>();
251
-
250
+
252
251
  auto x = object->Get(context,
253
252
  ConvertToV8String(isolate, "x")).ToLocalChecked()->NumberValue(
254
253
  context).ToChecked();
@@ -257,15 +256,15 @@ void CanvasRenderingContext2DImpl::DrawPoints(const v8::FunctionCallbackInfo<v8:
257
256
  context).ToChecked();
258
257
  store[next] = (float) x;
259
258
  store[next + 1] = (float) y;
260
-
259
+
261
260
  next = i + 2;
262
261
  }
263
-
262
+
264
263
  canvas_native_context_draw_points(
265
264
  ptr->GetContext(), pointMode,
266
265
  store.data(),store.size());
267
-
268
-
266
+
267
+
269
268
  ptr->UpdateInvalidateState();
270
269
  }
271
270
  }
@@ -275,10 +274,10 @@ void CanvasRenderingContext2DImpl::DrawPaint(const v8::FunctionCallbackInfo<v8::
275
274
  if (ptr == nullptr) {
276
275
  return;
277
276
  }
278
-
277
+
279
278
  auto isolate = args.GetIsolate();
280
-
281
-
279
+
280
+
282
281
  auto color = ConvertFromV8String(isolate, args[0]);
283
282
  canvas_native_context_draw_paint(
284
283
  ptr->GetContext(), color.c_str());
@@ -302,9 +301,9 @@ void CanvasRenderingContext2DImpl::__GetPointer(const v8::FunctionCallbackInfo<v
302
301
  args.GetReturnValue().SetEmptyString();
303
302
  return;
304
303
  }
305
-
304
+
306
305
  auto isolate = args.GetIsolate();
307
-
306
+
308
307
  auto pointer = (intptr_t *) ptr->GetContext();
309
308
  auto ret = std::to_string((intptr_t) pointer);
310
309
  args.GetReturnValue().Set(ConvertToV8String(isolate, ret));
@@ -315,11 +314,11 @@ void CanvasRenderingContext2DImpl::__Resize(const v8::FunctionCallbackInfo<v8::V
315
314
  if (ptr == nullptr) {
316
315
  return;
317
316
  }
318
-
317
+
319
318
  auto isolate = args.GetIsolate();
320
319
  auto context = isolate->GetCurrentContext();
321
-
322
-
320
+
321
+
323
322
  auto width = args[0]->NumberValue(context).ToChecked();
324
323
  auto height = args[1]->NumberValue(context).ToChecked();
325
324
  canvas_native_context_resize(
@@ -364,7 +363,7 @@ void CanvasRenderingContext2DImpl::GetFont(v8::Local<v8::String> property,
364
363
  auto isolate = info.GetIsolate();
365
364
  auto font = canvas_native_context_get_font(ptr->GetContext());
366
365
  info.GetReturnValue().Set(ConvertToV8String(isolate, font));
367
-
366
+
368
367
  canvas_native_string_destroy((char*) font);
369
368
  }
370
369
 
@@ -438,9 +437,9 @@ void CanvasRenderingContext2DImpl::GetImageSmoothingQuality(v8::Local<v8::String
438
437
  auto quality = canvas_native_context_get_image_smoothing_quality(ptr->GetContext());
439
438
  info.GetReturnValue().Set(
440
439
  ConvertToV8String(isolate, quality));
441
-
440
+
442
441
  canvas_native_string_destroy((char*)quality);
443
-
442
+
444
443
  }
445
444
 
446
445
  void CanvasRenderingContext2DImpl::SetImageSmoothingQuality(v8::Local<v8::String> property,
@@ -490,7 +489,7 @@ void CanvasRenderingContext2DImpl::GetLineJoin(v8::Local<v8::String> property,
490
489
  auto isolate = info.GetIsolate();
491
490
  auto join = canvas_native_context_get_line_join(ptr->GetContext());
492
491
  info.GetReturnValue().Set(ConvertToV8String(isolate, join));
493
-
492
+
494
493
  canvas_native_string_destroy((char*)join);
495
494
  }
496
495
 
@@ -516,7 +515,7 @@ void CanvasRenderingContext2DImpl::GetLineCap(v8::Local<v8::String> property,
516
515
  auto isolate = info.GetIsolate();
517
516
  auto cap = canvas_native_context_get_line_cap(ptr->GetContext());
518
517
  info.GetReturnValue().Set(ConvertToV8String(isolate, cap));
519
-
518
+
520
519
  canvas_native_string_destroy((char*)cap);
521
520
  }
522
521
 
@@ -695,7 +694,7 @@ void CanvasRenderingContext2DImpl::GetGlobalCompositeOperation(v8::Local<v8::Str
695
694
  auto operation = canvas_native_context_get_global_composition(ptr->GetContext());
696
695
  info.GetReturnValue().Set(
697
696
  ConvertToV8String(info.GetIsolate(), operation));
698
-
697
+
699
698
  canvas_native_string_destroy((char*) operation);
700
699
  }
701
700
 
@@ -720,34 +719,34 @@ void CanvasRenderingContext2DImpl::GetFillStyle(v8::Local<v8::String> property,
720
719
  return;
721
720
  }
722
721
  auto isolate = info.GetIsolate();
723
-
722
+
724
723
  PaintStyleType type = canvas_native_context_get_current_fill_style_type(ptr->GetContext());
725
-
724
+
726
725
  switch (type) {
727
726
  case PaintStyleType::PaintStyleTypeColor: {
728
727
  auto color = canvas_native_paint_style_get_current_fill_color_string(
729
728
  ptr->GetContext());
730
-
731
-
729
+
730
+
732
731
  auto value = new OneByteStringResource((char*)color);
733
732
  auto ret = v8::String::NewExternalOneByte(isolate, value);
734
733
  info.GetReturnValue().Set(ret.ToLocalChecked());
735
-
734
+
736
735
  //info.GetReturnValue().Set(ConvertToV8String(isolate, color.c_str()));
737
736
  break;
738
737
  }
739
738
  case PaintStyleType::PaintStyleTypeGradient: {
740
739
  auto style = CanvasGradient::NewInstance(isolate, new CanvasGradient(
741
740
  canvas_native_context_get_fill_style(ptr->GetContext())));
742
-
741
+
743
742
  info.GetReturnValue().Set(style);
744
-
743
+
745
744
  break;
746
745
  }
747
746
  case PaintStyleType::PaintStyleTypePattern: {
748
747
  auto style = CanvasPattern::NewInstance(isolate, new CanvasPattern(
749
748
  canvas_native_context_get_fill_style(ptr->GetContext())));
750
-
749
+
751
750
  info.GetReturnValue().Set(style);
752
751
  break;
753
752
  }
@@ -756,7 +755,7 @@ void CanvasRenderingContext2DImpl::GetFillStyle(v8::Local<v8::String> property,
756
755
  break;
757
756
  }
758
757
  }
759
-
758
+
760
759
  }
761
760
 
762
761
  void CanvasRenderingContext2DImpl::SetFillStyle(v8::Local<v8::String> property,
@@ -768,36 +767,31 @@ void CanvasRenderingContext2DImpl::SetFillStyle(v8::Local<v8::String> property,
768
767
  }
769
768
  auto isolate = info.GetIsolate();
770
769
  auto context = isolate->GetCurrentContext();
771
-
770
+
772
771
  if (value->IsString()) {
773
772
  auto style = ConvertFromV8String(isolate, value);
774
773
  canvas_native_paint_style_set_fill_color_with_c_string(ptr->GetContext(),
775
774
  style.c_str());
776
775
  } else if (value->IsObject()) {
777
-
778
- auto typeValue = GetPrivateValue(isolate, value.As<v8::Object>(),
779
- ConvertToV8String(isolate, "__type"));
780
-
781
- if (!typeValue.IsEmpty()) {
782
- auto type = (NativeType) typeValue->Int32Value(context).ToChecked();
783
-
784
- switch (type) {
785
- case NativeType::CanvasGradient: {
786
- auto gradient = CanvasGradient::GetPointer(value.As<v8::Object>());
787
- canvas_native_context_set_fill_style(ptr->GetContext(),
788
- gradient->GetPaintStyle());
789
- }
790
- break;
791
- case NativeType::CanvasPattern: {
792
- auto pattern = CanvasPattern::GetPointer(value.As<v8::Object>());
793
- canvas_native_context_set_fill_style(ptr->GetContext(),
794
- pattern->GetPaintStyle());
795
- }
796
- break;
797
- default:
798
- // noop
799
- break;
776
+
777
+ auto type = GetNativeType(isolate, value);
778
+
779
+ switch (type) {
780
+ case NativeType::CanvasGradient: {
781
+ auto gradient = CanvasGradient::GetPointer(value.As<v8::Object>());
782
+ canvas_native_context_set_fill_style(ptr->GetContext(),
783
+ gradient->GetPaintStyle());
800
784
  }
785
+ break;
786
+ case NativeType::CanvasPattern: {
787
+ auto pattern = CanvasPattern::GetPointer(value.As<v8::Object>());
788
+ canvas_native_context_set_fill_style(ptr->GetContext(),
789
+ pattern->GetPaintStyle());
790
+ }
791
+ break;
792
+ default:
793
+ // noop
794
+ break;
801
795
  }
802
796
  }
803
797
  }
@@ -810,33 +804,33 @@ void CanvasRenderingContext2DImpl::GetStrokeStyle(v8::Local<v8::String> property
810
804
  return;
811
805
  }
812
806
  auto isolate = info.GetIsolate();
813
-
807
+
814
808
  PaintStyleType type = canvas_native_context_get_current_stroke_style_type(ptr->GetContext());
815
-
809
+
816
810
  switch (type) {
817
811
  case PaintStyleType::PaintStyleTypeColor: {
818
812
  auto color = canvas_native_paint_style_get_current_stroke_color_string(
819
813
  ptr->GetContext());
820
-
814
+
821
815
  auto value = new OneByteStringResource((char*) color);
822
816
  auto ret = v8::String::NewExternalOneByte(isolate, value);
823
817
  info.GetReturnValue().Set(ret.ToLocalChecked());
824
-
818
+
825
819
  //info.GetReturnValue().Set(ConvertToV8String(isolate, color.c_str()));
826
820
  break;
827
821
  }
828
822
  case PaintStyleType::PaintStyleTypeGradient: {
829
823
  auto style = CanvasGradient::NewInstance(isolate, new CanvasGradient(
830
824
  canvas_native_context_get_stroke_style(ptr->GetContext())));
831
-
825
+
832
826
  info.GetReturnValue().Set(style);
833
-
827
+
834
828
  break;
835
829
  }
836
830
  case PaintStyleType::PaintStyleTypePattern: {
837
831
  auto style = CanvasPattern::NewInstance(isolate, new CanvasPattern(
838
832
  canvas_native_context_get_stroke_style(ptr->GetContext())));
839
-
833
+
840
834
  info.GetReturnValue().Set(style);
841
835
  break;
842
836
  }
@@ -845,7 +839,7 @@ void CanvasRenderingContext2DImpl::GetStrokeStyle(v8::Local<v8::String> property
845
839
  break;
846
840
  }
847
841
  }
848
-
842
+
849
843
  }
850
844
 
851
845
 
@@ -858,35 +852,30 @@ void CanvasRenderingContext2DImpl::SetStrokeStyle(v8::Local<v8::String> property
858
852
  }
859
853
  auto isolate = info.GetIsolate();
860
854
  auto context = isolate->GetCurrentContext();
861
-
855
+
862
856
  if (value->IsString()) {
863
857
  auto style = ConvertFromV8String(isolate, value);
864
858
  canvas_native_paint_style_set_stroke_color_with_c_string(ptr->GetContext(),
865
859
  style.c_str());
866
860
  } else if (value->IsObject()) {
867
-
868
- auto typeValue = GetPrivateValue(isolate, value.As<v8::Object>(),
869
- ConvertToV8String(isolate, "__type"));
870
-
871
- if (!typeValue.IsEmpty()) {
872
- auto type = (NativeType) typeValue->Int32Value(context).ToChecked();
873
-
874
- switch (type) {
875
- case NativeType::CanvasGradient: {
876
- auto gradient = CanvasGradient::GetPointer(value.As<v8::Object>());
877
- canvas_native_context_set_stroke_style(ptr->GetContext(),
878
- gradient->GetPaintStyle());
879
- }
880
- break;
881
- case NativeType::CanvasPattern: {
882
- auto pattern = CanvasPattern::GetPointer(value.As<v8::Object>());
883
- canvas_native_context_set_stroke_style(ptr->GetContext(),
884
- pattern->GetPaintStyle());
885
- }
886
- break;
887
- default:
888
- break;
861
+
862
+ auto type = GetNativeType(isolate, value);
863
+
864
+ switch (type) {
865
+ case NativeType::CanvasGradient: {
866
+ auto gradient = CanvasGradient::GetPointer(value.As<v8::Object>());
867
+ canvas_native_context_set_stroke_style(ptr->GetContext(),
868
+ gradient->GetPaintStyle());
889
869
  }
870
+ break;
871
+ case NativeType::CanvasPattern: {
872
+ auto pattern = CanvasPattern::GetPointer(value.As<v8::Object>());
873
+ canvas_native_context_set_stroke_style(ptr->GetContext(),
874
+ pattern->GetPaintStyle());
875
+ }
876
+ break;
877
+ default:
878
+ break;
890
879
  }
891
880
  }
892
881
  }
@@ -899,11 +888,11 @@ void CanvasRenderingContext2DImpl::GetLineWidth(v8::Local<v8::String> property,
899
888
  info.GetReturnValue().Set(0);
900
889
  return;
901
890
  }
902
-
891
+
903
892
  auto lineWidth = canvas_native_context_get_line_width(ptr->GetContext());
904
-
893
+
905
894
  info.GetReturnValue().Set((double) lineWidth);
906
-
895
+
907
896
  }
908
897
 
909
898
 
@@ -916,7 +905,7 @@ void CanvasRenderingContext2DImpl::SetLineWidth(v8::Local<v8::String> property,
916
905
  }
917
906
  auto isolate = info.GetIsolate();
918
907
  auto context = isolate->GetCurrentContext();
919
-
908
+
920
909
  auto lineWidth = (float) value->NumberValue(context).ToChecked();
921
910
  canvas_native_context_set_line_width(ptr->GetContext(), lineWidth);
922
911
  }
@@ -928,10 +917,10 @@ void CanvasRenderingContext2DImpl::GetLineDash(v8::Local<v8::String> property,
928
917
  info.GetReturnValue().Set(0);
929
918
  return;
930
919
  }
931
-
920
+
932
921
  auto isolate = info.GetIsolate();
933
922
  auto context = isolate->GetCurrentContext();
934
-
923
+
935
924
  auto lineDash = canvas_native_context_get_line_dash(ptr->GetContext());
936
925
  auto buf = canvas_native_f32_buffer_get_bytes(lineDash);
937
926
  auto size = canvas_native_f32_buffer_get_length(lineDash);
@@ -940,7 +929,7 @@ void CanvasRenderingContext2DImpl::GetLineDash(v8::Local<v8::String> property,
940
929
  auto item = buf[i];
941
930
  ret->Set(context, i, v8::Number::New(isolate, (double) item));
942
931
  }
943
-
932
+
944
933
  }
945
934
 
946
935
 
@@ -953,7 +942,7 @@ void CanvasRenderingContext2DImpl::SetLineDash(v8::Local<v8::String> property,
953
942
  }
954
943
  auto isolate = info.GetIsolate();
955
944
  auto context = isolate->GetCurrentContext();
956
-
945
+
957
946
  if (!value->IsNullOrUndefined() && value->IsObject()) {
958
947
  auto lineDashObject = value.As<v8::Object>();
959
948
  if (lineDashObject->IsArray()) {
@@ -984,10 +973,10 @@ void CanvasRenderingContext2DImpl::Arc(const v8::FunctionCallbackInfo<v8::Value>
984
973
  if (ptr == nullptr) {
985
974
  return;
986
975
  }
987
-
976
+
988
977
  auto isolate = args.GetIsolate();
989
978
  auto context = isolate->GetCurrentContext();
990
-
979
+
991
980
  auto anti_clockwise = false;
992
981
  if (args.Length() == 6) {
993
982
  anti_clockwise = args[5]->BooleanValue(isolate);
@@ -1008,10 +997,10 @@ void CanvasRenderingContext2DImpl::ArcTo(const v8::FunctionCallbackInfo<v8::Valu
1008
997
  if (ptr == nullptr) {
1009
998
  return;
1010
999
  }
1011
-
1000
+
1012
1001
  auto isolate = args.GetIsolate();
1013
1002
  auto context = isolate->GetCurrentContext();
1014
-
1003
+
1015
1004
  auto x1 = static_cast<float>(args[0]->NumberValue(context).ToChecked());
1016
1005
  auto y1 = static_cast<float>(args[1]->NumberValue(context).ToChecked());
1017
1006
  auto x2 = static_cast<float>(args[2]->NumberValue(context).ToChecked());
@@ -1032,7 +1021,7 @@ void CanvasRenderingContext2DImpl::BeginPath(const v8::FunctionCallbackInfo<v8::
1032
1021
  if (ptr == nullptr) {
1033
1022
  return;
1034
1023
  }
1035
-
1024
+
1036
1025
  canvas_native_context_begin_path(
1037
1026
  ptr->GetContext()
1038
1027
  );
@@ -1043,10 +1032,10 @@ void CanvasRenderingContext2DImpl::BezierCurveTo(const v8::FunctionCallbackInfo<
1043
1032
  if (ptr == nullptr) {
1044
1033
  return;
1045
1034
  }
1046
-
1035
+
1047
1036
  auto isolate = args.GetIsolate();
1048
1037
  auto context = isolate->GetCurrentContext();
1049
-
1038
+
1050
1039
  canvas_native_context_bezier_curve_to(
1051
1040
  ptr->GetContext(),
1052
1041
  static_cast<float>(args[0]->NumberValue(context).ToChecked()),
@@ -1072,10 +1061,10 @@ void CanvasRenderingContext2DImpl::ClearRect(const v8::FunctionCallbackInfo<v8::
1072
1061
  if (ptr == nullptr) {
1073
1062
  return;
1074
1063
  }
1075
-
1064
+
1076
1065
  auto isolate = args.GetIsolate();
1077
1066
  auto context = isolate->GetCurrentContext();
1078
-
1067
+
1079
1068
  canvas_native_context_clear_rect(
1080
1069
  ptr->GetContext(),
1081
1070
  static_cast<float>(args[0]->NumberValue(context).ToChecked()),
@@ -1091,9 +1080,9 @@ void CanvasRenderingContext2DImpl::Clip(const v8::FunctionCallbackInfo<v8::Value
1091
1080
  if (ptr == nullptr) {
1092
1081
  return;
1093
1082
  }
1094
-
1083
+
1095
1084
  auto isolate = args.GetIsolate();
1096
-
1085
+
1097
1086
  if (args.Length() == 0) {
1098
1087
  std::string rule("nonzero");
1099
1088
  canvas_native_context_clip_rule(
@@ -1110,7 +1099,7 @@ void CanvasRenderingContext2DImpl::ClosePath(const v8::FunctionCallbackInfo<v8::
1110
1099
  if (ptr == nullptr) {
1111
1100
  return;
1112
1101
  }
1113
-
1102
+
1114
1103
  canvas_native_context_close_path(
1115
1104
  ptr->GetContext());
1116
1105
  }
@@ -1122,19 +1111,19 @@ CanvasRenderingContext2DImpl::CreateImageData(const v8::FunctionCallbackInfo<v8:
1122
1111
  args.GetReturnValue().SetUndefined();
1123
1112
  return;
1124
1113
  }
1125
-
1114
+
1126
1115
  auto isolate = args.GetIsolate();
1127
1116
  auto context = isolate->GetCurrentContext();
1128
1117
  auto count = args.Length();
1129
1118
  auto value = args[0];
1130
1119
  if (count == 1 && value->IsObject()) {
1131
-
1120
+
1132
1121
  auto typeValue = GetNativeType(isolate, value);
1133
-
1122
+
1134
1123
  if (typeValue == NativeType::ImageData) {
1135
-
1124
+
1136
1125
  auto object = ImageDataImpl::GetPointer(value.As<v8::Object>());
1137
-
1126
+
1138
1127
  auto width = canvas_native_image_data_get_width(
1139
1128
  object->GetImageData());
1140
1129
  auto height = canvas_native_image_data_get_height(
@@ -1144,38 +1133,38 @@ CanvasRenderingContext2DImpl::CreateImageData(const v8::FunctionCallbackInfo<v8:
1144
1133
  width, height));
1145
1134
  auto ret = ImageDataImpl::GetCtor(isolate)->GetFunction(
1146
1135
  context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
1147
-
1136
+
1148
1137
  auto ext = v8::External::New(isolate, data);
1149
-
1138
+
1150
1139
  ret->SetInternalField(0, ext);
1151
-
1140
+
1152
1141
  SetNativeType(isolate, ret, NativeType::ImageData);
1153
-
1142
+
1154
1143
  args.GetReturnValue().Set(ret);
1155
-
1144
+
1156
1145
  return;
1157
1146
  }
1158
-
1147
+
1159
1148
  } else if (count > 1) {
1160
-
1149
+
1161
1150
  auto width = (int) args[0]->NumberValue(context).ToChecked();
1162
1151
  auto height = (int) args[1]->NumberValue(context).ToChecked();
1163
1152
  auto data = new ImageDataImpl(
1164
1153
  canvas_native_image_data_create(
1165
1154
  width, height));
1166
-
1155
+
1167
1156
  auto ret = ImageDataImpl::GetCtor(isolate)->GetFunction(
1168
1157
  context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
1169
-
1158
+
1170
1159
  auto ext = v8::External::New(isolate, data);
1171
-
1160
+
1172
1161
  ret->SetInternalField(0, ext);
1173
-
1162
+
1174
1163
  SetNativeType(isolate, ret, NativeType::ImageData);
1175
-
1164
+
1176
1165
  args.GetReturnValue().Set(ret);
1177
1166
  }
1178
-
1167
+
1179
1168
  args.GetReturnValue().SetUndefined();
1180
1169
  }
1181
1170
 
@@ -1187,11 +1176,11 @@ CanvasRenderingContext2DImpl::CreatePattern(const v8::FunctionCallbackInfo<v8::V
1187
1176
  return;
1188
1177
  }
1189
1178
  auto isolate = args.GetIsolate();
1190
-
1179
+
1191
1180
  if (args.Length() > 1) {
1192
1181
  auto value = args[0];
1193
1182
  auto valueType = GetNativeType(isolate, value);
1194
-
1183
+
1195
1184
  switch (valueType) {
1196
1185
  case NativeType::ImageAsset: {
1197
1186
  auto image_asset = ImageAssetImpl::GetPointer(value.As<v8::Object>());
@@ -1277,10 +1266,10 @@ CanvasRenderingContext2DImpl::CreatePattern(const v8::FunctionCallbackInfo<v8::V
1277
1266
  args.GetReturnValue().SetNull();
1278
1267
  return;
1279
1268
  }
1280
-
1269
+
1281
1270
  return;
1282
1271
  }
1283
-
1272
+
1284
1273
  args.GetReturnValue().SetNull();
1285
1274
  }
1286
1275
 
@@ -1292,28 +1281,28 @@ CanvasRenderingContext2DImpl::CreateLinearGradient(
1292
1281
  args.GetReturnValue().SetUndefined();
1293
1282
  return;
1294
1283
  }
1295
-
1284
+
1296
1285
  auto isolate = args.GetIsolate();
1297
1286
  auto context = isolate->GetCurrentContext();
1298
-
1287
+
1299
1288
  if (args.Length() == 4) {
1300
1289
  auto x0 = static_cast<float>(args[0]->NumberValue(context).ToChecked());
1301
1290
  auto y0 = static_cast<float>(args[1]->NumberValue(context).ToChecked());
1302
1291
  auto x1 = static_cast<float>(args[2]->NumberValue(context).ToChecked());
1303
1292
  auto y1 = static_cast<float>(args[3]->NumberValue(context).ToChecked());
1304
-
1293
+
1305
1294
  auto gradient = canvas_native_context_create_linear_gradient(
1306
1295
  ptr->GetContext(), x0, y0, x1,
1307
1296
  y1);
1308
-
1297
+
1309
1298
  auto data = CanvasGradient::NewInstance(isolate, new CanvasGradient(
1310
1299
  gradient));
1311
-
1300
+
1312
1301
  args.GetReturnValue().Set(data);
1313
-
1302
+
1314
1303
  return;
1315
1304
  }
1316
-
1305
+
1317
1306
  args.GetReturnValue().SetNull();
1318
1307
  }
1319
1308
 
@@ -1325,13 +1314,13 @@ CanvasRenderingContext2DImpl::__CreatePatternWithNative(
1325
1314
  args.GetReturnValue().SetUndefined();
1326
1315
  return;
1327
1316
  }
1328
-
1317
+
1329
1318
  auto isolate = args.GetIsolate();
1330
1319
  auto context = isolate->GetCurrentContext();
1331
-
1332
-
1320
+
1321
+
1333
1322
  auto pointer = args[0]->ToBigInt(context).ToLocalChecked();
1334
-
1323
+
1335
1324
  auto pattern = canvas_native_pattern_from_ptr(pointer->Int64Value());
1336
1325
  auto type = canvas_native_context_get_style_type(pattern);
1337
1326
  if (type == PaintStyleType::PaintStyleTypeNone) {
@@ -1339,10 +1328,10 @@ CanvasRenderingContext2DImpl::__CreatePatternWithNative(
1339
1328
  canvas_native_paint_style_destroy(pattern);
1340
1329
  } else {
1341
1330
  auto data = CanvasPattern::NewInstance(isolate, new CanvasPattern(pattern));
1342
-
1331
+
1343
1332
  args.GetReturnValue().Set(data);
1344
1333
  }
1345
-
1334
+
1346
1335
  }
1347
1336
 
1348
1337
  void
@@ -1353,10 +1342,10 @@ CanvasRenderingContext2DImpl::CreateRadialGradient(
1353
1342
  args.GetReturnValue().SetNull();
1354
1343
  return;
1355
1344
  }
1356
-
1345
+
1357
1346
  auto isolate = args.GetIsolate();
1358
1347
  auto context = isolate->GetCurrentContext();
1359
-
1348
+
1360
1349
  if (args.Length() == 6) {
1361
1350
  auto x0 = static_cast<float>(args[0]->NumberValue(context).ToChecked());
1362
1351
  auto y0 = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -1364,18 +1353,18 @@ CanvasRenderingContext2DImpl::CreateRadialGradient(
1364
1353
  auto x1 = static_cast<float>(args[3]->NumberValue(context).ToChecked());
1365
1354
  auto y1 = static_cast<float>(args[4]->NumberValue(context).ToChecked());
1366
1355
  auto r1 = static_cast<float>(args[5]->NumberValue(context).ToChecked());
1367
-
1356
+
1368
1357
  auto gradient = canvas_native_context_create_radial_gradient(
1369
1358
  ptr->GetContext(), x0, y0, r0,
1370
1359
  x1, y1, r1);
1371
-
1360
+
1372
1361
  auto data = CanvasGradient::NewInstance(isolate, new CanvasGradient(
1373
1362
  std::move(gradient)));
1374
-
1363
+
1375
1364
  args.GetReturnValue().Set(data);
1376
1365
  return;
1377
1366
  }
1378
-
1367
+
1379
1368
  args.GetReturnValue().SetNull();
1380
1369
  }
1381
1370
 
@@ -1392,19 +1381,19 @@ CanvasRenderingContext2DImpl::DrawFocusIfNeeded(const v8::FunctionCallbackInfo<v
1392
1381
 
1393
1382
  void
1394
1383
  CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value> &args) {
1395
-
1384
+
1396
1385
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
1397
1386
  if (ptr == nullptr) {
1398
1387
  return;
1399
1388
  }
1400
-
1389
+
1401
1390
  auto count = args.Length();
1402
1391
  auto value = args[0];
1403
-
1392
+
1404
1393
  if (value->IsNullOrUndefined() || !value->IsObject()) {
1405
1394
  return;
1406
1395
  }
1407
-
1396
+
1408
1397
  auto isolate = args.GetIsolate();
1409
1398
  auto context = isolate->GetCurrentContext();
1410
1399
  auto image = value.As<v8::Object>();
@@ -1412,11 +1401,11 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
1412
1401
  if (count == 3) {
1413
1402
  auto dx = static_cast<float>(args[1]->NumberValue(context).ToChecked());
1414
1403
  auto dy = static_cast<float>(args[2]->NumberValue(context).ToChecked());
1415
-
1404
+
1416
1405
  switch (imageType) {
1417
1406
  case NativeType::ImageAsset: {
1418
1407
  auto image_asset = ImageAssetImpl::GetPointer(image);
1419
-
1408
+
1420
1409
  if (image_asset != nullptr) {
1421
1410
  canvas_native_context_draw_image_dx_dy_asset(
1422
1411
  ptr->GetContext(),
@@ -1456,11 +1445,11 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
1456
1445
  auto dy = (float) args[2]->NumberValue(context).ToChecked();
1457
1446
  auto dWidth = (float) args[3]->NumberValue(context).ToChecked();
1458
1447
  auto dHeight = (float) args[4]->NumberValue(context).ToChecked();
1459
-
1448
+
1460
1449
  switch (imageType) {
1461
1450
  case NativeType::ImageAsset: {
1462
1451
  auto image_asset = ImageAssetImpl::GetPointer(image);
1463
-
1452
+
1464
1453
  if (image_asset != nullptr) {
1465
1454
  canvas_native_context_draw_image_dx_dy_dw_dh_asset(
1466
1455
  ptr->GetContext(),
@@ -1501,7 +1490,7 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
1501
1490
  default:
1502
1491
  break;
1503
1492
  }
1504
-
1493
+
1505
1494
  } else if (count == 9) {
1506
1495
  auto sx = (float) args[1]->NumberValue(context).ToChecked();
1507
1496
  auto sy = (float) args[2]->NumberValue(context).ToChecked();
@@ -1511,11 +1500,11 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
1511
1500
  auto dy = (float) args[6]->NumberValue(context).ToChecked();
1512
1501
  auto dWidth = (float) args[7]->NumberValue(context).ToChecked();
1513
1502
  auto dHeight = (float) args[8]->NumberValue(context).ToChecked();
1514
-
1503
+
1515
1504
  switch (imageType) {
1516
1505
  case NativeType::ImageAsset: {
1517
1506
  auto image_asset = ImageAssetImpl::GetPointer(image);
1518
-
1507
+
1519
1508
  if (image_asset != nullptr) {
1520
1509
  canvas_native_context_draw_image_asset(
1521
1510
  ptr->GetContext(),
@@ -1571,7 +1560,7 @@ CanvasRenderingContext2DImpl::Ellipse(const v8::FunctionCallbackInfo<v8::Value>
1571
1560
  }
1572
1561
  auto isolate = args.GetIsolate();
1573
1562
  auto context = isolate->GetCurrentContext();
1574
-
1563
+
1575
1564
  if (args.Length() == 8) {
1576
1565
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
1577
1566
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -1600,14 +1589,14 @@ CanvasRenderingContext2DImpl::Fill(const v8::FunctionCallbackInfo<v8::Value> &ar
1600
1589
  return;
1601
1590
  }
1602
1591
  auto isolate = args.GetIsolate();
1603
-
1592
+
1604
1593
  auto count = args.Length();
1605
1594
  auto value = args[0];
1606
1595
  if (count == 2) {
1607
1596
  auto type = GetNativeType(isolate, value.As<v8::Object>());
1608
1597
  if (type == NativeType::Path2D) {
1609
1598
  auto object = Path2D::GetPointer(value.As<v8::Object>());
1610
-
1599
+
1611
1600
  if (object != nullptr) {
1612
1601
  auto data = ConvertFromV8String(isolate, args[1]);
1613
1602
  canvas_native_context_fill_with_path(
@@ -1617,7 +1606,7 @@ CanvasRenderingContext2DImpl::Fill(const v8::FunctionCallbackInfo<v8::Value> &ar
1617
1606
  ptr->UpdateInvalidateState();
1618
1607
  }
1619
1608
  }
1620
-
1609
+
1621
1610
  } else if (count == 1) {
1622
1611
  if (value->IsString()) {
1623
1612
  auto rule = ConvertFromV8String(isolate, value);
@@ -1628,7 +1617,7 @@ CanvasRenderingContext2DImpl::Fill(const v8::FunctionCallbackInfo<v8::Value> &ar
1628
1617
  auto type = GetNativeType(isolate, value.As<v8::Object>());
1629
1618
  if (type == NativeType::Path2D) {
1630
1619
  auto object = Path2D::GetPointer(value.As<v8::Object>());
1631
-
1620
+
1632
1621
  std::string rule("nonzero");
1633
1622
  canvas_native_context_fill_with_path(
1634
1623
  ptr->GetContext(),
@@ -1652,7 +1641,7 @@ CanvasRenderingContext2DImpl::FillRect(const v8::FunctionCallbackInfo<v8::Value>
1652
1641
  }
1653
1642
  auto isolate = args.GetIsolate();
1654
1643
  auto context = isolate->GetCurrentContext();
1655
-
1644
+
1656
1645
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
1657
1646
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
1658
1647
  auto width = static_cast<float>(args[2]->NumberValue(context).ToChecked());
@@ -1671,9 +1660,9 @@ CanvasRenderingContext2DImpl::FillText(const v8::FunctionCallbackInfo<v8::Value>
1671
1660
  }
1672
1661
  auto isolate = args.GetIsolate();
1673
1662
  auto context = isolate->GetCurrentContext();
1674
-
1663
+
1675
1664
  auto text = ConvertFromV8String(isolate, args[0]);
1676
-
1665
+
1677
1666
  auto x = static_cast<float>(args[1]->NumberValue(context).ToChecked());
1678
1667
  auto y = static_cast<float>(args[2]->NumberValue(context).ToChecked());
1679
1668
  float width = -1;
@@ -1684,7 +1673,7 @@ CanvasRenderingContext2DImpl::FillText(const v8::FunctionCallbackInfo<v8::Value>
1684
1673
  ptr->GetContext(), text.c_str(), x,
1685
1674
  y, width);
1686
1675
  ptr->UpdateInvalidateState();
1687
-
1676
+
1688
1677
  }
1689
1678
 
1690
1679
  void
@@ -1696,8 +1685,8 @@ CanvasRenderingContext2DImpl::GetImageData(const v8::FunctionCallbackInfo<v8::Va
1696
1685
  }
1697
1686
  auto isolate = args.GetIsolate();
1698
1687
  auto context = isolate->GetCurrentContext();
1699
-
1700
-
1688
+
1689
+
1701
1690
  if (args.Length() == 4) {
1702
1691
  auto sx = static_cast<float>(args[0]->NumberValue(context).ToChecked());
1703
1692
  auto sy = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -1706,42 +1695,42 @@ CanvasRenderingContext2DImpl::GetImageData(const v8::FunctionCallbackInfo<v8::Va
1706
1695
  auto imageData = canvas_native_context_get_image_data(
1707
1696
  ptr->GetContext(), sx, sy, sw,
1708
1697
  sh);
1709
-
1698
+
1710
1699
  auto data = new ImageDataImpl(
1711
1700
  std::move(imageData));
1712
-
1701
+
1713
1702
  auto ret = ImageDataImpl::GetCtor(isolate)->GetFunction(
1714
1703
  context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
1715
-
1704
+
1716
1705
  auto ext = v8::External::New(isolate, data);
1717
-
1706
+
1718
1707
  ret->SetInternalField(0, ext);
1719
-
1708
+
1720
1709
  SetNativeType(isolate, ret, NativeType::ImageData);
1721
-
1710
+
1722
1711
  args.GetReturnValue().Set(ret);
1723
1712
  return;
1724
1713
  }
1725
-
1714
+
1726
1715
  args.GetReturnValue().SetUndefined();
1727
-
1728
-
1716
+
1717
+
1729
1718
  }
1730
1719
 
1731
1720
  void
1732
1721
  CanvasRenderingContext2DImpl::GetLineDash(const v8::FunctionCallbackInfo<v8::Value> &args) {
1733
1722
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
1734
-
1723
+
1735
1724
  auto isolate = args.GetIsolate();
1736
-
1725
+
1737
1726
  if (ptr == nullptr) {
1738
1727
  auto ret = v8::Array::New(isolate);
1739
1728
  args.GetReturnValue().Set(ret);
1740
1729
  return;
1741
1730
  }
1742
1731
  auto context = isolate->GetCurrentContext();
1743
-
1744
-
1732
+
1733
+
1745
1734
  auto dash = canvas_native_context_get_line_dash(
1746
1735
  ptr->GetContext());
1747
1736
  auto buf = canvas_native_f32_buffer_get_bytes(dash);
@@ -1752,18 +1741,18 @@ CanvasRenderingContext2DImpl::GetLineDash(const v8::FunctionCallbackInfo<v8::Val
1752
1741
  v8::Number::New(isolate,
1753
1742
  (double) buf[i]));
1754
1743
  }
1755
-
1744
+
1756
1745
  args.GetReturnValue().Set(array);
1757
1746
  }
1758
1747
 
1759
1748
  void
1760
1749
  CanvasRenderingContext2DImpl::IsPointInPath(const v8::FunctionCallbackInfo<v8::Value> &args) {
1761
1750
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
1762
-
1751
+
1763
1752
  auto isolate = args.GetIsolate();
1764
1753
  auto context = isolate->GetCurrentContext();
1765
1754
  auto count = args.Length();
1766
-
1755
+
1767
1756
  if (count == 2) {
1768
1757
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
1769
1758
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -1784,12 +1773,12 @@ CanvasRenderingContext2DImpl::IsPointInPath(const v8::FunctionCallbackInfo<v8::V
1784
1773
  } else if (count == 4 &&
1785
1774
  args[0]->IsObject() &&
1786
1775
  args[3]->IsString()) {
1787
-
1788
-
1776
+
1777
+
1789
1778
  auto value = args[0];
1790
1779
  auto typeValue = GetPrivateValue(isolate, value.As<v8::Object>(),
1791
1780
  ConvertToV8String(isolate, "__type"));
1792
-
1781
+
1793
1782
  if (!typeValue.IsEmpty()) {
1794
1783
  auto type = (NativeType) typeValue->Int32Value(context).ToChecked();
1795
1784
  if (type == NativeType::Path2D) {
@@ -1797,8 +1786,8 @@ CanvasRenderingContext2DImpl::IsPointInPath(const v8::FunctionCallbackInfo<v8::V
1797
1786
  auto x = static_cast<float>(args[1]->NumberValue(context).ToChecked());
1798
1787
  auto y = static_cast<float>(args[2]->NumberValue(context).ToChecked());
1799
1788
  auto rule = ConvertFromV8String(isolate, args[3]);
1800
-
1801
-
1789
+
1790
+
1802
1791
  if (path != nullptr) {
1803
1792
  auto ret = canvas_native_context_is_point_in_path_with_path(
1804
1793
  ptr->GetContext(),
@@ -1808,38 +1797,38 @@ CanvasRenderingContext2DImpl::IsPointInPath(const v8::FunctionCallbackInfo<v8::V
1808
1797
  }
1809
1798
  }
1810
1799
  }
1811
-
1800
+
1812
1801
  }
1813
-
1814
-
1802
+
1803
+
1815
1804
  args.GetReturnValue().Set(false);
1816
1805
  }
1817
1806
 
1818
1807
  void
1819
1808
  CanvasRenderingContext2DImpl::IsPointInStroke(const v8::FunctionCallbackInfo<v8::Value> &args) {
1820
1809
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
1821
-
1810
+
1822
1811
  auto isolate = args.GetIsolate();
1823
1812
  auto context = isolate->GetCurrentContext();
1824
1813
  auto count = args.Length();
1825
-
1826
-
1814
+
1815
+
1827
1816
  if (count == 2) {
1828
1817
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
1829
1818
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
1830
1819
  auto ret = canvas_native_context_is_point_in_stroke(
1831
1820
  ptr->GetContext(), x, y);
1832
-
1821
+
1833
1822
  args.GetReturnValue().Set(ret);
1834
1823
  return;
1835
1824
  } else if (count == 3 &&
1836
1825
  args[0]->IsObject()) {
1837
-
1838
-
1826
+
1827
+
1839
1828
  auto value = args[0];
1840
1829
  auto typeValue = GetPrivateValue(isolate, value.As<v8::Object>(),
1841
1830
  ConvertToV8String(isolate, "__type"));
1842
-
1831
+
1843
1832
  if (!typeValue.IsEmpty()) {
1844
1833
  auto type = (NativeType) typeValue->Int32Value(context).ToChecked();
1845
1834
  if (type == NativeType::Path2D) {
@@ -1847,8 +1836,8 @@ CanvasRenderingContext2DImpl::IsPointInStroke(const v8::FunctionCallbackInfo<v8:
1847
1836
  auto x = static_cast<float>(args[1]->NumberValue(context).ToChecked());
1848
1837
  auto y = static_cast<float>(args[2]->NumberValue(context).ToChecked());
1849
1838
  auto rule = ConvertFromV8String(isolate, args[3]);
1850
-
1851
-
1839
+
1840
+
1852
1841
  if (path != nullptr) {
1853
1842
  auto ret = canvas_native_context_is_point_in_stroke_with_path(
1854
1843
  ptr->GetContext(),
@@ -1859,17 +1848,17 @@ CanvasRenderingContext2DImpl::IsPointInStroke(const v8::FunctionCallbackInfo<v8:
1859
1848
  }
1860
1849
  }
1861
1850
  }
1862
-
1851
+
1863
1852
  args.GetReturnValue().Set(false);
1864
1853
  }
1865
1854
 
1866
1855
  void
1867
1856
  CanvasRenderingContext2DImpl::LineTo(const v8::FunctionCallbackInfo<v8::Value> &args) {
1868
1857
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
1869
-
1858
+
1870
1859
  auto isolate = args.GetIsolate();
1871
1860
  auto context = isolate->GetCurrentContext();
1872
-
1861
+
1873
1862
  if (args.Length() > 1) {
1874
1863
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
1875
1864
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -1881,38 +1870,38 @@ CanvasRenderingContext2DImpl::LineTo(const v8::FunctionCallbackInfo<v8::Value> &
1881
1870
  void
1882
1871
  CanvasRenderingContext2DImpl::MeasureText(const v8::FunctionCallbackInfo<v8::Value> &args) {
1883
1872
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
1884
-
1873
+
1885
1874
  auto isolate = args.GetIsolate();
1886
1875
  auto context = isolate->GetCurrentContext();
1887
-
1876
+
1888
1877
  auto text = ConvertFromV8String(isolate, args[0]);
1889
-
1878
+
1890
1879
  auto metrics = canvas_native_context_measure_text(
1891
1880
  ptr->GetContext(), text.c_str());
1892
-
1881
+
1893
1882
  auto data = new TextMetricsImpl(
1894
1883
  std::move(metrics));
1895
-
1884
+
1896
1885
  auto ret = TextMetricsImpl::GetCtor(isolate)->GetFunction(
1897
1886
  context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
1898
-
1887
+
1899
1888
  auto ext = v8::External::New(isolate, data);
1900
-
1889
+
1901
1890
  ret->SetInternalField(0, ext);
1902
-
1891
+
1903
1892
  SetNativeType(isolate, ret, NativeType::TextMetrics);
1904
-
1893
+
1905
1894
  args.GetReturnValue().Set(ret);
1906
-
1895
+
1907
1896
  }
1908
1897
 
1909
1898
  void
1910
1899
  CanvasRenderingContext2DImpl::MoveTo(const v8::FunctionCallbackInfo<v8::Value> &args) {
1911
1900
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
1912
-
1901
+
1913
1902
  auto isolate = args.GetIsolate();
1914
1903
  auto context = isolate->GetCurrentContext();
1915
-
1904
+
1916
1905
  if (args.Length() > 1) {
1917
1906
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
1918
1907
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -1924,11 +1913,11 @@ CanvasRenderingContext2DImpl::MoveTo(const v8::FunctionCallbackInfo<v8::Value> &
1924
1913
  void
1925
1914
  CanvasRenderingContext2DImpl::PutImageData(const v8::FunctionCallbackInfo<v8::Value> &args) {
1926
1915
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
1927
-
1916
+
1928
1917
  auto isolate = args.GetIsolate();
1929
1918
  auto context = isolate->GetCurrentContext();
1930
-
1931
-
1919
+
1920
+
1932
1921
  auto value = args[0];
1933
1922
  auto typeValue = GetPrivateValue(isolate, value.As<v8::Object>(),
1934
1923
  ConvertToV8String(isolate, "__type"));
@@ -1936,8 +1925,8 @@ CanvasRenderingContext2DImpl::PutImageData(const v8::FunctionCallbackInfo<v8::Va
1936
1925
  if (!typeValue.IsEmpty()) {
1937
1926
  auto type = (NativeType) typeValue->Int32Value(context).ToChecked();
1938
1927
  if (type == NativeType::ImageData) {
1939
-
1940
-
1928
+
1929
+
1941
1930
  auto imageData = ImageDataImpl::GetPointer(value.As<v8::Object>());
1942
1931
  if (count == 3) {
1943
1932
  auto dx = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -1970,16 +1959,16 @@ CanvasRenderingContext2DImpl::PutImageData(const v8::FunctionCallbackInfo<v8::Va
1970
1959
  }
1971
1960
  }
1972
1961
  }
1973
-
1962
+
1974
1963
  }
1975
1964
 
1976
1965
  void
1977
1966
  CanvasRenderingContext2DImpl::QuadraticCurveTo(const v8::FunctionCallbackInfo<v8::Value> &args) {
1978
1967
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
1979
-
1968
+
1980
1969
  auto isolate = args.GetIsolate();
1981
1970
  auto context = isolate->GetCurrentContext();
1982
-
1971
+
1983
1972
  if (args.Length() == 4) {
1984
1973
  auto cpx = static_cast<float>(args[0]->NumberValue(context).ToChecked());
1985
1974
  auto cpy = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -1989,16 +1978,16 @@ CanvasRenderingContext2DImpl::QuadraticCurveTo(const v8::FunctionCallbackInfo<v8
1989
1978
  ptr->GetContext(), cpx, cpy,
1990
1979
  x, y);
1991
1980
  }
1992
-
1981
+
1993
1982
  }
1994
1983
 
1995
1984
  void
1996
1985
  CanvasRenderingContext2DImpl::RoundRect(const v8::FunctionCallbackInfo<v8::Value> &args) {
1997
1986
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
1998
-
1987
+
1999
1988
  auto isolate = args.GetIsolate();
2000
1989
  auto context = isolate->GetCurrentContext();
2001
-
1990
+
2002
1991
  if (args.Length() == 5) {
2003
1992
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
2004
1993
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -2018,14 +2007,14 @@ CanvasRenderingContext2DImpl::RoundRect(const v8::FunctionCallbackInfo<v8::Value
2018
2007
  context,
2019
2008
  i).ToLocalChecked()->NumberValue(context).ToChecked();
2020
2009
  }
2021
-
2022
-
2010
+
2011
+
2023
2012
  canvas_native_context_round_rect(
2024
2013
  ptr->GetContext(),
2025
2014
  x, y,
2026
2015
  width,
2027
2016
  height, store.data(), store.size());
2028
-
2017
+
2029
2018
  }
2030
2019
  }
2031
2020
  } else {
@@ -2035,19 +2024,19 @@ CanvasRenderingContext2DImpl::RoundRect(const v8::FunctionCallbackInfo<v8::Value
2035
2024
  width,
2036
2025
  height, radii, radii,
2037
2026
  radii, radii);
2038
-
2027
+
2039
2028
  }
2040
2029
  }
2041
-
2030
+
2042
2031
  }
2043
2032
 
2044
2033
  void
2045
2034
  CanvasRenderingContext2DImpl::Rect(const v8::FunctionCallbackInfo<v8::Value> &args) {
2046
2035
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
2047
-
2036
+
2048
2037
  auto isolate = args.GetIsolate();
2049
2038
  auto context = isolate->GetCurrentContext();
2050
-
2039
+
2051
2040
  if (args.Length() == 4) {
2052
2041
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
2053
2042
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -2058,7 +2047,7 @@ CanvasRenderingContext2DImpl::Rect(const v8::FunctionCallbackInfo<v8::Value> &ar
2058
2047
  width,
2059
2048
  height);
2060
2049
  }
2061
-
2050
+
2062
2051
  }
2063
2052
 
2064
2053
  void
@@ -2072,7 +2061,7 @@ CanvasRenderingContext2DImpl::ResetTransform(const v8::FunctionCallbackInfo<v8::
2072
2061
  if (ptr == nullptr) {
2073
2062
  return;
2074
2063
  }
2075
-
2064
+
2076
2065
  canvas_native_context_reset_transform(
2077
2066
  ptr->GetContext());
2078
2067
  }
@@ -2083,7 +2072,7 @@ CanvasRenderingContext2DImpl::Restore(const v8::FunctionCallbackInfo<v8::Value>
2083
2072
  if (ptr == nullptr) {
2084
2073
  return;
2085
2074
  }
2086
-
2075
+
2087
2076
  canvas_native_context_restore(
2088
2077
  ptr->GetContext());
2089
2078
  }
@@ -2091,12 +2080,12 @@ CanvasRenderingContext2DImpl::Restore(const v8::FunctionCallbackInfo<v8::Value>
2091
2080
  void
2092
2081
  CanvasRenderingContext2DImpl::Rotate(const v8::FunctionCallbackInfo<v8::Value> &args) {
2093
2082
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
2094
-
2083
+
2095
2084
  auto isolate = args.GetIsolate();
2096
2085
  auto context = isolate->GetCurrentContext();
2097
-
2086
+
2098
2087
  auto value = args[0];
2099
-
2088
+
2100
2089
  if (args.Length() == 1 && value->IsNumber()) {
2101
2090
  canvas_native_context_rotate(
2102
2091
  ptr->GetContext(),
@@ -2110,7 +2099,7 @@ CanvasRenderingContext2DImpl::Save(const v8::FunctionCallbackInfo<v8::Value> &ar
2110
2099
  if (ptr == nullptr) {
2111
2100
  return;
2112
2101
  }
2113
-
2102
+
2114
2103
  canvas_native_context_save(
2115
2104
  ptr->GetContext());
2116
2105
  }
@@ -2118,10 +2107,10 @@ CanvasRenderingContext2DImpl::Save(const v8::FunctionCallbackInfo<v8::Value> &ar
2118
2107
  void
2119
2108
  CanvasRenderingContext2DImpl::Scale(const v8::FunctionCallbackInfo<v8::Value> &args) {
2120
2109
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
2121
-
2110
+
2122
2111
  auto isolate = args.GetIsolate();
2123
2112
  auto context = isolate->GetCurrentContext();
2124
-
2113
+
2125
2114
  if (args.Length() == 2) {
2126
2115
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
2127
2116
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -2138,12 +2127,12 @@ CanvasRenderingContext2DImpl::ScrollPathIntoView(const v8::FunctionCallbackInfo<
2138
2127
  void
2139
2128
  CanvasRenderingContext2DImpl::SetLineDash(const v8::FunctionCallbackInfo<v8::Value> &args) {
2140
2129
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
2141
-
2130
+
2142
2131
  auto isolate = args.GetIsolate();
2143
2132
  auto context = isolate->GetCurrentContext();
2144
-
2133
+
2145
2134
  auto value = args[0];
2146
-
2135
+
2147
2136
  if (args.Length() == 1 &&
2148
2137
  args[0]->IsObject()) {
2149
2138
  if (value->IsArray()) {
@@ -2156,7 +2145,7 @@ CanvasRenderingContext2DImpl::SetLineDash(const v8::FunctionCallbackInfo<v8::Val
2156
2145
  data.push_back(
2157
2146
  static_cast<float>(item));
2158
2147
  }
2159
-
2148
+
2160
2149
  canvas_native_context_set_line_dash(
2161
2150
  ptr->GetContext(), data.data(), data.size());
2162
2151
  }
@@ -2166,20 +2155,20 @@ CanvasRenderingContext2DImpl::SetLineDash(const v8::FunctionCallbackInfo<v8::Val
2166
2155
  void
2167
2156
  CanvasRenderingContext2DImpl::SetTransform(const v8::FunctionCallbackInfo<v8::Value> &args) {
2168
2157
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
2169
-
2158
+
2170
2159
  auto isolate = args.GetIsolate();
2171
2160
  auto context = isolate->GetCurrentContext();
2172
-
2161
+
2173
2162
  auto count = args.Length();
2174
2163
  auto value = args[0];
2175
2164
  if (count == 1 && value->IsObject()) {
2176
-
2165
+
2177
2166
  auto typeValue = GetPrivateValue(isolate, value.As<v8::Object>(),
2178
2167
  ConvertToV8String(isolate, "__type"));
2179
-
2168
+
2180
2169
  if (!typeValue.IsEmpty()) {
2181
2170
  auto type = (NativeType) typeValue->Int32Value(context).ToChecked();
2182
-
2171
+
2183
2172
  if (type == NativeType::Matrix) {
2184
2173
  auto matrix = MatrixImpl::GetPointer(value.As<v8::Object>());
2185
2174
  if (matrix != nullptr) {
@@ -2188,7 +2177,7 @@ CanvasRenderingContext2DImpl::SetTransform(const v8::FunctionCallbackInfo<v8::Va
2188
2177
  matrix->GetMatrix());
2189
2178
  }
2190
2179
  }
2191
-
2180
+
2192
2181
  }
2193
2182
  } else if (count == 6) {
2194
2183
  auto a = static_cast<float>(args[0]->NumberValue(context).ToChecked());
@@ -2207,9 +2196,9 @@ CanvasRenderingContext2DImpl::SetTransform(const v8::FunctionCallbackInfo<v8::Va
2207
2196
  void
2208
2197
  CanvasRenderingContext2DImpl::Stroke(const v8::FunctionCallbackInfo<v8::Value> &args) {
2209
2198
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
2210
-
2199
+
2211
2200
  auto isolate = args.GetIsolate();
2212
-
2201
+
2213
2202
  auto value = args[0];
2214
2203
  auto type = GetNativeType(isolate, value);
2215
2204
  if (type == NativeType::Path2D) {
@@ -2230,10 +2219,10 @@ CanvasRenderingContext2DImpl::Stroke(const v8::FunctionCallbackInfo<v8::Value> &
2230
2219
  void
2231
2220
  CanvasRenderingContext2DImpl::StrokeRect(const v8::FunctionCallbackInfo<v8::Value> &args) {
2232
2221
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
2233
-
2222
+
2234
2223
  auto isolate = args.GetIsolate();
2235
2224
  auto context = isolate->GetCurrentContext();
2236
-
2225
+
2237
2226
  if (args.Length() == 4) {
2238
2227
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
2239
2228
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -2250,21 +2239,21 @@ CanvasRenderingContext2DImpl::StrokeRect(const v8::FunctionCallbackInfo<v8::Valu
2250
2239
  void
2251
2240
  CanvasRenderingContext2DImpl::StrokeText(const v8::FunctionCallbackInfo<v8::Value> &args) {
2252
2241
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
2253
-
2242
+
2254
2243
  auto isolate = args.GetIsolate();
2255
2244
  auto context = isolate->GetCurrentContext();
2256
-
2245
+
2257
2246
  auto count = args.Length();
2258
2247
  if (count >= 3) {
2259
2248
  auto text = ConvertFromV8String(isolate, args[0]);
2260
2249
  auto x = static_cast<float>(args[1]->NumberValue(context).ToChecked());
2261
2250
  auto y = static_cast<float>(args[2]->NumberValue(context).ToChecked());
2262
2251
  float maxWidth = -1;
2263
-
2252
+
2264
2253
  if (count > 3) {
2265
2254
  maxWidth = static_cast<float>(args[3]->NumberValue(context).ToChecked());
2266
2255
  }
2267
-
2256
+
2268
2257
  canvas_native_context_stroke_text(
2269
2258
  ptr->GetContext(), text.c_str(),
2270
2259
  x, y, maxWidth);
@@ -2275,11 +2264,11 @@ CanvasRenderingContext2DImpl::StrokeText(const v8::FunctionCallbackInfo<v8::Valu
2275
2264
  void
2276
2265
  CanvasRenderingContext2DImpl::Transform(const v8::FunctionCallbackInfo<v8::Value> &args) {
2277
2266
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
2278
-
2267
+
2279
2268
  auto isolate = args.GetIsolate();
2280
2269
  auto context = isolate->GetCurrentContext();
2281
-
2282
-
2270
+
2271
+
2283
2272
  if (args.Length() == 6) {
2284
2273
  auto a = static_cast<float>(args[0]->NumberValue(context).ToChecked());
2285
2274
  auto b = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -2297,11 +2286,11 @@ CanvasRenderingContext2DImpl::Transform(const v8::FunctionCallbackInfo<v8::Value
2297
2286
  void
2298
2287
  CanvasRenderingContext2DImpl::Translate(const v8::FunctionCallbackInfo<v8::Value> &args) {
2299
2288
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
2300
-
2289
+
2301
2290
  auto isolate = args.GetIsolate();
2302
2291
  auto context = isolate->GetCurrentContext();
2303
-
2304
-
2292
+
2293
+
2305
2294
  if (args.Length() == 2) {
2306
2295
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
2307
2296
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
@@ -2313,31 +2302,31 @@ CanvasRenderingContext2DImpl::Translate(const v8::FunctionCallbackInfo<v8::Value
2313
2302
  void
2314
2303
  CanvasRenderingContext2DImpl::__ToDataURL(const v8::FunctionCallbackInfo<v8::Value> &args) {
2315
2304
  CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
2316
-
2305
+
2317
2306
  auto isolate = args.GetIsolate();
2318
2307
  auto context = isolate->GetCurrentContext();
2319
-
2320
-
2308
+
2309
+
2321
2310
  std::string type("image/png");
2322
2311
  int quality = 92;
2323
2312
  if (args[0]->IsString()) {
2324
2313
  type = ConvertFromV8String(isolate, args[0]);
2325
2314
  }
2326
-
2327
-
2315
+
2316
+
2328
2317
  if (args[1]->IsNumber()) {
2329
2318
  quality = (int) args[1]->NumberValue(context).ToChecked();
2330
2319
  }
2331
-
2332
-
2320
+
2321
+
2333
2322
  auto data = canvas_native_to_data_url(
2334
2323
  ptr->GetContext(), type.c_str(),
2335
2324
  quality);
2336
-
2325
+
2337
2326
  auto value = new OneByteStringResource((char*)data);
2338
2327
  auto ret = v8::String::NewExternalOneByte(isolate, value);
2339
2328
  args.GetReturnValue().Set(ret.ToLocalChecked());
2340
-
2329
+
2341
2330
  // args.GetReturnValue().Set(ConvertToV8String(isolate, data.c_str()));
2342
2331
  }
2343
2332
 
@@ -2346,7 +2335,7 @@ CanvasRenderingContext2DImpl::~CanvasRenderingContext2DImpl() {
2346
2335
  if (raf != nullptr) {
2347
2336
  canvas_native_raf_stop(raf->GetRaf());
2348
2337
  }
2349
-
2338
+
2350
2339
  canvas_native_context_destroy(this->GetContext());
2351
2340
  this->context_ = nullptr;
2352
2341
  }
@@ -2358,7 +2347,7 @@ void CanvasRenderingContext2DImpl::UpdateInvalidateState() {
2358
2347
  canvas_native_raf_start(raf->GetRaf());
2359
2348
  }
2360
2349
  }
2361
-
2350
+
2362
2351
  auto state = this->GetInvalidateState();
2363
2352
  this->SetInvalidateState((int) state | (int) InvalidateState::InvalidateStatePending);
2364
2353
  }