src/test/resources/protrend.c
/* vline: Draw a vertical line on screen, with a different color pixel in top & bottom */
Draw a vertical line on screen, with a different color pixel in top & bottom
Draw a vertical line on screen with a different color pixel in top & bottom
static void vline(int x, int y1, int y2, int top, int middle, int bottom) {
    int *pix = (int*) surface->pixels;
    y1 = clamp(y1, 0, H - 1);
    y2 = clamp(y2, 0, H - 1);
    if (y2 == y1)
        pix[y1 * W + x] = middle;
    else if (y2 > y1) {
        pix[y1 * W + x] = top;
        for (int y = y1 + 1; y < y2; ++y) pix[y * W + x] = middle;
        pix[y2 * W + x] = bottom;
    }
}
static void vline ( int x , int y1 , int y2 , int top , int middle , int bottom ) { int * pix = ( int * ) surface -> pixels ; y1 = clamp ( y1 , 0 , H - 1 ) ; y2 = clamp ( y2 , 0 , H - 1 ) ; if ( y2 == y1 ) pix [ y1 * W + x ] = middle ; else if ( y2 > y1 ) { pix [ y1 * W + x ] = top ; for ( int y = y1 + 1 ; y < y2 ; ++ y ) pix [ y * W + x ] = middle ; pix [ y2 * W + x ] = bottom ; } }
vline: Draw a vertical line on screen, with a different color pixel in top & bottom
vline : Draw a vertical line on screen with a different color pixel in top & bottom