Handle odd screen resolution (POCOPHONE fix)

This commit is contained in:
Marcel Szewczyk 2019-02-08 21:24:09 +01:00
parent a65436cc6c
commit 8893f97435
2 changed files with 22 additions and 3 deletions

View File

@ -1175,8 +1175,17 @@ void fullscreenQuadPrepareFramebuffer(float xScale, float yScale) {
// Reduce width to keep 4:3 aspect ratio (640x480)
u32 reducedWidth = 4 * screen_height / 3;
u32 reducedWidthOffset = (screen_width - reducedWidth) / 2;
glScissor(reducedWidthOffset, 0, reducedWidth, screen_height);
// handle odd/even screen width
if (screen_width % 2 == 0) {
u32 reducedWidthOffset = (screen_width - reducedWidth) / 2;
glScissor(reducedWidthOffset, 0, reducedWidth, screen_height);
}
else {
u32 reducedWidthOffset = (screen_width + 1 - reducedWidth) / 2;
glScissor(reducedWidthOffset, 0, reducedWidth - 1, screen_height);
}
if (settings.rend.WideScreen &&
(pvrrc.fb_X_CLIP.min==0) && ((pvrrc.fb_X_CLIP.max+1)/xScale==640) &&
(pvrrc.fb_Y_CLIP.min==0) && ((pvrrc.fb_Y_CLIP.max+1)/yScale==480 ))

View File

@ -1902,6 +1902,10 @@ bool RenderFrame()
*/
float dc2s_scale_h = screen_height / 480.0;
float ds2s_offs_x = (screen_width - dc2s_scale_h * 640.0) / 2;
// handle odd screen width
if (screen_width % 2) {
ds2s_offs_x = (screen_width + 1 - dc2s_scale_h * 640.0) / 2;
}
if (!is_rtt) {
ShaderUniforms.scale_coefs[0] = 2.0f / (screen_width / dc2s_scale_h * scale_x);
@ -2118,7 +2122,13 @@ bool RenderFrame()
width *= dc2s_scale_h;
height *= dc2s_scale_h;
}
glScissor(min_x + 0.5f, min_y + 0.5f, width + 0.5f, height + 0.5f);
// handle odd/even screen width
if (screen_width % 2 == 0) {
glScissor(min_x + 0.5f, min_y + 0.5f, width + 0.5f, height + 0.5f);
}
else {
glScissor(min_x + 0.5f, min_y + 0.5f, width + 0.5f - 1, height + 0.5f);
}
glEnable(GL_SCISSOR_TEST);
}
}