Added aspect ratio option to RICE GLES1.1
authorptitSeb <sebastien.chev@gmail.com>
Sat, 12 Oct 2013 19:12:56 +0000 (21:12 +0200)
committerptitSeb <sebastien.chev@gmail.com>
Sat, 12 Oct 2013 19:12:56 +0000 (21:12 +0200)
source/rice_gles/src/Config.cpp
source/rice_gles/src/OGLRender.cpp
source/rice_gles/src/Video.h [changed mode: 0644->0755]

index a749357..da025e7 100755 (executable)
@@ -431,10 +431,16 @@ static void ReadConfiguration(void)
 {
     windowSetting.bDisplayFullscreen = ConfigGetParamBool(l_ConfigVideoGeneral, "Fullscreen");
     windowSetting.uDisplayWidth = ConfigGetParamInt(l_ConfigVideoGeneral, "ScreenWidth");
-#ifdef HAVE_GLES
-       if (windowSetting.uDisplayWidth==800)
-               windowSetting.uDisplayWidth = 640;      // no strech
-#endif
+       windowSetting.bDisplayRatio = true;
+       windowSetting.uDisplayX = 0;
+       windowSetting.uDisplayY = 0;
+    windowSetting.bDisplayRatio = ConfigGetParamBool(l_ConfigVideoGeneral, "AspectRatio");
+       if (windowSetting.bDisplayRatio) {
+               if (windowSetting.uDisplayWidth==800) {
+                       windowSetting.uDisplayWidth = 640;      // no strech
+                       windowSetting.uDisplayX = 80;
+               }
+       }
     windowSetting.uDisplayHeight = ConfigGetParamInt(l_ConfigVideoGeneral, "ScreenHeight");
     windowSetting.bVerticalSync = ConfigGetParamBool(l_ConfigVideoGeneral, "VerticalSync");
 
index 8ced90f..a8b7599 100755 (executable)
@@ -1417,7 +1417,7 @@ void OGLRender::UpdateScissor()
         uint32 height = (gRDP.scissor.right*gRDP.scissor.bottom)/width;
         glEnable(GL_SCISSOR_TEST);
         OPENGL_CHECK_ERRORS;
-        glScissor(80, int(height*windowSetting.fMultY+windowSetting.statusBarHeightToUse),
+        glScissor(windowSetting.uDisplayX, windowSetting.uDisplayY+int(height*windowSetting.fMultY+windowSetting.statusBarHeightToUse),
             int(width*windowSetting.fMultX), int(height*windowSetting.fMultY) );
         OPENGL_CHECK_ERRORS;
     }
@@ -1438,13 +1438,13 @@ void OGLRender::ApplyRDPScissor(bool force)
         uint32 height = (gRDP.scissor.right*gRDP.scissor.bottom)/width;
         glEnable(GL_SCISSOR_TEST);
         OPENGL_CHECK_ERRORS;
-        glScissor(80, int(height*windowSetting.fMultY+windowSetting.statusBarHeightToUse),
+        glScissor(windowSetting.uDisplayX, windowSetting.uDisplayY+int(height*windowSetting.fMultY+windowSetting.statusBarHeightToUse),
             int(width*windowSetting.fMultX), int(height*windowSetting.fMultY) );
         OPENGL_CHECK_ERRORS;
     }
     else
     {
-        glScissor(80+int(gRDP.scissor.left*windowSetting.fMultX), int((windowSetting.uViHeight-gRDP.scissor.bottom)*windowSetting.fMultY+windowSetting.statusBarHeightToUse),
+        glScissor(windowSetting.uDisplayX+int(gRDP.scissor.left*windowSetting.fMultX), windowSetting.uDisplayY+int((windowSetting.uViHeight-gRDP.scissor.bottom)*windowSetting.fMultY+windowSetting.statusBarHeightToUse),
             int((gRDP.scissor.right-gRDP.scissor.left)*windowSetting.fMultX), int((gRDP.scissor.bottom-gRDP.scissor.top)*windowSetting.fMultY ));
         OPENGL_CHECK_ERRORS;
     }
@@ -1458,7 +1458,7 @@ void OGLRender::ApplyScissorWithClipRatio(bool force)
 
     glEnable(GL_SCISSOR_TEST);
     OPENGL_CHECK_ERRORS;
-    glScissor(80+windowSetting.clipping.left, int((windowSetting.uViHeight-gRSP.real_clip_scissor_bottom)*windowSetting.fMultY)+windowSetting.statusBarHeightToUse,
+    glScissor(windowSetting.uDisplayX+windowSetting.clipping.left, windowSetting.uDisplayY+int((windowSetting.uViHeight-gRSP.real_clip_scissor_bottom)*windowSetting.fMultY)+windowSetting.statusBarHeightToUse,
         windowSetting.clipping.width, windowSetting.clipping.height);
     OPENGL_CHECK_ERRORS;
 
@@ -1570,7 +1570,8 @@ void OGLRender::glViewportWrapper(GLint x, GLint y, GLsizei width, GLsizei heigh
     static GLsizei m_width=0, m_height=0;
     static bool mflag=true;
        
-       x+=80;
+    x+=windowSetting.uDisplayX;
+    y+=windowSetting.uDisplayY;
 
     if( x!=mx || y!=my || width!=m_width || height!=m_height || mflag!=flag)
     {
old mode 100644 (file)
new mode 100755 (executable)
index 30a23d7..d957b23
@@ -30,6 +30,9 @@ typedef struct {
     float   fViWidth, fViHeight;
     unsigned short        uViWidth, uViHeight;
     unsigned short        uDisplayWidth, uDisplayHeight;
+
+       unsigned short            uDisplayX, uDisplayY;
+    BOOL       bDisplayRatio;
     
     BOOL    bDisplayFullscreen;
     BOOL    bVerticalSync;