@@ -320,8 +320,7 @@ static const GLfloat white_color[16] = {
320320 */
321321static void gl2_set_viewport (gl2_t * gl ,
322322 unsigned vp_width , unsigned vp_height ,
323- bool force_full , bool allow_rotate ,
324- bool video_scale_integer );
323+ bool force_full , bool allow_rotate );
325324
326325#ifdef IOS
327326/* There is no default frame buffer on iOS. */
@@ -947,7 +946,7 @@ static void gl2_raster_font_setup_viewport(
947946 bool full_screen ,
948947 bool video_scale_integer )
949948{
950- gl2_set_viewport (gl , width , height , full_screen , true, video_scale_integer );
949+ gl2_set_viewport (gl , width , height , full_screen , true);
951950
952951 glEnable (GL_BLEND );
953952 glBlendFunc (GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA );
@@ -1059,7 +1058,7 @@ static void gl2_raster_font_render_msg(
10591058 /* Restore viewport */
10601059 glBindTexture (GL_TEXTURE_2D , gl -> texture [gl -> tex_index ]);
10611060 glDisable (GL_BLEND );
1062- gl2_set_viewport (gl , width , height , false, true, video_scale_integer );
1061+ gl2_set_viewport (gl , width , height , false, true);
10631062 }
10641063}
10651064
@@ -1091,7 +1090,7 @@ static void gl2_raster_font_flush_block(unsigned width, unsigned height,
10911090 glBindTexture (GL_TEXTURE_2D , gl -> texture [gl -> tex_index ]);
10921091
10931092 glDisable (GL_BLEND );
1094- gl2_set_viewport (gl , width , height , block -> fullscreen , true, video_scale_integer );
1093+ gl2_set_viewport (gl , width , height , block -> fullscreen , true);
10951094}
10961095
10971096static void gl2_raster_font_bind_block (void * data , void * userdata )
@@ -1274,48 +1273,21 @@ static void gl2_set_projection(gl2_t *gl,
12741273static void gl2_set_viewport (gl2_t * gl ,
12751274 unsigned vp_width ,
12761275 unsigned vp_height ,
1277- bool force_full , bool allow_rotate ,
1278- bool video_scale_integer )
1276+ bool force_full , bool allow_rotate )
12791277{
1280- float device_aspect = (float )vp_width / (float )vp_height ;
1281-
1282- if (gl -> ctx_driver -> translate_aspect )
1283- device_aspect = gl -> ctx_driver -> translate_aspect (
1284- gl -> ctx_data , vp_width , vp_height );
1285-
1286- if (video_scale_integer && !force_full )
1287- {
1288- video_viewport_get_scaled_integer (& gl -> vp ,
1289- vp_width , vp_height ,
1290- video_driver_get_aspect_ratio (),
1291- (gl -> flags & GL2_FLAG_KEEP_ASPECT ) ? true : false,
1292- false);
1293- vp_width = gl -> vp .width ;
1294- vp_height = gl -> vp .height ;
1295- }
1296- else if ((gl -> flags & GL2_FLAG_KEEP_ASPECT ) && !force_full )
1297- {
1298- gl -> vp .full_height = gl -> video_height ;
1299- video_viewport_get_scaled_aspect2 (& gl -> vp , vp_width , vp_height ,
1300- false, device_aspect , video_driver_get_aspect_ratio ());
1301- vp_width = gl -> vp .width ;
1302- vp_height = gl -> vp .height ;
1303- }
1304- else
1305- {
1306- gl -> vp .x = gl -> vp .y = 0 ;
1307- gl -> vp .width = vp_width ;
1308- gl -> vp .height = vp_height ;
1309- }
1278+ gl -> vp .full_width = vp_width ;
1279+ gl -> vp .full_height = vp_height ;
1280+ video_driver_update_viewport (& gl -> vp , force_full ,
1281+ (gl -> flags & GL2_FLAG_KEEP_ASPECT ) ? true : false, false);
13101282
13111283 glViewport (gl -> vp .x , gl -> vp .y , gl -> vp .width , gl -> vp .height );
13121284 gl2_set_projection (gl , & default_ortho , allow_rotate );
13131285
13141286 /* Set last backbuffer viewport. */
13151287 if (!force_full )
13161288 {
1317- gl -> out_vp_width = vp_width ;
1318- gl -> out_vp_height = vp_height ;
1289+ gl -> out_vp_width = gl -> vp . width ;
1290+ gl -> out_vp_height = gl -> vp . height ;
13191291 }
13201292}
13211293
@@ -1382,8 +1354,7 @@ static void gl2_renderchain_render(
13821354
13831355 /* Render to FBO with certain size. */
13841356 gl2_set_viewport (gl ,
1385- rect -> img_width , rect -> img_height , true, false,
1386- video_scale_integer );
1357+ rect -> img_width , rect -> img_height , true, false);
13871358
13881359 params .vp_width = gl -> out_vp_width ;
13891360 params .vp_height = gl -> out_vp_height ;
@@ -1449,7 +1420,7 @@ static void gl2_renderchain_render(
14491420 glGenerateMipmap (GL_TEXTURE_2D );
14501421
14511422 glClear (GL_COLOR_BUFFER_BIT );
1452- gl2_set_viewport (gl , width , height , false, true, video_scale_integer );
1423+ gl2_set_viewport (gl , width , height , false, true);
14531424
14541425 params .vp_width = gl -> out_vp_width ;
14551426 params .vp_height = gl -> out_vp_height ;
@@ -1866,8 +1837,7 @@ static void gl2_renderchain_start_render(gl2_t *gl,
18661837
18671838 gl2_set_viewport (gl ,
18681839 gl -> fbo_rect [0 ].img_width ,
1869- gl -> fbo_rect [0 ].img_height , true, false,
1870- video_scale_integer );
1840+ gl -> fbo_rect [0 ].img_height , true, false);
18711841
18721842 /* Need to preserve the "flipped" state when in FBO
18731843 * as well to have consistent texture coordinates.
@@ -2768,10 +2738,7 @@ static void gl2_set_viewport_wrapper(void *data, unsigned vp_width,
27682738 unsigned vp_height , bool force_full , bool allow_rotate )
27692739{
27702740 gl2_t * gl = (gl2_t * )data ;
2771- gl2_set_viewport (gl ,
2772- vp_width , vp_height , force_full , allow_rotate ,
2773- config_get_ptr ()-> bools .video_scale_integer
2774- );
2741+ gl2_set_viewport (gl , vp_width , vp_height , force_full , allow_rotate );
27752742}
27762743
27772744/* Shaders */
@@ -3105,8 +3072,7 @@ static INLINE void gl2_set_shader_viewports(gl2_t *gl, bool video_scale_integer)
31053072 for (i = 0 ; i < 2 ; i ++ )
31063073 {
31073074 gl -> shader -> use (gl , gl -> shader_data , i , true);
3108- gl2_set_viewport (gl , width , height , false, true,
3109- video_scale_integer );
3075+ gl2_set_viewport (gl , width , height , false, true);
31103076 }
31113077}
31123078
@@ -3220,8 +3186,7 @@ static void gl2_render_osd_background(gl2_t *gl, bool video_scale_integer, const
32203186
32213187 gl2_set_viewport (gl ,
32223188 gl -> video_width ,
3223- gl -> video_height , true, false,
3224- video_scale_integer );
3189+ gl -> video_height , true, false);
32253190
32263191 gl -> shader -> use (gl , gl -> shader_data ,
32273192 VIDEO_SHADER_STOCK_BLEND , true);
@@ -3269,7 +3234,7 @@ static void gl2_render_osd_background(gl2_t *gl, bool video_scale_integer, const
32693234
32703235 gl2_set_viewport (gl ,
32713236 gl -> video_width ,
3272- gl -> video_height , false, true, video_scale_integer );
3237+ gl -> video_height , false, true);
32733238}
32743239
32753240static void gl2_show_mouse (void * data , bool state )
@@ -3415,7 +3380,7 @@ static bool gl2_frame(void *data, const void *frame,
34153380
34163381#ifdef IOS
34173382 /* Apparently the viewport is lost each frame, thanks Apple. */
3418- gl2_set_viewport (gl , width , height , false, true, video_scale_integer );
3383+ gl2_set_viewport (gl , width , height , false, true);
34193384#endif
34203385
34213386 /* Render to texture in first pass. */
@@ -3490,7 +3455,7 @@ static bool gl2_frame(void *data, const void *frame,
34903455 gl2_renderchain_start_render (gl , chain , video_scale_integer );
34913456 }
34923457 else
3493- gl2_set_viewport (gl , width , height , false, true, video_scale_integer );
3458+ gl2_set_viewport (gl , width , height , false, true);
34943459 }
34953460
34963461 if (frame )
@@ -3524,7 +3489,7 @@ static bool gl2_frame(void *data, const void *frame,
35243489 if (!(gl -> flags & GL2_FLAG_FBO_INITED ))
35253490 {
35263491 gl2_renderchain_bind_backbuffer ();
3527- gl2_set_viewport (gl , width , height , false, true, video_scale_integer );
3492+ gl2_set_viewport (gl , width , height , false, true);
35283493 }
35293494
35303495 gl2_renderchain_restore_default_state (gl );
0 commit comments