Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 694 → Rev 693

/shark/trunk/ports/snapshot/snapshot.c
64,7 → 64,7
{
void* tmp;
 
if ((wx<=0) || (wy<=0) || (nbuff<0) || (nbuff>15)){
if ((wx<=0) || (wy<=0) || (nbuff<=0) || (nbuff>15)){
return NULL;
}
 
92,9 → 92,13
 
void snapshot_grab(int nbuff)
{
extern void *video_memory;
int i;
SYS_FLAGS f;
 
memcpy(sslot[nbuff].buff,video_memory,sslot[nbuff].wx * sslot[nbuff].wy * sslot[nbuff].bytesperpixel);
f = kern_fsave();
for (i = 0; i < sslot[nbuff].wx * sslot[nbuff].wy; i++)
*(int *)(sslot[nbuff].buff + i*2)= (int)grx_getpixel(i % sslot[nbuff].wx,i / sslot[nbuff].wx);
kern_frestore(f);
 
}
 
136,9 → 140,9
cprintf(out_st);
 
for (i = 0; i < sslot[nbuff].wx * sslot[nbuff].wy; i++) {
col_r = ((*(int *)(sslot[nbuff].buff + i*2) & 0xF800) >> 11) << 3;
col_g = ((*(int *)(sslot[nbuff].buff + i*2) & 0x07E0) >> 5) << 2;
col_b = (*(int *)(sslot[nbuff].buff + i*2) & 0x001F) << 3;
col_r = ((*(int *)(sslot[nbuff].buff + i*2) & 0xF800) >> 11) * 4;
col_g = ((*(int *)(sslot[nbuff].buff + i*2) & 0x07E0) >> 5) * 2;
col_b = (*(int *)(sslot[nbuff].buff + i*2) & 0x001F) * 4;
sprintf(out_st, "%d %d %d ", col_r, col_g, col_b);
DOS_fwrite(out_st, strlen(out_st), 1, outf);
}