@nativescript/canvas 2.0.0-alpha.23 → 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.
- package/Canvas/common.d.ts +199 -25
- package/Canvas/common.js +624 -489
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.js +19 -9
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.ios.js +13 -12
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.d.ts +0 -1
- package/Canvas2D/CanvasRenderingContext2D/index.js +9 -121
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/WebGL/WebGLExtensions/index.d.ts +4 -3
- package/WebGL/WebGLExtensions/index.js +10 -3
- package/WebGL/WebGLExtensions/index.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.d.ts +15 -15
- package/WebGL/WebGLRenderingContext/index.js +15 -277
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.js +0 -86
- package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/canvas-release.aar +0 -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 +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +19 -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 +1035 -83
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +2 -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_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +4 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +19 -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 +1035 -83
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +1035 -83
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +24 -24
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +13 -62
- package/platforms/ios/src/cpp/ImageBitmapImpl.h +15 -3
- package/platforms/ios/src/cpp/OneByteStringResource.cpp +26 -2
- package/platforms/ios/src/cpp/OneByteStringResource.h +14 -3
- package/platforms/ios/src/cpp/TextDecoderImpl.cpp +8 -9
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +257 -268
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +8 -2
- package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +72 -94
- package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.cpp +2 -2
- package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.h +4 -3
- package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.cpp +1 -5
- package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.h +5 -5
- package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +103 -113
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
#include "OneByteStringResource.h"
|
|
8
8
|
|
|
9
9
|
CanvasRenderingContext2DImpl::CanvasRenderingContext2DImpl(
|
|
10
|
-
|
|
10
|
+
CanvasRenderingContext2D *context) : context_(context) {
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
auto ctx_ptr = reinterpret_cast<intptr_t>(reinterpret_cast<intptr_t *>(this));
|
|
13
|
+
auto raf_callback = new OnRafCallback(ctx_ptr, 0);
|
|
14
|
+
auto raf_callback_ptr = reinterpret_cast<intptr_t>(reinterpret_cast<intptr_t *>(raf_callback));
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (_raf != nullptr) {
|
|
22
|
+
canvas_native_raf_start(_raf->GetRaf());
|
|
23
|
+
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
void CanvasRenderingContext2DImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate) {
|
|
@@ -182,7 +182,7 @@ v8::Local<v8::FunctionTemplate> CanvasRenderingContext2DImpl::GetCtor(v8::Isolat
|
|
|
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;
|
|
187
187
|
}
|
|
188
188
|
|
|
@@ -209,7 +209,7 @@ void CanvasRenderingContext2DImpl::DrawPoint(const v8::FunctionCallbackInfo<v8::
|
|
|
209
209
|
auto y = (float) args[1]->NumberValue(context).ToChecked();
|
|
210
210
|
|
|
211
211
|
canvas_native_context_draw_point(
|
|
212
|
-
|
|
212
|
+
ptr->GetContext(), x, y);
|
|
213
213
|
ptr->UpdateInvalidateState();
|
|
214
214
|
}
|
|
215
215
|
|
|
@@ -246,14 +246,14 @@ void CanvasRenderingContext2DImpl::DrawPoints(const v8::FunctionCallbackInfo<v8:
|
|
|
246
246
|
for (int i = 0; i < size; i++) {
|
|
247
247
|
|
|
248
248
|
auto object = points->Get(
|
|
249
|
-
|
|
249
|
+
context, i).ToLocalChecked().As<v8::Object>();
|
|
250
250
|
|
|
251
251
|
auto x = object->Get(context,
|
|
252
252
|
ConvertToV8String(isolate, "x")).ToLocalChecked()->NumberValue(
|
|
253
|
-
|
|
253
|
+
context).ToChecked();
|
|
254
254
|
auto y = object->Get(context,
|
|
255
255
|
ConvertToV8String(isolate, "y")).ToLocalChecked()->NumberValue(
|
|
256
|
-
|
|
256
|
+
context).ToChecked();
|
|
257
257
|
store[next] = (float) x;
|
|
258
258
|
store[next + 1] = (float) y;
|
|
259
259
|
|
|
@@ -261,8 +261,8 @@ void CanvasRenderingContext2DImpl::DrawPoints(const v8::FunctionCallbackInfo<v8:
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
canvas_native_context_draw_points(
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
ptr->GetContext(), pointMode,
|
|
265
|
+
store.data(), store.size());
|
|
266
266
|
|
|
267
267
|
|
|
268
268
|
ptr->UpdateInvalidateState();
|
|
@@ -280,7 +280,7 @@ void CanvasRenderingContext2DImpl::DrawPaint(const v8::FunctionCallbackInfo<v8::
|
|
|
280
280
|
|
|
281
281
|
auto color = ConvertFromV8String(isolate, args[0]);
|
|
282
282
|
canvas_native_context_draw_paint(
|
|
283
|
-
|
|
283
|
+
ptr->GetContext(), color.c_str());
|
|
284
284
|
ptr->UpdateInvalidateState();
|
|
285
285
|
}
|
|
286
286
|
|
|
@@ -322,9 +322,9 @@ void CanvasRenderingContext2DImpl::__Resize(const v8::FunctionCallbackInfo<v8::V
|
|
|
322
322
|
auto width = args[0]->NumberValue(context).ToChecked();
|
|
323
323
|
auto height = args[1]->NumberValue(context).ToChecked();
|
|
324
324
|
canvas_native_context_resize(
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
ptr->GetContext(),
|
|
326
|
+
static_cast<float>(width),
|
|
327
|
+
static_cast<float>(height));
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
|
|
@@ -338,7 +338,7 @@ void CanvasRenderingContext2DImpl::GetFilter(v8::Local<v8::String> property,
|
|
|
338
338
|
auto isolate = info.GetIsolate();
|
|
339
339
|
auto filter = canvas_native_context_get_filter(ptr->GetContext());
|
|
340
340
|
info.GetReturnValue().Set(ConvertToV8String(isolate, filter));
|
|
341
|
-
canvas_native_string_destroy((char*) filter);
|
|
341
|
+
canvas_native_string_destroy((char *) filter);
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
void CanvasRenderingContext2DImpl::SetFilter(v8::Local<v8::String> property,
|
|
@@ -364,7 +364,7 @@ void CanvasRenderingContext2DImpl::GetFont(v8::Local<v8::String> property,
|
|
|
364
364
|
auto font = canvas_native_context_get_font(ptr->GetContext());
|
|
365
365
|
info.GetReturnValue().Set(ConvertToV8String(isolate, font));
|
|
366
366
|
|
|
367
|
-
canvas_native_string_destroy((char*) font);
|
|
367
|
+
canvas_native_string_destroy((char *) font);
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
void CanvasRenderingContext2DImpl::SetFont(v8::Local<v8::String> property,
|
|
@@ -436,9 +436,9 @@ void CanvasRenderingContext2DImpl::GetImageSmoothingQuality(v8::Local<v8::String
|
|
|
436
436
|
auto isolate = info.GetIsolate();
|
|
437
437
|
auto quality = canvas_native_context_get_image_smoothing_quality(ptr->GetContext());
|
|
438
438
|
info.GetReturnValue().Set(
|
|
439
|
-
|
|
439
|
+
ConvertToV8String(isolate, quality));
|
|
440
440
|
|
|
441
|
-
canvas_native_string_destroy((char*)quality);
|
|
441
|
+
canvas_native_string_destroy((char *) quality);
|
|
442
442
|
|
|
443
443
|
}
|
|
444
444
|
|
|
@@ -490,7 +490,7 @@ void CanvasRenderingContext2DImpl::GetLineJoin(v8::Local<v8::String> property,
|
|
|
490
490
|
auto join = canvas_native_context_get_line_join(ptr->GetContext());
|
|
491
491
|
info.GetReturnValue().Set(ConvertToV8String(isolate, join));
|
|
492
492
|
|
|
493
|
-
canvas_native_string_destroy((char*)join);
|
|
493
|
+
canvas_native_string_destroy((char *) join);
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
void CanvasRenderingContext2DImpl::SetLineJoin(v8::Local<v8::String> property,
|
|
@@ -516,7 +516,7 @@ void CanvasRenderingContext2DImpl::GetLineCap(v8::Local<v8::String> property,
|
|
|
516
516
|
auto cap = canvas_native_context_get_line_cap(ptr->GetContext());
|
|
517
517
|
info.GetReturnValue().Set(ConvertToV8String(isolate, cap));
|
|
518
518
|
|
|
519
|
-
canvas_native_string_destroy((char*)cap);
|
|
519
|
+
canvas_native_string_destroy((char *) cap);
|
|
520
520
|
}
|
|
521
521
|
|
|
522
522
|
void CanvasRenderingContext2DImpl::SetLineCap(v8::Local<v8::String> property,
|
|
@@ -567,7 +567,7 @@ void CanvasRenderingContext2DImpl::GetShadowColor(v8::Local<v8::String> property
|
|
|
567
567
|
auto isolate = info.GetIsolate();
|
|
568
568
|
auto color = canvas_native_context_get_shadow_color(ptr->GetContext());
|
|
569
569
|
info.GetReturnValue().Set(ConvertToV8String(isolate, color));
|
|
570
|
-
canvas_native_string_destroy((char*) color);
|
|
570
|
+
canvas_native_string_destroy((char *) color);
|
|
571
571
|
}
|
|
572
572
|
|
|
573
573
|
void CanvasRenderingContext2DImpl::SetShadowColor(v8::Local<v8::String> property,
|
|
@@ -667,8 +667,8 @@ void CanvasRenderingContext2DImpl::GetTextAlign(v8::Local<v8::String> property,
|
|
|
667
667
|
auto isolate = info.GetIsolate();
|
|
668
668
|
auto alignment = canvas_native_context_get_text_align(ptr->GetContext());
|
|
669
669
|
info.GetReturnValue().Set(
|
|
670
|
-
|
|
671
|
-
canvas_native_string_destroy((char*) alignment);
|
|
670
|
+
ConvertToV8String(isolate, alignment));
|
|
671
|
+
canvas_native_string_destroy((char *) alignment);
|
|
672
672
|
}
|
|
673
673
|
|
|
674
674
|
void CanvasRenderingContext2DImpl::SetTextAlign(v8::Local<v8::String> property,
|
|
@@ -693,9 +693,9 @@ void CanvasRenderingContext2DImpl::GetGlobalCompositeOperation(v8::Local<v8::Str
|
|
|
693
693
|
}
|
|
694
694
|
auto operation = canvas_native_context_get_global_composition(ptr->GetContext());
|
|
695
695
|
info.GetReturnValue().Set(
|
|
696
|
-
|
|
696
|
+
ConvertToV8String(info.GetIsolate(), operation));
|
|
697
697
|
|
|
698
|
-
canvas_native_string_destroy((char*) operation);
|
|
698
|
+
canvas_native_string_destroy((char *) operation);
|
|
699
699
|
}
|
|
700
700
|
|
|
701
701
|
void CanvasRenderingContext2DImpl::SetGlobalCompositeOperation(v8::Local<v8::String> property,
|
|
@@ -725,10 +725,10 @@ void CanvasRenderingContext2DImpl::GetFillStyle(v8::Local<v8::String> property,
|
|
|
725
725
|
switch (type) {
|
|
726
726
|
case PaintStyleType::PaintStyleTypeColor: {
|
|
727
727
|
auto color = canvas_native_paint_style_get_current_fill_color_string(
|
|
728
|
-
|
|
728
|
+
ptr->GetContext());
|
|
729
729
|
|
|
730
730
|
|
|
731
|
-
auto value = new OneByteStringResource((char*)color);
|
|
731
|
+
auto value = new OneByteStringResource((char *) color);
|
|
732
732
|
auto ret = v8::String::NewExternalOneByte(isolate, value);
|
|
733
733
|
info.GetReturnValue().Set(ret.ToLocalChecked());
|
|
734
734
|
|
|
@@ -737,7 +737,7 @@ void CanvasRenderingContext2DImpl::GetFillStyle(v8::Local<v8::String> property,
|
|
|
737
737
|
}
|
|
738
738
|
case PaintStyleType::PaintStyleTypeGradient: {
|
|
739
739
|
auto style = CanvasGradient::NewInstance(isolate, new CanvasGradient(
|
|
740
|
-
|
|
740
|
+
canvas_native_context_get_fill_style(ptr->GetContext())));
|
|
741
741
|
|
|
742
742
|
info.GetReturnValue().Set(style);
|
|
743
743
|
|
|
@@ -745,7 +745,7 @@ void CanvasRenderingContext2DImpl::GetFillStyle(v8::Local<v8::String> property,
|
|
|
745
745
|
}
|
|
746
746
|
case PaintStyleType::PaintStyleTypePattern: {
|
|
747
747
|
auto style = CanvasPattern::NewInstance(isolate, new CanvasPattern(
|
|
748
|
-
|
|
748
|
+
canvas_native_context_get_fill_style(ptr->GetContext())));
|
|
749
749
|
|
|
750
750
|
info.GetReturnValue().Set(style);
|
|
751
751
|
break;
|
|
@@ -810,9 +810,9 @@ void CanvasRenderingContext2DImpl::GetStrokeStyle(v8::Local<v8::String> property
|
|
|
810
810
|
switch (type) {
|
|
811
811
|
case PaintStyleType::PaintStyleTypeColor: {
|
|
812
812
|
auto color = canvas_native_paint_style_get_current_stroke_color_string(
|
|
813
|
-
|
|
813
|
+
ptr->GetContext());
|
|
814
814
|
|
|
815
|
-
auto value = new OneByteStringResource((char*) color);
|
|
815
|
+
auto value = new OneByteStringResource((char *) color);
|
|
816
816
|
auto ret = v8::String::NewExternalOneByte(isolate, value);
|
|
817
817
|
info.GetReturnValue().Set(ret.ToLocalChecked());
|
|
818
818
|
|
|
@@ -821,7 +821,7 @@ void CanvasRenderingContext2DImpl::GetStrokeStyle(v8::Local<v8::String> property
|
|
|
821
821
|
}
|
|
822
822
|
case PaintStyleType::PaintStyleTypeGradient: {
|
|
823
823
|
auto style = CanvasGradient::NewInstance(isolate, new CanvasGradient(
|
|
824
|
-
|
|
824
|
+
canvas_native_context_get_stroke_style(ptr->GetContext())));
|
|
825
825
|
|
|
826
826
|
info.GetReturnValue().Set(style);
|
|
827
827
|
|
|
@@ -829,7 +829,7 @@ void CanvasRenderingContext2DImpl::GetStrokeStyle(v8::Local<v8::String> property
|
|
|
829
829
|
}
|
|
830
830
|
case PaintStyleType::PaintStyleTypePattern: {
|
|
831
831
|
auto style = CanvasPattern::NewInstance(isolate, new CanvasPattern(
|
|
832
|
-
|
|
832
|
+
canvas_native_context_get_stroke_style(ptr->GetContext())));
|
|
833
833
|
|
|
834
834
|
info.GetReturnValue().Set(style);
|
|
835
835
|
break;
|
|
@@ -982,14 +982,14 @@ void CanvasRenderingContext2DImpl::Arc(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
982
982
|
anti_clockwise = args[5]->BooleanValue(isolate);
|
|
983
983
|
}
|
|
984
984
|
canvas_native_context_arc(
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
985
|
+
ptr->GetContext(),
|
|
986
|
+
static_cast<float>(args[0]->NumberValue(context).ToChecked()),
|
|
987
|
+
static_cast<float>(args[1]->NumberValue(context).ToChecked()),
|
|
988
|
+
static_cast<float>(args[2]->NumberValue(context).ToChecked()),
|
|
989
|
+
static_cast<float>(args[3]->NumberValue(context).ToChecked()),
|
|
990
|
+
static_cast<float>(args[4]->NumberValue(context).ToChecked()),
|
|
991
|
+
anti_clockwise
|
|
992
|
+
);
|
|
993
993
|
}
|
|
994
994
|
|
|
995
995
|
void CanvasRenderingContext2DImpl::ArcTo(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -1007,13 +1007,13 @@ void CanvasRenderingContext2DImpl::ArcTo(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
1007
1007
|
auto y2 = static_cast<float>(args[3]->NumberValue(context).ToChecked());
|
|
1008
1008
|
auto radius = static_cast<float>(args[4]->NumberValue(context).ToChecked());
|
|
1009
1009
|
canvas_native_context_arc_to(
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1010
|
+
ptr->GetContext(),
|
|
1011
|
+
x1,
|
|
1012
|
+
y1,
|
|
1013
|
+
x2,
|
|
1014
|
+
y2,
|
|
1015
|
+
radius
|
|
1016
|
+
);
|
|
1017
1017
|
}
|
|
1018
1018
|
|
|
1019
1019
|
void CanvasRenderingContext2DImpl::BeginPath(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -1023,8 +1023,8 @@ void CanvasRenderingContext2DImpl::BeginPath(const v8::FunctionCallbackInfo<v8::
|
|
|
1023
1023
|
}
|
|
1024
1024
|
|
|
1025
1025
|
canvas_native_context_begin_path(
|
|
1026
|
-
|
|
1027
|
-
|
|
1026
|
+
ptr->GetContext()
|
|
1027
|
+
);
|
|
1028
1028
|
}
|
|
1029
1029
|
|
|
1030
1030
|
void CanvasRenderingContext2DImpl::BezierCurveTo(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -1037,14 +1037,14 @@ void CanvasRenderingContext2DImpl::BezierCurveTo(const v8::FunctionCallbackInfo<
|
|
|
1037
1037
|
auto context = isolate->GetCurrentContext();
|
|
1038
1038
|
|
|
1039
1039
|
canvas_native_context_bezier_curve_to(
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1040
|
+
ptr->GetContext(),
|
|
1041
|
+
static_cast<float>(args[0]->NumberValue(context).ToChecked()),
|
|
1042
|
+
static_cast<float>(args[1]->NumberValue(context).ToChecked()),
|
|
1043
|
+
static_cast<float>(args[2]->NumberValue(context).ToChecked()),
|
|
1044
|
+
static_cast<float>(args[3]->NumberValue(context).ToChecked()),
|
|
1045
|
+
static_cast<float>(args[4]->NumberValue(context).ToChecked()),
|
|
1046
|
+
static_cast<float>(args[5]->NumberValue(context).ToChecked())
|
|
1047
|
+
);
|
|
1048
1048
|
}
|
|
1049
1049
|
|
|
1050
1050
|
void
|
|
@@ -1066,12 +1066,12 @@ void CanvasRenderingContext2DImpl::ClearRect(const v8::FunctionCallbackInfo<v8::
|
|
|
1066
1066
|
auto context = isolate->GetCurrentContext();
|
|
1067
1067
|
|
|
1068
1068
|
canvas_native_context_clear_rect(
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1069
|
+
ptr->GetContext(),
|
|
1070
|
+
static_cast<float>(args[0]->NumberValue(context).ToChecked()),
|
|
1071
|
+
static_cast<float>(args[1]->NumberValue(context).ToChecked()),
|
|
1072
|
+
static_cast<float>(args[2]->NumberValue(context).ToChecked()),
|
|
1073
|
+
static_cast<float>(args[3]->NumberValue(context).ToChecked())
|
|
1074
|
+
);
|
|
1075
1075
|
ptr->UpdateInvalidateState();
|
|
1076
1076
|
}
|
|
1077
1077
|
|
|
@@ -1086,11 +1086,11 @@ void CanvasRenderingContext2DImpl::Clip(const v8::FunctionCallbackInfo<v8::Value
|
|
|
1086
1086
|
if (args.Length() == 0) {
|
|
1087
1087
|
std::string rule("nonzero");
|
|
1088
1088
|
canvas_native_context_clip_rule(
|
|
1089
|
-
|
|
1089
|
+
ptr->GetContext(), rule.c_str());
|
|
1090
1090
|
} else if (args[0]->IsString()) {
|
|
1091
1091
|
auto val = ConvertFromV8String(isolate, args[0]);
|
|
1092
1092
|
canvas_native_context_clip_rule(
|
|
1093
|
-
|
|
1093
|
+
ptr->GetContext(), val.c_str());
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
1096
|
|
|
@@ -1101,7 +1101,7 @@ void CanvasRenderingContext2DImpl::ClosePath(const v8::FunctionCallbackInfo<v8::
|
|
|
1101
1101
|
}
|
|
1102
1102
|
|
|
1103
1103
|
canvas_native_context_close_path(
|
|
1104
|
-
|
|
1104
|
+
ptr->GetContext());
|
|
1105
1105
|
}
|
|
1106
1106
|
|
|
1107
1107
|
void
|
|
@@ -1125,14 +1125,14 @@ CanvasRenderingContext2DImpl::CreateImageData(const v8::FunctionCallbackInfo<v8:
|
|
|
1125
1125
|
auto object = ImageDataImpl::GetPointer(value.As<v8::Object>());
|
|
1126
1126
|
|
|
1127
1127
|
auto width = canvas_native_image_data_get_width(
|
|
1128
|
-
|
|
1128
|
+
object->GetImageData());
|
|
1129
1129
|
auto height = canvas_native_image_data_get_height(
|
|
1130
|
-
|
|
1130
|
+
object->GetImageData());
|
|
1131
1131
|
auto data = new ImageDataImpl(
|
|
1132
|
-
|
|
1133
|
-
|
|
1132
|
+
canvas_native_image_data_create(
|
|
1133
|
+
width, height));
|
|
1134
1134
|
auto ret = ImageDataImpl::GetCtor(isolate)->GetFunction(
|
|
1135
|
-
|
|
1135
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
1136
1136
|
|
|
1137
1137
|
auto ext = v8::External::New(isolate, data);
|
|
1138
1138
|
|
|
@@ -1150,11 +1150,11 @@ CanvasRenderingContext2DImpl::CreateImageData(const v8::FunctionCallbackInfo<v8:
|
|
|
1150
1150
|
auto width = (int) args[0]->NumberValue(context).ToChecked();
|
|
1151
1151
|
auto height = (int) args[1]->NumberValue(context).ToChecked();
|
|
1152
1152
|
auto data = new ImageDataImpl(
|
|
1153
|
-
|
|
1154
|
-
|
|
1153
|
+
canvas_native_image_data_create(
|
|
1154
|
+
width, height));
|
|
1155
1155
|
|
|
1156
1156
|
auto ret = ImageDataImpl::GetCtor(isolate)->GetFunction(
|
|
1157
|
-
|
|
1157
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
1158
1158
|
|
|
1159
1159
|
auto ext = v8::External::New(isolate, data);
|
|
1160
1160
|
|
|
@@ -1187,8 +1187,8 @@ CanvasRenderingContext2DImpl::CreatePattern(const v8::FunctionCallbackInfo<v8::V
|
|
|
1187
1187
|
if (image_asset != nullptr) {
|
|
1188
1188
|
auto rep = ConvertFromV8String(isolate, args[1]);
|
|
1189
1189
|
auto pattern = canvas_native_context_create_pattern_asset(
|
|
1190
|
-
|
|
1191
|
-
|
|
1190
|
+
ptr->GetContext(),
|
|
1191
|
+
image_asset->GetImageAsset(), rep.c_str());
|
|
1192
1192
|
auto style_type = canvas_native_context_get_style_type(pattern);
|
|
1193
1193
|
if (style_type ==
|
|
1194
1194
|
PaintStyleType::PaintStyleTypeNone) {
|
|
@@ -1206,8 +1206,8 @@ CanvasRenderingContext2DImpl::CreatePattern(const v8::FunctionCallbackInfo<v8::V
|
|
|
1206
1206
|
if (image_bitmap != nullptr) {
|
|
1207
1207
|
auto rep = ConvertFromV8String(isolate, args[1]);
|
|
1208
1208
|
auto pattern = canvas_native_context_create_pattern_asset(
|
|
1209
|
-
|
|
1210
|
-
|
|
1209
|
+
ptr->GetContext(),
|
|
1210
|
+
image_bitmap->GetImageAsset(), rep.c_str());
|
|
1211
1211
|
auto style_type = canvas_native_context_get_style_type(pattern);
|
|
1212
1212
|
if (style_type ==
|
|
1213
1213
|
PaintStyleType::PaintStyleTypeNone) {
|
|
@@ -1222,12 +1222,12 @@ CanvasRenderingContext2DImpl::CreatePattern(const v8::FunctionCallbackInfo<v8::V
|
|
|
1222
1222
|
}
|
|
1223
1223
|
case NativeType::CanvasRenderingContext2D: {
|
|
1224
1224
|
auto canvas_2d = CanvasRenderingContext2DImpl::GetPointer(
|
|
1225
|
-
|
|
1225
|
+
value.As<v8::Object>());
|
|
1226
1226
|
if (canvas_2d != nullptr) {
|
|
1227
1227
|
auto rep = ConvertFromV8String(isolate, args[1]);
|
|
1228
1228
|
auto pattern = canvas_native_context_create_pattern_canvas2d(
|
|
1229
|
-
|
|
1230
|
-
|
|
1229
|
+
canvas_2d->GetContext(),
|
|
1230
|
+
ptr->GetContext(), rep.c_str());
|
|
1231
1231
|
auto style_type = canvas_native_context_get_style_type(pattern);
|
|
1232
1232
|
if (style_type ==
|
|
1233
1233
|
PaintStyleType::PaintStyleTypeNone) {
|
|
@@ -1245,8 +1245,8 @@ CanvasRenderingContext2DImpl::CreatePattern(const v8::FunctionCallbackInfo<v8::V
|
|
|
1245
1245
|
if (webgl != nullptr) {
|
|
1246
1246
|
auto rep = ConvertFromV8String(isolate, args[1]);
|
|
1247
1247
|
auto pattern = canvas_native_context_create_pattern_webgl(
|
|
1248
|
-
|
|
1249
|
-
|
|
1248
|
+
webgl->GetState(),
|
|
1249
|
+
ptr->GetContext(), rep.c_str());
|
|
1250
1250
|
auto type = canvas_native_context_get_style_type(pattern);
|
|
1251
1251
|
if (type ==
|
|
1252
1252
|
PaintStyleType::PaintStyleTypeNone) {
|
|
@@ -1255,7 +1255,7 @@ CanvasRenderingContext2DImpl::CreatePattern(const v8::FunctionCallbackInfo<v8::V
|
|
|
1255
1255
|
return;
|
|
1256
1256
|
} else {
|
|
1257
1257
|
auto ret = CanvasPattern::NewInstance(isolate, new CanvasPattern(
|
|
1258
|
-
|
|
1258
|
+
pattern));
|
|
1259
1259
|
args.GetReturnValue().Set(ret);
|
|
1260
1260
|
return;
|
|
1261
1261
|
}
|
|
@@ -1275,7 +1275,7 @@ CanvasRenderingContext2DImpl::CreatePattern(const v8::FunctionCallbackInfo<v8::V
|
|
|
1275
1275
|
|
|
1276
1276
|
void
|
|
1277
1277
|
CanvasRenderingContext2DImpl::CreateLinearGradient(
|
|
1278
|
-
|
|
1278
|
+
const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
1279
1279
|
CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
|
|
1280
1280
|
if (ptr == nullptr) {
|
|
1281
1281
|
args.GetReturnValue().SetUndefined();
|
|
@@ -1292,11 +1292,11 @@ CanvasRenderingContext2DImpl::CreateLinearGradient(
|
|
|
1292
1292
|
auto y1 = static_cast<float>(args[3]->NumberValue(context).ToChecked());
|
|
1293
1293
|
|
|
1294
1294
|
auto gradient = canvas_native_context_create_linear_gradient(
|
|
1295
|
-
|
|
1296
|
-
|
|
1295
|
+
ptr->GetContext(), x0, y0, x1,
|
|
1296
|
+
y1);
|
|
1297
1297
|
|
|
1298
1298
|
auto data = CanvasGradient::NewInstance(isolate, new CanvasGradient(
|
|
1299
|
-
|
|
1299
|
+
gradient));
|
|
1300
1300
|
|
|
1301
1301
|
args.GetReturnValue().Set(data);
|
|
1302
1302
|
|
|
@@ -1308,7 +1308,7 @@ CanvasRenderingContext2DImpl::CreateLinearGradient(
|
|
|
1308
1308
|
|
|
1309
1309
|
void
|
|
1310
1310
|
CanvasRenderingContext2DImpl::__CreatePatternWithNative(
|
|
1311
|
-
|
|
1311
|
+
const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
1312
1312
|
CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
|
|
1313
1313
|
if (ptr == nullptr) {
|
|
1314
1314
|
args.GetReturnValue().SetUndefined();
|
|
@@ -1336,7 +1336,7 @@ CanvasRenderingContext2DImpl::__CreatePatternWithNative(
|
|
|
1336
1336
|
|
|
1337
1337
|
void
|
|
1338
1338
|
CanvasRenderingContext2DImpl::CreateRadialGradient(
|
|
1339
|
-
|
|
1339
|
+
const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
1340
1340
|
CanvasRenderingContext2DImpl *ptr = GetPointer(args.This());
|
|
1341
1341
|
if (ptr == nullptr) {
|
|
1342
1342
|
args.GetReturnValue().SetNull();
|
|
@@ -1355,11 +1355,10 @@ CanvasRenderingContext2DImpl::CreateRadialGradient(
|
|
|
1355
1355
|
auto r1 = static_cast<float>(args[5]->NumberValue(context).ToChecked());
|
|
1356
1356
|
|
|
1357
1357
|
auto gradient = canvas_native_context_create_radial_gradient(
|
|
1358
|
-
|
|
1359
|
-
|
|
1358
|
+
ptr->GetContext(), x0, y0, r0,
|
|
1359
|
+
x1, y1, r1);
|
|
1360
1360
|
|
|
1361
|
-
auto data = CanvasGradient::NewInstance(isolate, new CanvasGradient(
|
|
1362
|
-
std::move(gradient)));
|
|
1361
|
+
auto data = CanvasGradient::NewInstance(isolate, new CanvasGradient(gradient));
|
|
1363
1362
|
|
|
1364
1363
|
args.GetReturnValue().Set(data);
|
|
1365
1364
|
return;
|
|
@@ -1408,9 +1407,9 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
|
|
|
1408
1407
|
|
|
1409
1408
|
if (image_asset != nullptr) {
|
|
1410
1409
|
canvas_native_context_draw_image_dx_dy_asset(
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1410
|
+
ptr->GetContext(),
|
|
1411
|
+
image_asset->GetImageAsset(),
|
|
1412
|
+
dx, dy);
|
|
1414
1413
|
ptr->UpdateInvalidateState();
|
|
1415
1414
|
}
|
|
1416
1415
|
}
|
|
@@ -1419,9 +1418,9 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
|
|
|
1419
1418
|
auto image_bitmap = ImageBitmapImpl::GetPointer(image);
|
|
1420
1419
|
if (image_bitmap != nullptr) {
|
|
1421
1420
|
canvas_native_context_draw_image_dx_dy_asset(
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1421
|
+
ptr->GetContext(),
|
|
1422
|
+
image_bitmap->GetImageAsset(),
|
|
1423
|
+
dx, dy);
|
|
1425
1424
|
ptr->UpdateInvalidateState();
|
|
1426
1425
|
}
|
|
1427
1426
|
}
|
|
@@ -1430,9 +1429,9 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
|
|
|
1430
1429
|
auto image_canvas = CanvasRenderingContext2DImpl::GetPointer(image);
|
|
1431
1430
|
if (image_canvas != nullptr) {
|
|
1432
1431
|
canvas_native_context_draw_image_dx_dy_context(
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1432
|
+
ptr->GetContext(),
|
|
1433
|
+
image_canvas->GetContext(),
|
|
1434
|
+
dx, dy);
|
|
1436
1435
|
ptr->UpdateInvalidateState();
|
|
1437
1436
|
}
|
|
1438
1437
|
}
|
|
@@ -1452,11 +1451,11 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
|
|
|
1452
1451
|
|
|
1453
1452
|
if (image_asset != nullptr) {
|
|
1454
1453
|
canvas_native_context_draw_image_dx_dy_dw_dh_asset(
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1454
|
+
ptr->GetContext(),
|
|
1455
|
+
image_asset->GetImageAsset(),
|
|
1456
|
+
dx, dy,
|
|
1457
|
+
dWidth,
|
|
1458
|
+
dHeight);
|
|
1460
1459
|
ptr->UpdateInvalidateState();
|
|
1461
1460
|
}
|
|
1462
1461
|
}
|
|
@@ -1465,11 +1464,11 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
|
|
|
1465
1464
|
auto image_bitmap = ImageBitmapImpl::GetPointer(image);
|
|
1466
1465
|
if (image_bitmap != nullptr) {
|
|
1467
1466
|
canvas_native_context_draw_image_dx_dy_dw_dh_asset(
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1467
|
+
ptr->GetContext(),
|
|
1468
|
+
image_bitmap->GetImageAsset(),
|
|
1469
|
+
dx, dy,
|
|
1470
|
+
dWidth,
|
|
1471
|
+
dHeight);
|
|
1473
1472
|
ptr->UpdateInvalidateState();
|
|
1474
1473
|
}
|
|
1475
1474
|
}
|
|
@@ -1478,11 +1477,11 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
|
|
|
1478
1477
|
auto image_canvas = CanvasRenderingContext2DImpl::GetPointer(image);
|
|
1479
1478
|
if (image_canvas != nullptr) {
|
|
1480
1479
|
canvas_native_context_draw_image_dx_dy_dw_dh_context(
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1480
|
+
ptr->GetContext(),
|
|
1481
|
+
image_canvas->GetContext(),
|
|
1482
|
+
dx, dy,
|
|
1483
|
+
dWidth,
|
|
1484
|
+
dHeight);
|
|
1486
1485
|
ptr->UpdateInvalidateState();
|
|
1487
1486
|
}
|
|
1488
1487
|
}
|
|
@@ -1507,12 +1506,12 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
|
|
|
1507
1506
|
|
|
1508
1507
|
if (image_asset != nullptr) {
|
|
1509
1508
|
canvas_native_context_draw_image_asset(
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1509
|
+
ptr->GetContext(),
|
|
1510
|
+
image_asset->GetImageAsset(),
|
|
1511
|
+
sx,
|
|
1512
|
+
sy, sWidth, sHeight,
|
|
1513
|
+
dx,
|
|
1514
|
+
dy, dWidth, dHeight);
|
|
1516
1515
|
ptr->UpdateInvalidateState();
|
|
1517
1516
|
}
|
|
1518
1517
|
}
|
|
@@ -1521,12 +1520,12 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
|
|
|
1521
1520
|
auto image_bitmap = ImageBitmapImpl::GetPointer(image);
|
|
1522
1521
|
if (image_bitmap != nullptr) {
|
|
1523
1522
|
canvas_native_context_draw_image_asset(
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1523
|
+
ptr->GetContext(),
|
|
1524
|
+
image_bitmap->GetImageAsset(),
|
|
1525
|
+
sx,
|
|
1526
|
+
sy, sWidth, sHeight,
|
|
1527
|
+
dx,
|
|
1528
|
+
dy, dWidth, dHeight);
|
|
1530
1529
|
ptr->UpdateInvalidateState();
|
|
1531
1530
|
}
|
|
1532
1531
|
}
|
|
@@ -1535,12 +1534,12 @@ CanvasRenderingContext2DImpl::DrawImage(const v8::FunctionCallbackInfo<v8::Value
|
|
|
1535
1534
|
auto image_canvas = CanvasRenderingContext2DImpl::GetPointer(image);
|
|
1536
1535
|
if (image_canvas != nullptr) {
|
|
1537
1536
|
canvas_native_context_draw_image_context(
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1537
|
+
ptr->GetContext(),
|
|
1538
|
+
image_canvas->GetContext(),
|
|
1539
|
+
sx,
|
|
1540
|
+
sy, sWidth, sHeight,
|
|
1541
|
+
dx,
|
|
1542
|
+
dy, dWidth, dHeight);
|
|
1544
1543
|
ptr->UpdateInvalidateState();
|
|
1545
1544
|
}
|
|
1546
1545
|
}
|
|
@@ -1574,11 +1573,11 @@ CanvasRenderingContext2DImpl::Ellipse(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
1574
1573
|
anticlockwise = args[7]->BooleanValue(isolate);
|
|
1575
1574
|
}
|
|
1576
1575
|
canvas_native_context_ellipse(
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1576
|
+
ptr->GetContext(), x, y,
|
|
1577
|
+
radiusX,
|
|
1578
|
+
radiusY, rotation,
|
|
1579
|
+
startAngle, endAngle,
|
|
1580
|
+
anticlockwise);
|
|
1582
1581
|
}
|
|
1583
1582
|
}
|
|
1584
1583
|
|
|
@@ -1600,9 +1599,9 @@ CanvasRenderingContext2DImpl::Fill(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
1600
1599
|
if (object != nullptr) {
|
|
1601
1600
|
auto data = ConvertFromV8String(isolate, args[1]);
|
|
1602
1601
|
canvas_native_context_fill_with_path(
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1602
|
+
ptr->GetContext(),
|
|
1603
|
+
object->GetPath(),
|
|
1604
|
+
data.c_str());
|
|
1606
1605
|
ptr->UpdateInvalidateState();
|
|
1607
1606
|
}
|
|
1608
1607
|
}
|
|
@@ -1611,7 +1610,7 @@ CanvasRenderingContext2DImpl::Fill(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
1611
1610
|
if (value->IsString()) {
|
|
1612
1611
|
auto rule = ConvertFromV8String(isolate, value);
|
|
1613
1612
|
canvas_native_context_fill(
|
|
1614
|
-
|
|
1613
|
+
ptr->GetContext(), rule.c_str());
|
|
1615
1614
|
ptr->UpdateInvalidateState();
|
|
1616
1615
|
} else if (value->IsObject()) {
|
|
1617
1616
|
auto type = GetNativeType(isolate, value.As<v8::Object>());
|
|
@@ -1620,15 +1619,15 @@ CanvasRenderingContext2DImpl::Fill(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
1620
1619
|
|
|
1621
1620
|
std::string rule("nonzero");
|
|
1622
1621
|
canvas_native_context_fill_with_path(
|
|
1623
|
-
|
|
1624
|
-
|
|
1622
|
+
ptr->GetContext(),
|
|
1623
|
+
object->GetPath(), rule.c_str());
|
|
1625
1624
|
ptr->UpdateInvalidateState();
|
|
1626
1625
|
}
|
|
1627
1626
|
}
|
|
1628
1627
|
} else {
|
|
1629
1628
|
std::string rule("nonzero");
|
|
1630
1629
|
canvas_native_context_fill(
|
|
1631
|
-
|
|
1630
|
+
ptr->GetContext(), rule.c_str());
|
|
1632
1631
|
ptr->UpdateInvalidateState();
|
|
1633
1632
|
}
|
|
1634
1633
|
}
|
|
@@ -1647,8 +1646,8 @@ CanvasRenderingContext2DImpl::FillRect(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
1647
1646
|
auto width = static_cast<float>(args[2]->NumberValue(context).ToChecked());
|
|
1648
1647
|
auto height = static_cast<float>(args[3]->NumberValue(context).ToChecked());
|
|
1649
1648
|
canvas_native_context_fill_rect(
|
|
1650
|
-
|
|
1651
|
-
|
|
1649
|
+
ptr->GetContext(), x, y, width,
|
|
1650
|
+
height);
|
|
1652
1651
|
ptr->UpdateInvalidateState();
|
|
1653
1652
|
}
|
|
1654
1653
|
|
|
@@ -1670,8 +1669,8 @@ CanvasRenderingContext2DImpl::FillText(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
1670
1669
|
width = static_cast<float>(args[3]->NumberValue(context).ToChecked());
|
|
1671
1670
|
}
|
|
1672
1671
|
canvas_native_context_fill_text(
|
|
1673
|
-
|
|
1674
|
-
|
|
1672
|
+
ptr->GetContext(), text.c_str(), x,
|
|
1673
|
+
y, width);
|
|
1675
1674
|
ptr->UpdateInvalidateState();
|
|
1676
1675
|
|
|
1677
1676
|
}
|
|
@@ -1693,14 +1692,13 @@ CanvasRenderingContext2DImpl::GetImageData(const v8::FunctionCallbackInfo<v8::Va
|
|
|
1693
1692
|
auto sw = static_cast<float>(args[2]->NumberValue(context).ToChecked());
|
|
1694
1693
|
auto sh = static_cast<float>(args[3]->NumberValue(context).ToChecked());
|
|
1695
1694
|
auto imageData = canvas_native_context_get_image_data(
|
|
1696
|
-
|
|
1697
|
-
|
|
1695
|
+
ptr->GetContext(), sx, sy, sw,
|
|
1696
|
+
sh);
|
|
1698
1697
|
|
|
1699
|
-
auto data = new ImageDataImpl(
|
|
1700
|
-
std::move(imageData));
|
|
1698
|
+
auto data = new ImageDataImpl(imageData);
|
|
1701
1699
|
|
|
1702
1700
|
auto ret = ImageDataImpl::GetCtor(isolate)->GetFunction(
|
|
1703
|
-
|
|
1701
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
1704
1702
|
|
|
1705
1703
|
auto ext = v8::External::New(isolate, data);
|
|
1706
1704
|
|
|
@@ -1732,7 +1730,7 @@ CanvasRenderingContext2DImpl::GetLineDash(const v8::FunctionCallbackInfo<v8::Val
|
|
|
1732
1730
|
|
|
1733
1731
|
|
|
1734
1732
|
auto dash = canvas_native_context_get_line_dash(
|
|
1735
|
-
|
|
1733
|
+
ptr->GetContext());
|
|
1736
1734
|
auto buf = canvas_native_f32_buffer_get_bytes(dash);
|
|
1737
1735
|
auto size = canvas_native_f32_buffer_get_length(dash);
|
|
1738
1736
|
auto array = v8::Array::New(isolate, (int) size);
|
|
@@ -1758,7 +1756,7 @@ CanvasRenderingContext2DImpl::IsPointInPath(const v8::FunctionCallbackInfo<v8::V
|
|
|
1758
1756
|
auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
|
|
1759
1757
|
std::string rule("nonzero");
|
|
1760
1758
|
auto ret = canvas_native_context_is_point_in_path(
|
|
1761
|
-
|
|
1759
|
+
ptr->GetContext(), x, y, rule.c_str());
|
|
1762
1760
|
args.GetReturnValue().Set(ret);
|
|
1763
1761
|
return;
|
|
1764
1762
|
} else if (count == 3 &&
|
|
@@ -1767,7 +1765,7 @@ CanvasRenderingContext2DImpl::IsPointInPath(const v8::FunctionCallbackInfo<v8::V
|
|
|
1767
1765
|
auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
|
|
1768
1766
|
auto rule = ConvertFromV8String(isolate, args[2]);
|
|
1769
1767
|
auto ret = canvas_native_context_is_point_in_path(
|
|
1770
|
-
|
|
1768
|
+
ptr->GetContext(), x, y, rule.c_str());
|
|
1771
1769
|
args.GetReturnValue().Set(ret);
|
|
1772
1770
|
return;
|
|
1773
1771
|
} else if (count == 4 &&
|
|
@@ -1776,25 +1774,21 @@ CanvasRenderingContext2DImpl::IsPointInPath(const v8::FunctionCallbackInfo<v8::V
|
|
|
1776
1774
|
|
|
1777
1775
|
|
|
1778
1776
|
auto value = args[0];
|
|
1779
|
-
auto
|
|
1780
|
-
ConvertToV8String(isolate, "__type"));
|
|
1777
|
+
auto type = GetNativeType(isolate, value);
|
|
1781
1778
|
|
|
1782
|
-
if (
|
|
1783
|
-
auto
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
args.GetReturnValue().Set(ret);
|
|
1796
|
-
return;
|
|
1797
|
-
}
|
|
1779
|
+
if (type == NativeType::Path2D) {
|
|
1780
|
+
auto path = Path2D::GetPointer(value.As<v8::Object>());
|
|
1781
|
+
auto x = static_cast<float>(args[1]->NumberValue(context).ToChecked());
|
|
1782
|
+
auto y = static_cast<float>(args[2]->NumberValue(context).ToChecked());
|
|
1783
|
+
auto rule = ConvertFromV8String(isolate, args[3]);
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
if (path != nullptr) {
|
|
1787
|
+
auto ret = canvas_native_context_is_point_in_path_with_path(
|
|
1788
|
+
ptr->GetContext(),
|
|
1789
|
+
path->GetPath(), x, y, rule.c_str());
|
|
1790
|
+
args.GetReturnValue().Set(ret);
|
|
1791
|
+
return;
|
|
1798
1792
|
}
|
|
1799
1793
|
}
|
|
1800
1794
|
|
|
@@ -1817,7 +1811,7 @@ CanvasRenderingContext2DImpl::IsPointInStroke(const v8::FunctionCallbackInfo<v8:
|
|
|
1817
1811
|
auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
|
|
1818
1812
|
auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
|
|
1819
1813
|
auto ret = canvas_native_context_is_point_in_stroke(
|
|
1820
|
-
|
|
1814
|
+
ptr->GetContext(), x, y);
|
|
1821
1815
|
|
|
1822
1816
|
args.GetReturnValue().Set(ret);
|
|
1823
1817
|
return;
|
|
@@ -1826,25 +1820,21 @@ CanvasRenderingContext2DImpl::IsPointInStroke(const v8::FunctionCallbackInfo<v8:
|
|
|
1826
1820
|
|
|
1827
1821
|
|
|
1828
1822
|
auto value = args[0];
|
|
1829
|
-
auto
|
|
1830
|
-
ConvertToV8String(isolate, "__type"));
|
|
1823
|
+
auto type = GetNativeType(isolate, value);
|
|
1831
1824
|
|
|
1832
|
-
if (
|
|
1833
|
-
auto
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
args.GetReturnValue().Set(ret);
|
|
1846
|
-
return;
|
|
1847
|
-
}
|
|
1825
|
+
if (type == NativeType::Path2D) {
|
|
1826
|
+
auto path = Path2D::GetPointer(value.As<v8::Object>());
|
|
1827
|
+
auto x = static_cast<float>(args[1]->NumberValue(context).ToChecked());
|
|
1828
|
+
auto y = static_cast<float>(args[2]->NumberValue(context).ToChecked());
|
|
1829
|
+
auto rule = ConvertFromV8String(isolate, args[3]);
|
|
1830
|
+
|
|
1831
|
+
|
|
1832
|
+
if (path != nullptr) {
|
|
1833
|
+
auto ret = canvas_native_context_is_point_in_stroke_with_path(
|
|
1834
|
+
ptr->GetContext(),
|
|
1835
|
+
path->GetPath(), x, y);
|
|
1836
|
+
args.GetReturnValue().Set(ret);
|
|
1837
|
+
return;
|
|
1848
1838
|
}
|
|
1849
1839
|
}
|
|
1850
1840
|
}
|
|
@@ -1863,7 +1853,7 @@ CanvasRenderingContext2DImpl::LineTo(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
1863
1853
|
auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
|
|
1864
1854
|
auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
|
|
1865
1855
|
canvas_native_context_line_to(
|
|
1866
|
-
|
|
1856
|
+
ptr->GetContext(), x, y);
|
|
1867
1857
|
}
|
|
1868
1858
|
}
|
|
1869
1859
|
|
|
@@ -1877,13 +1867,12 @@ CanvasRenderingContext2DImpl::MeasureText(const v8::FunctionCallbackInfo<v8::Val
|
|
|
1877
1867
|
auto text = ConvertFromV8String(isolate, args[0]);
|
|
1878
1868
|
|
|
1879
1869
|
auto metrics = canvas_native_context_measure_text(
|
|
1880
|
-
|
|
1870
|
+
ptr->GetContext(), text.c_str());
|
|
1881
1871
|
|
|
1882
|
-
auto data = new TextMetricsImpl(
|
|
1883
|
-
std::move(metrics));
|
|
1872
|
+
auto data = new TextMetricsImpl(metrics);
|
|
1884
1873
|
|
|
1885
1874
|
auto ret = TextMetricsImpl::GetCtor(isolate)->GetFunction(
|
|
1886
|
-
|
|
1875
|
+
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
1887
1876
|
|
|
1888
1877
|
auto ext = v8::External::New(isolate, data);
|
|
1889
1878
|
|
|
@@ -1906,7 +1895,7 @@ CanvasRenderingContext2DImpl::MoveTo(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
1906
1895
|
auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
|
|
1907
1896
|
auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
|
|
1908
1897
|
canvas_native_context_move_to(
|
|
1909
|
-
|
|
1898
|
+
ptr->GetContext(), x, y);
|
|
1910
1899
|
}
|
|
1911
1900
|
}
|
|
1912
1901
|
|
|
@@ -1934,14 +1923,14 @@ CanvasRenderingContext2DImpl::PutImageData(const v8::FunctionCallbackInfo<v8::Va
|
|
|
1934
1923
|
float dirtyX = 0;
|
|
1935
1924
|
float dirtyY = 0;
|
|
1936
1925
|
auto dirtyWidth = (float) canvas_native_image_data_get_width(
|
|
1937
|
-
|
|
1926
|
+
imageData->GetImageData());
|
|
1938
1927
|
auto dirtyHeight = (float) canvas_native_image_data_get_height(
|
|
1939
|
-
|
|
1928
|
+
imageData->GetImageData());
|
|
1940
1929
|
canvas_native_context_put_image_data(
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1930
|
+
ptr->GetContext(),
|
|
1931
|
+
imageData->GetImageData(), dx,
|
|
1932
|
+
dy, dirtyX, dirtyY,
|
|
1933
|
+
dirtyWidth, dirtyHeight);
|
|
1945
1934
|
ptr->UpdateInvalidateState();
|
|
1946
1935
|
} else if (count == 7) {
|
|
1947
1936
|
auto dx = static_cast<float>(args[1]->NumberValue(context).ToChecked());
|
|
@@ -1951,10 +1940,10 @@ CanvasRenderingContext2DImpl::PutImageData(const v8::FunctionCallbackInfo<v8::Va
|
|
|
1951
1940
|
auto dirtyWidth = static_cast<float>(args[5]->NumberValue(context).ToChecked());
|
|
1952
1941
|
auto dirtyHeight = static_cast<float>(args[6]->NumberValue(context).ToChecked());
|
|
1953
1942
|
canvas_native_context_put_image_data(
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1943
|
+
ptr->GetContext(),
|
|
1944
|
+
imageData->GetImageData(), dx,
|
|
1945
|
+
dy, dirtyX, dirtyY,
|
|
1946
|
+
dirtyWidth, dirtyHeight);
|
|
1958
1947
|
ptr->UpdateInvalidateState();
|
|
1959
1948
|
}
|
|
1960
1949
|
}
|
|
@@ -1975,8 +1964,8 @@ CanvasRenderingContext2DImpl::QuadraticCurveTo(const v8::FunctionCallbackInfo<v8
|
|
|
1975
1964
|
auto x = static_cast<float>(args[2]->NumberValue(context).ToChecked());
|
|
1976
1965
|
auto y = static_cast<float>(args[3]->NumberValue(context).ToChecked());
|
|
1977
1966
|
canvas_native_context_quadratic_curve_to(
|
|
1978
|
-
|
|
1979
|
-
|
|
1967
|
+
ptr->GetContext(), cpx, cpy,
|
|
1968
|
+
x, y);
|
|
1980
1969
|
}
|
|
1981
1970
|
|
|
1982
1971
|
}
|
|
@@ -2004,26 +1993,26 @@ CanvasRenderingContext2DImpl::RoundRect(const v8::FunctionCallbackInfo<v8::Value
|
|
|
2004
1993
|
for (int i = 0;
|
|
2005
1994
|
i < size; i++) {
|
|
2006
1995
|
store[i] = (float) array->Get(
|
|
2007
|
-
|
|
2008
|
-
|
|
1996
|
+
context,
|
|
1997
|
+
i).ToLocalChecked()->NumberValue(context).ToChecked();
|
|
2009
1998
|
}
|
|
2010
1999
|
|
|
2011
2000
|
|
|
2012
2001
|
canvas_native_context_round_rect(
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2002
|
+
ptr->GetContext(),
|
|
2003
|
+
x, y,
|
|
2004
|
+
width,
|
|
2005
|
+
height, store.data(), store.size());
|
|
2017
2006
|
|
|
2018
2007
|
}
|
|
2019
2008
|
}
|
|
2020
2009
|
} else {
|
|
2021
2010
|
auto radii = (float) args[4]->NumberValue(context).ToChecked();
|
|
2022
2011
|
canvas_native_context_round_rect_tl_tr_br_bl(
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2012
|
+
ptr->GetContext(), x, y,
|
|
2013
|
+
width,
|
|
2014
|
+
height, radii, radii,
|
|
2015
|
+
radii, radii);
|
|
2027
2016
|
|
|
2028
2017
|
}
|
|
2029
2018
|
}
|
|
@@ -2043,9 +2032,9 @@ CanvasRenderingContext2DImpl::Rect(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
2043
2032
|
auto width = static_cast<float>(args[2]->NumberValue(context).ToChecked());
|
|
2044
2033
|
auto height = static_cast<float>(args[3]->NumberValue(context).ToChecked());
|
|
2045
2034
|
canvas_native_context_rect(
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2035
|
+
ptr->GetContext(), x, y,
|
|
2036
|
+
width,
|
|
2037
|
+
height);
|
|
2049
2038
|
}
|
|
2050
2039
|
|
|
2051
2040
|
}
|
|
@@ -2063,7 +2052,7 @@ CanvasRenderingContext2DImpl::ResetTransform(const v8::FunctionCallbackInfo<v8::
|
|
|
2063
2052
|
}
|
|
2064
2053
|
|
|
2065
2054
|
canvas_native_context_reset_transform(
|
|
2066
|
-
|
|
2055
|
+
ptr->GetContext());
|
|
2067
2056
|
}
|
|
2068
2057
|
|
|
2069
2058
|
void
|
|
@@ -2074,7 +2063,7 @@ CanvasRenderingContext2DImpl::Restore(const v8::FunctionCallbackInfo<v8::Value>
|
|
|
2074
2063
|
}
|
|
2075
2064
|
|
|
2076
2065
|
canvas_native_context_restore(
|
|
2077
|
-
|
|
2066
|
+
ptr->GetContext());
|
|
2078
2067
|
}
|
|
2079
2068
|
|
|
2080
2069
|
void
|
|
@@ -2088,8 +2077,8 @@ CanvasRenderingContext2DImpl::Rotate(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
2088
2077
|
|
|
2089
2078
|
if (args.Length() == 1 && value->IsNumber()) {
|
|
2090
2079
|
canvas_native_context_rotate(
|
|
2091
|
-
|
|
2092
|
-
|
|
2080
|
+
ptr->GetContext(),
|
|
2081
|
+
(float) args[0]->NumberValue(context).ToChecked());
|
|
2093
2082
|
}
|
|
2094
2083
|
}
|
|
2095
2084
|
|
|
@@ -2101,7 +2090,7 @@ CanvasRenderingContext2DImpl::Save(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
2101
2090
|
}
|
|
2102
2091
|
|
|
2103
2092
|
canvas_native_context_save(
|
|
2104
|
-
|
|
2093
|
+
ptr->GetContext());
|
|
2105
2094
|
}
|
|
2106
2095
|
|
|
2107
2096
|
void
|
|
@@ -2115,7 +2104,7 @@ CanvasRenderingContext2DImpl::Scale(const v8::FunctionCallbackInfo<v8::Value> &a
|
|
|
2115
2104
|
auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
|
|
2116
2105
|
auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
|
|
2117
2106
|
canvas_native_context_scale(
|
|
2118
|
-
|
|
2107
|
+
ptr->GetContext(), x, y);
|
|
2119
2108
|
}
|
|
2120
2109
|
}
|
|
2121
2110
|
|
|
@@ -2141,13 +2130,13 @@ CanvasRenderingContext2DImpl::SetLineDash(const v8::FunctionCallbackInfo<v8::Val
|
|
|
2141
2130
|
std::vector<float> data;
|
|
2142
2131
|
for (int i = 0; i < len; ++i) {
|
|
2143
2132
|
auto item = segments->Get(
|
|
2144
|
-
|
|
2133
|
+
context, i).ToLocalChecked()->NumberValue(context).ToChecked();
|
|
2145
2134
|
data.push_back(
|
|
2146
|
-
|
|
2135
|
+
static_cast<float>(item));
|
|
2147
2136
|
}
|
|
2148
2137
|
|
|
2149
2138
|
canvas_native_context_set_line_dash(
|
|
2150
|
-
|
|
2139
|
+
ptr->GetContext(), data.data(), data.size());
|
|
2151
2140
|
}
|
|
2152
2141
|
}
|
|
2153
2142
|
}
|
|
@@ -2173,8 +2162,8 @@ CanvasRenderingContext2DImpl::SetTransform(const v8::FunctionCallbackInfo<v8::Va
|
|
|
2173
2162
|
auto matrix = MatrixImpl::GetPointer(value.As<v8::Object>());
|
|
2174
2163
|
if (matrix != nullptr) {
|
|
2175
2164
|
canvas_native_context_set_transform_matrix(
|
|
2176
|
-
|
|
2177
|
-
|
|
2165
|
+
ptr->GetContext(),
|
|
2166
|
+
matrix->GetMatrix());
|
|
2178
2167
|
}
|
|
2179
2168
|
}
|
|
2180
2169
|
|
|
@@ -2187,9 +2176,9 @@ CanvasRenderingContext2DImpl::SetTransform(const v8::FunctionCallbackInfo<v8::Va
|
|
|
2187
2176
|
auto e = static_cast<float>(args[4]->NumberValue(context).ToChecked());
|
|
2188
2177
|
auto f = static_cast<float>(args[5]->NumberValue(context).ToChecked());
|
|
2189
2178
|
canvas_native_context_set_transform(
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2179
|
+
ptr->GetContext(), a, b, c, d,
|
|
2180
|
+
e,
|
|
2181
|
+
f);
|
|
2193
2182
|
}
|
|
2194
2183
|
}
|
|
2195
2184
|
|
|
@@ -2205,13 +2194,13 @@ CanvasRenderingContext2DImpl::Stroke(const v8::FunctionCallbackInfo<v8::Value> &
|
|
|
2205
2194
|
auto path = Path2D::GetPointer(value.As<v8::Object>());
|
|
2206
2195
|
if (path != nullptr) {
|
|
2207
2196
|
canvas_native_context_stroke_with_path(
|
|
2208
|
-
|
|
2209
|
-
|
|
2197
|
+
ptr->GetContext(),
|
|
2198
|
+
path->GetPath());
|
|
2210
2199
|
ptr->UpdateInvalidateState();
|
|
2211
2200
|
}
|
|
2212
2201
|
} else {
|
|
2213
2202
|
canvas_native_context_stroke(
|
|
2214
|
-
|
|
2203
|
+
ptr->GetContext());
|
|
2215
2204
|
ptr->UpdateInvalidateState();
|
|
2216
2205
|
}
|
|
2217
2206
|
}
|
|
@@ -2229,9 +2218,9 @@ CanvasRenderingContext2DImpl::StrokeRect(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2229
2218
|
auto width = static_cast<float>(args[2]->NumberValue(context).ToChecked());
|
|
2230
2219
|
auto height = static_cast<float>(args[3]->NumberValue(context).ToChecked());
|
|
2231
2220
|
canvas_native_context_stroke_rect(
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2221
|
+
ptr->GetContext(), x, y,
|
|
2222
|
+
width,
|
|
2223
|
+
height);
|
|
2235
2224
|
ptr->UpdateInvalidateState();
|
|
2236
2225
|
}
|
|
2237
2226
|
}
|
|
@@ -2255,8 +2244,8 @@ CanvasRenderingContext2DImpl::StrokeText(const v8::FunctionCallbackInfo<v8::Valu
|
|
|
2255
2244
|
}
|
|
2256
2245
|
|
|
2257
2246
|
canvas_native_context_stroke_text(
|
|
2258
|
-
|
|
2259
|
-
|
|
2247
|
+
ptr->GetContext(), text.c_str(),
|
|
2248
|
+
x, y, maxWidth);
|
|
2260
2249
|
ptr->UpdateInvalidateState();
|
|
2261
2250
|
}
|
|
2262
2251
|
}
|
|
@@ -2277,9 +2266,9 @@ CanvasRenderingContext2DImpl::Transform(const v8::FunctionCallbackInfo<v8::Value
|
|
|
2277
2266
|
auto e = static_cast<float>(args[4]->NumberValue(context).ToChecked());
|
|
2278
2267
|
auto f = static_cast<float>(args[5]->NumberValue(context).ToChecked());
|
|
2279
2268
|
canvas_native_context_transform(
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2269
|
+
ptr->GetContext(), a, b, c, d,
|
|
2270
|
+
e,
|
|
2271
|
+
f);
|
|
2283
2272
|
}
|
|
2284
2273
|
}
|
|
2285
2274
|
|
|
@@ -2295,7 +2284,7 @@ CanvasRenderingContext2DImpl::Translate(const v8::FunctionCallbackInfo<v8::Value
|
|
|
2295
2284
|
auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
|
|
2296
2285
|
auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
|
|
2297
2286
|
canvas_native_context_translate(
|
|
2298
|
-
|
|
2287
|
+
ptr->GetContext(), x, y);
|
|
2299
2288
|
}
|
|
2300
2289
|
}
|
|
2301
2290
|
|
|
@@ -2320,10 +2309,10 @@ CanvasRenderingContext2DImpl::__ToDataURL(const v8::FunctionCallbackInfo<v8::Val
|
|
|
2320
2309
|
|
|
2321
2310
|
|
|
2322
2311
|
auto data = canvas_native_to_data_url(
|
|
2323
|
-
|
|
2324
|
-
|
|
2312
|
+
ptr->GetContext(), type.c_str(),
|
|
2313
|
+
quality);
|
|
2325
2314
|
|
|
2326
|
-
auto value = new OneByteStringResource((char*)data);
|
|
2315
|
+
auto value = new OneByteStringResource((char *) data);
|
|
2327
2316
|
auto ret = v8::String::NewExternalOneByte(isolate, value);
|
|
2328
2317
|
args.GetReturnValue().Set(ret.ToLocalChecked());
|
|
2329
2318
|
|
|
@@ -2354,7 +2343,7 @@ void CanvasRenderingContext2DImpl::UpdateInvalidateState() {
|
|
|
2354
2343
|
|
|
2355
2344
|
InvalidateState CanvasRenderingContext2DImpl::GetInvalidateState() const {
|
|
2356
2345
|
return (InvalidateState)
|
|
2357
|
-
|
|
2346
|
+
this->invalidateState_;
|
|
2358
2347
|
}
|
|
2359
2348
|
|
|
2360
2349
|
void CanvasRenderingContext2DImpl::SetInvalidateState(InvalidateState state) {
|
|
@@ -2386,6 +2375,6 @@ void CanvasRenderingContext2DImpl::Flush(intptr_t context) {
|
|
|
2386
2375
|
}
|
|
2387
2376
|
|
|
2388
2377
|
|
|
2389
|
-
CanvasRenderingContext2D*
|
|
2378
|
+
CanvasRenderingContext2D *CanvasRenderingContext2DImpl::GetContext() {
|
|
2390
2379
|
return this->context_;
|
|
2391
2380
|
}
|