Skip to content

Commit

Permalink
Simplify YGConfigSetPointScaleFactor (#1451)
Browse files Browse the repository at this point in the history
Summary:

X-link: facebook/react-native#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
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Nov 10, 2023
1 parent 6400c2c commit 4884d9a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions yoga/YGConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4884d9a

Please sign in to comment.