Skip to content

Commit

Permalink
shape: use the rounding util functions
Browse files Browse the repository at this point in the history
  • Loading branch information
PaideiaDilemma committed Dec 27, 2024
1 parent eebc6f6 commit af99a9a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/renderer/widgets/Shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,19 @@ bool CShape::draw(const SRenderData& data) {
}

if (!shapeFB.isAllocated()) {
const auto MINHALFSHAPE = std::min(shapeBox.w, shapeBox.h) / 2.0;
const bool ALLOWROUND = rounding > -1 && rounding < MINHALFSHAPE;
const int ROUND = roundingForBox(shapeBox, rounding);
const int BORDERROUND = roundingForBorderBox(borderBox, rounding, border);
Debug::log(LOG, "round: {}, borderround: {}", ROUND, BORDERROUND);

shapeFB.alloc(borderBox.width + borderBox.x * 2.0, borderBox.height + borderBox.y * 2.0, true);
g_pRenderer->pushFb(shapeFB.m_iFb);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);

if (border > 0)
g_pRenderer->renderBorder(borderBox, borderGrad, border, ALLOWROUND ? (rounding == 0 ? 0 : rounding + std::round(border / M_PI)) : MINHALFBORDER, 1.0);
g_pRenderer->renderBorder(borderBox, borderGrad, border, BORDERROUND, 1.0);

g_pRenderer->renderRect(shapeBox, color, ALLOWROUND ? rounding : MINHALFSHAPE);
g_pRenderer->renderRect(shapeBox, color, ROUND);
g_pRenderer->popFb();
}

Expand Down

0 comments on commit af99a9a

Please sign in to comment.