From: Javier S. Pedro Date: Sun, 3 Jan 2010 01:10:14 +0000 (+0100) Subject: support for nonsquare scalers X-Git-Tag: drnoksnes_1_3_0~31 X-Git-Url: http://vcs.maemo.org/git/?p=drnoksnes;a=commitdiff_plain;h=96b93ff5f9e7aef51e96b218ddb2c7a7f658b7da support for nonsquare scalers --- diff --git a/platform/platform.h b/platform/platform.h index f761cab..9a645a7 100644 --- a/platform/platform.h +++ b/platform/platform.h @@ -38,7 +38,7 @@ extern struct gui { /** Size of the (scaled) rendering area, relative to window. */ unsigned short RenderX, RenderY, RenderW, RenderH; /** Scaling ratio */ - unsigned short Scale; + float ScaleX, ScaleY; } GUI; void S9xVideoToggleFullscreen(); void S9xVideoOutputFocus(bool hasFocus); diff --git a/platform/scaler.h b/platform/scaler.h index 601ca6c..a26d1fe 100644 --- a/platform/scaler.h +++ b/platform/scaler.h @@ -14,7 +14,7 @@ public: virtual void getRenderedGUIArea(unsigned short & x, unsigned short & y, unsigned short & w, unsigned short & h) const = 0; - virtual int getRatio() const = 0; + virtual void getRatio(float & x, float & y) const = 0; virtual void prepare() = 0; virtual void finish() = 0; virtual void pause() = 0; diff --git a/platform/sdli.cpp b/platform/sdli.cpp index 92a2b0d..86b3223 100644 --- a/platform/sdli.cpp +++ b/platform/sdli.cpp @@ -111,8 +111,8 @@ static void processMouse(unsigned int x, unsigned int y, int pressed = 0) } // Take care of scaling - mouse.x /= GUI.Scale; - mouse.y /= GUI.Scale; + mouse.x /= GUI.ScaleX; + mouse.y /= GUI.ScaleY; if (pressed > 0) mouse.pressed = true; diff --git a/platform/sdlv.cpp b/platform/sdlv.cpp index 513a93e..535a899 100644 --- a/platform/sdlv.cpp +++ b/platform/sdlv.cpp @@ -147,7 +147,7 @@ static void setupVideoSurface() GFX.PPLx2 = GFX.Pitch; scaler->getRenderedGUIArea(GUI.RenderX, GUI.RenderY, GUI.RenderW, GUI.RenderH); - GUI.Scale = scaler->getRatio(); + scaler->getRatio(GUI.ScaleX, GUI.ScaleY); printf("Video: %dx%d (%dx%d output), %hu bits per pixel, %s, %s\n", gameWidth, gameHeight, diff --git a/platform/sdlvscalers.cpp b/platform/sdlvscalers.cpp index d949bde..ee29992 100644 --- a/platform/sdlvscalers.cpp +++ b/platform/sdlvscalers.cpp @@ -101,9 +101,9 @@ public: x = m_area.x; y = m_area.y; w = m_area.w; h = m_area.h; }; - virtual int getRatio() const + virtual void getRatio(float & x, float & y) const { - return 1; + x = 1.0f; y = 1.0f; }; virtual void prepare() { }; @@ -182,9 +182,9 @@ public: x = m_area.x; y = m_area.y; w = m_area.w; h = m_area.h; }; - int getRatio() const + void getRatio(float & x, float & y) const { - return 2; + x = 2.0f; y = 2.0f; }; void prepare() { }; @@ -283,9 +283,9 @@ public: x = m_area.x; y = m_area.y; w = m_area.w; h = m_area.h; }; - int getRatio() const + void getRatio(float & x, float & y) const { - return 2; + x = 2.0f; y = 2.0f; }; void prepare() { }; @@ -528,9 +528,9 @@ public: x = m_area.x; y = m_area.y; w = m_area.w; h = m_area.h; }; - virtual int getRatio() const + virtual void getRatio(float & x, float & y) const { - return ratio_y; // TODO + x = ratio_x; y = ratio_y; }; virtual void prepare() @@ -829,9 +829,9 @@ public: x = m_area.x; y = m_area.y; w = m_area.w; h = m_area.h; }; - int getRatio() const + void getRatio(float & x, float & y) const { - return 2; + x = 2.0f; y = 2.0f; }; void prepare()