some D idioms

This commit is contained in:
gazer 2017-05-31 18:28:40 +03:00
parent e288e6fd40
commit 1d08185329
1 changed files with 6 additions and 6 deletions

View File

@ -642,11 +642,10 @@ private void FillColor(uint color, Color[] buf_slice) {
} }
} }
private float[] convertColors(uint[] cols) { private float[] convertColors(uint[] cols) pure nothrow {
float[] colors; float[] colors;
colors.assumeSafeAppend();
colors.length = cols.length * 4; colors.length = cols.length * 4;
for (uint i = 0; i < cols.length; i++) { foreach(i; 0 .. cols.length) {
uint color = cols[i]; uint color = cols[i];
float r = ((color >> 16) & 255) / 255.0; float r = ((color >> 16) & 255) / 255.0;
float g = ((color >> 8) & 255) / 255.0; float g = ((color >> 8) & 255) / 255.0;
@ -1453,6 +1452,7 @@ private final class OpenGLQueue {
enum BatchType { Line = 0, Rect, Triangle, TexturedRect } enum BatchType { Line = 0, Rect, Triangle, TexturedRect }
BatchType type; BatchType type;
Tex2D texture; Tex2D texture;
int textureDx; int textureDx;
int textureDy; int textureDy;
@ -1643,7 +1643,7 @@ private final class OpenGLQueue {
}; };
/// make indices for rectangle (2 triangles == 6 vertexes per rect) /// make indices for rectangle (2 triangles == 6 vertexes per rect)
int[6] makeRectangleIndicesArray(int offset) { int[6] makeRectangleIndicesArray(int offset) pure nothrow {
int[6] indices; int[6] indices;
indices[0] = offset + 0; indices[0] = offset + 0;
indices[1] = offset + 1; indices[1] = offset + 1;
@ -1656,7 +1656,7 @@ private final class OpenGLQueue {
} }
/// make indices for triangles /// make indices for triangles
int[3] makeTriangleIndicesArray(int offset) { int[3] makeTriangleIndicesArray(int offset) pure nothrow {
int[3] indices; int[3] indices;
indices[0] = offset + 0; indices[0] = offset + 0;
indices[1] = offset + 1; indices[1] = offset + 1;
@ -1665,7 +1665,7 @@ private final class OpenGLQueue {
} }
/// make indices for lines /// make indices for lines
int[2] makeLineIndicesArray(int offset) { int[2] makeLineIndicesArray(int offset) pure nothrow {
int[2] indices; int[2] indices;
indices[0] = offset + 0; indices[0] = offset + 0;
indices[1] = offset + 1; indices[1] = offset + 1;