Ver código fonte

improve fix - (pixel offset issue with `DrawRectangleRoundedLinesEx`)

pull/4666/head
Bigfoot71 1 semana atrás
pai
commit
2294c5c734
1 arquivos alterados com 8 adições e 7 exclusões
  1. +8
    -7
      src/rshapes.c

+ 8
- 7
src/rshapes.c Ver arquivo

@ -1141,7 +1141,8 @@ void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, f
}
float stepLength = 90.0f/(float)segments;
const float outerRadius = radius + lineThick, innerRadius = radius;
const float outerRadius = radius + lineThick - 0.5f;
const float innerRadius = radius - 0.5f;
/*
Quick sketch to make sense of all of this,
@ -1162,20 +1163,20 @@ void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, f
const Vector2 point[16] = {
{(float)rec.x + innerRadius + 0.5f, rec.y - lineThick + 0.5f},
{(float)(rec.x + rec.width) - innerRadius - 0.5f, rec.y - lineThick + 0.5f},
{rec.x + rec.width + lineThick - 0.5f, (float)rec.y + innerRadius - 0.5f}, // PO, P1, P2
{rec.x + rec.width + lineThick - 0.5f, (float)(rec.y + rec.height) - innerRadius + 0.5f},
{rec.x + rec.width + lineThick - 0.5f, (float)rec.y + innerRadius + 0.5f}, // PO, P1, P2
{rec.x + rec.width + lineThick - 0.5f, (float)(rec.y + rec.height) - innerRadius - 0.5f},
{(float)(rec.x + rec.width) - innerRadius - 0.5f, rec.y + rec.height + lineThick - 0.5f}, // P3, P4
{(float)rec.x + innerRadius + 0.5f, rec.y + rec.height + lineThick - 0.5f},
{rec.x - lineThick + 0.5f, (float)(rec.y + rec.height) - innerRadius - 0.5f},
{rec.x - lineThick + 0.5f, (float)rec.y + innerRadius + 0.5f}, // P5, P6, P7
{(float)rec.x + innerRadius + 0.5f, rec.y + 0.5f},
{(float)(rec.x + rec.width) - innerRadius - 0.5f, rec.y + 0.5f}, // P8, P9
{rec.x + rec.width - 0.5f, (float)rec.y + innerRadius - 0.5f},
{rec.x + rec.width - 0.5f, (float)(rec.y + rec.height) - innerRadius + 0.5f}, // P10, P11
{rec.x + rec.width - 0.5f, (float)rec.y + innerRadius + 0.5f},
{rec.x + rec.width - 0.5f, (float)(rec.y + rec.height) - innerRadius - 0.5f}, // P10, P11
{(float)(rec.x + rec.width) - innerRadius - 0.5f, rec.y + rec.height - 0.5f},
{(float)rec.x + innerRadius + 0.5f, rec.y + rec.height - 0.5f}, // P12, P13
{rec.x + 0.5f, (float)(rec.y + rec.height) - innerRadius + 0.5f},
{rec.x + 0.5f, (float)rec.y + innerRadius - 0.5f} // P14, P15
{rec.x + 0.5f, (float)(rec.y + rec.height) - innerRadius - 0.5f},
{rec.x + 0.5f, (float)rec.y + innerRadius + 0.5f} // P14, P15
};
const Vector2 centers[4] = {

Carregando…
Cancelar
Salvar