OPENGL: Improve scaling, aspect ratio correction and display(GFX) modes.

Now the previous aspect ratio modes are handled as GFX modes. The previous
GFX modes were for scaling, but are removed now. A new 4/3 display mode
added. Added Ctrl-Shift-A for backward switching through display modes, and
Ctrl-Alt-<number key> for switching to a specific GFX mode.
Window resizing now is available for all display modes, and will
automatically change the scale factor as well as maintain the aspect ratio
when needed.

svn-id: r52501
This commit is contained in:
Alejandro Marzini 2010-09-03 03:23:46 +00:00
parent 27beca0e8c
commit 19bf2b9eb6
4 changed files with 293 additions and 260 deletions

View file

@ -38,8 +38,9 @@ namespace OpenGL {
// do not clash with the SDL GFX modes.
enum {
GFX_NORMAL = 0,
GFX_DOUBLESIZE = 1,
GFX_TRIPLESIZE = 2
GFX_CONSERVE = 1,
GFX_4_3 = 2,
GFX_ORIGINAL = 3
};
}
@ -141,18 +142,11 @@ protected:
TransactionDetails _transactionDetails;
int _transactionMode;
enum {
kAspectRatioNone,
kAspectRatioConserve,
kAspectRatioOriginal
};
struct VideoState {
bool setup;
bool fullscreen;
int activeFullscreenMode;
int aspectRatioCorrection;
int mode;
int scaleFactor;
@ -178,20 +172,22 @@ protected:
virtual void setScale(int newScale);
// Drawing coordinates for the current aspect ratio
int _aspectX;
int _aspectY;
int _aspectWidth;
int _aspectHeight;
// Drawing coordinates for the current display mode and scale
int _displayX;
int _displayY;
int _displayWidth;
int _displayHeight;
/**
* Sets the aspect ratio mode.
* @mode the aspect ratio mode, if -1 it will switch to next mode.
* Sets the dispaly mode.
* @mode the dispaly mode, if -1 it will switch to next mode. If -2 to previous mode.
*/
virtual void setAspectRatioCorrection(int mode);
virtual void switchDisplayMode(int mode);
virtual void refreshAspectRatio();
virtual Common::String getAspectRatioName();
virtual const char *getCurrentModeName();
virtual void calculateDisplaySize(int &width, int &height);
virtual void refreshDisplaySize();
/**
* Returns the current target aspect ratio x 10000