remove useBatchingForLayoutOutputs config param and start using batching for layout outputs

Summary: Removes config param useBatchingForLayoutOutputs and now we are using batching of layout outputs as float array while passing data from c++ to java

Reviewed By: davidaurelio

Differential Revision: D16221483

fbshipit-source-id: 326c668d4dfd13b2cf031f98a84bfa50b1440513
This commit is contained in:
Sidharth Guglani
2019-07-15 11:09:05 -07:00
committed by Facebook Github Bot
parent 296982a29e
commit 838fc3f019
5 changed files with 56 additions and 149 deletions

View File

@@ -11,7 +11,6 @@ import com.facebook.soloader.SoLoader;
public class YogaConfig {
public static int SPACING_TYPE = 1;
public static boolean useBatchingForLayoutOutputs = false;
long mNativePointer;
private YogaLogger mLogger;

View File

@@ -28,8 +28,8 @@ public class YogaNative {
// YGNode related
static native long jni_YGNodeNew(boolean useBatchingForLayoutOutputs);
static native long jni_YGNodeNewWithConfig(long configPointer, boolean useBatchingForLayoutOutputs);
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);

View File

@@ -10,11 +10,11 @@ import javax.annotation.Nullable;
public abstract class YogaNode {
public static YogaNode create() {
return YogaConfig.useBatchingForLayoutOutputs ? new YogaNodeJNIBatching() : new YogaNodeJNI();
return new YogaNodeJNIBatching();
}
public static YogaNode create(YogaConfig config) {
return YogaConfig.useBatchingForLayoutOutputs ? new YogaNodeJNIBatching(config) : new YogaNodeJNI(config);
return new YogaNodeJNIBatching(config);
}
public abstract void reset();

View File

@@ -22,14 +22,14 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
@Nullable private Object mData;
public YogaNodeJNIBase() {
mNativePointer = YogaNative.jni_YGNodeNew(YogaConfig.useBatchingForLayoutOutputs);
mNativePointer = YogaNative.jni_YGNodeNew();
if (mNativePointer == 0) {
throw new IllegalStateException("Failed to allocate native memory");
}
}
public YogaNodeJNIBase(YogaConfig config) {
mNativePointer = YogaNative.jni_YGNodeNewWithConfig(config.mNativePointer, YogaConfig.useBatchingForLayoutOutputs);
mNativePointer = YogaNative.jni_YGNodeNewWithConfig(config.mNativePointer);
if (mNativePointer == 0) {
throw new IllegalStateException("Failed to allocate native memory");
}