if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count; j += nr ) {
+ for (j = 0; j < count; j += nr) {
nr = MIN2( currentsz, count - j );
- TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) );
+ TAG(emit_verts)(ctx, start + j, nr, ALLOC_VERTS(nr));
currentsz = dmasz;
}
/* Emit whole number of lines in total and in each buffer:
*/
- count -= (count-start) & 1;
+ count -= count & 1;
currentsz = GET_CURRENT_VB_MAX_VERTS();
currentsz -= currentsz & 1;
dmasz -= dmasz & 1;
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count; j += nr ) {
+ for (j = 0; j < count; j += nr) {
nr = MIN2( currentsz, count - j );
- TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) );
+ TAG(emit_verts)(ctx, start + j, nr, ALLOC_VERTS(nr));
currentsz = dmasz;
}
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j + 1 < count; j += nr - 1 ) {
+ for (j = 0; j + 1 < count; j += nr - 1 ) {
nr = MIN2( currentsz, count - j );
- TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) );
+ TAG(emit_verts)(ctx, start + j, nr, ALLOC_VERTS(nr));
currentsz = dmasz;
}
INIT( GL_LINE_STRIP );
if (flags & PRIM_BEGIN)
- j = start;
+ j = 0;
else
- j = start + 1;
+ j = 1;
/* Ensure last vertex won't wrap buffers:
*/
nr = MIN2( currentsz, count - j );
if (j + nr >= count &&
- start < count - 1 &&
+ 0 < count - 1 &&
(flags & PRIM_END))
{
void *tmp;
tmp = ALLOC_VERTS(nr+1);
- tmp = TAG(emit_verts)( ctx, j, nr, tmp );
+ tmp = TAG(emit_verts)(ctx, start + j, nr, tmp);
tmp = TAG(emit_verts)( ctx, start, 1, tmp );
(void) tmp;
}
else {
- TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) );
+ TAG(emit_verts)(ctx, start + j, nr, ALLOC_VERTS(nr));
currentsz = dmasz;
}
}
}
- else if (start + 1 < count && (flags & PRIM_END)) {
+ else if (1 < count && (flags & PRIM_END)) {
void *tmp;
tmp = ALLOC_VERTS(2);
tmp = TAG(emit_verts)( ctx, start+1, 1, tmp );
/* Emit whole number of tris in total. dmasz is already a multiple
* of 3.
*/
- count -= (count-start)%3;
+ count -= count % 3;
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count; j += nr) {
+ for (j = 0; j < count; j += nr) {
nr = MIN2( currentsz, count - j );
- TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) );
+ TAG(emit_verts)(ctx, start + j, nr, ALLOC_VERTS(nr));
currentsz = dmasz;
}
}
dmasz -= (dmasz & 1);
currentsz -= (currentsz & 1);
- for (j = start ; j + 2 < count; j += nr - 2 ) {
+ for (j = 0; j + 2 < count; j += nr - 2) {
nr = MIN2( currentsz, count - j );
- TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) );
+ TAG(emit_verts)(ctx, start + j, nr, ALLOC_VERTS(nr));
currentsz = dmasz;
}
currentsz = dmasz;
}
- for (j = start + 1 ; j + 1 < count; j += nr - 2 ) {
+ for (j = 1; j + 1 < count; j += nr - 2) {
void *tmp;
nr = MIN2( currentsz, count - j + 1 );
tmp = ALLOC_VERTS( nr );
tmp = TAG(emit_verts)( ctx, start, 1, tmp );
- tmp = TAG(emit_verts)( ctx, j, nr - 1, tmp );
+ tmp = TAG(emit_verts)( ctx, start + j, nr - 1, tmp );
(void) tmp;
currentsz = dmasz;
}
currentsz = dmasz;
}
- for (j = start + 1 ; j + 1 < count ; j += nr - 2 ) {
+ for (j = 1 ; j + 1 < count ; j += nr - 2 ) {
void *tmp;
nr = MIN2( currentsz, count - j + 1 );
tmp = ALLOC_VERTS( nr );
tmp = TAG(emit_verts)( ctx, start, 1, tmp );
- tmp = TAG(emit_verts)( ctx, j, nr - 1, tmp );
+ tmp = TAG(emit_verts)(ctx, start + j, nr - 1, tmp);
(void) tmp;
currentsz = dmasz;
}
dmasz -= (dmasz & 2);
currentsz -= (currentsz & 2);
- for (j = start ; j + 3 < count; j += nr - 2 ) {
+ for (j = 0; j + 3 < count; j += nr - 2 ) {
nr = MIN2( currentsz, count - j );
- TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) );
+ TAG(emit_verts)(ctx, start + j, nr, ALLOC_VERTS(nr));
currentsz = dmasz;
}
/* Emit whole number of quads in total, and in each buffer.
*/
dmasz -= dmasz & 1;
- count -= (count-start) & 1;
+ count -= count & 1;
currentsz -= currentsz & 1;
if (currentsz < 12)
currentsz = currentsz/6*2;
dmasz = dmasz/6*2;
- for (j = start; j + 3 < count; j += nr - 2 ) {
+ for (j = 0; j + 3 < count; j += nr - 2) {
nr = MIN2( currentsz, count - j );
if (nr >= 4) {
GLint quads = (nr/2)-1;
GLint i;
ELTS_VARS( ALLOC_ELTS( quads*6 ) );
- for ( i = j-start ; i < j-start+quads*2 ; i+=2 ) {
+ for (i = j; i < j + quads * 2; i += 2) {
EMIT_TWO_ELTS( 0, (i+0), (i+1) );
EMIT_TWO_ELTS( 2, (i+2), (i+1) );
EMIT_TWO_ELTS( 4, (i+3), (i+2) );
dmasz -= dmasz & 1;
currentsz = GET_CURRENT_VB_MAX_VERTS();
currentsz -= currentsz & 1;
- count -= (count-start) & 1;
+ count -= count & 1;
if (currentsz < 8) {
currentsz = dmasz;
}
- for (j = start; j + 3 < count; j += nr - 2 ) {
+ for (j = 0; j + 3 < count; j += nr - 2) {
nr = MIN2( currentsz, count - j );
- TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) );
+ TAG(emit_verts)(ctx, start + j, nr, ALLOC_VERTS(nr));
currentsz = dmasz;
}
/* Emit whole number of quads in total. dmasz is already a multiple
* of 4.
*/
- count -= (count-start)%4;
+ count -= count % 4;
currentsz = (GET_CURRENT_VB_MAX_VERTS()/4) * 4;
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count; j += nr) {
+ for (j = 0; j < count; j += nr) {
nr = MIN2( currentsz, count - j );
- TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) );
+ TAG(emit_verts)(ctx, start + j, nr, ALLOC_VERTS(nr));
currentsz = dmasz;
}
}
/* Emit whole number of quads in total, and in each buffer.
*/
dmasz -= dmasz & 3;
- count -= (count-start) & 3;
+ count -= count & 3;
currentsz -= currentsz & 3;
/* Adjust for rendering as triangles:
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count; j += nr ) {
+ for (j = 0; j < count; j += nr ) {
nr = MIN2( currentsz, count - j );
if (nr >= 4) {
GLint quads = nr/4;
GLint i;
ELTS_VARS( ALLOC_ELTS( quads*6 ) );
- for ( i = j-start ; i < j-start+quads*4 ; i+=4 ) {
+ for (i = j; i < j + quads * 4; i += 4) {
EMIT_TWO_ELTS( 0, (i+0), (i+1) );
EMIT_TWO_ELTS( 2, (i+3), (i+1) );
EMIT_TWO_ELTS( 4, (i+2), (i+3) );
INIT(GL_TRIANGLES);
- for (j = start; j < count-3; j += 4) {
+ for (j = 0; j < count-3; j += 4) {
void *tmp = ALLOC_VERTS( 6 );
/* Send v0, v1, v3
*/
- tmp = EMIT_VERTS(ctx, j, 2, tmp);
- tmp = EMIT_VERTS(ctx, j + 3, 1, tmp);
+ tmp = EMIT_VERTS(ctx, start + j, 2, tmp);
+ tmp = EMIT_VERTS(ctx, start + j + 3, 1, tmp);
/* Send v1, v2, v3
*/
- tmp = EMIT_VERTS(ctx, j + 1, 3, tmp);
+ tmp = EMIT_VERTS(ctx, start + j + 1, 3, tmp);
(void) tmp;
}
}
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count; j += nr ) {
+ for (j = 0; j < count; j += nr ) {
nr = MIN2( currentsz, count - j );
- TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) );
+ TAG(emit_elts)(ctx, elts + start + j, nr, ALLOC_ELTS(nr));
FLUSH();
currentsz = dmasz;
}
/* Emit whole number of lines in total and in each buffer:
*/
- count -= (count-start) & 1;
+ count -= count & 1;
currentsz -= currentsz & 1;
dmasz -= dmasz & 1;
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count; j += nr ) {
+ for (j = 0; j < count; j += nr ) {
nr = MIN2( currentsz, count - j );
- TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) );
+ TAG(emit_elts)(ctx, elts + start + j, nr, ALLOC_ELTS(nr));
FLUSH();
currentsz = dmasz;
}
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j + 1 < count; j += nr - 1 ) {
+ for (j = 0; j + 1 < count; j += nr - 1) {
nr = MIN2( currentsz, count - j );
- TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) );
+ TAG(emit_elts)( ctx, elts + start + j, nr, ALLOC_ELTS(nr));
FLUSH();
currentsz = dmasz;
}
ELT_INIT( GL_LINE_STRIP );
if (flags & PRIM_BEGIN)
- j = start;
+ j = 0;
else
- j = start + 1;
+ j = 1;
currentsz = GET_CURRENT_VB_MAX_ELTS();
if (currentsz < 8) {
nr = MIN2( currentsz, count - j );
if (j + nr >= count &&
- start < count - 1 &&
+ 0 < count - 1 &&
(flags & PRIM_END))
{
void *tmp;
tmp = ALLOC_ELTS(nr+1);
- tmp = TAG(emit_elts)( ctx, elts+j, nr, tmp );
+ tmp = TAG(emit_elts)(ctx, elts + start + j, nr, tmp);
tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp );
(void) tmp;
}
else {
- TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) );
+ TAG(emit_elts)(ctx, elts + start + j, nr, ALLOC_ELTS(nr));
currentsz = dmasz;
}
}
}
- else if (start + 1 < count && (flags & PRIM_END)) {
+ else if (1 < count && (flags & PRIM_END)) {
void *tmp;
tmp = ALLOC_ELTS(2);
tmp = TAG(emit_elts)( ctx, elts+start+1, 1, tmp );
/* Emit whole number of tris in total. dmasz is already a multiple
* of 3.
*/
- count -= (count-start)%3;
+ count -= count % 3;
currentsz -= currentsz%3;
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count; j += nr) {
+ for (j = 0; j < count; j += nr) {
nr = MIN2( currentsz, count - j );
- TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) );
+ TAG(emit_elts)(ctx, elts + start + j, nr, ALLOC_ELTS(nr));
FLUSH();
currentsz = dmasz;
}
dmasz -= (dmasz & 1);
currentsz -= (currentsz & 1);
- for (j = start ; j + 2 < count; j += nr - 2 ) {
+ for (j = 0; j + 2 < count; j += nr - 2) {
nr = MIN2( currentsz, count - j );
- TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) );
+ TAG(emit_elts)( ctx, elts + start + j, nr, ALLOC_ELTS(nr) );
FLUSH();
currentsz = dmasz;
}
currentsz = dmasz;
}
- for (j = start + 1 ; j + 1 < count; j += nr - 2 ) {
+ for (j = 1; j + 1 < count; j += nr - 2) {
void *tmp;
nr = MIN2( currentsz, count - j + 1 );
tmp = ALLOC_ELTS( nr );
tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp );
- tmp = TAG(emit_elts)( ctx, elts+j, nr - 1, tmp );
+ tmp = TAG(emit_elts)(ctx, elts + start + j, nr - 1, tmp);
(void) tmp;
FLUSH();
currentsz = dmasz;
currentsz = dmasz;
}
- for (j = start + 1 ; j + 1 < count; j += nr - 2 ) {
+ for (j = 1 ; j + 1 < count; j += nr - 2) {
void *tmp;
nr = MIN2( currentsz, count - j + 1 );
tmp = ALLOC_ELTS( nr );
tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp );
- tmp = TAG(emit_elts)( ctx, elts+j, nr - 1, tmp );
+ tmp = TAG(emit_elts)(ctx, elts + start + j, nr - 1, tmp);
(void) tmp;
FLUSH();
currentsz = dmasz;
/* Emit whole number of quads in total, and in each buffer.
*/
dmasz -= dmasz & 1;
- count -= (count-start) & 1;
+ count -= count & 1;
currentsz -= currentsz & 1;
if (currentsz < 12)
currentsz = currentsz/6*2;
dmasz = dmasz/6*2;
- for (j = start; j + 3 < count; j += nr - 2 ) {
+ for (j = 0; j + 3 < count; j += nr - 2) {
nr = MIN2( currentsz, count - j );
if (nr >= 4)
GLint quads = (nr/2)-1;
ELTS_VARS( ALLOC_ELTS( quads*6 ) );
- for ( i = j-start ; i < j-start+quads ; i++, elts += 2 ) {
+ for (i = j; i < j + quads; i++, elts += 2) {
EMIT_TWO_ELTS( 0, elts[0], elts[1] );
EMIT_TWO_ELTS( 2, elts[2], elts[1] );
EMIT_TWO_ELTS( 4, elts[3], elts[2] );
else {
ELT_INIT( GL_TRIANGLE_STRIP );
- for (j = start; j + 3 < count; j += nr - 2 ) {
+ for (j = 0; j + 3 < count; j += nr - 2) {
nr = MIN2( currentsz, count - j );
- TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) );
+ TAG(emit_elts)(ctx, elts + start + j, nr, ALLOC_ELTS(nr));
FLUSH();
currentsz = dmasz;
}
currentsz = GET_CURRENT_VB_MAX_ELTS()/4*4;
- count -= (count-start)%4;
+ count -= count % 4;
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count; j += nr) {
+ for (j = 0; j < count; j += nr) {
nr = MIN2( currentsz, count - j );
- TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) );
+ TAG(emit_elts)(ctx, elts + start + j, nr, ALLOC_ELTS(nr));
FLUSH();
currentsz = dmasz;
}
/* Emit whole number of quads in total, and in each buffer.
*/
dmasz -= dmasz & 3;
- count -= (count-start) & 3;
+ count -= count & 3;
currentsz -= currentsz & 3;
/* Adjust for rendering as triangles:
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j + 3 < count; j += nr - 2 ) {
+ for (j = 0; j + 3 < count; j += nr - 2) {
nr = MIN2( currentsz, count - j );
if (nr >= 4)
GLint i;
ELTS_VARS( ALLOC_ELTS( quads * 6 ) );
- for ( i = j-start ; i < j-start+quads ; i++, elts += 4 ) {
+ for (i = j; i < j + quads; i++, elts += 4) {
EMIT_TWO_ELTS( 0, elts[0], elts[1] );
EMIT_TWO_ELTS( 2, elts[3], elts[1] );
EMIT_TWO_ELTS( 4, elts[2], elts[3] );