From 7b42e199d7e619651153cef3cc043ad99ef253df Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 4 Apr 2010 02:06:15 +0200 Subject: [PATCH] updating to new sdl_haa api --- debian/control.m4 | 2 +- platform/sdlvscalers.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/debian/control.m4 b/debian/control.m4 index a0de6ab..6806306 100644 --- a/debian/control.m4 +++ b/debian/control.m4 @@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 5), pkg-config, maemo-version, m4, libsdl1.2-dev, libx11-dev, x11proto-core-dev, libxsp-dev, libpopt-dev, zlib1g-dev, gnupg, libosso-dev, osso-games-startup-dev, libsdl-image1.2-dev, libhildonfm2-dev, libosso-gnomevfs2-dev, libhildonmime-dev, - maemo-version (<< 5.0) | libsdl-haa1.2-dev, + maemo-version (<< 5.0) | libsdl-haa1.2-dev (>= 1.1.0), libbluetooth2-dev | libbluetooth3-dev, libzeemote-dev, libzeemote-conf-dev Standards-Version: 3.7.2 diff --git a/platform/sdlvscalers.cpp b/platform/sdlvscalers.cpp index a4aba0b..dd65495 100644 --- a/platform/sdlvscalers.cpp +++ b/platform/sdlvscalers.cpp @@ -373,6 +373,8 @@ class HAAScalerBase : public Scaler const int m_w, m_h, m_Bpp; const float ratio_x, ratio_y; + static bool initialized; + protected: HAAScalerBase(SDL_Surface* screen, int w, int h, float r_x, float r_y) : m_screen(screen), m_w(w), m_h(h), @@ -385,9 +387,16 @@ protected: // Clear the SDL screen with black, just in case it gets drawn. SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 0, 0)); - HAA_Init(fullscreen ? SDL_FULLSCREEN : 0); + if (!initialized) { + HAA_Init(0); + initialized = true; + } else { + HAA_SetVideoMode(); // Tell HAA we might have changed video mode + } + actor = HAA_CreateActor(0, m_w, m_h, m_screen->format->BitsPerPixel); HAA_SetPosition(actor, m_area.x, m_area.y + (fullscreen ? 0 : 60)); + // In windowed mode, take care of the title bar (xoffset = 60) HAA_SetScale(actor, r_x, r_y); HAA_Show(actor); } @@ -396,7 +405,6 @@ public: virtual ~HAAScalerBase() { HAA_FreeActor(actor); - HAA_Quit(); }; uint8* getDrawBuffer() const @@ -438,6 +446,7 @@ public: return HAA_FilterEvent(&event) == 0; }; }; +bool HAAScalerBase::initialized = false; class HAAFillScaler : public HAAScalerBase { -- 1.7.9.5