version 1.13, 2009/08/21 07:29:37 |
version 1.14, 2009/09/15 15:14:09 |
|
|
|
|
/* Expand line to fit to cell. */ |
/* Expand line to fit to cell. */ |
void |
void |
grid_expand_line(struct grid *gd, u_int py, u_int wantx) |
grid_expand_line(struct grid *gd, u_int py, u_int sx) |
{ |
{ |
struct grid_line *gl; |
struct grid_line *gl; |
u_int xx, sx; |
u_int xx; |
|
|
gl = &gd->linedata[py]; |
gl = &gd->linedata[py]; |
if (wantx <= gl->cellsize) |
if (sx <= gl->cellsize) |
return; |
return; |
|
|
if (gl->cellsize > gd->sx / 2) |
|
sx = gd->sx; |
|
else { |
|
sx = gl->cellsize + 1; |
|
while (sx < wantx) |
|
sx *= 2; |
|
} |
|
gl->celldata = xrealloc(gl->celldata, sx, sizeof *gl->celldata); |
gl->celldata = xrealloc(gl->celldata, sx, sizeof *gl->celldata); |
for (xx = gl->cellsize; xx < sx; xx++) |
for (xx = gl->cellsize; xx < sx; xx++) |
grid_put_cell(gd, xx, py, &grid_default_cell); |
grid_put_cell(gd, xx, py, &grid_default_cell); |
|
|
grid_put_utf8(gd, px, py, gc); |
grid_put_utf8(gd, px, py, gc); |
} |
} |
|
|
/* |
/* Clear area. */ |
* Clear area. Note this is different from a fill as it just omits unallocated |
|
* cells. |
|
*/ |
|
void |
void |
grid_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny) |
grid_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny) |
{ |
{ |
|
|
return; |
return; |
|
|
for (yy = py; yy < py + ny; yy++) { |
for (yy = py; yy < py + ny; yy++) { |
|
if (px >= gd->linedata[yy].cellsize) |
|
continue; |
|
if (px + nx >= gd->linedata[yy].cellsize) { |
|
gd->linedata[yy].cellsize = px; |
|
continue; |
|
} |
for (xx = px; xx < px + nx; xx++) { |
for (xx = px; xx < px + nx; xx++) { |
if (xx >= gd->linedata[yy].cellsize) |
if (xx >= gd->linedata[yy].cellsize) |
break; |
break; |