Simplify YGConfigSetPointScaleFactor (#1451)

Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1451

X-link: https://github.com/facebook/react-native/pull/41327

The special meaning of `0.0` is now explained in the function header, and we aren't doing any sort of insensitive compare here, so the code after should be equivalent and a bit simpler.

Reviewed By: yungsters

Differential Revision: D51014264

fbshipit-source-id: 60f4a2df039f74089d5c7fabd4b7d8ac6234ba72
This commit is contained in:
Nick Gerleman
2023-11-10 16:31:46 -08:00
committed by Facebook GitHub Bot
parent c46ea9c6f5
commit 1b1df3a87e

View File

@@ -40,13 +40,7 @@ void YGConfigSetPointScaleFactor(
pixelsInPoint >= 0.0f,
"Scale factor should not be less than zero");
// We store points for Pixel as we will use it for rounding
if (pixelsInPoint == 0.0f) {
// Zero is used to skip rounding
resolveRef(config)->setPointScaleFactor(0.0f);
} else {
resolveRef(config)->setPointScaleFactor(pixelsInPoint);
}
resolveRef(config)->setPointScaleFactor(pixelsInPoint);
}
float YGConfigGetPointScaleFactor(const YGConfigConstRef config) {