Rounding error in width/height fixed
Reviewed By: emilsjolander Differential Revision: D5209073 Tags: accept2ship fbshipit-source-id: a3a6a43767aa707ebfa5eee62a83adcdd88d7ce6
This commit is contained in:
parent
6407071424
commit
f908cce679
|
@ -3456,11 +3456,22 @@ static void YGRoundToPixelGrid(const YGNodeRef node,
|
|||
node->layout.position[YGEdgeTop] =
|
||||
YGRoundValueToPixelGrid(nodeTop, pointScaleFactor, false, textRounding);
|
||||
|
||||
const bool hasFractionalWidth = !YGFloatsEqual(fmodf(nodeWidth, 1.0), 0);
|
||||
const bool hasFractionalHeight = !YGFloatsEqual(fmodf(nodeHeight, 1.0), 0);
|
||||
|
||||
node->layout.dimensions[YGDimensionWidth] =
|
||||
YGRoundValueToPixelGrid(absoluteNodeRight, pointScaleFactor, textRounding, false) -
|
||||
YGRoundValueToPixelGrid(
|
||||
absoluteNodeRight,
|
||||
pointScaleFactor,
|
||||
(textRounding && hasFractionalWidth),
|
||||
(textRounding && !hasFractionalWidth)) -
|
||||
YGRoundValueToPixelGrid(absoluteNodeLeft, pointScaleFactor, false, textRounding);
|
||||
node->layout.dimensions[YGDimensionHeight] =
|
||||
YGRoundValueToPixelGrid(absoluteNodeBottom, pointScaleFactor, textRounding, false) -
|
||||
YGRoundValueToPixelGrid(
|
||||
absoluteNodeBottom,
|
||||
pointScaleFactor,
|
||||
(textRounding && hasFractionalHeight),
|
||||
(textRounding && !hasFractionalHeight)) -
|
||||
YGRoundValueToPixelGrid(absoluteNodeTop, pointScaleFactor, false, textRounding);
|
||||
|
||||
const uint32_t childCount = YGNodeListCount(node->children);
|
||||
|
|
Loading…
Reference in New Issue