support for nonsquare scalers
authorJavier S. Pedro <maemo@javispedro.com>
Sun, 3 Jan 2010 01:10:14 +0000 (02:10 +0100)
committerJavier S. Pedro <maemo@javispedro.com>
Sun, 3 Jan 2010 01:10:14 +0000 (02:10 +0100)
platform/platform.h
platform/scaler.h
platform/sdli.cpp
platform/sdlv.cpp
platform/sdlvscalers.cpp

index f761cab..9a645a7 100644 (file)
@@ -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);
index 601ca6c..a26d1fe 100644 (file)
@@ -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;
index 92a2b0d..86b3223 100644 (file)
@@ -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;
index 513a93e..535a899 100644 (file)
@@ -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,
index d949bde..ee29992 100644 (file)
@@ -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()