From 166f15617dda22638a85c64864d284565e20c07c Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 30 Nov 2014 22:09:18 +0000 Subject: [PATCH] Pass ogl_ubitmapm_cs arg by & --- common/2d/bitblt.cpp | 8 ++++---- common/include/ogl_init.h | 2 +- similar/2d/font.cpp | 4 ++-- similar/arch/ogl/ogl.cpp | 38 +++++++++++++++++++------------------- similar/main/gamerend.cpp | 6 +++--- similar/main/gauges.cpp | 6 +++--- similar/main/menu.cpp | 2 +- similar/main/state.cpp | 2 +- similar/main/titles.cpp | 6 +++--- 9 files changed, 37 insertions(+), 37 deletions(-) diff --git a/common/2d/bitblt.cpp b/common/2d/bitblt.cpp index 19fd42465..d9c55ee01 100644 --- a/common/2d/bitblt.cpp +++ b/common/2d/bitblt.cpp @@ -183,7 +183,7 @@ void gr_ubitmap( int x, int y, grs_bitmap *bm ) return; #ifdef OGL case BM_OGL: - ogl_ubitmapm_cs(x,y,-1,-1,bm,-1,F1_0); + ogl_ubitmapm_cs(x,y,-1,-1,*bm,-1,F1_0); return; #endif default: @@ -213,7 +213,7 @@ void gr_ubitmapm( int x, int y, grs_bitmap *bm ) return; #ifdef OGL case BM_OGL: - ogl_ubitmapm_cs(x,y,-1,-1,bm,-1,F1_0); + ogl_ubitmapm_cs(x,y,-1,-1,*bm,-1,F1_0); return; #endif default: @@ -359,7 +359,7 @@ void gr_bitmap( int x, int y, grs_bitmap *bm ) if ((dy1 >= grd_curcanv->cv_bitmap.bm_h) || (dy2 < 0)) return; // Draw bitmap bm[x,y] into (dx1,dy1)-(dx2,dy2) #ifdef OGL - ogl_ubitmapm_cs(x, y, 0, 0, bm, -1, F1_0); + ogl_ubitmapm_cs(x, y, 0, 0, *bm, -1, F1_0); #else if ( dx1 < 0 ) { @@ -569,7 +569,7 @@ void show_fullscr(grs_bitmap *bm) if(bm->bm_type == BM_LINEAR && scr->bm_type == BM_OGL && bm->bm_w <= grd_curscreen->sc_w && bm->bm_h <= grd_curscreen->sc_h) // only scale with OGL if bitmap is not bigger than screen size { - ogl_ubitmapm_cs(0,0,-1,-1,bm,-1,F1_0);//use opengl to scale, faster and saves ram. -MPM + ogl_ubitmapm_cs(0,0,-1,-1,*bm,-1,F1_0);//use opengl to scale, faster and saves ram. -MPM return; } #endif diff --git a/common/include/ogl_init.h b/common/include/ogl_init.h index c601159a4..83284dee3 100644 --- a/common/include/ogl_init.h +++ b/common/include/ogl_init.h @@ -99,7 +99,7 @@ void ogl_set_screen_mode(void); void ogl_cache_level_textures(void); void ogl_urect(int left, int top, int right, int bot); -bool ogl_ubitmapm_cs(int x, int y,int dw, int dh, grs_bitmap *bm,int c, int scale); +bool ogl_ubitmapm_cs(int x, int y,int dw, int dh, grs_bitmap &bm,int c, int scale); bool ogl_ubitblt_i(int dw, int dh, int dx, int dy, int sw, int sh, int sx, int sy, grs_bitmap * src, grs_bitmap * dest, int texfilt); bool ogl_ubitblt(int w, int h, int dx, int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest); void ogl_upixelc(int x, int y, int c); diff --git a/similar/2d/font.cpp b/similar/2d/font.cpp index 8e13ca62a..7688cdd65 100644 --- a/similar/2d/font.cpp +++ b/similar/2d/font.cpp @@ -774,10 +774,10 @@ static int ogl_internal_string(int x, int y, const char *s ) ft_w = grd_curcanv->cv_font->ft_w; if (grd_curcanv->cv_font->ft_flags&FT_COLOR) - ogl_ubitmapm_cs(xx,yy,FONTSCALE_X(ft_w),FONTSCALE_Y(grd_curcanv->cv_font->ft_h),&grd_curcanv->cv_font->ft_bitmaps[letter],-1,F1_0); + ogl_ubitmapm_cs(xx,yy,FONTSCALE_X(ft_w),FONTSCALE_Y(grd_curcanv->cv_font->ft_h),grd_curcanv->cv_font->ft_bitmaps[letter],-1,F1_0); else{ if (grd_curcanv->cv_bitmap.bm_type==BM_OGL) - ogl_ubitmapm_cs(xx,yy,ft_w*(FONTSCALE_X(grd_curcanv->cv_font->ft_w)/grd_curcanv->cv_font->ft_w),FONTSCALE_Y(grd_curcanv->cv_font->ft_h),&grd_curcanv->cv_font->ft_bitmaps[letter],grd_curcanv->cv_font_fg_color,F1_0); + ogl_ubitmapm_cs(xx,yy,ft_w*(FONTSCALE_X(grd_curcanv->cv_font->ft_w)/grd_curcanv->cv_font->ft_w),FONTSCALE_Y(grd_curcanv->cv_font->ft_h),grd_curcanv->cv_font->ft_bitmaps[letter],grd_curcanv->cv_font_fg_color,F1_0); else Error("ogl_internal_string: non-color string to non-ogl dest\n"); } diff --git a/similar/arch/ogl/ogl.cpp b/similar/arch/ogl/ogl.cpp index f9fdd85a1..3089a888d 100644 --- a/similar/arch/ogl/ogl.cpp +++ b/similar/arch/ogl/ogl.cpp @@ -1644,7 +1644,7 @@ void ogl_freebmtexture(grs_bitmap *bm){ /* * Menu / gauges */ -bool ogl_ubitmapm_cs(int x, int y,int dw, int dh, grs_bitmap *bm,int c, int scale) // to scale bitmaps +bool ogl_ubitmapm_cs(int x, int y,int dw, int dh, grs_bitmap &bm,int c, int scale) // to scale bitmaps { GLfloat xo,yo,xf,yf,u1,u2,v1,v2,color_r,color_g,color_b,h; GLfloat color_array[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; @@ -1654,9 +1654,9 @@ bool ogl_ubitmapm_cs(int x, int y,int dw, int dh, grs_bitmap *bm,int c, int scal x+=grd_curcanv->cv_bitmap.bm_x; y+=grd_curcanv->cv_bitmap.bm_y; xo=x/(float)last_width; - xf=(bm->bm_w+x)/(float)last_width; + xf=(bm.bm_w+x)/(float)last_width; yo=1.0-y/(float)last_height; - yf=1.0-(bm->bm_h+y)/(float)last_height; + yf=1.0-(bm.bm_h+y)/(float)last_height; glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); @@ -1665,11 +1665,11 @@ bool ogl_ubitmapm_cs(int x, int y,int dw, int dh, grs_bitmap *bm,int c, int scal if (dw < 0) dw = grd_curcanv->cv_bitmap.bm_w; else if (dw == 0) - dw = bm->bm_w; + dw = bm.bm_w; if (dh < 0) dh = grd_curcanv->cv_bitmap.bm_h; else if (dh == 0) - dh = bm->bm_h; + dh = bm.bm_h; h = (double) scale / (double) F1_0; @@ -1679,28 +1679,28 @@ bool ogl_ubitmapm_cs(int x, int y,int dw, int dh, grs_bitmap *bm,int c, int scal yf = 1.0 - (dh + y) / ((double) last_height * h); OGL_ENABLE(TEXTURE_2D); - ogl_bindbmtex(*bm); - ogl_texwrap(bm->gltexture,GL_CLAMP_TO_EDGE); + ogl_bindbmtex(bm); + ogl_texwrap(bm.gltexture,GL_CLAMP_TO_EDGE); - if (bm->bm_x==0){ + if (bm.bm_x==0){ u1=0; - if (bm->bm_w==bm->gltexture->w) - u2=bm->gltexture->u; + if (bm.bm_w==bm.gltexture->w) + u2=bm.gltexture->u; else - u2=(bm->bm_w+bm->bm_x)/(float)bm->gltexture->tw; + u2=(bm.bm_w+bm.bm_x)/(float)bm.gltexture->tw; }else { - u1=bm->bm_x/(float)bm->gltexture->tw; - u2=(bm->bm_w+bm->bm_x)/(float)bm->gltexture->tw; + u1=bm.bm_x/(float)bm.gltexture->tw; + u2=(bm.bm_w+bm.bm_x)/(float)bm.gltexture->tw; } - if (bm->bm_y==0){ + if (bm.bm_y==0){ v1=0; - if (bm->bm_h==bm->gltexture->h) - v2=bm->gltexture->v; + if (bm.bm_h==bm.gltexture->h) + v2=bm.gltexture->v; else - v2=(bm->bm_h+bm->bm_y)/(float)bm->gltexture->th; + v2=(bm.bm_h+bm.bm_y)/(float)bm.gltexture->th; }else{ - v1=bm->bm_y/(float)bm->gltexture->th; - v2=(bm->bm_h+bm->bm_y)/(float)bm->gltexture->th; + v1=bm.bm_y/(float)bm.gltexture->th; + v2=(bm.bm_h+bm.bm_y)/(float)bm.gltexture->th; } if (c < 0) { diff --git a/similar/main/gamerend.cpp b/similar/main/gamerend.cpp index e5fd090cc..6915b1b72 100644 --- a/similar/main/gamerend.cpp +++ b/similar/main/gamerend.cpp @@ -704,7 +704,7 @@ static void update_cockpits() bm=&GameBitmaps[cockpit_bitmap[mode].index]; gr_set_current_canvas(NULL); #ifdef OGL - ogl_ubitmapm_cs (0, 0, -1, -1, bm, 255, F1_0); + ogl_ubitmapm_cs (0, 0, -1, -1, *bm, 255, F1_0); #else gr_ubitmapm(0,0, bm); #endif @@ -714,7 +714,7 @@ static void update_cockpits() bm=&GameBitmaps[cockpit_bitmap[mode].index]; gr_set_current_canvas(NULL); #ifdef OGL - ogl_ubitmapm_cs (0, 0, -1, -1, bm, 255, F1_0); + ogl_ubitmapm_cs (0, 0, -1, -1, *bm, 255, F1_0); #else gr_ubitmapm(0,0, bm); #endif @@ -728,7 +728,7 @@ static void update_cockpits() bm=&GameBitmaps[cockpit_bitmap[mode].index]; gr_set_current_canvas(NULL); #ifdef OGL - ogl_ubitmapm_cs (0, (HIRESMODE?(SHEIGHT*2)/2.6:(SHEIGHT*2)/2.72), -1, ((int) ((double) (bm->bm_h) * (HIRESMODE?(double)SHEIGHT/480:(double)SHEIGHT/200) + 0.5)), bm,255, F1_0); + ogl_ubitmapm_cs (0, (HIRESMODE?(SHEIGHT*2)/2.6:(SHEIGHT*2)/2.72), -1, ((int) ((double) (bm->bm_h) * (HIRESMODE?(double)SHEIGHT/480:(double)SHEIGHT/200) + 0.5)), *bm,255, F1_0); #else gr_ubitmapm(0,SHEIGHT-bm->bm_h,bm); #endif diff --git a/similar/main/gauges.cpp b/similar/main/gauges.cpp index 434e07e14..12c09cabb 100644 --- a/similar/main/gauges.cpp +++ b/similar/main/gauges.cpp @@ -723,7 +723,7 @@ const span weapon_window_right_hires[] = { static inline void hud_bitblt_free (int x, int y, int w, int h, grs_bitmap *bm) { #ifdef OGL - ogl_ubitmapm_cs (x,y,w,h,bm,-1,F1_0); + ogl_ubitmapm_cs (x,y,w,h,*bm,-1,F1_0); #else gr_ubitmapm(x, y, bm); #endif @@ -732,7 +732,7 @@ static inline void hud_bitblt_free (int x, int y, int w, int h, grs_bitmap *bm) static inline void hud_bitblt (int x, int y, grs_bitmap *bm) { #ifdef OGL - ogl_ubitmapm_cs (x,y,HUD_SCALE_X (bm->bm_w),HUD_SCALE_Y (bm->bm_h),bm,-1,F1_0); + ogl_ubitmapm_cs (x,y,HUD_SCALE_X (bm->bm_w),HUD_SCALE_Y (bm->bm_h),*bm,-1,F1_0); #else gr_ubitmapm(x, y, bm); #endif @@ -1804,7 +1804,7 @@ static void cockpit_decode_alpha(grs_bitmap *bm) gr_init_bitmap (&deccpt, 0, 0, 0, bm->bm_w, bm->bm_h, bm->bm_w, cockpitbuf); gr_set_transparent(&deccpt,1); #ifdef OGL - ogl_ubitmapm_cs (0, 0, -1, -1, &deccpt, 255, F1_0); // render one time to init the texture + ogl_ubitmapm_cs (0, 0, -1, -1, deccpt, 255, F1_0); // render one time to init the texture #endif WinBoxOverlay[0] = gr_create_sub_bitmap(&deccpt,(PRIMARY_W_BOX_LEFT)-2,(PRIMARY_W_BOX_TOP)-2,(PRIMARY_W_BOX_RIGHT-PRIMARY_W_BOX_LEFT+4),(PRIMARY_W_BOX_BOT-PRIMARY_W_BOX_TOP+4)); WinBoxOverlay[1] = gr_create_sub_bitmap(&deccpt,(SECONDARY_W_BOX_LEFT)-2,(SECONDARY_W_BOX_TOP)-2,(SECONDARY_W_BOX_RIGHT-SECONDARY_W_BOX_LEFT)+4,(SECONDARY_W_BOX_BOT-SECONDARY_W_BOX_TOP)+4); diff --git a/similar/main/menu.cpp b/similar/main/menu.cpp index 9482805f6..8d761c738 100644 --- a/similar/main/menu.cpp +++ b/similar/main/menu.cpp @@ -2141,7 +2141,7 @@ static window_event_result gamebitmaps_viewer_handler(window *wind,const d_event gr_clear_canvas( BM_XRGB(0,0,0) ); #ifdef OGL scale = (bm->bm_w > bm->bm_h)?(SHEIGHT/bm->bm_w)*0.8:(SHEIGHT/bm->bm_h)*0.8; - ogl_ubitmapm_cs((SWIDTH/2)-(bm->bm_w*scale/2),(SHEIGHT/2)-(bm->bm_h*scale/2),bm->bm_w*scale,bm->bm_h*scale,bm,-1,F1_0); + ogl_ubitmapm_cs((SWIDTH/2)-(bm->bm_w*scale/2),(SHEIGHT/2)-(bm->bm_h*scale/2),bm->bm_w*scale,bm->bm_h*scale,*bm,-1,F1_0); #else gr_bitmap((SWIDTH/2)-(bm->bm_w/2), (SHEIGHT/2)-(bm->bm_h/2), bm); #endif diff --git a/similar/main/state.cpp b/similar/main/state.cpp index faeb8222b..2d2b5ccd8 100644 --- a/similar/main/state.cpp +++ b/similar/main/state.cpp @@ -599,7 +599,7 @@ static int state_callback(newmenu *menu,const d_event &event, arraycv_bitmap.bm_w/2)-FSPACX(THUMBNAIL_W/2),items[0].y-3, &temp_canv->cv_bitmap); #else - ogl_ubitmapm_cs((grd_curcanv->cv_bitmap.bm_w/2)-FSPACX(THUMBNAIL_W/2),items[0].y-FSPACY(3),FSPACX(THUMBNAIL_W),FSPACY(THUMBNAIL_H),&temp_canv->cv_bitmap,-1,F1_0); + ogl_ubitmapm_cs((grd_curcanv->cv_bitmap.bm_w/2)-FSPACX(THUMBNAIL_W/2),items[0].y-FSPACY(3),FSPACX(THUMBNAIL_W),FSPACY(THUMBNAIL_H),temp_canv->cv_bitmap,-1,F1_0); #endif } diff --git a/similar/main/titles.cpp b/similar/main/titles.cpp index e38eef0ba..393bbfa2e 100644 --- a/similar/main/titles.cpp +++ b/similar/main/titles.cpp @@ -1002,7 +1002,7 @@ static void show_animated_bitmap(briefing *br) bitmap_ptr = &GameBitmaps[bi.index]; PIGGY_PAGE_IN( bi ); #ifdef OGL - ogl_ubitmapm_cs(rescale_x(220), rescale_y(45),bitmap_ptr->bm_w*scale,bitmap_ptr->bm_h*scale,bitmap_ptr,255,F1_0); + ogl_ubitmapm_cs(rescale_x(220), rescale_y(45),bitmap_ptr->bm_w*scale,bitmap_ptr->bm_h*scale,*bitmap_ptr,255,F1_0); #else gr_bitmapm(rescale_x(220), rescale_y(45), bitmap_ptr); #endif @@ -1070,7 +1070,7 @@ static void show_animated_bitmap(briefing *br) bitmap_ptr = &GameBitmaps[bi.index]; PIGGY_PAGE_IN( bi ); #ifdef OGL - ogl_ubitmapm_cs(0,0,bitmap_ptr->bm_w*scale,bitmap_ptr->bm_h*scale,bitmap_ptr,255,F1_0); + ogl_ubitmapm_cs(0,0,bitmap_ptr->bm_w*scale,bitmap_ptr->bm_h*scale,*bitmap_ptr,255,F1_0); #else gr_bitmapm(0, 0, bitmap_ptr); #endif @@ -1110,7 +1110,7 @@ static void show_briefing_bitmap(grs_bitmap *bmp) else scale = ((float)SHEIGHT/(HIRESMODE ? 480 : 200)); - ogl_ubitmapm_cs(0,0,bmp->bm_w*scale,bmp->bm_h*scale,bmp,255,F1_0); + ogl_ubitmapm_cs(0,0,bmp->bm_w*scale,bmp->bm_h*scale,*bmp,255,F1_0); #else gr_bitmapm(0, 0, bmp); #endif