Remove useVanillaJNI flag and usage of fbjni in yoga build

Summary:
## Changelog:

[General] [Yoga] - Use vanilla jni instead of fbjni for all the jni communication

Reviewed By: astreet

Differential Revision: D17808005

fbshipit-source-id: 5e9a1ed73978f519c71c248774a28e5a294e7c7f
This commit is contained in:
Sidharth Guglani
2019-11-13 15:13:02 -08:00
committed by Facebook Github Bot
parent 5960dd888d
commit f99da09716
18 changed files with 125 additions and 1278 deletions

View File

@@ -38,8 +38,4 @@ public abstract class YogaConfig {
public abstract YogaLogger getLogger();
abstract long getNativePointer();
public abstract void setUseVanillaJNI(boolean useVanillaJNI);
public abstract boolean useVanillaJNI();
}

View File

@@ -11,8 +11,4 @@ public abstract class YogaConfigFactory {
public static YogaConfig create() {
return new YogaConfigJNIFinalizer();
}
public static YogaConfig create(boolean useVanillaJNI) {
return new YogaConfigJNIFinalizer(useVanillaJNI);
}
}

View File

@@ -11,7 +11,6 @@ public abstract class YogaConfigJNIBase extends YogaConfig {
long mNativePointer;
private YogaLogger mLogger;
protected boolean useVanillaJNI = false;
private YogaConfigJNIBase(long nativePointer) {
if (nativePointer == 0) {
@@ -21,40 +20,27 @@ public abstract class YogaConfigJNIBase extends YogaConfig {
}
YogaConfigJNIBase() {
this(YogaNative.jni_YGConfigNew());
this(YogaNative.jni_YGConfigNewJNI());
}
YogaConfigJNIBase(boolean useVanillaJNI) {
this(useVanillaJNI ? YogaNative.jni_YGConfigNewJNI() : YogaNative.jni_YGConfigNew());
this.useVanillaJNI = useVanillaJNI;
this(YogaNative.jni_YGConfigNewJNI());
}
public void setExperimentalFeatureEnabled(YogaExperimentalFeature feature, boolean enabled) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetExperimentalFeatureEnabledJNI(mNativePointer, feature.intValue(), enabled);
else
YogaNative.jni_YGConfigSetExperimentalFeatureEnabled(mNativePointer, feature.intValue(), enabled);
YogaNative.jni_YGConfigSetExperimentalFeatureEnabledJNI(mNativePointer, feature.intValue(), enabled);
}
public void setUseWebDefaults(boolean useWebDefaults) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetUseWebDefaultsJNI(mNativePointer, useWebDefaults);
else
YogaNative.jni_YGConfigSetUseWebDefaults(mNativePointer, useWebDefaults);
YogaNative.jni_YGConfigSetUseWebDefaultsJNI(mNativePointer, useWebDefaults);
}
public void setPrintTreeFlag(boolean enable) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetPrintTreeFlagJNI(mNativePointer, enable);
else
YogaNative.jni_YGConfigSetPrintTreeFlag(mNativePointer, enable);
YogaNative.jni_YGConfigSetPrintTreeFlagJNI(mNativePointer, enable);
}
public void setPointScaleFactor(float pixelsInPoint) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetPointScaleFactorJNI(mNativePointer, pixelsInPoint);
else
YogaNative.jni_YGConfigSetPointScaleFactor(mNativePointer, pixelsInPoint);
YogaNative.jni_YGConfigSetPointScaleFactorJNI(mNativePointer, pixelsInPoint);
}
/**
@@ -63,10 +49,7 @@ public abstract class YogaConfigJNIBase extends YogaConfig {
* Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour.
*/
public void setUseLegacyStretchBehaviour(boolean useLegacyStretchBehaviour) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetUseLegacyStretchBehaviourJNI(mNativePointer, useLegacyStretchBehaviour);
else
YogaNative.jni_YGConfigSetUseLegacyStretchBehaviour(mNativePointer, useLegacyStretchBehaviour);
YogaNative.jni_YGConfigSetUseLegacyStretchBehaviourJNI(mNativePointer, useLegacyStretchBehaviour);
}
/**
@@ -76,20 +59,13 @@ public abstract class YogaConfigJNIBase extends YogaConfig {
*/
public void setShouldDiffLayoutWithoutLegacyStretchBehaviour(
boolean shouldDiffLayoutWithoutLegacyStretchBehaviour) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviourJNI(
mNativePointer, shouldDiffLayoutWithoutLegacyStretchBehaviour);
else
YogaNative.jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(
mNativePointer, shouldDiffLayoutWithoutLegacyStretchBehaviour);
}
public void setLogger(YogaLogger logger) {
mLogger = logger;
if (useVanillaJNI)
YogaNative.jni_YGConfigSetLoggerJNI(mNativePointer, logger);
else
YogaNative.jni_YGConfigSetLogger(mNativePointer, logger);
YogaNative.jni_YGConfigSetLoggerJNI(mNativePointer, logger);
}
public YogaLogger getLogger() {
@@ -99,14 +75,4 @@ public abstract class YogaConfigJNIBase extends YogaConfig {
long getNativePointer() {
return mNativePointer;
}
@Override
public void setUseVanillaJNI(boolean useVanillaJNI) {
this.useVanillaJNI = useVanillaJNI;
}
@Override
public boolean useVanillaJNI() {
return this.useVanillaJNI;
}
}

View File

@@ -12,10 +12,6 @@ public class YogaConfigJNIFinalizer extends YogaConfigJNIBase {
super();
}
public YogaConfigJNIFinalizer(boolean useVanillaJNI) {
super(useVanillaJNI);
}
@Override
protected void finalize() throws Throwable {
try {
@@ -29,10 +25,7 @@ public class YogaConfigJNIFinalizer extends YogaConfigJNIBase {
if (mNativePointer != 0) {
long nativePointer = mNativePointer;
mNativePointer = 0;
if (useVanillaJNI)
YogaNative.jni_YGConfigFreeJNI(nativePointer);
else
YogaNative.jni_YGConfigFree(nativePointer);
YogaNative.jni_YGConfigFreeJNI(nativePointer);
}
}
}

View File

@@ -15,105 +15,7 @@ public class YogaNative {
static {
SoLoader.loadLibrary("yoga");
}
// YGConfig related
static native long jni_YGConfigNew();
static native void jni_YGConfigFree(long nativePointer);
static native void jni_YGConfigSetExperimentalFeatureEnabled(long nativePointer, int feature, boolean enabled);
static native void jni_YGConfigSetUseWebDefaults(long nativePointer, boolean useWebDefaults);
static native void jni_YGConfigSetPrintTreeFlag(long nativePointer, boolean enable);
static native void jni_YGConfigSetPointScaleFactor(long nativePointer, float pixelsInPoint);
static native void jni_YGConfigSetUseLegacyStretchBehaviour(long nativePointer, boolean useLegacyStretchBehaviour);
static native void jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(long nativePointer, boolean shouldDiffLayoutWithoutLegacyStretchBehaviour);
static native void jni_YGConfigSetLogger(long nativePointer, Object logger);
// YGNode related
static native long jni_YGNodeNew();
static native long jni_YGNodeNewWithConfig(long configPointer);
static native void jni_YGNodeFree(long nativePointer);
static native void jni_YGNodeReset(long nativePointer);
static native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
static native void jni_YGNodeSetIsReferenceBaseline(long nativePointer, boolean isReferenceBaseline);
static native boolean jni_YGNodeIsReferenceBaseline(long nativePointer);
static native void jni_YGNodeClearChildren(long nativePointer);
static native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
static native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height, long[] nativePointers, YogaNodeJNIBase[] nodes);
static native void jni_YGNodeMarkDirty(long nativePointer);
static native void jni_YGNodeMarkDirtyAndPropogateToDescendants(long nativePointer);
static native boolean jni_YGNodeIsDirty(long nativePointer);
static native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
static native int jni_YGNodeStyleGetDirection(long nativePointer);
static native void jni_YGNodeStyleSetDirection(long nativePointer, int direction);
static native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
static native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
static native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
static native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
static native int jni_YGNodeStyleGetAlignItems(long nativePointer);
static native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems);
static native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
static native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
static native int jni_YGNodeStyleGetAlignContent(long nativePointer);
static native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent);
static native int jni_YGNodeStyleGetPositionType(long nativePointer);
static native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType);
static native int jni_YGNodeStyleGetFlexWrap(long nativePointer);
static native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType);
static native int jni_YGNodeStyleGetOverflow(long nativePointer);
static native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow);
static native int jni_YGNodeStyleGetDisplay(long nativePointer);
static native void jni_YGNodeStyleSetDisplay(long nativePointer, int display);
static native float jni_YGNodeStyleGetFlex(long nativePointer);
static native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
static native float jni_YGNodeStyleGetFlexGrow(long nativePointer);
static native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
static native float jni_YGNodeStyleGetFlexShrink(long nativePointer);
static native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
static native long jni_YGNodeStyleGetFlexBasis(long nativePointer);
static native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
static native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent);
static native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer);
static native long jni_YGNodeStyleGetMargin(long nativePointer, int edge);
static native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
static native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent);
static native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge);
static native long jni_YGNodeStyleGetPadding(long nativePointer, int edge);
static native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
static native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent);
static native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
static native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border);
static native long jni_YGNodeStyleGetPosition(long nativePointer, int edge);
static native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
static native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent);
static native long jni_YGNodeStyleGetWidth(long nativePointer);
static native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
static native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent);
static native void jni_YGNodeStyleSetWidthAuto(long nativePointer);
static native long jni_YGNodeStyleGetHeight(long nativePointer);
static native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
static native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent);
static native void jni_YGNodeStyleSetHeightAuto(long nativePointer);
static native long jni_YGNodeStyleGetMinWidth(long nativePointer);
static native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
static native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent);
static native long jni_YGNodeStyleGetMinHeight(long nativePointer);
static native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
static native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent);
static native long jni_YGNodeStyleGetMaxWidth(long nativePointer);
static native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
static native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent);
static native long jni_YGNodeStyleGetMaxHeight(long nativePointer);
static native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
static native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent);
static native float jni_YGNodeStyleGetAspectRatio(long nativePointer);
static native void jni_YGNodeStyleSetAspectRatio(long nativePointer, float aspectRatio);
static native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
static native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
static native void jni_YGNodePrint(long nativePointer);
static native void jni_YGNodeSetStyleInputs(long nativePointer, float[] styleInputsArray, int size);
static native long jni_YGNodeClone(long nativePointer);
// JNI methods that use Vanilla JNI
// YGConfig related
static native long jni_YGConfigNewJNI();

View File

@@ -12,10 +12,6 @@ public abstract class YogaNodeFactory {
return new YogaNodeJNIFinalizer();
}
public static YogaNode create(boolean useVanillaJNI) {
return new YogaNodeJNIFinalizer(useVanillaJNI);
}
public static YogaNode create(YogaConfig config) {
return new YogaNodeJNIFinalizer(config);
}

View File

@@ -47,8 +47,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
private boolean mHasNewLayout = true;
protected boolean useVanillaJNI = false;
private YogaNodeJNIBase(long nativePointer) {
if (nativePointer == 0) {
throw new IllegalStateException("Failed to allocate native memory");
@@ -57,17 +55,11 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
}
YogaNodeJNIBase() {
this(YogaNative.jni_YGNodeNew());
}
YogaNodeJNIBase(boolean useVanillaJNI) {
this(useVanillaJNI ? YogaNative.jni_YGNodeNewJNI() : YogaNative.jni_YGNodeNew());
this.useVanillaJNI = useVanillaJNI;
this(YogaNative.jni_YGNodeNewJNI());
}
YogaNodeJNIBase(YogaConfig config) {
this(config.useVanillaJNI() ? YogaNative.jni_YGNodeNewWithConfigJNI(((YogaConfigJNIBase)config).mNativePointer) : YogaNative.jni_YGNodeNewWithConfig(((YogaConfigJNIBase)config).mNativePointer));
this.useVanillaJNI = config.useVanillaJNI();
this(YogaNative.jni_YGNodeNewWithConfigJNI(((YogaConfigJNIBase)config).mNativePointer));
}
public void reset() {
@@ -78,10 +70,7 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
mHasNewLayout = true;
mLayoutDirection = 0;
if (useVanillaJNI)
YogaNative.jni_YGNodeResetJNI(mNativePointer);
else
YogaNative.jni_YGNodeReset(mNativePointer);
YogaNative.jni_YGNodeResetJNI(mNativePointer);
}
public int getChildCount() {
@@ -106,28 +95,22 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
}
mChildren.add(i, child);
child.mOwner = this;
if (useVanillaJNI)
YogaNative.jni_YGNodeInsertChildJNI(mNativePointer, child.mNativePointer, i);
else
YogaNative.jni_YGNodeInsertChild(mNativePointer, child.mNativePointer, i);
YogaNative.jni_YGNodeInsertChildJNI(mNativePointer, child.mNativePointer, i);
}
public void setIsReferenceBaseline(boolean isReferenceBaseline) {
if (useVanillaJNI)
YogaNative.jni_YGNodeSetIsReferenceBaselineJNI(mNativePointer, isReferenceBaseline);
else
YogaNative.jni_YGNodeSetIsReferenceBaseline(mNativePointer, isReferenceBaseline);
YogaNative.jni_YGNodeSetIsReferenceBaselineJNI(mNativePointer, isReferenceBaseline);
}
public boolean isReferenceBaseline() {
return useVanillaJNI ? YogaNative.jni_YGNodeIsReferenceBaselineJNI(mNativePointer) : YogaNative.jni_YGNodeIsReferenceBaseline(mNativePointer);
return YogaNative.jni_YGNodeIsReferenceBaselineJNI(mNativePointer);
}
@Override
public YogaNodeJNIBase cloneWithoutChildren() {
try {
YogaNodeJNIBase clonedYogaNode = (YogaNodeJNIBase) super.clone();
long clonedNativePointer = useVanillaJNI ? YogaNative.jni_YGNodeCloneJNI(mNativePointer) : YogaNative.jni_YGNodeClone(mNativePointer);;
long clonedNativePointer = YogaNative.jni_YGNodeCloneJNI(mNativePointer);
clonedYogaNode.mOwner = null;
clonedYogaNode.mNativePointer = clonedNativePointer;
clonedYogaNode.clearChildren();
@@ -140,10 +123,7 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
private void clearChildren() {
mChildren = null;
if (useVanillaJNI)
YogaNative.jni_YGNodeClearChildrenJNI(mNativePointer);
else
YogaNative.jni_YGNodeClearChildren(mNativePointer);
YogaNative.jni_YGNodeClearChildrenJNI(mNativePointer);
}
public YogaNodeJNIBase removeChildAt(int i) {
@@ -153,10 +133,7 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
}
final YogaNodeJNIBase child = mChildren.remove(i);
child.mOwner = null;
if (useVanillaJNI)
YogaNative.jni_YGNodeRemoveChildJNI(mNativePointer, child.mNativePointer);
else
YogaNative.jni_YGNodeRemoveChild(mNativePointer, child.mNativePointer);
YogaNative.jni_YGNodeRemoveChildJNI(mNativePointer, child.mNativePointer);
return child;
}
@@ -203,418 +180,285 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
nativePointers[i] = nodes[i].mNativePointer;
}
if (useVanillaJNI)
YogaNative.jni_YGNodeCalculateLayoutJNI(mNativePointer, width, height, nativePointers, nodes);
else
YogaNative.jni_YGNodeCalculateLayout(mNativePointer, width, height, nativePointers, nodes);
YogaNative.jni_YGNodeCalculateLayoutJNI(mNativePointer, width, height, nativePointers, nodes);
}
public void dirty() {
if (useVanillaJNI)
YogaNative.jni_YGNodeMarkDirtyJNI(mNativePointer);
else
YogaNative.jni_YGNodeMarkDirty(mNativePointer);
YogaNative.jni_YGNodeMarkDirtyJNI(mNativePointer);
}
public void dirtyAllDescendants() {
if (useVanillaJNI)
YogaNative.jni_YGNodeMarkDirtyAndPropogateToDescendantsJNI(mNativePointer);
else
YogaNative.jni_YGNodeMarkDirtyAndPropogateToDescendants(mNativePointer);
YogaNative.jni_YGNodeMarkDirtyAndPropogateToDescendantsJNI(mNativePointer);
}
public boolean isDirty() {
return useVanillaJNI ? YogaNative.jni_YGNodeIsDirtyJNI(mNativePointer) : YogaNative.jni_YGNodeIsDirty(mNativePointer);
return YogaNative.jni_YGNodeIsDirtyJNI(mNativePointer);
}
@Override
public void copyStyle(YogaNode srcNode) {
if (useVanillaJNI)
YogaNative.jni_YGNodeCopyStyleJNI(mNativePointer, ((YogaNodeJNIBase) srcNode).mNativePointer);
else
YogaNative.jni_YGNodeCopyStyle(mNativePointer, ((YogaNodeJNIBase) srcNode).mNativePointer);
YogaNative.jni_YGNodeCopyStyleJNI(mNativePointer, ((YogaNodeJNIBase) srcNode).mNativePointer);
}
public YogaDirection getStyleDirection() {
return YogaDirection.fromInt(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetDirectionJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetDirection(mNativePointer));
return YogaDirection.fromInt(YogaNative.jni_YGNodeStyleGetDirectionJNI(mNativePointer));
}
public void setDirection(YogaDirection direction) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetDirectionJNI(mNativePointer, direction.intValue());
else
YogaNative.jni_YGNodeStyleSetDirection(mNativePointer, direction.intValue());
YogaNative.jni_YGNodeStyleSetDirectionJNI(mNativePointer, direction.intValue());
}
public YogaFlexDirection getFlexDirection() {
return YogaFlexDirection.fromInt(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetFlexDirectionJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetFlexDirection(mNativePointer));
return YogaFlexDirection.fromInt(YogaNative.jni_YGNodeStyleGetFlexDirectionJNI(mNativePointer));
}
public void setFlexDirection(YogaFlexDirection flexDirection) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetFlexDirectionJNI(mNativePointer, flexDirection.intValue());
else
YogaNative.jni_YGNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
YogaNative.jni_YGNodeStyleSetFlexDirectionJNI(mNativePointer, flexDirection.intValue());
}
public YogaJustify getJustifyContent() {
return YogaJustify.fromInt(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetJustifyContentJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetJustifyContent(mNativePointer));
return YogaJustify.fromInt(YogaNative.jni_YGNodeStyleGetJustifyContentJNI(mNativePointer));
}
public void setJustifyContent(YogaJustify justifyContent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetJustifyContentJNI(mNativePointer, justifyContent.intValue());
else
YogaNative.jni_YGNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
YogaNative.jni_YGNodeStyleSetJustifyContentJNI(mNativePointer, justifyContent.intValue());
}
public YogaAlign getAlignItems() {
return YogaAlign.fromInt(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetAlignItemsJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetAlignItems(mNativePointer));
return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignItemsJNI(mNativePointer));
}
public void setAlignItems(YogaAlign alignItems) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetAlignItemsJNI(mNativePointer, alignItems.intValue());
else
YogaNative.jni_YGNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
YogaNative.jni_YGNodeStyleSetAlignItemsJNI(mNativePointer, alignItems.intValue());
}
public YogaAlign getAlignSelf() {
return YogaAlign.fromInt(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetAlignSelfJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetAlignSelf(mNativePointer));
return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignSelfJNI(mNativePointer));
}
public void setAlignSelf(YogaAlign alignSelf) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetAlignSelfJNI(mNativePointer, alignSelf.intValue());
else
YogaNative.jni_YGNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
YogaNative.jni_YGNodeStyleSetAlignSelfJNI(mNativePointer, alignSelf.intValue());
}
public YogaAlign getAlignContent() {
return YogaAlign.fromInt(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetAlignContentJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetAlignContent(mNativePointer));
return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignContentJNI(mNativePointer));
}
public void setAlignContent(YogaAlign alignContent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetAlignContentJNI(mNativePointer, alignContent.intValue());
else
YogaNative.jni_YGNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
YogaNative.jni_YGNodeStyleSetAlignContentJNI(mNativePointer, alignContent.intValue());
}
public YogaPositionType getPositionType() {
return YogaPositionType.fromInt(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetPositionTypeJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetPositionType(mNativePointer));
return YogaPositionType.fromInt(YogaNative.jni_YGNodeStyleGetPositionTypeJNI(mNativePointer));
}
public void setPositionType(YogaPositionType positionType) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetPositionTypeJNI(mNativePointer, positionType.intValue());
else
YogaNative.jni_YGNodeStyleSetPositionType(mNativePointer, positionType.intValue());
YogaNative.jni_YGNodeStyleSetPositionTypeJNI(mNativePointer, positionType.intValue());
}
public YogaWrap getWrap() {
return YogaWrap.fromInt(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetFlexWrapJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetFlexWrap(mNativePointer));
return YogaWrap.fromInt(YogaNative.jni_YGNodeStyleGetFlexWrapJNI(mNativePointer));
}
public void setWrap(YogaWrap flexWrap) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetFlexWrapJNI(mNativePointer, flexWrap.intValue());
else
YogaNative.jni_YGNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
YogaNative.jni_YGNodeStyleSetFlexWrapJNI(mNativePointer, flexWrap.intValue());
}
public YogaOverflow getOverflow() {
return YogaOverflow.fromInt(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetOverflowJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetOverflow(mNativePointer));
return YogaOverflow.fromInt(YogaNative.jni_YGNodeStyleGetOverflowJNI(mNativePointer));
}
public void setOverflow(YogaOverflow overflow) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetOverflowJNI(mNativePointer, overflow.intValue());
else
YogaNative.jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
YogaNative.jni_YGNodeStyleSetOverflowJNI(mNativePointer, overflow.intValue());
}
public YogaDisplay getDisplay() {
return YogaDisplay.fromInt(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetDisplayJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetDisplay(mNativePointer));
return YogaDisplay.fromInt(YogaNative.jni_YGNodeStyleGetDisplayJNI(mNativePointer));
}
public void setDisplay(YogaDisplay display) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetDisplayJNI(mNativePointer, display.intValue());
else
YogaNative.jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue());
YogaNative.jni_YGNodeStyleSetDisplayJNI(mNativePointer, display.intValue());
}
public float getFlex() {
return useVanillaJNI ? YogaNative.jni_YGNodeStyleGetFlexJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetFlex(mNativePointer);
return YogaNative.jni_YGNodeStyleGetFlexJNI(mNativePointer);
}
public void setFlex(float flex) {
if (useVanillaJNI) {
YogaNative.jni_YGNodeStyleSetFlexJNI(mNativePointer, flex);
} else {
YogaNative.jni_YGNodeStyleSetFlex(mNativePointer, flex);
}
YogaNative.jni_YGNodeStyleSetFlexJNI(mNativePointer, flex);
}
public float getFlexGrow() {
return useVanillaJNI ? YogaNative.jni_YGNodeStyleGetFlexGrowJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetFlexGrow(mNativePointer);
return YogaNative.jni_YGNodeStyleGetFlexGrowJNI(mNativePointer);
}
public void setFlexGrow(float flexGrow) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetFlexGrowJNI(mNativePointer, flexGrow);
else
YogaNative.jni_YGNodeStyleSetFlexGrow(mNativePointer, flexGrow);
YogaNative.jni_YGNodeStyleSetFlexGrowJNI(mNativePointer, flexGrow);
}
public float getFlexShrink() {
return useVanillaJNI ? YogaNative.jni_YGNodeStyleGetFlexShrinkJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetFlexShrink(mNativePointer);
return YogaNative.jni_YGNodeStyleGetFlexShrinkJNI(mNativePointer);
}
public void setFlexShrink(float flexShrink) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetFlexShrinkJNI(mNativePointer, flexShrink);
else
YogaNative.jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink);
YogaNative.jni_YGNodeStyleSetFlexShrinkJNI(mNativePointer, flexShrink);
}
public YogaValue getFlexBasis() {
return valueFromLong(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetFlexBasisJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetFlexBasis(mNativePointer));
return valueFromLong(YogaNative.jni_YGNodeStyleGetFlexBasisJNI(mNativePointer));
}
public void setFlexBasis(float flexBasis) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetFlexBasisJNI(mNativePointer, flexBasis);
else
YogaNative.jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis);
YogaNative.jni_YGNodeStyleSetFlexBasisJNI(mNativePointer, flexBasis);
}
public void setFlexBasisPercent(float percent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetFlexBasisPercentJNI(mNativePointer, percent);
else
YogaNative.jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent);
YogaNative.jni_YGNodeStyleSetFlexBasisPercentJNI(mNativePointer, percent);
}
public void setFlexBasisAuto() {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetFlexBasisAutoJNI(mNativePointer);
else
YogaNative.jni_YGNodeStyleSetFlexBasisAuto(mNativePointer);
YogaNative.jni_YGNodeStyleSetFlexBasisAutoJNI(mNativePointer);
}
public YogaValue getMargin(YogaEdge edge) {
return valueFromLong(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetMarginJNI(mNativePointer, edge.intValue()) : YogaNative.jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue()));
return valueFromLong(YogaNative.jni_YGNodeStyleGetMarginJNI(mNativePointer, edge.intValue()));
}
public void setMargin(YogaEdge edge, float margin) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetMarginJNI(mNativePointer, edge.intValue(), margin);
else
YogaNative.jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
YogaNative.jni_YGNodeStyleSetMarginJNI(mNativePointer, edge.intValue(), margin);
}
public void setMarginPercent(YogaEdge edge, float percent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetMarginPercentJNI(mNativePointer, edge.intValue(), percent);
else
YogaNative.jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent);
YogaNative.jni_YGNodeStyleSetMarginPercentJNI(mNativePointer, edge.intValue(), percent);
}
public void setMarginAuto(YogaEdge edge) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetMarginAutoJNI(mNativePointer, edge.intValue());
else
YogaNative.jni_YGNodeStyleSetMarginAuto(mNativePointer, edge.intValue());
YogaNative.jni_YGNodeStyleSetMarginAutoJNI(mNativePointer, edge.intValue());
}
public YogaValue getPadding(YogaEdge edge) {
return valueFromLong(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetPaddingJNI(mNativePointer, edge.intValue()) : YogaNative.jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue()));
return valueFromLong(YogaNative.jni_YGNodeStyleGetPaddingJNI(mNativePointer, edge.intValue()));
}
public void setPadding(YogaEdge edge, float padding) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetPaddingJNI(mNativePointer, edge.intValue(), padding);
else
YogaNative.jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
YogaNative.jni_YGNodeStyleSetPaddingJNI(mNativePointer, edge.intValue(), padding);
}
public void setPaddingPercent(YogaEdge edge, float percent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetPaddingPercentJNI(mNativePointer, edge.intValue(), percent);
else
YogaNative.jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent);
YogaNative.jni_YGNodeStyleSetPaddingPercentJNI(mNativePointer, edge.intValue(), percent);
}
public float getBorder(YogaEdge edge) {
return useVanillaJNI ? YogaNative.jni_YGNodeStyleGetBorderJNI(mNativePointer, edge.intValue()) : YogaNative.jni_YGNodeStyleGetBorder(mNativePointer, edge.intValue());
return YogaNative.jni_YGNodeStyleGetBorderJNI(mNativePointer, edge.intValue());
}
public void setBorder(YogaEdge edge, float border) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetBorderJNI(mNativePointer, edge.intValue(), border);
else
YogaNative.jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
YogaNative.jni_YGNodeStyleSetBorderJNI(mNativePointer, edge.intValue(), border);
}
public YogaValue getPosition(YogaEdge edge) {
return valueFromLong(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetPositionJNI(mNativePointer, edge.intValue()) : YogaNative.jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue()));
return valueFromLong(YogaNative.jni_YGNodeStyleGetPositionJNI(mNativePointer, edge.intValue()));
}
public void setPosition(YogaEdge edge, float position) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetPositionJNI(mNativePointer, edge.intValue(), position);
else
YogaNative.jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
YogaNative.jni_YGNodeStyleSetPositionJNI(mNativePointer, edge.intValue(), position);
}
public void setPositionPercent(YogaEdge edge, float percent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetPositionPercentJNI(mNativePointer, edge.intValue(), percent);
else
YogaNative.jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent);
YogaNative.jni_YGNodeStyleSetPositionPercentJNI(mNativePointer, edge.intValue(), percent);
}
public YogaValue getWidth() {
return valueFromLong(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetWidthJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetWidth(mNativePointer));
return valueFromLong(YogaNative.jni_YGNodeStyleGetWidthJNI(mNativePointer));
}
public void setWidth(float width) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetWidthJNI(mNativePointer, width);
else
YogaNative.jni_YGNodeStyleSetWidth(mNativePointer, width);
YogaNative.jni_YGNodeStyleSetWidthJNI(mNativePointer, width);
}
public void setWidthPercent(float percent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetWidthPercentJNI(mNativePointer, percent);
else
YogaNative.jni_YGNodeStyleSetWidthPercent(mNativePointer, percent);
YogaNative.jni_YGNodeStyleSetWidthPercentJNI(mNativePointer, percent);
}
public void setWidthAuto() {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetWidthAutoJNI(mNativePointer);
else
YogaNative.jni_YGNodeStyleSetWidthAuto(mNativePointer);
YogaNative.jni_YGNodeStyleSetWidthAutoJNI(mNativePointer);
}
public YogaValue getHeight() {
return valueFromLong(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetHeightJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetHeight(mNativePointer));
return valueFromLong(YogaNative.jni_YGNodeStyleGetHeightJNI(mNativePointer));
}
public void setHeight(float height) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetHeightJNI(mNativePointer, height);
else
YogaNative.jni_YGNodeStyleSetHeight(mNativePointer, height);
YogaNative.jni_YGNodeStyleSetHeightJNI(mNativePointer, height);
}
public void setHeightPercent(float percent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetHeightPercentJNI(mNativePointer, percent);
else
YogaNative.jni_YGNodeStyleSetHeightPercent(mNativePointer, percent);
YogaNative.jni_YGNodeStyleSetHeightPercentJNI(mNativePointer, percent);
}
public void setHeightAuto() {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetHeightAutoJNI(mNativePointer);
else
YogaNative.jni_YGNodeStyleSetHeightAuto(mNativePointer);
YogaNative.jni_YGNodeStyleSetHeightAutoJNI(mNativePointer);
}
public YogaValue getMinWidth() {
return valueFromLong(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetMinWidthJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetMinWidth(mNativePointer));
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinWidthJNI(mNativePointer));
}
public void setMinWidth(float minWidth) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetMinWidthJNI(mNativePointer, minWidth);
else
YogaNative.jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth);
YogaNative.jni_YGNodeStyleSetMinWidthJNI(mNativePointer, minWidth);
}
public void setMinWidthPercent(float percent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetMinWidthPercentJNI(mNativePointer, percent);
else
YogaNative.jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent);
YogaNative.jni_YGNodeStyleSetMinWidthPercentJNI(mNativePointer, percent);
}
public YogaValue getMinHeight() {
return valueFromLong(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetMinHeightJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetMinHeight(mNativePointer));
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinHeightJNI(mNativePointer));
}
public void setMinHeight(float minHeight) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetMinHeightJNI(mNativePointer, minHeight);
else
YogaNative.jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight);
YogaNative.jni_YGNodeStyleSetMinHeightJNI(mNativePointer, minHeight);
}
public void setMinHeightPercent(float percent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetMinHeightPercentJNI(mNativePointer, percent);
else
YogaNative.jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent);
YogaNative.jni_YGNodeStyleSetMinHeightPercentJNI(mNativePointer, percent);
}
public YogaValue getMaxWidth() {
return valueFromLong(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetMaxWidthJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetMaxWidth(mNativePointer));
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxWidthJNI(mNativePointer));
}
public void setMaxWidth(float maxWidth) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetMaxWidthJNI(mNativePointer, maxWidth);
else
YogaNative.jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth);
YogaNative.jni_YGNodeStyleSetMaxWidthJNI(mNativePointer, maxWidth);
}
public void setMaxWidthPercent(float percent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetMaxWidthPercentJNI(mNativePointer, percent);
else
YogaNative.jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent);
YogaNative.jni_YGNodeStyleSetMaxWidthPercentJNI(mNativePointer, percent);
}
public YogaValue getMaxHeight() {
return valueFromLong(useVanillaJNI ? YogaNative.jni_YGNodeStyleGetMaxHeightJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetMaxHeight(mNativePointer));
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxHeightJNI(mNativePointer));
}
public void setMaxHeight(float maxheight) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetMaxHeightJNI(mNativePointer, maxheight);
else
YogaNative.jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight);
YogaNative.jni_YGNodeStyleSetMaxHeightJNI(mNativePointer, maxheight);
}
public void setMaxHeightPercent(float percent) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetMaxHeightPercentJNI(mNativePointer, percent);
else
YogaNative.jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent);
YogaNative.jni_YGNodeStyleSetMaxHeightPercentJNI(mNativePointer, percent);
}
public float getAspectRatio() {
return useVanillaJNI ? YogaNative.jni_YGNodeStyleGetAspectRatioJNI(mNativePointer) : YogaNative.jni_YGNodeStyleGetAspectRatio(mNativePointer);
return YogaNative.jni_YGNodeStyleGetAspectRatioJNI(mNativePointer);
}
public void setAspectRatio(float aspectRatio) {
if (useVanillaJNI)
YogaNative.jni_YGNodeStyleSetAspectRatioJNI(mNativePointer, aspectRatio);
else
YogaNative.jni_YGNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
YogaNative.jni_YGNodeStyleSetAspectRatioJNI(mNativePointer, aspectRatio);
}
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
mMeasureFunction = measureFunction;
if (useVanillaJNI)
YogaNative.jni_YGNodeSetHasMeasureFuncJNI(mNativePointer, measureFunction != null);
else
YogaNative.jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
YogaNative.jni_YGNodeSetHasMeasureFuncJNI(mNativePointer, measureFunction != null);
}
// Implementation Note: Why this method needs to stay final
@@ -638,10 +482,7 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
mBaselineFunction = baselineFunction;
if (useVanillaJNI)
YogaNative.jni_YGNodeSetHasBaselineFuncJNI(mNativePointer, baselineFunction != null);
else
YogaNative.jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null);
YogaNative.jni_YGNodeSetHasBaselineFuncJNI(mNativePointer, baselineFunction != null);
}
@DoNotStrip
@@ -672,10 +513,7 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
* layout of the tree rooted at this node.
*/
public void print() {
if (useVanillaJNI)
YogaNative.jni_YGNodePrintJNI(mNativePointer);
else
YogaNative.jni_YGNodePrint(mNativePointer);
YogaNative.jni_YGNodePrintJNI(mNativePointer);
}
/**

View File

@@ -12,10 +12,6 @@ public class YogaNodeJNIFinalizer extends YogaNodeJNIBase {
super();
}
public YogaNodeJNIFinalizer(boolean useVanillaJNI) {
super(useVanillaJNI);
}
public YogaNodeJNIFinalizer(YogaConfig config) {
super(config);
}
@@ -33,10 +29,7 @@ public class YogaNodeJNIFinalizer extends YogaNodeJNIBase {
if (mNativePointer != 0) {
long nativePointer = mNativePointer;
mNativePointer = 0;
if (useVanillaJNI)
YogaNative.jni_YGNodeFreeJNI(nativePointer);
else
YogaNative.jni_YGNodeFree(nativePointer);
YogaNative.jni_YGNodeFreeJNI(nativePointer);
}
}
}