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

Method scheduleLazyLayout

valdi/src/valdi/runtime/Context/ViewNode.cpp:2134–2147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2132 Frame bounds;
2133 if (VALDI_LIKELY(_scaleX == 1.0f && _scaleY == 1.0f)) {
2134 bounds = f.withOffset(tx, ty);
2135 } else {
2136 // Scale is applied around the center anchor point (matching iOS CALayer default
2137 // anchor of 0.5,0.5 and Android View default pivot at center).
2138 auto scaledX = f.x + (f.width * (1.0f - _scaleX)) / 2.0f + tx;
2139 auto scaledY = f.y + (f.height * (1.0f - _scaleY)) / 2.0f + ty;
2140 bounds = Frame(scaledX, scaledY, f.width * _scaleX, f.height * _scaleY);
2141 // Normalize to ensure positive dimensions so that Frame::intersects() and
2142 // setLeft/Right/Top/Bottom all work correctly (negative scale flips sign).
2143 if (bounds.width < 0.0f) {
2144 bounds.x += bounds.width;
2145 bounds.width = -bounds.width;
2146 }
2147 if (bounds.height < 0.0f) {
2148 bounds.y += bounds.height;
2149 bounds.height = -bounds.height;
2150 }

Callers 1

ygDirtiedCallbackFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected