REVIEWED: DrawRectangleLinesEx(), avoid early-return
NOTE: raylib data validation policy defines not to validate any data that does not suppose a crash in the program, letting user manage that layer... probably several functions should be carefully reviewed or the policy itself...
This commit is contained in:
parent
60b9f20469
commit
63f82f0ca8
1 changed files with 13 additions and 12 deletions
|
|
@ -631,8 +631,6 @@ void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
|
|||
// Draw rectangle outline with line thickness
|
||||
void DrawRectangleLinesEx(Rectangle rec, float thick, Color color)
|
||||
{
|
||||
if (thick <= 0.0f) return;
|
||||
|
||||
if ((thick > rec.width/2) || (thick > rec.height/2))
|
||||
{
|
||||
if (rec.width >= rec.height) thick = rec.height/2;
|
||||
|
|
@ -650,6 +648,8 @@ void DrawRectangleLinesEx(Rectangle rec, float thick, Color color)
|
|||
// BBBBBBBB
|
||||
//
|
||||
|
||||
if (thick > 0.0f)
|
||||
{
|
||||
Rectangle top = { rec.x, rec.y, rec.width, thick };
|
||||
Rectangle bottom = { rec.x, rec.y - thick + rec.height, rec.width, thick };
|
||||
Rectangle left = { rec.x, rec.y + thick, thick, rec.height - thick*2.0f };
|
||||
|
|
@ -659,6 +659,7 @@ void DrawRectangleLinesEx(Rectangle rec, float thick, Color color)
|
|||
DrawRectangleRec(bottom, color);
|
||||
DrawRectangleRec(left, color);
|
||||
DrawRectangleRec(right, color);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw rectangle with rounded edges
|
||||
|
|
|
|||
Loading…
Reference in a new issue