unsigned char gr_gpixel( grsBitmap * bitmap, int x, int y ) { if ((x<0) || (y<0) || (x>=bitmap->bmProps.w) || (y>=bitmap->bmProps.h)) return 0; #ifdef __DJGPP__ switch(bitmap->bmProps.nType) { case BM_LINEAR: #endif return bitmap->bmTexBuf[ bitmap->bmProps.rowSize*y + x ]; #ifdef __DJGPP__ case BM_MODEX: x += bitmap->bmProps.x; y += bitmap->bmProps.y; gr_modex_setplane( x & 3 ); return gr_video_memory[(bitmap->bmProps.rowSize * y) + (x/4)]; case BM_SVGA: { unsigned int offset; offset = (unsigned int)bitmap->bmTexBuf + (unsigned int)bitmap->bmProps.rowSize * y + x; gr_vesa_setpage( offset >> 16 ); return gr_video_memory[offset & 0xFFFF]; } } return 0; #endif }
// From Linear to ModeX void gr_bm_ubitblt01(int w, int h, int dx, int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest) { ubyte * dbits; ubyte * sbits; int sstep,dstep; int y,plane; int w1; if ( w < 4 ) return; sstep = src->bm_rowsize; dstep = dest->bm_rowsize << gr_bitblt_dest_step_shift; if (!gr_bitblt_double) { for (plane=0; plane<4; plane++ ) { gr_modex_setplane( (plane+dx)&3 ); sbits = src->bm_data + (src->bm_rowsize * sy) + sx + plane; dbits = &gr_video_memory[(dest->bm_rowsize * dy) + ((plane+dx)/4) ]; w1 = w >> 2; if ( (w&3) > plane ) w1++; for (y=dy; y < dy+h; y++ ) { modex_copy_scanline( sbits, dbits, w1 ); dbits += dstep; sbits += sstep; } } } else { for (plane=0; plane<4; plane++ ) {
unsigned char gr_gpixel( grs_bitmap * bitmap, int x, int y ) { if ((x<0) || (y<0) || (x>=bitmap->bm_w) || (y>=bitmap->bm_h)) return 0; #ifdef __MSDOS__ switch(bitmap->bm_type) { case BM_LINEAR: #endif return bitmap->bm_data[ bitmap->bm_rowsize*y + x ]; #ifdef __MSDOS__ case BM_MODEX: x += bitmap->bm_x; y += bitmap->bm_y; gr_modex_setplane( x & 3 ); return gr_video_memory[(bitmap->bm_rowsize * y) + (x/4)]; case BM_SVGA: { unsigned int offset; offset = (unsigned int)bitmap->bm_data + (unsigned int)bitmap->bm_rowsize * y + x; gr_vesa_setpage( offset >> 16 ); return gr_video_memory[offset & 0xFFFF]; } } return 0; #endif }
unsigned char gr_ugpixel( grs_bitmap * bitmap, int x, int y ) { switch(bitmap->bm_type) { case BM_LINEAR: return bitmap->bm_data[ bitmap->bm_rowsize*y + x ]; case BM_MODEX: x += bitmap->bm_x; y += bitmap->bm_y; gr_modex_setplane( x & 3 ); return gr_video_memory[(bitmap->bm_rowsize * y) + (x/4)]; case BM_SVGA: { unsigned int offset; offset = (unsigned int)bitmap->bm_data + (unsigned int)bitmap->bm_rowsize * y + x; gr_vesa_setpage( offset >> 16 ); return gr_video_memory[offset & 0xFFFF]; } } return 0; }