home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Kyūkyoku!! X68000 Emulator
/
X68000Book.dat
/
mac
/
OLS
/
X68000
/
Ko-Window
/
kow142s.lzh
/
corlib
/
SheetCut.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-04-09
|
2KB
|
63 lines
/*
SheetCut.c Ko-Window âëâCâuâëâè 1991 żè}î┤öÄöV
SPS-NET: SPS0783 COR.
Sheet é╠öCê╙é╠ê╩Æué⌐éτüAöCê╙é╠æσé½é│é╠ Sheet é≡ĵéΦÅoé╖üB
*/
#include <wlib.h>
unsigned short mask[]= {
0x0000, 0x8000, 0xc000, 0xe000,
0xf000, 0xf800, 0xfc00, 0xfe00,
0xff00, 0xff80, 0xffc0, 0xffe0,
0xfff0, 0xfff8, 0xfffc, 0xfffe, 0xffff
};
SheetCut( sp, cp, x, y )
Sheet *sp, /* î│âfü[â^ */
*cp; /* ĵéΦÅoé╖âoâbâtâ@ */
unsigned int x, /* É╪éΦÅoé╖ì└òW */
y;
{
unsigned int dy = sp->hword+ sp->hword,
byte= dy*y + ((x&0xfff0)>>3),
bit = x & 15;
if( bit ){
unsigned int bsize = (((bit+cp->h)&0xfff0)>>3)+2,
i= cp->v;
unsigned short sbuf[64],
*sptr= (unsigned short*)(((char*)sp->buf1)+byte),
*sptr2=(unsigned short*)(((char*)sp->buf2)+byte),
*cptr= (unsigned short*)cp->buf1,
*cptr2=(unsigned short*)cp->buf2,
mskpat= mask[ cp->h - (cp->hword-1)*16 ];
do{
memcpyW( bsize>>1, sbuf, sptr );
shiftL( bit, bsize, sbuf );
memcpyW( cp->hword, cptr, sbuf );
cptr[ cp->hword-1 ] &= mskpat;
cptr+= cp->hword;
sptr+= sp->hword;
memcpyW( bsize>>1, sbuf, sptr2 );
shiftL( bit, bsize, sbuf );
memcpyW( cp->hword, cptr2, sbuf );
cptr2[ cp->hword-1 ] &= mskpat;
cptr2+= cp->hword;
sptr2+= sp->hword;
}while( --i );
}else{
dy= (sp->hword - cp->hword)*2;
Scpy( dy, cp->v, cp->buf1, ((char*)sp->buf1)+byte, cp->hword );
Scpy( dy, cp->v, cp->buf2, ((char*)sp->buf2)+byte, cp->hword );
}
}