MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getViewNodeSize

Method getViewNodeSize

valdi/src/valdi/android/NativeBridge.cpp:1016–1043  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1014 output = viewNode->convertSelfVisualToParentVisual(input);
1015 } else if (mode == kModeVisualAbsolute) {
1016 output = viewNode->convertSelfVisualToRootVisual(input);
1017 } else if (mode == kModeViewportRelative) {
1018 output = viewNode->getCalculatedViewport().location();
1019 } else if (mode == kModeViewportAbsolute) {
1020 auto viewportLocation = viewNode->getCalculatedViewport().location();
1021 output = viewNode->convertSelfVisualToRootVisual(viewportLocation);
1022 } else {
1023 ValdiAndroid::JavaEnv::getUnsafeEnv()->ThrowNew(
1024 ValdiAndroid::JavaEnv::getCache().getValdiExceptionClass().getClass(), "Invalid coordinate mode");
1025 }
1026
1027 return Valdi::pointsToPackedPixels(output.x, output.y, pointScale);
1028}
1029
1030jlong ValdiAndroid::NativeBridge::getViewNodeSize( // NOLINT
1031 fbjni::alias_ref<fbjni::JClass> /* clazz */, // NOLINT,
1032 jlong runtimeHandle,
1033 jlong viewNodeHandle,
1034 jint mode) {
1035 auto* runtimeWrapper = getRuntimeWrapper(runtimeHandle);
1036 auto viewNode = getViewNode(viewNodeHandle);
1037 if (viewNode == nullptr || runtimeWrapper == nullptr) {
1038 return 0;
1039 }
1040
1041 static constexpr jint kModeFrame = 1;
1042 static constexpr jint kModeViewport = 2;
1043
1044 Valdi::Size output;
1045
1046 if (mode == kModeFrame) {

Callers

nothing calls this directly

Calls 6

getRuntimeWrapperFunction · 0.85
getViewNodeFunction · 0.85
pointsToPackedPixelsFunction · 0.85
sizeMethod · 0.45
getClassMethod · 0.45
getPointScaleMethod · 0.45

Tested by

no test coverage detected