Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/skia/cpp/jsi/JsiHostObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* Creates a JSI export function declaration
*/
#define JSI_EXPORT_FUNC(CLASS, FUNCTION) \
{#FUNCTION, (jsi::Value(JsiHostObject::*)( \
{#FUNCTION, (jsi::Value (JsiHostObject::*)( \
jsi::Runtime & runtime, const jsi::Value &thisValue, \
const jsi::Value *arguments, size_t)) & \
CLASS::FUNCTION}
Expand All @@ -65,7 +65,7 @@
* Creates a JSI export getter declaration
*/
#define JSI_EXPORT_PROP_GET(CLASS, FUNCTION) \
{#FUNCTION, (jsi::Value(JsiHostObject::*)(jsi::Runtime & runtime)) & \
{#FUNCTION, (jsi::Value (JsiHostObject::*)(jsi::Runtime & runtime)) & \
CLASS::STR_CAT(STR_GET, FUNCTION)}

/**
Expand All @@ -83,7 +83,7 @@
*/
#define JSI_EXPORT_PROP_SET(CLASS, FUNCTION) \
{#FUNCTION, \
(void(JsiHostObject::*)(jsi::Runtime & runtime, const jsi::Value &)) & \
(void (JsiHostObject::*)(jsi::Runtime & runtime, const jsi::Value &)) & \
CLASS::STR_CAT(STR_SET, FUNCTION)}

/**
Expand Down
13 changes: 9 additions & 4 deletions packages/skia/cpp/rnskia/RNSkJsiViewApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ class RNSkJsiViewApi : public RNJsi::JsiHostObject,
if (name == "onSize" && isSharedValue(runtime, arguments[2])) {
jsi::Object size(runtime);
auto pd = _platformContext->getPixelDensity();
size.setProperty(runtime, "width",
info->view->getScaledWidth() / pd);
size.setProperty(runtime, "height",
info->view->getScaledHeight() / pd);
auto w = info->view != nullptr
? std::max(info->view->getScaledWidth(), 0)
: 0;
auto h = info->view != nullptr
? std::max(info->view->getScaledHeight(), 0)
: 0;

size.setProperty(runtime, "width", w / pd);
size.setProperty(runtime, "height", h / pd);
arguments[2].asObject(runtime).setProperty(runtime, "value", size);
} else {
info->props.insert_or_assign(
Expand Down
Loading