diff --git a/poincare/include/poincare/parenthesis_layout.h b/poincare/include/poincare/parenthesis_layout.h index 5cc757d03..f35679205 100644 --- a/poincare/include/poincare/parenthesis_layout.h +++ b/poincare/include/poincare/parenthesis_layout.h @@ -27,7 +27,6 @@ public: #endif protected: - static KDColor s_parenthesisWorkingBuffer[k_parenthesisCurveHeight*k_parenthesisCurveWidth]; KDSize computeSize() override { return KDSize(ParenthesisWidth(), HeightGivenChildHeight(childHeight())); } diff --git a/poincare/src/left_parenthesis_layout.cpp b/poincare/src/left_parenthesis_layout.cpp index 8ddd2dea5..31b28e1db 100644 --- a/poincare/src/left_parenthesis_layout.cpp +++ b/poincare/src/left_parenthesis_layout.cpp @@ -25,20 +25,21 @@ const uint8_t bottomLeftCurve[ParenthesisLayoutNode::k_parenthesisCurveHeight][P }; void LeftParenthesisLayoutNode::RenderWithChildHeight(KDCoordinate childHeight, KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) { + KDColor parenthesisWorkingBuffer[k_parenthesisCurveHeight*k_parenthesisCurveWidth]; KDCoordinate parenthesisHeight = ParenthesisLayoutNode::HeightGivenChildHeight(childHeight); KDRect frame(p.x()+ParenthesisLayoutNode::k_externWidthMargin, p.y()+ParenthesisLayoutNode::k_externHeightMargin, ParenthesisLayoutNode::k_parenthesisCurveWidth, ParenthesisLayoutNode::k_parenthesisCurveHeight); - ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)topLeftCurve, (KDColor *)(ParenthesisLayoutNode::s_parenthesisWorkingBuffer)); + ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)topLeftCurve, parenthesisWorkingBuffer); frame = KDRect(p.x()+ParenthesisLayoutNode::k_externWidthMargin, p.y() + parenthesisHeight - ParenthesisLayoutNode::k_parenthesisCurveHeight - ParenthesisLayoutNode::k_externHeightMargin, ParenthesisLayoutNode::k_parenthesisCurveWidth, ParenthesisLayoutNode::k_parenthesisCurveHeight); - ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)bottomLeftCurve, (KDColor *)(ParenthesisLayoutNode::s_parenthesisWorkingBuffer)); + ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)bottomLeftCurve, parenthesisWorkingBuffer); ctx->fillRect(KDRect(p.x()+ParenthesisLayoutNode::k_externWidthMargin, p.y()+ParenthesisLayoutNode::k_parenthesisCurveHeight+ParenthesisLayoutNode::k_externHeightMargin, diff --git a/poincare/src/parenthesis_layout.cpp b/poincare/src/parenthesis_layout.cpp index 40c5fc263..dece3d9d9 100644 --- a/poincare/src/parenthesis_layout.cpp +++ b/poincare/src/parenthesis_layout.cpp @@ -2,6 +2,4 @@ namespace Poincare { -KDColor ParenthesisLayoutNode::s_parenthesisWorkingBuffer[]; - } diff --git a/poincare/src/right_parenthesis_layout.cpp b/poincare/src/right_parenthesis_layout.cpp index d38345f20..35b9c1527 100644 --- a/poincare/src/right_parenthesis_layout.cpp +++ b/poincare/src/right_parenthesis_layout.cpp @@ -25,20 +25,21 @@ const uint8_t bottomRightCurve[ParenthesisLayoutNode::k_parenthesisCurveHeight][ }; void RightParenthesisLayoutNode::RenderWithChildHeight(KDCoordinate childHeight, KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) { + KDColor parenthesisWorkingBuffer[k_parenthesisCurveHeight*k_parenthesisCurveWidth]; KDCoordinate parenthesisHeight = ParenthesisLayoutNode::HeightGivenChildHeight(childHeight); KDRect frame = KDRect(p.x() + ParenthesisLayoutNode::k_widthMargin + ParenthesisLayoutNode::k_lineThickness - ParenthesisLayoutNode::k_parenthesisCurveWidth, p.y() + ParenthesisLayoutNode::k_externHeightMargin, ParenthesisLayoutNode::k_parenthesisCurveWidth, ParenthesisLayoutNode::k_parenthesisCurveHeight); - ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)topRightCurve, (KDColor *)(ParenthesisLayoutNode::s_parenthesisWorkingBuffer)); + ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)topRightCurve, parenthesisWorkingBuffer); frame = KDRect(p.x() + ParenthesisLayoutNode::k_widthMargin + ParenthesisLayoutNode::k_lineThickness - ParenthesisLayoutNode::k_parenthesisCurveWidth, p.y() + parenthesisHeight - ParenthesisLayoutNode::k_parenthesisCurveHeight - ParenthesisLayoutNode::k_externHeightMargin, ParenthesisLayoutNode::k_parenthesisCurveWidth, ParenthesisLayoutNode::k_parenthesisCurveHeight); - ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)bottomRightCurve, (KDColor *)(ParenthesisLayoutNode::s_parenthesisWorkingBuffer)); + ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)bottomRightCurve, parenthesisWorkingBuffer); ctx->fillRect(KDRect(p.x()+ParenthesisLayoutNode::k_widthMargin, p.y()+ParenthesisLayoutNode::k_parenthesisCurveHeight+2, diff --git a/poincare/src/trigonometry_cheat_table.cpp b/poincare/src/trigonometry_cheat_table.cpp index eac4f3a4b..c0e02ba82 100644 --- a/poincare/src/trigonometry_cheat_table.cpp +++ b/poincare/src/trigonometry_cheat_table.cpp @@ -82,7 +82,7 @@ Expression TrigonometryCheatTable::simplify(const Expression e, ExpressionNode:: * For instance, when simplfy a Cosine, we always compute the value for an angle * in the top right trigonometric quadrant. */ const TrigonometryCheatTable * TrigonometryCheatTable::Table() { - static Row sTableRows[] = { + static const Row sTableRows[] = { Row(Row::Pair("-90", -90.0f), Row::Pair("π*(-2)^(-1)", -1.5707963267948966f), Row::Pair("-100", -100.0f), @@ -306,7 +306,7 @@ const TrigonometryCheatTable * TrigonometryCheatTable::Table() { Row::Pair("0",0.0f), Row::Pair("0",0.0f)) }; - static TrigonometryCheatTable sTable(sTableRows); + static const TrigonometryCheatTable sTable(sTableRows); return &sTable; }