@nativescript/canvas 2.0.0-alpha.22 → 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 (26) hide show
  1. package/package.json +1 -1
  2. package/platforms/android/canvas-release.aar +0 -0
  3. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +4 -4
  4. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.cpp +0 -2
  5. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +643 -624
  6. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.cpp +14 -14
  7. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.cpp +2 -2
  8. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.cpp +4 -4
  9. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.cpp +58 -71
  10. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.h +4 -4
  11. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.h +2 -2
  12. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.h +1 -1
  13. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.h +1 -1
  14. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.h +1 -1
  15. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.h +1 -1
  16. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.h +4 -4
  17. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.h +3 -3
  18. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.h +1 -1
  19. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.h +10 -10
  20. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.h +4 -4
  21. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.h +4 -4
  22. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.h +4 -4
  23. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.h +1 -1
  24. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.cpp +5 -13
  25. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.h +40 -39
  26. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +695 -690
@@ -5,7 +5,7 @@
5
5
  #include "ANGLE_instanced_arraysImpl.h"
6
6
  #include "Caches.h"
7
7
 
8
- ANGLE_instanced_arraysImpl::ANGLE_instanced_arraysImpl(ANGLE_instanced_arrays * arrays)
8
+ ANGLE_instanced_arraysImpl::ANGLE_instanced_arraysImpl(ANGLE_instanced_arrays *arrays)
9
9
  : arrays_(arrays) {}
10
10
 
11
11
  ANGLE_instanced_arraysImpl *
@@ -26,10 +26,10 @@ void ANGLE_instanced_arraysImpl::DrawArraysInstancedANGLE(
26
26
  auto isolate = args.GetIsolate();
27
27
  auto context = isolate->GetCurrentContext();
28
28
 
29
- auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
30
- auto first = (int32_t) args[1]->NumberValue(context).ToChecked();
31
- auto count_ = (int32_t) args[2]->NumberValue(context).ToChecked();
32
- auto primcount = (int32_t) args[3]->NumberValue(context).ToChecked();
29
+ auto mode = args[0]->Uint32Value(context).ToChecked();
30
+ auto first = args[1]->Int32Value(context).ToChecked();
31
+ auto count_ = args[2]->Int32Value(context).ToChecked();
32
+ auto primcount = args[3]->Int32Value(context).ToChecked();
33
33
 
34
34
  canvas_native_webgl_angle_instanced_arrays_draw_arrays_instanced_angle(
35
35
  mode,
@@ -49,11 +49,11 @@ void ANGLE_instanced_arraysImpl::DrawElementsInstancedANGLE(
49
49
  auto isolate = args.GetIsolate();
50
50
  auto context = isolate->GetCurrentContext();
51
51
 
52
- auto mode = (uint32_t) args[0]->NumberValue(context).ToChecked();
53
- auto count_ = (int32_t) args[1]->NumberValue(context).ToChecked();
54
- auto type = (uint32_t) args[2]->NumberValue(context).ToChecked();
55
- auto offset = (int32_t) args[3]->NumberValue(context).ToChecked();
56
- auto primcount = (int32_t) args[4]->NumberValue(context).ToChecked();
52
+ auto mode = args[0]->Uint32Value(context).ToChecked();
53
+ auto count_ = args[1]->Int32Value(context).ToChecked();
54
+ auto type = args[2]->Uint32Value(context).ToChecked();
55
+ auto offset = args[3]->Int32Value(context).ToChecked();
56
+ auto primcount = args[4]->Int32Value(context).ToChecked();
57
57
  canvas_native_webgl_angle_instanced_arrays_draw_elements_instanced_angle(
58
58
  mode,
59
59
  count_,
@@ -73,8 +73,8 @@ void ANGLE_instanced_arraysImpl::VertexAttribDivisorANGLE(
73
73
  auto isolate = args.GetIsolate();
74
74
  auto context = isolate->GetCurrentContext();
75
75
 
76
- auto index = (u_int32_t) args[0]->NumberValue(context).ToChecked();
77
- auto divisor = (u_int32_t) args[1]->NumberValue(context).ToChecked();
76
+ auto index = args[0]->Uint32Value(context).ToChecked();
77
+ auto divisor = args[1]->Uint32Value(context).ToChecked();
78
78
  canvas_native_webgl_angle_instanced_arrays_vertex_attrib_divisor_angle(
79
79
  index,
80
80
  divisor,
@@ -98,7 +98,7 @@ v8::Local<v8::FunctionTemplate> ANGLE_instanced_arraysImpl::GetCtor(v8::Isolate
98
98
  tmpl->SetInternalFieldCount(1);
99
99
 
100
100
  tmpl->Set(ConvertToV8String(isolate, "VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE"),
101
- v8::Number::New(isolate, 0x88FE));
101
+ v8::Integer::NewFromUnsigned(isolate, 0x88FE));
102
102
 
103
103
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
104
104
  ConvertToV8String(isolate, "ANGLE_instanced_arrays"));
@@ -121,6 +121,6 @@ v8::Local<v8::FunctionTemplate> ANGLE_instanced_arraysImpl::GetCtor(v8::Isolate
121
121
  return ctorTmpl;
122
122
  }
123
123
 
124
- ANGLE_instanced_arrays* ANGLE_instanced_arraysImpl::GetArrays() {
124
+ ANGLE_instanced_arrays *ANGLE_instanced_arraysImpl::GetArrays() {
125
125
  return this->arrays_;
126
126
  }
@@ -21,10 +21,10 @@ v8::Local<v8::FunctionTemplate> EXT_blend_minmaxImpl::GetCtor(v8::Isolate *isola
21
21
  tmpl->SetInternalFieldCount(1);
22
22
 
23
23
  tmpl->Set(ConvertToV8String(isolate, "MIN_EXT"),
24
- v8::Number::New(isolate, 0x8007));
24
+ v8::Integer::NewFromUnsigned(isolate, 0x8007));
25
25
 
26
26
  tmpl->Set(ConvertToV8String(isolate, "MAX_EXT"),
27
- v8::Number::New(isolate, 0x8008));
27
+ v8::Integer::NewFromUnsigned(isolate, 0x8008));
28
28
 
29
29
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
30
30
  ConvertToV8String(isolate, "EXT_blend_minmax"));
@@ -21,16 +21,16 @@ v8::Local<v8::FunctionTemplate> EXT_color_buffer_half_floatImpl::GetCtor(v8::Iso
21
21
  tmpl->SetInternalFieldCount(1);
22
22
 
23
23
  tmpl->Set(ConvertToV8String(isolate, "RGBA16F_EXT"),
24
- v8::Number::New(isolate, 0x881A));
24
+ v8::Integer::NewFromUnsigned(isolate, 0x881A));
25
25
 
26
26
  tmpl->Set(ConvertToV8String(isolate, "RGB16F_EXT"),
27
- v8::Number::New(isolate, 0x881B));
27
+ v8::Integer::NewFromUnsigned(isolate, 0x881B));
28
28
 
29
29
  tmpl->Set(ConvertToV8String(isolate, "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT"),
30
- v8::Number::New(isolate, 0x8211));
30
+ v8::Integer::NewFromUnsigned(isolate, 0x8211));
31
31
 
32
32
  tmpl->Set(ConvertToV8String(isolate, "UNSIGNED_NORMALIZED_EXT"),
33
- v8::Number::New(isolate, 0x8C17));
33
+ v8::Integer::NewFromUnsigned(isolate, 0x8C17));
34
34
 
35
35
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
36
36
  ConvertToV8String(isolate, "EXT_color_buffer_half_float"));
@@ -6,7 +6,7 @@
6
6
  #include "Caches.h"
7
7
 
8
8
  EXT_disjoint_timer_queryImpl::EXT_disjoint_timer_queryImpl(
9
- EXT_disjoint_timer_query* query) : query_(query) {}
9
+ EXT_disjoint_timer_query *query) : query_(query) {}
10
10
 
11
11
 
12
12
  v8::Local<v8::FunctionTemplate> EXT_disjoint_timer_queryImpl::GetCtor(v8::Isolate *isolate) {
@@ -24,25 +24,25 @@ v8::Local<v8::FunctionTemplate> EXT_disjoint_timer_queryImpl::GetCtor(v8::Isolat
24
24
  tmpl->SetInternalFieldCount(1);
25
25
 
26
26
  tmpl->Set(ConvertToV8String(isolate, "QUERY_COUNTER_BITS_EXT"),
27
- v8::Number::New(isolate, 0x8864));
27
+ v8::Integer::NewFromUnsigned(isolate, 0x8864));
28
28
 
29
29
  tmpl->Set(ConvertToV8String(isolate, "CURRENT_QUERY_EXT"),
30
- v8::Number::New(isolate, 0x8865));
30
+ v8::Integer::NewFromUnsigned(isolate, 0x8865));
31
31
 
32
32
  tmpl->Set(ConvertToV8String(isolate, "QUERY_RESULT_EXT"),
33
- v8::Number::New(isolate, 0x8866));
33
+ v8::Integer::NewFromUnsigned(isolate, 0x8866));
34
34
 
35
35
  tmpl->Set(ConvertToV8String(isolate, "QUERY_RESULT_AVAILABLE_EXT"),
36
- v8::Number::New(isolate, 0x8867));
36
+ v8::Integer::NewFromUnsigned(isolate, 0x8867));
37
37
 
38
38
  tmpl->Set(ConvertToV8String(isolate, "TIME_ELAPSED_EXT"),
39
- v8::Number::New(isolate, 0x88BF));
39
+ v8::Integer::NewFromUnsigned(isolate, 0x88BF));
40
40
 
41
41
  tmpl->Set(ConvertToV8String(isolate, "TIMESTAMP_EXT"),
42
- v8::Number::New(isolate, 0x8E28));
42
+ v8::Integer::NewFromUnsigned(isolate, 0x8E28));
43
43
 
44
44
  tmpl->Set(ConvertToV8String(isolate, "GPU_DISJOINT_EXT"),
45
- v8::Number::New(isolate, 0x8FBB));
45
+ v8::Integer::NewFromUnsigned(isolate, 0x8FBB));
46
46
 
47
47
 
48
48
  tmpl->Set(ConvertToV8String(isolate, "createQueryExt"),
@@ -111,19 +111,17 @@ void EXT_disjoint_timer_queryImpl::DeleteQueryExt(
111
111
  }
112
112
  auto isolate = args.GetIsolate();
113
113
  auto value = args[0];
114
- if (value->IsObject()) {
115
- auto type = GetNativeType(isolate, value.As<v8::Object>());
116
-
117
- if (type == NativeType::WebGLQuery) {
118
- auto query = WebGLQuery::GetPointer(value.As<v8::Object>());
119
- if (query ==
120
- nullptr) { return; }
121
- canvas_native_webgl_ext_disjoint_timer_query_delete_query_ext(
122
- query->GetQuery(),
123
- ptr->GetQuery());
124
- }
125
-
114
+ auto type = GetNativeType(isolate, value);
115
+
116
+ if (type == NativeType::WebGLQuery) {
117
+ auto query = WebGLQuery::GetPointer(value.As<v8::Object>());
118
+ if (query ==
119
+ nullptr) { return; }
120
+ canvas_native_webgl_ext_disjoint_timer_query_delete_query_ext(
121
+ query->GetQuery(),
122
+ ptr->GetQuery());
126
123
  }
124
+
127
125
  }
128
126
 
129
127
  void EXT_disjoint_timer_queryImpl::IsQueryExt(
@@ -134,20 +132,17 @@ void EXT_disjoint_timer_queryImpl::IsQueryExt(
134
132
  }
135
133
  auto isolate = args.GetIsolate();
136
134
  auto value = args[0];
137
- if (value->IsObject()) {
138
- auto type = GetNativeType(isolate, value.As<v8::Object>());
139
-
140
- if (type == NativeType::WebGLQuery) {
141
- auto query = WebGLQuery::GetPointer(value.As<v8::Object>());
142
- if (query != nullptr) {
143
- auto ret = canvas_native_webgl_ext_disjoint_timer_query_is_query_ext(
144
- query->GetQuery(),
145
- ptr->GetQuery());
146
-
147
- args.GetReturnValue().Set(ret);
148
- }
149
- }
135
+ auto type = GetNativeType(isolate, value);
150
136
 
137
+ if (type == NativeType::WebGLQuery) {
138
+ auto query = WebGLQuery::GetPointer(value.As<v8::Object>());
139
+ if (query != nullptr) {
140
+ auto ret = canvas_native_webgl_ext_disjoint_timer_query_is_query_ext(
141
+ query->GetQuery(),
142
+ ptr->GetQuery());
143
+
144
+ args.GetReturnValue().Set(ret);
145
+ }
151
146
  }
152
147
  args.GetReturnValue().Set(false);
153
148
  }
@@ -164,19 +159,16 @@ void EXT_disjoint_timer_queryImpl::BeginQueryExt(
164
159
  auto targetValue = args[0];
165
160
  auto queryValue = args[1];
166
161
 
167
- if (targetValue->IsNumber() &&
168
- queryValue->IsObject()) {
169
- auto target = (uint32_t) targetValue->NumberValue(context).ToChecked();
170
- auto type = GetNativeType(isolate, queryValue.As<v8::Object>());
171
- if (type == NativeType::WebGLQuery) {
172
- auto query = WebGLQuery::GetPointer(queryValue.As<v8::Object>());
162
+ auto target = targetValue->Uint32Value(context).ToChecked();
163
+ auto type = GetNativeType(isolate, queryValue);
164
+ if (type == NativeType::WebGLQuery) {
165
+ auto query = WebGLQuery::GetPointer(queryValue.As<v8::Object>());
173
166
 
174
- canvas_native_webgl_ext_disjoint_timer_query_begin_query_ext(
175
- target,
176
- query->GetQuery(),
177
- ptr->GetQuery()
178
- );
179
- }
167
+ canvas_native_webgl_ext_disjoint_timer_query_begin_query_ext(
168
+ target,
169
+ query->GetQuery(),
170
+ ptr->GetQuery()
171
+ );
180
172
  }
181
173
  }
182
174
 
@@ -190,13 +182,11 @@ void EXT_disjoint_timer_queryImpl::EndQueryExt(
190
182
  auto context = isolate->GetCurrentContext();
191
183
 
192
184
  auto value = args[0];
193
- if (value->IsNumber()) {
194
- auto target = (uint32_t) value->NumberValue(context).ToChecked();
195
- canvas_native_webgl_ext_disjoint_timer_query_end_query_ext(
196
- target,
197
- ptr->GetQuery()
198
- );
199
- }
185
+ auto target = value->Uint32Value(context).ToChecked();
186
+ canvas_native_webgl_ext_disjoint_timer_query_end_query_ext(
187
+ target,
188
+ ptr->GetQuery()
189
+ );
200
190
  }
201
191
 
202
192
  void EXT_disjoint_timer_queryImpl::QueryCounterExt(
@@ -212,19 +202,16 @@ void EXT_disjoint_timer_queryImpl::QueryCounterExt(
212
202
  auto queryValue = args[0];
213
203
  auto targetValue = args[1];
214
204
 
215
- if (targetValue->IsNumber() &&
216
- queryValue->IsObject()) {
217
- auto target = (uint32_t) targetValue->NumberValue(context).ToChecked();
218
- auto type = GetNativeType(isolate, queryValue.As<v8::Object>());
219
- if (type == NativeType::WebGLQuery) {
220
- auto query = WebGLQuery::GetPointer(queryValue.As<v8::Object>());
205
+ auto target = targetValue->Uint32Value(context).ToChecked();
206
+ auto type = GetNativeType(isolate, queryValue.As<v8::Object>());
207
+ if (type == NativeType::WebGLQuery) {
208
+ auto query = WebGLQuery::GetPointer(queryValue.As<v8::Object>());
221
209
 
222
- canvas_native_webgl_ext_disjoint_timer_query_query_counter_ext(
223
- query->GetQuery(),
224
- target,
225
- ptr->GetQuery()
226
- );
227
- }
210
+ canvas_native_webgl_ext_disjoint_timer_query_query_counter_ext(
211
+ query->GetQuery(),
212
+ target,
213
+ ptr->GetQuery()
214
+ );
228
215
  }
229
216
  }
230
217
 
@@ -237,8 +224,8 @@ void EXT_disjoint_timer_queryImpl::GetQueryExt(
237
224
  auto isolate = args.GetIsolate();
238
225
  auto context = isolate->GetCurrentContext();
239
226
 
240
- auto target = (uint32_t) args[0]->NumberValue(context).ToChecked();
241
- auto pname = (uint32_t) args[1]->NumberValue(context).ToChecked();
227
+ auto target = args[0]->Uint32Value(context).ToChecked();
228
+ auto pname = args[1]->Uint32Value(context).ToChecked();
242
229
  auto ret = canvas_native_webgl_ext_disjoint_timer_query_get_query_ext(
243
230
  target,
244
231
  pname,
@@ -260,14 +247,14 @@ void EXT_disjoint_timer_queryImpl::GetQueryObjectExt(
260
247
 
261
248
 
262
249
  auto query = WebGLQuery::GetPointer(args[0].As<v8::Object>());
263
- auto pname = (uint32_t) args[1]->NumberValue(context).ToChecked();
250
+ auto pname = args[1]->Uint32Value(context).ToChecked();
264
251
 
265
252
  auto ret = canvas_native_webgl_ext_disjoint_timer_query_get_query_object_ext(
266
253
  query->GetQuery(),
267
254
  pname,
268
255
  ptr->GetQuery()
269
256
  );
270
-
257
+
271
258
 
272
259
  // GL_QUERY_RESULT_AVAILABLE_EXT
273
260
  if (pname == 0x8867) {
@@ -280,7 +267,7 @@ void EXT_disjoint_timer_queryImpl::GetQueryObjectExt(
280
267
 
281
268
  args.GetReturnValue().Set(canvas_native_webgl_result_get_i32(
282
269
  ret));
283
-
270
+
284
271
  canvas_native_webgl_WebGLResult_destroy(ret);
285
272
  }
286
273
 
@@ -296,7 +283,7 @@ void EXT_disjoint_timer_queryImpl::GetQueryParameterExt(
296
283
 
297
284
 
298
285
  auto query = WebGLQuery::GetPointer(args[0].As<v8::Object>());
299
- auto pname = (uint32_t) args[1]->NumberValue(context).ToChecked();
286
+ auto pname = args[1]->Uint32Value(context).ToChecked();
300
287
 
301
288
  auto ret = canvas_native_webgl_ext_disjoint_timer_query_get_query_object_ext(
302
289
  query->GetQuery(),
@@ -318,6 +305,6 @@ void EXT_disjoint_timer_queryImpl::GetQueryParameterExt(
318
305
  }
319
306
 
320
307
 
321
- EXT_disjoint_timer_query* EXT_disjoint_timer_queryImpl::GetQuery() {
308
+ EXT_disjoint_timer_query *EXT_disjoint_timer_queryImpl::GetQuery() {
322
309
  return this->query_;
323
310
  }
@@ -25,13 +25,13 @@ public:
25
25
  auto tmpl = ctorTmpl->InstanceTemplate();
26
26
  tmpl->SetInternalFieldCount(1);
27
27
  tmpl->Set(ConvertToV8String(isolate, "SRGB_EXT"),
28
- v8::Number::New(isolate, (double) GL_SRGB_EXT));
28
+ v8::Integer::NewFromUnsigned(isolate, GL_SRGB_EXT));
29
29
  tmpl->Set(ConvertToV8String(isolate, "SRGB_ALPHA_EXT"),
30
- v8::Number::New(isolate, (double) GL_SRGB_ALPHA_EXT));
30
+ v8::Integer::NewFromUnsigned(isolate, GL_SRGB_ALPHA_EXT));
31
31
  tmpl->Set(ConvertToV8String(isolate, "SRGB8_ALPHA8_EXT"),
32
- v8::Number::New(isolate, (double) GL_SRGB8_ALPHA8_EXT));
32
+ v8::Integer::NewFromUnsigned(isolate, GL_SRGB8_ALPHA8_EXT));
33
33
  tmpl->Set(ConvertToV8String(isolate, "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT"),
34
- v8::Number::New(isolate, (double) GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT));
34
+ v8::Integer::NewFromUnsigned(isolate, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT));
35
35
  tmpl->Set(ConvertToV8String(isolate, "ext_name"), ConvertToV8String(isolate, "EXT_sRGB"));
36
36
 
37
37
  cache->EXT_sRGBTmpl =
@@ -26,9 +26,9 @@ public:
26
26
  auto tmpl = ctorTmpl->InstanceTemplate();
27
27
  tmpl->SetInternalFieldCount(1);
28
28
  tmpl->Set(ConvertToV8String(isolate, "MAX_TEXTURE_MAX_ANISOTROPY_EXT"),
29
- v8::Number::New(isolate, (double) GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
29
+ v8::Integer::NewFromUnsigned(isolate, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
30
30
  tmpl->Set(ConvertToV8String(isolate, "TEXTURE_MAX_ANISOTROPY_EXT"),
31
- v8::Number::New(isolate, (double) GL_TEXTURE_MAX_ANISOTROPY_EXT));
31
+ v8::Integer::NewFromUnsigned(isolate, GL_TEXTURE_MAX_ANISOTROPY_EXT));
32
32
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
33
33
  ConvertToV8String(isolate, "EXT_texture_filter_anisotropic"));
34
34
 
@@ -27,7 +27,7 @@ public:
27
27
  tmpl->SetInternalFieldCount(1);
28
28
 
29
29
  tmpl->Set(ConvertToV8String(isolate, "UNSIGNED_INT"),
30
- v8::Number::New(isolate, (double) GL_UNSIGNED_INT));
30
+ v8::Integer::NewFromUnsigned(isolate, GL_UNSIGNED_INT));
31
31
 
32
32
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
33
33
  ConvertToV8String(isolate, "OES_element_index_uint"));
@@ -26,7 +26,7 @@ public:
26
26
  auto tmpl = ctorTmpl->InstanceTemplate();
27
27
  tmpl->SetInternalFieldCount(1);
28
28
  tmpl->Set(ConvertToV8String(isolate, "FRAGMENT_SHADER_DERIVATIVE_HINT_OES"),
29
- v8::Number::New(isolate, GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES));
29
+ v8::Integer::NewFromUnsigned(isolate, GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES));
30
30
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
31
31
  ConvertToV8String(isolate, "OES_standard_derivatives"));
32
32
  cache->OES_standard_derivativesTmpl =
@@ -26,7 +26,7 @@ public:
26
26
  auto tmpl = ctorTmpl->InstanceTemplate();
27
27
  tmpl->SetInternalFieldCount(1);
28
28
  tmpl->Set(ConvertToV8String(isolate, "ext_name"), ConvertToV8String(isolate, "OES_texture_half_float"));
29
- tmpl->Set(ConvertToV8String(isolate, "HALF_FLOAT_OES"), v8::Number::New(isolate, (double ) GL_HALF_FLOAT_OES));
29
+ tmpl->Set(ConvertToV8String(isolate, "HALF_FLOAT_OES"), v8::Integer::New(isolate, GL_HALF_FLOAT_OES));
30
30
  cache->OES_texture_half_floatTmpl =
31
31
  std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
32
32
  return ctorTmpl;
@@ -33,7 +33,7 @@ public:
33
33
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
34
34
  ConvertToV8String(isolate, "OES_vertex_array_object"));
35
35
  tmpl->Set(ConvertToV8String(isolate, "VERTEX_ARRAY_BINDING_OES"),
36
- v8::Number::New(isolate, (double) GL_VERTEX_ARRAY_BINDING_OES));
36
+ v8::Integer::NewFromUnsigned(isolate, GL_VERTEX_ARRAY_BINDING_OES));
37
37
  tmpl->Set(ConvertToV8String(isolate, "createVertexArrayOES"),
38
38
  v8::FunctionTemplate::New(isolate, &CreateVertexArrayOES));
39
39
  tmpl->Set(ConvertToV8String(isolate, "deleteVertexArrayOES"),
@@ -29,13 +29,13 @@ public:
29
29
  ConvertToV8String(isolate, "WEBGL_color_buffer_float"));
30
30
 
31
31
  tmpl->Set(ConvertToV8String(isolate, "RGBA32F_EXT"),
32
- v8::Number::New(isolate, (double) GL_RGBA32F_EXT));
32
+ v8::Integer::NewFromUnsigned(isolate, GL_RGBA32F_EXT));
33
33
  tmpl->Set(ConvertToV8String(isolate, "RGB32F_EXT"),
34
- v8::Number::New(isolate, (double) GL_RGB32F_EXT));
34
+ v8::Integer::NewFromUnsigned(isolate, GL_RGB32F_EXT));
35
35
  tmpl->Set(ConvertToV8String(isolate, "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT"),
36
- v8::Number::New(isolate, (double) GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT));
36
+ v8::Integer::NewFromUnsigned(isolate, GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT));
37
37
  tmpl->Set(ConvertToV8String(isolate, "UNSIGNED_NORMALIZED_EXT"),
38
- v8::Number::New(isolate, (double) GL_UNSIGNED_NORMALIZED_EXT));
38
+ v8::Integer::NewFromUnsigned(isolate, GL_UNSIGNED_NORMALIZED_EXT));
39
39
  cache->WEBGL_color_buffer_floatTmpl =
40
40
  std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
41
41
  return ctorTmpl;
@@ -28,11 +28,11 @@ public:
28
28
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
29
29
  ConvertToV8String(isolate, "WEBGL_compressed_texture_atc"));
30
30
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB_ATC_WEBGL"),
31
- v8::Number::New(isolate, (double) GL_ATC_RGB_AMD));
31
+ v8::Integer::NewFromUnsigned(isolate, GL_ATC_RGB_AMD));
32
32
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL"),
33
- v8::Number::New(isolate, (double) GL_ATC_RGBA_EXPLICIT_ALPHA_AMD));
33
+ v8::Integer::NewFromUnsigned(isolate, GL_ATC_RGBA_EXPLICIT_ALPHA_AMD));
34
34
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"),
35
- v8::Number::New(isolate, (double) GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD));
35
+ v8::Integer::NewFromUnsigned(isolate, GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD));
36
36
 
37
37
  cache->WEBGL_compressed_texture_atcTmpl =
38
38
  std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
@@ -30,7 +30,7 @@ public:
30
30
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
31
31
  ConvertToV8String(isolate, "WEBGL_compressed_texture_etc1"));
32
32
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB_ETC1_WEBGL"),
33
- v8::Number::New(isolate, GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG));
33
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG));
34
34
 
35
35
  cache->WEBGL_compressed_texture_etc1Tmpl =
36
36
  std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
@@ -27,34 +27,34 @@ public:
27
27
  tmpl->SetInternalFieldCount(1);
28
28
 
29
29
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_R11_EAC"),
30
- v8::Number::New(isolate, (double) GL_COMPRESSED_R11_EAC));
30
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_R11_EAC));
31
31
 
32
32
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SIGNED_R11_EAC"),
33
- v8::Number::New(isolate, (double) GL_COMPRESSED_SIGNED_R11_EAC));
33
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_SIGNED_R11_EAC));
34
34
 
35
35
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RG11_EAC"),
36
- v8::Number::New(isolate, (double) GL_COMPRESSED_RG11_EAC));
36
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RG11_EAC));
37
37
 
38
38
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SIGNED_RG11_EAC"),
39
- v8::Number::New(isolate, (double) GL_COMPRESSED_SIGNED_RG11_EAC));
39
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_SIGNED_RG11_EAC));
40
40
 
41
41
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB8_ETC2"),
42
- v8::Number::New(isolate, (double) GL_COMPRESSED_RGB8_ETC2));
42
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGB8_ETC2));
43
43
 
44
44
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA8_ETC2_EAC"),
45
- v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA8_ETC2_EAC));
45
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGBA8_ETC2_EAC));
46
46
 
47
47
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB8_ETC2"),
48
- v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB8_ETC2));
48
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_SRGB8_ETC2));
49
49
 
50
50
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"),
51
- v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC));
51
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC));
52
52
 
53
53
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2"),
54
- v8::Number::New(isolate, (double) GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2));
54
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2));
55
55
 
56
56
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2"),
57
- v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2));
57
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2));
58
58
 
59
59
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
60
60
  ConvertToV8String(isolate, "WEBGL_compressed_texture_etc"));
@@ -28,16 +28,16 @@ public:
28
28
  tmpl->SetInternalFieldCount(1);
29
29
 
30
30
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB_PVRTC_4BPPV1_IMG"),
31
- v8::Number::New(isolate, (double) GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG));
31
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG));
32
32
 
33
33
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG"),
34
- v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG));
34
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG));
35
35
 
36
36
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB_PVRTC_2BPPV1_IMG"),
37
- v8::Number::New(isolate, (double) GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG));
37
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG));
38
38
 
39
39
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG"),
40
- v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG));
40
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG));
41
41
 
42
42
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
43
43
  ConvertToV8String(isolate, "WEBGL_compressed_texture_pvrtc"));
@@ -27,13 +27,13 @@ public:
27
27
  tmpl->SetInternalFieldCount(1);
28
28
 
29
29
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB_S3TC_DXT1_EXT"),
30
- v8::Number::New(isolate, (double) GL_COMPRESSED_RGB_S3TC_DXT1_EXT));
30
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGB_S3TC_DXT1_EXT));
31
31
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_S3TC_DXT1_EXT"),
32
- v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA_S3TC_DXT1_EXT));
32
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT));
33
33
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_S3TC_DXT3_EXT"),
34
- v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA_S3TC_DXT3_EXT));
34
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT));
35
35
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_S3TC_DXT5_EXT"),
36
- v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA_S3TC_DXT5_EXT));
36
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT));
37
37
 
38
38
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
39
39
  ConvertToV8String(isolate, "WEBGL_compressed_texture_s3tc"));
@@ -27,16 +27,16 @@ public:
27
27
  tmpl->SetInternalFieldCount(1);
28
28
 
29
29
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB_S3TC_DXT1_EXT"),
30
- v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB_S3TC_DXT1_EXT));
30
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT));
31
31
 
32
32
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT"),
33
- v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT));
33
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT));
34
34
 
35
35
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT"),
36
- v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT));
36
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT));
37
37
 
38
38
  tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT"),
39
- v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT));
39
+ v8::Integer::NewFromUnsigned(isolate, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT));
40
40
 
41
41
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
42
42
  ConvertToV8String(isolate, "WEBGL_compressed_texture_s3tc_srgb"));
@@ -27,7 +27,7 @@ public:
27
27
  auto tmpl = ctorTmpl->InstanceTemplate();
28
28
  tmpl->SetInternalFieldCount(1);
29
29
 
30
- tmpl->Set(ConvertToV8String(isolate, "UNSIGNED_INT_24_8_WEBGL"), v8::Number::New(isolate, 0x84FA));
30
+ tmpl->Set(ConvertToV8String(isolate, "UNSIGNED_INT_24_8_WEBGL"), v8::Integer::NewFromUnsigned(isolate, 0x84FA));
31
31
 
32
32
  tmpl->Set(ConvertToV8String(isolate, "ext_name"),
33
33
  ConvertToV8String(isolate, "WEBGL_depth_texture"));
@@ -4,12 +4,12 @@
4
4
 
5
5
  #include "WEBGL_draw_buffersImpl.h"
6
6
 
7
- WEBGL_draw_buffersImpl::WEBGL_draw_buffersImpl(WEBGL_draw_buffers* buffers) : buffers_(buffers) {
7
+ WEBGL_draw_buffersImpl::WEBGL_draw_buffersImpl(WEBGL_draw_buffers *buffers) : buffers_(buffers) {
8
8
 
9
9
  }
10
10
 
11
11
  void WEBGL_draw_buffersImpl::DrawBuffersWEBGL(
12
- const v8::FunctionCallbackInfo <v8::Value> &args) {
12
+ const v8::FunctionCallbackInfo<v8::Value> &args) {
13
13
  WEBGL_draw_buffersImpl *ptr = GetPointer(args.This());
14
14
  if (ptr == nullptr) {
15
15
  return;
@@ -25,18 +25,10 @@ void WEBGL_draw_buffersImpl::DrawBuffersWEBGL(
25
25
  buf.reserve(len);
26
26
  for (int j = 0; j < len; ++j) {
27
27
  auto item = buffers->Get(context, j).ToLocalChecked();
28
- if (!item->IsNumber()) {
29
- // todo verify
30
- buf.push_back(0);
31
- } else {
32
- buf.push_back(
33
- (uint32_t) item->NumberValue(context).ToChecked());
34
- }
35
-
28
+ buf.push_back(item->Uint32Value(context).ToChecked());
36
29
  }
37
-
38
-
39
- canvas_native_webgl_draw_buffers_draw_buffers_webgl(buf.data(), buf.size(),ptr->GetDrawBuffers());
30
+ canvas_native_webgl_draw_buffers_draw_buffers_webgl(buf.data(), buf.size(),
31
+ ptr->GetDrawBuffers());
40
32
 
41
33
  }
42
34