History

Make array size a constexpr

Atlante45 committed 11 years ago

Commit 5166d831 parent d0f27f11 file · +5 −6Browse files

Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 1 file). Show all

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+5−6
@@ -1025,11 +1025,11 @@ void GeometryCache::renderBevelCornersRect(gpu::Batch& batch, int x, int y, int · 1024 unmodified lines
10251025 #endif // def WANT_DEBUG
10261026 }
10271027
1028− const int FLOATS_PER_VERTEX = 2; // vertices
1029− const int NUM_VERTICES = 8;
1030−
10311028 if (!details.isCreated) {
1032−
1029+ static const int FLOATS_PER_VERTEX = 2; // vertices
1030+ static const int NUM_VERTICES = 8;
1031+ static constexpr int NUM_FLOATS = NUM_VERTICES * FLOATS_PER_VERTEX;
1032+
10331033 details.isCreated = true;
10341034 details.vertices = NUM_VERTICES;
10351035 details.vertexSize = FLOATS_PER_VERTEX;
@@ -1051,8 +1051,7 @@ void GeometryCache::renderBevelCornersRect(gpu::Batch& batch, int x, int y, int · 15 unmodified lines
10511051 details.stream->addBuffer(details.colorBuffer, 0, details.streamFormat->getChannels().at(1)._stride);
10521052
10531053
1054− int vertexPoints = NUM_VERTICES * FLOATS_PER_VERTEX;
1055− GLfloat vertexBuffer[vertexPoints]; // only vertices, no normals because we're a 2D quad
1054+ GLfloat vertexBuffer[NUM_FLOATS]; // only vertices, no normals because we're a 2D quad
10561055 int vertexPoint = 0;
10571056
10581057 // Triangle strip points

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t