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

1014jlong ValdiAndroid::NativeBridge::getViewNodePoint( // NOLINT
1015 fbjni::alias_ref<fbjni::JClass> /* clazz */, // NOLINT
1016 jlong runtimeHandle,
1017 jlong viewNodeHandle,
1018 jint x,
1019 jint y,
1020 jint mode,
1021 jboolean fromBoundsOrigin) {
1022 static constexpr jint kModeDirectionAgnosticRelative = 1;
1023 static constexpr jint kModeDirectionAgnosticAbsolute = 2;
1024 static constexpr jint kModeVisualRelative = 3;
1025 static constexpr jint kModeVisualAbsolute = 4;
1026 static constexpr jint kModeViewportRelative = 5;
1027 static constexpr jint kModeViewportAbsolute = 6;
1028
1029 auto* runtimeWrapper = getRuntimeWrapper(runtimeHandle);
1030 auto viewNode = getViewNode(viewNodeHandle);
1031 if (viewNode == nullptr || runtimeWrapper == nullptr) {
1032 return 0;
1033 }
1034
1035 auto pointScale = runtimeWrapper->getPointScale();
1036
1037 Valdi::Point input = Valdi::Point(Valdi::pixelsToPoints(static_cast<int32_t>(x), pointScale),
1038 Valdi::pixelsToPoints(static_cast<int32_t>(y), pointScale));
1039
1040 if (static_cast<bool>(fromBoundsOrigin)) {
1041 input = input.withOffset(viewNode->getBoundsOriginPoint());
1042 }
1043
1044 Valdi::Point output;
1045
1046 if (mode == kModeDirectionAgnosticRelative) {

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