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

Method setVisibleViewport

valdi/src/valdi/android/NativeBridge.cpp:1149–1176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1147 jint height,
1148 jboolean isRTL) {
1149 auto viewNodeTree = getViewNodeTree(contextHandle);
1150 auto* runtimeWrapper = getRuntimeWrapper(runtimeHandle);
1151
1152 if (viewNodeTree == nullptr || runtimeWrapper == nullptr) {
1153 return;
1154 }
1155
1156 auto widthFloat = static_cast<float>(width) / runtimeWrapper->getPointScale();
1157 auto heightFloat = static_cast<float>(height) / runtimeWrapper->getPointScale();
1158 auto layoutDirection = static_cast<bool>(isRTL) ? Valdi::LayoutDirectionRTL : Valdi::LayoutDirectionLTR;
1159
1160 viewNodeTree->setLayoutSpecs(Valdi::Size(widthFloat, heightFloat), layoutDirection);
1161}
1162
1163void ValdiAndroid::NativeBridge::setVisibleViewport( // NOLINT
1164 fbjni::alias_ref<fbjni::JClass> /* clazz */, // NOLINT
1165 jlong runtimeHandle,
1166 jlong contextHandle,
1167 jint x,
1168 jint y,
1169 jint width,
1170 jint height,
1171 jboolean shouldUnset) {
1172 auto viewNodeTree = getViewNodeTree(contextHandle);
1173 auto* runtimeWrapper = getRuntimeWrapper(runtimeHandle);
1174
1175 if (viewNodeTree == nullptr || runtimeWrapper == nullptr) {
1176 return;
1177 }
1178
1179 if (static_cast<bool>(shouldUnset)) {

Callers

nothing calls this directly

Calls 5

getViewNodeTreeFunction · 0.85
getRuntimeWrapperFunction · 0.85
setViewportMethod · 0.80
FrameClass · 0.50
getPointScaleMethod · 0.45

Tested by

no test coverage detected