mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[poincare] In parenthesis layout, add an extern margin to seperate 'm'
and '(' when consecutive
Change-Id: Idc0490e3925081c28babf4067a0e43cf764ec132
This commit is contained in:
@@ -62,25 +62,25 @@ KDColor s_parenthesisWorkingBuffer[ParenthesisLayout::k_parenthesisCurveHeight*P
|
||||
|
||||
void ParenthesisLayout::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
|
||||
KDSize operandSize = m_operandLayout->size();
|
||||
KDRect frame(p.x(), p.y(), k_parenthesisCurveWidth, k_parenthesisCurveHeight);
|
||||
KDRect frame(p.x()+k_externWidthMargin, p.y(), k_parenthesisCurveWidth, k_parenthesisCurveHeight);
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)topLeftCurve, (KDColor *)s_parenthesisWorkingBuffer);
|
||||
frame = KDRect(p.x(), p.y() + operandSize.height() - k_parenthesisCurveHeight,
|
||||
frame = KDRect(p.x()+k_externWidthMargin, p.y() + operandSize.height() - k_parenthesisCurveHeight,
|
||||
k_parenthesisCurveWidth, k_parenthesisCurveHeight);
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)bottomLeftCurve, (KDColor *)s_parenthesisWorkingBuffer);
|
||||
frame = KDRect(p.x() + operandSize.width() + 2*k_widthMargin + 2*k_lineThickness - k_parenthesisCurveWidth, p.y(),
|
||||
frame = KDRect(p.x()+k_externWidthMargin + operandSize.width() + 2*k_widthMargin + 2*k_lineThickness - k_parenthesisCurveWidth, p.y(),
|
||||
k_parenthesisCurveWidth, k_parenthesisCurveHeight);
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)topRightCurve, (KDColor *)s_parenthesisWorkingBuffer);
|
||||
frame = KDRect(p.x() + operandSize.width() + 2*k_widthMargin + 2*k_lineThickness - k_parenthesisCurveWidth, p.y() + operandSize.height() - k_parenthesisCurveHeight,
|
||||
frame = KDRect(p.x() +k_externWidthMargin + operandSize.width() + 2*k_widthMargin + 2*k_lineThickness - k_parenthesisCurveWidth, p.y() + operandSize.height() - k_parenthesisCurveHeight,
|
||||
k_parenthesisCurveWidth, k_parenthesisCurveHeight);
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)bottomRightCurve, (KDColor *)s_parenthesisWorkingBuffer);
|
||||
|
||||
ctx->fillRect(KDRect(p.x(), p.y()+k_parenthesisCurveHeight, k_lineThickness, m_operandLayout->size().height() - 2*k_parenthesisCurveHeight), expressionColor);
|
||||
ctx->fillRect(KDRect(p.x()+operandSize.width()+2*k_widthMargin+k_lineThickness, p.y()+k_parenthesisCurveHeight, k_lineThickness, m_operandLayout->size().height()- 2*k_parenthesisCurveHeight), expressionColor);
|
||||
ctx->fillRect(KDRect(p.x()+k_externWidthMargin, p.y()+k_parenthesisCurveHeight, k_lineThickness, m_operandLayout->size().height() - 2*k_parenthesisCurveHeight), expressionColor);
|
||||
ctx->fillRect(KDRect(p.x()+k_externWidthMargin+operandSize.width()+2*k_widthMargin+k_lineThickness, p.y()+k_parenthesisCurveHeight, k_lineThickness, m_operandLayout->size().height()- 2*k_parenthesisCurveHeight), expressionColor);
|
||||
}
|
||||
|
||||
KDSize ParenthesisLayout::computeSize() {
|
||||
KDSize operandSize = m_operandLayout->size();
|
||||
return KDSize(operandSize.width() + 2*k_widthMargin + 2*k_lineThickness, operandSize.height());
|
||||
return KDSize(operandSize.width() + 2*k_widthMargin + 2*k_lineThickness+2*k_externWidthMargin, operandSize.height());
|
||||
}
|
||||
|
||||
ExpressionLayout * ParenthesisLayout::child(uint16_t index) {
|
||||
@@ -91,7 +91,7 @@ ExpressionLayout * ParenthesisLayout::child(uint16_t index) {
|
||||
}
|
||||
|
||||
KDPoint ParenthesisLayout::positionOfChild(ExpressionLayout * child) {
|
||||
return KDPoint(k_widthMargin+k_lineThickness, 0);
|
||||
return KDPoint(k_widthMargin+k_lineThickness+k_externWidthMargin, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ protected:
|
||||
ExpressionLayout * child(uint16_t index) override;
|
||||
KDPoint positionOfChild(ExpressionLayout * child) override;
|
||||
private:
|
||||
constexpr static KDCoordinate k_externWidthMargin = 1;
|
||||
constexpr static KDCoordinate k_widthMargin = 5;
|
||||
constexpr static KDCoordinate k_lineThickness = 1;
|
||||
ExpressionLayout * m_operandLayout;
|
||||
|
||||
Reference in New Issue
Block a user