Skip to content

Commit

Permalink
Fixed double resize during same batch
Browse files Browse the repository at this point in the history
  • Loading branch information
Apostolique committed Aug 22, 2023
1 parent 1169bb1 commit 98f4964
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Source/ShapeBatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void Begin(Matrix? view = null, Matrix? projection = null) {
}
public void DrawCircle(Vector2 center, float radius, Color c1, Color c2, float thickness = 1f) {
EnsureSizeOrDouble(ref _vertices, _vertexCount + 4);
if (EnsureSizeOrDouble(ref _indices, _indexCount + 6)) {
if (EnsureSizeOrDouble(ref _indices, _indexCount + 6) && !_indicesChanged) {
_fromIndex = _indexCount;
_indicesChanged = true;
}
Expand Down Expand Up @@ -72,7 +72,7 @@ public void BorderCircle(Vector2 center, float radius, Color c, float thickness
}
public void DrawRectangle(Vector2 xy, Vector2 size, Color c1, Color c2, float thickness = 1f) {
EnsureSizeOrDouble(ref _vertices, _vertexCount + 4);
if (EnsureSizeOrDouble(ref _indices, _indexCount + 6)) {
if (EnsureSizeOrDouble(ref _indices, _indexCount + 6) && !_indicesChanged) {
_fromIndex = _indexCount;
_indicesChanged = true;
}
Expand Down Expand Up @@ -108,7 +108,7 @@ public void BorderRectangle(Vector2 xy, Vector2 size, Color c, float thickness =
}
public void DrawLine(Vector2 a, Vector2 b, float radius, Color c1, Color c2, float thickness = 1f) {
EnsureSizeOrDouble(ref _vertices, _vertexCount + 4);
if (EnsureSizeOrDouble(ref _indices, _indexCount + 6)) {
if (EnsureSizeOrDouble(ref _indices, _indexCount + 6) && !_indicesChanged) {
_fromIndex = _indexCount;
_indicesChanged = true;
}
Expand Down Expand Up @@ -151,7 +151,7 @@ public void BorderLine(Vector2 a, Vector2 b, float radius, Color c, float thickn

public void DrawHexagon(Vector2 center, float radius, Color c1, Color c2, float thickness = 1f) {
EnsureSizeOrDouble(ref _vertices, _vertexCount + 4);
if (EnsureSizeOrDouble(ref _indices, _indexCount + 6)) {
if (EnsureSizeOrDouble(ref _indices, _indexCount + 6) && !_indicesChanged) {
_fromIndex = _indexCount;
_indicesChanged = true;
}
Expand Down

0 comments on commit 98f4964

Please sign in to comment.