BREAKING - Make first parameter of measure and print functions CSSNodeRef instead of just context
Summary: To perform some JNI optimizations for java we need a reference to the node in the measure function. This updates the API to provide the whole node as input instead of just the context. Reviewed By: javache Differential Revision: D4081544 fbshipit-source-id: d49679025cea027cf7b8482898de0a01fe0f9d40
This commit is contained in:
committed by
Facebook Github Bot
parent
b59ce09109
commit
46823878a5
@@ -14,17 +14,17 @@
|
||||
using namespace facebook::jni;
|
||||
using namespace std;
|
||||
|
||||
static void _jniPrint(void *context) {
|
||||
auto obj = adopt_local(Environment::current()->NewLocalRef(reinterpret_cast<jweak>(context)));
|
||||
static void _jniPrint(CSSNodeRef node) {
|
||||
auto obj = adopt_local(Environment::current()->NewLocalRef(reinterpret_cast<jweak>(CSSNodeGetContext(node))));
|
||||
cout << obj->toString() << endl;
|
||||
}
|
||||
|
||||
static CSSSize _jniMeasureFunc(void *context,
|
||||
static CSSSize _jniMeasureFunc(CSSNodeRef node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
auto obj = adopt_local(Environment::current()->NewLocalRef(reinterpret_cast<jweak>(context)));
|
||||
auto obj = adopt_local(Environment::current()->NewLocalRef(reinterpret_cast<jweak>(CSSNodeGetContext(node))));
|
||||
static auto measureFunc =
|
||||
obj->getClass()->getMethod<jlong(jfloat, jint, jfloat, jint)>("measure");
|
||||
const auto measureResult = measureFunc(obj, width, widthMode, height, heightMode);
|
||||
|
Reference in New Issue
Block a user