mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Remove statically-allocated buffers
This commit is contained in:
committed by
EmilieNumworks
parent
2768ac2b48
commit
2f61b823d0
@@ -27,7 +27,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
static KDColor s_parenthesisWorkingBuffer[k_parenthesisCurveHeight*k_parenthesisCurveWidth];
|
||||
KDSize computeSize() override {
|
||||
return KDSize(ParenthesisWidth(), HeightGivenChildHeight(childHeight()));
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -2,6 +2,4 @@
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
KDColor ParenthesisLayoutNode::s_parenthesisWorkingBuffer[];
|
||||
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user