Просмотр исходного кода

Merge pull request #4843 from theundergroundsorcerer/DrawCircleSector-quickfix

Add early return when angles are equal in DrawCircleSector and DrawCircleSectorLine functions.
pull/4845/head
Ray 2 месяцев назад
committed by GitHub
Родитель
Сommit
cd9206956c
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: B5690EEEBB952194
1 измененных файлов: 2 добавлений и 0 удалений
  1. +2
    -0
      src/rshapes.c

+ 2
- 0
src/rshapes.c Просмотреть файл

@ -285,6 +285,7 @@ void DrawCircleV(Vector2 center, float radius, Color color)
// Draw a piece of a circle // Draw a piece of a circle
void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color) void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color)
{ {
if (startAngle == endAngle) return;
if (radius <= 0.0f) radius = 0.1f; // Avoid div by zero if (radius <= 0.0f) radius = 0.1f; // Avoid div by zero
// Function expects (endAngle > startAngle) // Function expects (endAngle > startAngle)
@ -376,6 +377,7 @@ void DrawCircleSector(Vector2 center, float radius, float startAngle, float endA
// Draw a piece of a circle outlines // Draw a piece of a circle outlines
void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color) void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color)
{ {
if (startAngle == endAngle) return;
if (radius <= 0.0f) radius = 0.1f; // Avoid div by zero issue if (radius <= 0.0f) radius = 0.1f; // Avoid div by zero issue
// Function expects (endAngle > startAngle) // Function expects (endAngle > startAngle)

Загрузка…
Отмена
Сохранить