Skip to content

Commit

Permalink
fix: RGBA class
Browse files Browse the repository at this point in the history
  • Loading branch information
vadzz-dev committed Mar 20, 2024
1 parent 59f5263 commit 8ab7dea
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion shared/bindings/RGBA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static void Constructor(const v8::FunctionCallbackInfo<v8::Value>& info)

V8_CHECK_ARGS_LEN_MIN_MAX(1, 4);

V8Helpers::SetObjectClass(isolate, info.This(), V8Class::ObjectClass::QUATERNION);
V8Helpers::SetObjectClass(isolate, info.This(), V8Class::ObjectClass::RGBA);
int32_t r = 0, g = 0, b = 0, a = 255;

if(info.Length() == 1)
Expand Down
8 changes: 0 additions & 8 deletions shared/helpers/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,14 @@
V8_CHECK(val, "baseobject is not of type " #type); \
}

// idx starts with 1
#define V8_GET_THIS_INTERNAL_FIELD_OBJECT(idx, val) \
V8_CHECK(info.This()->InternalFieldCount() > idx - 1, "Invalid internal field count (is the 'this' context correct?)"); \
auto val = info.This()->GetInternalField(idx)->ToObject(isolate->GetEnteredOrMicrotaskContext()).ToLocalChecked();

// idx starts with 1
#define V8_GET_THIS_INTERNAL_FIELD_V8ENTITY(idx, val) \
V8_CHECK(info.This()->InternalFieldCount() > idx - 1, "Invalid internal field count (is the 'this' context correct?)"); \
auto val = V8Entity::Get(info.This()->GetInternalField(idx)->ToObject(isolate->GetEnteredOrMicrotaskContext()).ToLocalChecked());

// idx starts with 1
#define V8_GET_THIS_INTERNAL_FIELD_ENTITY(idx, val, type) \
type* val; \
{ \
Expand All @@ -69,27 +66,22 @@
V8_CHECK(val, "baseobject is not of type " #type); \
}

// idx starts with 1
#define V8_GET_THIS_INTERNAL_FIELD_INTEGER(idx, val) \
V8_CHECK(info.This()->InternalFieldCount() > idx - 1, "Invalid internal field count (is the 'this' context correct?)"); \
auto val = info.This()->GetInternalField(idx)->IntegerValue(ctx).ToChecked();

// idx starts with 1
#define V8_GET_THIS_INTERNAL_FIELD_UINT32(idx, val) \
V8_CHECK(info.This()->InternalFieldCount() > idx - 1, "Invalid internal field count (is the 'this' context correct?)"); \
auto val = info.This()->GetInternalField(idx)->Uint32Value(ctx).ToChecked();

// idx starts with 1
#define V8_GET_THIS_INTERNAL_FIELD_EXTERNAL(idx, val, type) \
V8_CHECK(info.This()->InternalFieldCount() > idx - 1, "Invalid internal field count (is the 'this' context correct?)"); \
auto val = static_cast<type*>(info.This()->GetInternalField(idx).As<v8::External>()->Value());

// idx starts with 1
#define V8_GET_THIS_INTERNAL_FIELD_PTR(idx, val, type) \
V8_CHECK(info.This()->InternalFieldCount() > idx - 1, "Invalid internal field count (is the 'this' context correct?)"); \
auto val = static_cast<type*>(info.This()->GetAlignedPointerFromInternalField(idx));

// idx starts with 1
#define V8_GET_THIS_INTERNAL_FIELD_STRING(idx, val) \
V8_CHECK(info.This()->InternalFieldCount() > idx - 1, "Invalid internal field count (is the 'this' context correct?)"); \
auto intVal = info.This()->GetInternalField(idx).As<v8::String>(); \
Expand Down

0 comments on commit 8ab7dea

Please sign in to comment.