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

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