home *** CD-ROM | disk | FTP | other *** search
-
- BitBlt(int swidth,int sheight,int ix,int iy,int iwidth,int iheight,char *image,int device) {
- register int pixel,count,ioffset,scan,yoffset;
- short bank;
- int width,height,nbanks,scansperbank,startscan,endscan,shortline;
-
- width = (swidth < iwidth) ? swidth : iwidth;
- height= (sheight< iheight)? sheight: iheight;
-
- nbanks = ((swidth * sheight) / 65536) + 1;
-
- scansperbank = 65536 / swidth;
-
- SetBank(device,0);
- count = 0;
- shortline = 65536 % swidth;
-
- for (bank = 1;bank < nbanks;bank++) {
-
- startscan = (bank - 1) * scansperbank;
- endscan = startscan + scansperbank;
-
- for (scan = startscan;scan < endscan - 1;scan++) {
- yoffset = iy + scan;
- ioffset = yoffset * iwidth + ix;
-
- for (pixel = 0;pixel < width;pixel++)
- screen[count + pixel] = image[ioffset + pixel];
-
- count += swidth;
- }
-
- if ((shortline < iwidth) && (shortline > 0)) {
- yoffset = iy + endscan - 1;
- ioffset = yoffset * iwidth + ix;
-
- for (pixel = 0;pixel < shortline;pixel++)
- screen[count + pixel] = image[ioffset + pixel];
-
- SetBank(device,bank);
- count = 0;
-
- for (pixel = shortline + 1;pixel < width;pixel++)
- screen[count + pixel] = image[ioffset + pixel];
- } else {
- SetBank(device,bank);
- count = 0;
- }
- }
- }
-
-