version 1.25 | | version 1.26 |
---|
| | |
#endif | | #endif |
bool ogl_ubitblt_tolinear(int w,int h,int dx,int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest){ | | bool ogl_ubitblt_tolinear(int w,int h,int dx,int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest){ |
#if 1 | | #if 1 |
grs_bitmap tmp; | | |
unsigned char *d,*s; | | unsigned char *d,*s; |
int i,j; | | int i,j; |
int w1,h1; | | int w1,h1; |
//char data[1024*1024]; | | |
char data[OGLTEXBUFSIZE/4]; | | |
// w1=w;h1=h; | | // w1=w;h1=h; |
w1=grd_curscreen->sc_w;h1=grd_curscreen->sc_h; | | w1=grd_curscreen->sc_w;h1=grd_curscreen->sc_h; |
if (w1*h1*4>OGLTEXBUFSIZE) | | if (w1*h1*4>OGLTEXBUFSIZE) |
| | |
// glReadPixels(sx,sy,w+sx,h+sy,GL_RGB,GL_UNSIGNED_BYTE,texbuf); | | // glReadPixels(sx,sy,w+sx,h+sy,GL_RGB,GL_UNSIGNED_BYTE,texbuf); |
}else | | }else |
memset(texbuf,0,w1*h1*3); | | memset(texbuf,0,w1*h1*3); |
//gr_init_bitmap( grs_bitmap *bm, int mode, int x, int y, int w, int h, int bytesperline, unsigned char * data ) // TODO: virtualize | | sx+=src->bm_x; |
gr_init_bitmap(&tmp,BM_LINEAR,0,0,w1,h1,w1,data); | | sy+=src->bm_y; |
d=data; | | for (i=0;i<h;i++){ |
for (i=0;i<h1;i++){ | | d=dest->bm_data+dx+(dy+i)*dest->bm_rowsize; |
s=texbuf+(h1-(i+1))*w1*3; | | s=texbuf+((h1-(i+sy+1))*w1+sx)*3; |
for (j=0;j<w1;j++){ | | for (j=0;j<w;j++){ |
*d=gr_find_closest_color(s[0]/4,s[1]/4,s[2]/4); | | *d=gr_find_closest_color(s[0]/4,s[1]/4,s[2]/4); |
s+=3; | | s+=3; |
d++; | | d++; |
} | | } |
} | | } |
sx+=src->bm_x; | | |
sy+=src->bm_y; | | |
gr_bm_ubitbltm(w,h,dx,dy,sx,sy,&tmp,dest); | | |
// gr_bm_ubitbltm(w,h,dx,dy,0,0,&tmp,dest); | | |
#else | | #else |
int i,j,c=0; | | int i,j,c=0; |
unsigned char *d,*s,*e; | | unsigned char *d,*s,*e; |