mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Fix calculation height allocation failure handling
This commit is contained in:
@@ -72,17 +72,29 @@ KDCoordinate Calculation::height(Context * context) {
|
||||
LayoutRef inputLayout = createInputLayout();
|
||||
if (inputLayout.isAllocationFailure()) {
|
||||
/* If there is not enough tree pool space to create the layout, return a
|
||||
* default height. Do not store it in m_height in case some memory get
|
||||
* default height. Do not store it in m_height in case some memory gets
|
||||
* freed afterwards. */
|
||||
return k_heightComputationFailureHeight;
|
||||
}
|
||||
KDCoordinate inputHeight = inputLayout.layoutSize().height();
|
||||
LayoutRef approximateLayout = createApproximateOutputLayout(context);
|
||||
if (approximateLayout.isAllocationFailure()) {
|
||||
/* If there is not enough tree pool space to create the layout, return a
|
||||
* default height. Do not store it in m_height in case some memory gets
|
||||
* freed afterwards. */
|
||||
return k_heightComputationFailureHeight;
|
||||
}
|
||||
KDCoordinate approximateOutputHeight = approximateLayout.layoutSize().height();
|
||||
if (shouldOnlyDisplayApproximateOutput(context)) {
|
||||
m_height = inputHeight+approximateOutputHeight;
|
||||
} else {
|
||||
LayoutRef exactLayout = createExactOutputLayout(context);
|
||||
if (exactLayout.isAllocationFailure()) {
|
||||
/* If there is not enough tree pool space to create the layout, return a
|
||||
* default height. Do not store it in m_height in case some memory gets
|
||||
* freed afterwards. */
|
||||
return k_heightComputationFailureHeight;
|
||||
}
|
||||
KDCoordinate exactOutputHeight = exactLayout.layoutSize().height();
|
||||
KDCoordinate outputHeight = max(exactLayout.baseline(), approximateLayout.baseline()) + max(exactOutputHeight-exactLayout.baseline(), approximateOutputHeight-approximateLayout.baseline());
|
||||
m_height = inputHeight + outputHeight;
|
||||
|
||||
Reference in New Issue
Block a user