diff --git a/java/jni/YGJNI.cpp b/java/jni/YGJNI.cpp index 5649ef7e..1d6f464c 100644 --- a/java/jni/YGJNI.cpp +++ b/java/jni/YGJNI.cpp @@ -33,13 +33,17 @@ struct YGConfigContext { } }; -static inline weak_ref *YGNodeJobject(YGNodeRef node) { +static inline weak_ref* YGNodeJobject(YGNodeRef node) { return reinterpret_cast*>(node->getContext()); } -static void YGTransferLayoutDirection(YGNodeRef node, alias_ref javaNode) { - static auto layoutDirectionField = javaNode->getClass()->getField("mLayoutDirection"); - javaNode->setFieldValue(layoutDirectionField, static_cast(YGNodeLayoutGetDirection(node))); +static void YGTransferLayoutDirection( + YGNodeRef node, + alias_ref javaNode) { + static auto layoutDirectionField = + javaNode->getClass()->getField("mLayoutDirection"); + javaNode->setFieldValue( + layoutDirectionField, static_cast(YGNodeLayoutGetDirection(node))); } static void YGTransferLayoutOutputsRecursive(YGNodeRef root) { @@ -50,23 +54,37 @@ static void YGTransferLayoutOutputsRecursive(YGNodeRef root) { static auto leftField = obj->getClass()->getField("mLeft"); static auto topField = obj->getClass()->getField("mTop"); - static auto marginLeftField = obj->getClass()->getField("mMarginLeft"); - static auto marginTopField = obj->getClass()->getField("mMarginTop"); - static auto marginRightField = obj->getClass()->getField("mMarginRight"); - static auto marginBottomField = obj->getClass()->getField("mMarginBottom"); + static auto marginLeftField = + obj->getClass()->getField("mMarginLeft"); + static auto marginTopField = + obj->getClass()->getField("mMarginTop"); + static auto marginRightField = + obj->getClass()->getField("mMarginRight"); + static auto marginBottomField = + obj->getClass()->getField("mMarginBottom"); - static auto paddingLeftField = obj->getClass()->getField("mPaddingLeft"); - static auto paddingTopField = obj->getClass()->getField("mPaddingTop"); - static auto paddingRightField = obj->getClass()->getField("mPaddingRight"); - static auto paddingBottomField = obj->getClass()->getField("mPaddingBottom"); + static auto paddingLeftField = + obj->getClass()->getField("mPaddingLeft"); + static auto paddingTopField = + obj->getClass()->getField("mPaddingTop"); + static auto paddingRightField = + obj->getClass()->getField("mPaddingRight"); + static auto paddingBottomField = + obj->getClass()->getField("mPaddingBottom"); - static auto borderLeftField = obj->getClass()->getField("mBorderLeft"); - static auto borderTopField = obj->getClass()->getField("mBorderTop"); - static auto borderRightField = obj->getClass()->getField("mBorderRight"); - static auto borderBottomField = obj->getClass()->getField("mBorderBottom"); + static auto borderLeftField = + obj->getClass()->getField("mBorderLeft"); + static auto borderTopField = + obj->getClass()->getField("mBorderTop"); + static auto borderRightField = + obj->getClass()->getField("mBorderRight"); + static auto borderBottomField = + obj->getClass()->getField("mBorderBottom"); - static auto edgeSetFlagField = obj->getClass()->getField("mEdgeSetFlag"); - static auto hasNewLayoutField = obj->getClass()->getField("mHasNewLayout"); + static auto edgeSetFlagField = + obj->getClass()->getField("mEdgeSetFlag"); + static auto hasNewLayoutField = + obj->getClass()->getField("mHasNewLayout"); static auto doesLegacyStretchBehaviour = obj->getClass()->getField( "mDoesLegacyStretchFlagAffectsLayout"); @@ -76,7 +94,7 @@ static void YGTransferLayoutOutputsRecursive(YGNodeRef root) { const int PADDING = 2; const int BORDER = 4; - int hasEdgeSetFlag = (int) obj->getFieldValue(edgeSetFlagField); + int hasEdgeSetFlag = (int)obj->getFieldValue(edgeSetFlagField); obj->setFieldValue(widthField, YGNodeLayoutGetWidth(root)); obj->setFieldValue(heightField, YGNodeLayoutGetHeight(root)); @@ -98,17 +116,25 @@ static void YGTransferLayoutOutputsRecursive(YGNodeRef root) { } if ((hasEdgeSetFlag & PADDING) == PADDING) { - obj->setFieldValue(paddingLeftField, YGNodeLayoutGetPadding(root, YGEdgeLeft)); - obj->setFieldValue(paddingTopField, YGNodeLayoutGetPadding(root, YGEdgeTop)); - obj->setFieldValue(paddingRightField, YGNodeLayoutGetPadding(root, YGEdgeRight)); - obj->setFieldValue(paddingBottomField, YGNodeLayoutGetPadding(root, YGEdgeBottom)); + obj->setFieldValue( + paddingLeftField, YGNodeLayoutGetPadding(root, YGEdgeLeft)); + obj->setFieldValue( + paddingTopField, YGNodeLayoutGetPadding(root, YGEdgeTop)); + obj->setFieldValue( + paddingRightField, YGNodeLayoutGetPadding(root, YGEdgeRight)); + obj->setFieldValue( + paddingBottomField, YGNodeLayoutGetPadding(root, YGEdgeBottom)); } if ((hasEdgeSetFlag & BORDER) == BORDER) { - obj->setFieldValue(borderLeftField, YGNodeLayoutGetBorder(root, YGEdgeLeft)); - obj->setFieldValue(borderTopField, YGNodeLayoutGetBorder(root, YGEdgeTop)); - obj->setFieldValue(borderRightField, YGNodeLayoutGetBorder(root, YGEdgeRight)); - obj->setFieldValue(borderBottomField, YGNodeLayoutGetBorder(root, YGEdgeBottom)); + obj->setFieldValue( + borderLeftField, YGNodeLayoutGetBorder(root, YGEdgeLeft)); + obj->setFieldValue( + borderTopField, YGNodeLayoutGetBorder(root, YGEdgeTop)); + obj->setFieldValue( + borderRightField, YGNodeLayoutGetBorder(root, YGEdgeRight)); + obj->setFieldValue( + borderBottomField, YGNodeLayoutGetBorder(root, YGEdgeBottom)); } obj->setFieldValue(hasNewLayoutField, true); @@ -119,7 +145,10 @@ static void YGTransferLayoutOutputsRecursive(YGNodeRef root) { YGTransferLayoutOutputsRecursive(YGNodeGetChild(root, i)); } } else { - YGLog(root, YGLogLevelError, "Java YGNode was GCed during layout calculation\n"); + YGLog( + root, + YGLogLevelError, + "Java YGNode was GCed during layout calculation\n"); } } } @@ -128,14 +157,18 @@ static void YGPrint(YGNodeRef node) { if (auto obj = YGNodeJobject(node)->lockLocal()) { cout << obj->toString() << endl; } else { - YGLog(node, YGLogLevelError, "Java YGNode was GCed during layout calculation\n"); + YGLog( + node, + YGLogLevelError, + "Java YGNode was GCed during layout calculation\n"); } } static float YGJNIBaselineFunc(YGNodeRef node, float width, float height) { if (auto obj = YGNodeJobject(node)->lockLocal()) { - static auto baselineFunc = findClassStatic("com/facebook/yoga/YogaNode") - ->getMethod("baseline"); + static auto baselineFunc = + findClassStatic("com/facebook/yoga/YogaNode") + ->getMethod("baseline"); return baselineFunc(obj, width, height); } else { return height; @@ -150,20 +183,17 @@ static inline YGConfigRef _jlong2YGConfigRef(jlong addr) { return reinterpret_cast(static_cast(addr)); } -static YGNodeRef YGJNIOnNodeClonedFunc( - YGNodeRef oldNode, - YGNodeRef owner, - int childIndex) { +static YGNodeRef +YGJNIOnNodeClonedFunc(YGNodeRef oldNode, YGNodeRef owner, int childIndex) { auto config = oldNode->getConfig(); if (!config) { return nullptr; } - static auto onNodeClonedFunc = findClassStatic("com/facebook/yoga/YogaConfig") - ->getMethod( - local_ref, - local_ref, - jint)>("cloneNode"); + static auto onNodeClonedFunc = + findClassStatic("com/facebook/yoga/YogaConfig") + ->getMethod( + local_ref, local_ref, jint)>("cloneNode"); auto context = reinterpret_cast(YGConfigGetContext(config)); auto javaConfig = context->config; @@ -174,15 +204,12 @@ static YGNodeRef YGJNIOnNodeClonedFunc( YGNodeJobject(owner)->lockLocal(), childIndex); - static auto replaceChild = findClassStatic("com/facebook/yoga/YogaNode") - ->getMethod, - jint)>("replaceChild"); + static auto replaceChild = + findClassStatic("com/facebook/yoga/YogaNode") + ->getMethod, jint)>("replaceChild"); - jlong newNodeNativePointer = replaceChild( - YGNodeJobject(owner)->lockLocal(), - newNode, - childIndex); + jlong newNodeNativePointer = + replaceChild(YGNodeJobject(owner)->lockLocal(), newNode, childIndex); return _jlong2YGNodeRef(newNodeNativePointer); } @@ -194,24 +221,30 @@ static YGSize YGJNIMeasureFunc( float height, YGMeasureMode heightMode) { if (auto obj = YGNodeJobject(node)->lockLocal()) { - static auto measureFunc = findClassStatic("com/facebook/yoga/YogaNode") - ->getMethod("measure"); + static auto measureFunc = + findClassStatic("com/facebook/yoga/YogaNode") + ->getMethod("measure"); YGTransferLayoutDirection(node, obj); - const auto measureResult = measureFunc(obj, width, widthMode, height, heightMode); + const auto measureResult = + measureFunc(obj, width, widthMode, height, heightMode); - static_assert(sizeof(measureResult) == 8, - "Expected measureResult to be 8 bytes, or two 32 bit ints"); + static_assert( + sizeof(measureResult) == 8, + "Expected measureResult to be 8 bytes, or two 32 bit ints"); int32_t wBits = 0xFFFFFFFF & (measureResult >> 32); int32_t hBits = 0xFFFFFFFF & measureResult; - const float *measuredWidth = reinterpret_cast(&wBits); - const float *measuredHeight = reinterpret_cast(&hBits); + const float* measuredWidth = reinterpret_cast(&wBits); + const float* measuredHeight = reinterpret_cast(&hBits); return YGSize{*measuredWidth, *measuredHeight}; } else { - YGLog(node, YGLogLevelError, "Java YGNode was GCed during layout calculation\n"); + YGLog( + node, + YGLogLevelError, + "Java YGNode was GCed during layout calculation\n"); return YGSize{ widthMode == YGMeasureModeUndefined ? 0 : width, heightMode == YGMeasureModeUndefined ? 0 : height, @@ -223,24 +256,28 @@ struct JYogaLogLevel : public JavaClass { static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaLogLevel;"; }; -static int YGJNILogFunc(const YGConfigRef config, - const YGNodeRef node, - YGLogLevel level, - const char *format, - va_list args) { +static int YGJNILogFunc( + const YGConfigRef config, + const YGNodeRef node, + YGLogLevel level, + const char* format, + va_list args) { int result = vsnprintf(NULL, 0, format, args); std::vector buffer(1 + result); vsnprintf(buffer.data(), buffer.size(), format, args); static auto logFunc = findClassStatic("com/facebook/yoga/YogaLogger") - ->getMethod, local_ref, jstring)>("log"); + ->getMethod, local_ref, jstring)>("log"); static auto logLevelFromInt = - JYogaLogLevel::javaClassStatic()->getStaticMethod("fromInt"); + JYogaLogLevel::javaClassStatic() + ->getStaticMethod("fromInt"); if (auto obj = YGNodeJobject(node)->lockLocal()) { - auto jlogger = reinterpret_cast *>(YGConfigGetContext(config)); + auto jlogger = + reinterpret_cast*>(YGConfigGetContext(config)); logFunc( jlogger->get(), obj, @@ -309,13 +346,19 @@ void jni_YGNodeReset(alias_ref thiz, jlong nativePointer) { void jni_YGNodePrint(alias_ref thiz, jlong nativePointer) { const YGNodeRef node = _jlong2YGNodeRef(nativePointer); - YGNodePrint(node, - (YGPrintOptions)(YGPrintOptionsStyle | YGPrintOptionsLayout | - YGPrintOptionsChildren)); + YGNodePrint( + node, + (YGPrintOptions)( + YGPrintOptionsStyle | YGPrintOptionsLayout | YGPrintOptionsChildren)); } -void jni_YGNodeInsertChild(alias_ref, jlong nativePointer, jlong childPointer, jint index) { - YGNodeInsertChild(_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), index); +void jni_YGNodeInsertChild( + alias_ref, + jlong nativePointer, + jlong childPointer, + jint index) { + YGNodeInsertChild( + _jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), index); } void jni_YGNodeInsertSharedChild( @@ -327,19 +370,25 @@ void jni_YGNodeInsertSharedChild( _jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), index); } -void jni_YGNodeRemoveChild(alias_ref, jlong nativePointer, jlong childPointer) { - YGNodeRemoveChild(_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer)); +void jni_YGNodeRemoveChild( + alias_ref, + jlong nativePointer, + jlong childPointer) { + YGNodeRemoveChild( + _jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer)); } -void jni_YGNodeCalculateLayout(alias_ref, - jlong nativePointer, - jfloat width, - jfloat height) { +void jni_YGNodeCalculateLayout( + alias_ref, + jlong nativePointer, + jfloat width, + jfloat height) { const YGNodeRef root = _jlong2YGNodeRef(nativePointer); - YGNodeCalculateLayout(root, - static_cast(width), - static_cast(height), - YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer))); + YGNodeCalculateLayout( + root, + static_cast(width), + static_cast(height), + YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer))); YGTransferLayoutOutputsRecursive(root); } @@ -357,20 +406,28 @@ jboolean jni_YGNodeIsDirty(alias_ref, jlong nativePointer) { return (jboolean)_jlong2YGNodeRef(nativePointer)->isDirty(); } -void jni_YGNodeSetHasMeasureFunc(alias_ref, jlong nativePointer, jboolean hasMeasureFunc) { +void jni_YGNodeSetHasMeasureFunc( + alias_ref, + jlong nativePointer, + jboolean hasMeasureFunc) { _jlong2YGNodeRef(nativePointer) ->setMeasureFunc(hasMeasureFunc ? YGJNIMeasureFunc : nullptr); } -void jni_YGNodeSetHasBaselineFunc(alias_ref, - jlong nativePointer, - jboolean hasBaselineFunc) { +void jni_YGNodeSetHasBaselineFunc( + alias_ref, + jlong nativePointer, + jboolean hasBaselineFunc) { _jlong2YGNodeRef(nativePointer) ->setBaseLineFunc(hasBaselineFunc ? YGJNIBaselineFunc : nullptr); } -void jni_YGNodeCopyStyle(alias_ref, jlong dstNativePointer, jlong srcNativePointer) { - YGNodeCopyStyle(_jlong2YGNodeRef(dstNativePointer), _jlong2YGNodeRef(srcNativePointer)); +void jni_YGNodeCopyStyle( + alias_ref, + jlong dstNativePointer, + jlong srcNativePointer) { + YGNodeCopyStyle( + _jlong2YGNodeRef(dstNativePointer), _jlong2YGNodeRef(srcNativePointer)); } struct JYogaValue : public JavaClass { @@ -392,67 +449,76 @@ struct JYogaValue : public JavaClass { _jlong2YGNodeRef(nativePointer), static_cast(value)); \ } -#define YG_NODE_JNI_STYLE_UNIT_PROP(name) \ - local_ref jni_YGNodeStyleGet##name(alias_ref, jlong nativePointer) { \ - return JYogaValue::create(YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer))); \ - } \ - \ - void jni_YGNodeStyleSet##name(alias_ref, jlong nativePointer, jfloat value) { \ - YGNodeStyleSet##name(_jlong2YGNodeRef(nativePointer), static_cast(value)); \ - } \ - \ - void jni_YGNodeStyleSet##name##Percent(alias_ref, jlong nativePointer, jfloat value) { \ - YGNodeStyleSet##name##Percent(_jlong2YGNodeRef(nativePointer), static_cast(value)); \ +#define YG_NODE_JNI_STYLE_UNIT_PROP(name) \ + local_ref jni_YGNodeStyleGet##name( \ + alias_ref, jlong nativePointer) { \ + return JYogaValue::create( \ + YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer))); \ + } \ + \ + void jni_YGNodeStyleSet##name( \ + alias_ref, jlong nativePointer, jfloat value) { \ + YGNodeStyleSet##name( \ + _jlong2YGNodeRef(nativePointer), static_cast(value)); \ + } \ + \ + void jni_YGNodeStyleSet##name##Percent( \ + alias_ref, jlong nativePointer, jfloat value) { \ + YGNodeStyleSet##name##Percent( \ + _jlong2YGNodeRef(nativePointer), static_cast(value)); \ } -#define YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(name) \ - YG_NODE_JNI_STYLE_UNIT_PROP(name) \ - void jni_YGNodeStyleSet##name##Auto(alias_ref, jlong nativePointer) { \ - YGNodeStyleSet##name##Auto(_jlong2YGNodeRef(nativePointer)); \ +#define YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(name) \ + YG_NODE_JNI_STYLE_UNIT_PROP(name) \ + void jni_YGNodeStyleSet##name##Auto( \ + alias_ref, jlong nativePointer) { \ + YGNodeStyleSet##name##Auto(_jlong2YGNodeRef(nativePointer)); \ } -#define YG_NODE_JNI_STYLE_EDGE_PROP(javatype, type, name) \ - javatype jni_YGNodeStyleGet##name(alias_ref, jlong nativePointer, jint edge) { \ - return (javatype) YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer), \ - static_cast(edge)); \ - } \ - \ - void jni_YGNodeStyleSet##name(alias_ref, \ - jlong nativePointer, \ - jint edge, \ - javatype value) { \ - YGNodeStyleSet##name(_jlong2YGNodeRef(nativePointer), \ - static_cast(edge), \ - static_cast(value)); \ +#define YG_NODE_JNI_STYLE_EDGE_PROP(javatype, type, name) \ + javatype jni_YGNodeStyleGet##name( \ + alias_ref, jlong nativePointer, jint edge) { \ + return (javatype)YGNodeStyleGet##name( \ + _jlong2YGNodeRef(nativePointer), static_cast(edge)); \ + } \ + \ + void jni_YGNodeStyleSet##name( \ + alias_ref, jlong nativePointer, jint edge, javatype value) { \ + YGNodeStyleSet##name( \ + _jlong2YGNodeRef(nativePointer), \ + static_cast(edge), \ + static_cast(value)); \ } -#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \ - local_ref jni_YGNodeStyleGet##name(alias_ref, \ - jlong nativePointer, \ - jint edge) { \ - return JYogaValue::create( \ - YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer), static_cast(edge))); \ - } \ - \ - void jni_YGNodeStyleSet##name(alias_ref, jlong nativePointer, jint edge, jfloat value) { \ - YGNodeStyleSet##name(_jlong2YGNodeRef(nativePointer), \ - static_cast(edge), \ - static_cast(value)); \ - } \ - \ - void jni_YGNodeStyleSet##name##Percent(alias_ref, \ - jlong nativePointer, \ - jint edge, \ - jfloat value) { \ - YGNodeStyleSet##name##Percent(_jlong2YGNodeRef(nativePointer), \ - static_cast(edge), \ - static_cast(value)); \ +#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \ + local_ref jni_YGNodeStyleGet##name( \ + alias_ref, jlong nativePointer, jint edge) { \ + return JYogaValue::create(YGNodeStyleGet##name( \ + _jlong2YGNodeRef(nativePointer), static_cast(edge))); \ + } \ + \ + void jni_YGNodeStyleSet##name( \ + alias_ref, jlong nativePointer, jint edge, jfloat value) { \ + YGNodeStyleSet##name( \ + _jlong2YGNodeRef(nativePointer), \ + static_cast(edge), \ + static_cast(value)); \ + } \ + \ + void jni_YGNodeStyleSet##name##Percent( \ + alias_ref, jlong nativePointer, jint edge, jfloat value) { \ + YGNodeStyleSet##name##Percent( \ + _jlong2YGNodeRef(nativePointer), \ + static_cast(edge), \ + static_cast(value)); \ } -#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(name) \ - YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \ - void jni_YGNodeStyleSet##name##Auto(alias_ref, jlong nativePointer, jint edge) { \ - YGNodeStyleSet##name##Auto(_jlong2YGNodeRef(nativePointer), static_cast(edge)); \ +#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(name) \ + YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \ + void jni_YGNodeStyleSet##name##Auto( \ + alias_ref, jlong nativePointer, jint edge) { \ + YGNodeStyleSet##name##Auto( \ + _jlong2YGNodeRef(nativePointer), static_cast(edge)); \ } YG_NODE_JNI_STYLE_PROP(jint, YGDirection, Direction); @@ -466,8 +532,12 @@ YG_NODE_JNI_STYLE_PROP(jint, YGWrap, FlexWrap); YG_NODE_JNI_STYLE_PROP(jint, YGOverflow, Overflow); YG_NODE_JNI_STYLE_PROP(jint, YGDisplay, Display); -void jni_YGNodeStyleSetFlex(alias_ref, jlong nativePointer, jfloat value) { - YGNodeStyleSetFlex(_jlong2YGNodeRef(nativePointer), static_cast(value)); +void jni_YGNodeStyleSetFlex( + alias_ref, + jlong nativePointer, + jfloat value) { + YGNodeStyleSetFlex( + _jlong2YGNodeRef(nativePointer), static_cast(value)); } YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow); YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink); @@ -501,14 +571,14 @@ void jni_YGConfigFree(alias_ref, jlong nativePointer) { YGConfigFree(config); } -void jni_YGConfigSetExperimentalFeatureEnabled(alias_ref, - jlong nativePointer, - jint feature, - jboolean enabled) { +void jni_YGConfigSetExperimentalFeatureEnabled( + alias_ref, + jlong nativePointer, + jint feature, + jboolean enabled) { const YGConfigRef config = _jlong2YGConfigRef(nativePointer); - YGConfigSetExperimentalFeatureEnabled(config, - static_cast(feature), - enabled); + YGConfigSetExperimentalFeatureEnabled( + config, static_cast(feature), enabled); } void jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour( @@ -519,23 +589,26 @@ void jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour( YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(config, enabled); } -void jni_YGConfigSetUseWebDefaults(alias_ref, - jlong nativePointer, - jboolean useWebDefaults) { +void jni_YGConfigSetUseWebDefaults( + alias_ref, + jlong nativePointer, + jboolean useWebDefaults) { const YGConfigRef config = _jlong2YGConfigRef(nativePointer); YGConfigSetUseWebDefaults(config, useWebDefaults); } -void jni_YGConfigSetPointScaleFactor(alias_ref, - jlong nativePointer, - jfloat pixelsInPoint) { +void jni_YGConfigSetPointScaleFactor( + alias_ref, + jlong nativePointer, + jfloat pixelsInPoint) { const YGConfigRef config = _jlong2YGConfigRef(nativePointer); YGConfigSetPointScaleFactor(config, pixelsInPoint); } -void jni_YGConfigSetUseLegacyStretchBehaviour(alias_ref, - jlong nativePointer, - jboolean useLegacyStretchBehaviour) { +void jni_YGConfigSetUseLegacyStretchBehaviour( + alias_ref, + jlong nativePointer, + jboolean useLegacyStretchBehaviour) { const YGConfigRef config = _jlong2YGConfigRef(nativePointer); YGConfigSetUseLegacyStretchBehaviour(config, useLegacyStretchBehaviour); } @@ -592,7 +665,7 @@ jint jni_YGNodeGetInstanceCount(alias_ref clazz) { #define YGMakeNativeMethod(name) makeNativeMethod(#name, name) -jint JNI_OnLoad(JavaVM *vm, void *) { +jint JNI_OnLoad(JavaVM* vm, void*) { return initialize(vm, [] { registerNatives( "com/facebook/yoga/YogaNode",