aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/graphics/opengl/opengl-graphics.h5
-rw-r--r--backends/platform/tizen/graphics.cpp99
-rw-r--r--backends/platform/tizen/graphics.h19
3 files changed, 45 insertions, 78 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index d4bd0137ed..67ad5aa067 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -154,6 +154,11 @@ protected:
void setMousePosition(int x, int y) { _cursorX = x; _cursorY = y; }
/**
+ * Query the mouse position in physical coordinates.
+ */
+ void getMousePosition(int16 &x, int16 &y) const { x = _cursorX; y = _cursorY; }
+
+ /**
* Set up the mouse position for the (event) system.
*
* @param x X coordinate in physical coordinates.
diff --git a/backends/platform/tizen/graphics.cpp b/backends/platform/tizen/graphics.cpp
index 2cafb9f781..6af0c2b37e 100644
--- a/backends/platform/tizen/graphics.cpp
+++ b/backends/platform/tizen/graphics.cpp
@@ -37,7 +37,20 @@ TizenGraphicsManager::TizenGraphicsManager(TizenAppForm *appForm) :
_eglContext(EGL_NO_CONTEXT),
_initState(true) {
assert(appForm != NULL);
- _videoMode.fullscreen = true;
+ // Initialize our OpenGL ES context.
+ loadEgl();
+
+ // Notify the OpenGL code about our context.
+
+ // We default to RGB565 and RGBA5551 which is closest to the actual output
+ // mode we setup.
+ notifyContextChange(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
+
+ // Tell our size.
+ int x, y, width, height;
+ _appForm->GetBounds(x, y, width, height);
+ AppLog("screen size: %dx%d", width, height);
+ setActualScreenSize(width, height);
}
TizenGraphicsManager::~TizenGraphicsManager() {
@@ -56,12 +69,11 @@ const Graphics::Font *TizenGraphicsManager::getFontOSD() {
}
bool TizenGraphicsManager::moveMouse(int16 &x, int16 &y) {
- int16 currentX = _cursorState.x;
- int16 currentY = _cursorState.y;
+ int16 currentX, currentY;
+ getMousePosition(currentX, currentY);
// save the current hardware coordinates
- _cursorState.x = x;
- _cursorState.y = y;
+ setMousePosition(x, y);
// return x/y as game coordinates
adjustMousePosition(x, y);
@@ -85,15 +97,17 @@ Common::List<Graphics::PixelFormat> TizenGraphicsManager::getSupportedFormats()
}
bool TizenGraphicsManager::hasFeature(OSystem::Feature f) {
- bool result = (f == OSystem::kFeatureFullscreenMode ||
- f == OSystem::kFeatureVirtualKeyboard ||
+ bool result =
+ (f == OSystem::kFeatureVirtualKeyboard ||
OpenGLGraphicsManager::hasFeature(f));
return result;
}
void TizenGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
- if (f == OSystem::kFeatureVirtualKeyboard && enable) {
- _appForm->showKeypad();
+ if (f == OSystem::kFeatureVirtualKeyboard) {
+ if (enable) {
+ _appForm->showKeypad();
+ }
} else {
OpenGLGraphicsManager::setFeatureState(f, enable);
}
@@ -106,8 +120,9 @@ void TizenGraphicsManager::setReady() {
}
void TizenGraphicsManager::updateScreen() {
- if (_transactionMode == kTransactionNone) {
- internUpdateScreen();
+ if (!_initState) {
+ OpenGLGraphicsManager::updateScreen();
+ eglSwapBuffers(_eglDisplay, _eglSurface);
}
}
@@ -133,10 +148,6 @@ bool TizenGraphicsManager::loadEgl() {
eglBindAPI(EGL_OPENGL_ES_API);
- if (_eglDisplay) {
- unloadGFXMode();
- }
-
_eglDisplay = eglGetDisplay((EGLNativeDisplayType) EGL_DEFAULT_DISPLAY);
if (EGL_NO_DISPLAY == _eglDisplay) {
systemError("eglGetDisplay() failed");
@@ -185,58 +196,8 @@ bool TizenGraphicsManager::loadEgl() {
return true;
}
-bool TizenGraphicsManager::loadGFXMode() {
- logEntered();
-
- if (!loadEgl()) {
- unloadGFXMode();
- return false;
- }
-
- int x, y, width, height;
- _appForm->GetBounds(x, y, width, height);
- _videoMode.overlayWidth = _videoMode.hardwareWidth = width;
- _videoMode.overlayHeight = _videoMode.hardwareHeight = height;
- _videoMode.scaleFactor = 4; // for proportional sized cursor in the launcher
-
- AppLog("screen size: %dx%d", _videoMode.hardwareWidth, _videoMode.hardwareHeight);
- return OpenGLGraphicsManager::loadGFXMode();
-}
-
-void TizenGraphicsManager::loadTextures() {
- logEntered();
- OpenGLGraphicsManager::loadTextures();
-}
-
-void TizenGraphicsManager::internUpdateScreen() {
- if (!_initState) {
- OpenGLGraphicsManager::internUpdateScreen();
- eglSwapBuffers(_eglDisplay, _eglSurface);
- }
-}
-
-void TizenGraphicsManager::unloadGFXMode() {
- logEntered();
- _appForm->GetVisualElement()->SetShowState(false);
-
- if (_eglDisplay != EGL_NO_DISPLAY) {
- eglMakeCurrent(_eglDisplay, NULL, NULL, NULL);
-
- if (_eglContext != EGL_NO_CONTEXT) {
- eglDestroyContext(_eglDisplay, _eglContext);
- _eglContext = EGL_NO_CONTEXT;
- }
-
- if (_eglSurface != EGL_NO_SURFACE) {
- eglDestroySurface(_eglDisplay, _eglSurface);
- _eglSurface = EGL_NO_SURFACE;
- }
-
- eglTerminate(_eglDisplay);
- _eglDisplay = EGL_NO_DISPLAY;
- }
-
- _eglConfig = NULL;
- OpenGLGraphicsManager::unloadGFXMode();
- logLeaving();
+bool TizenGraphicsManager::loadVideoMode(uint requestedWidth, uint requestedHeight, const Graphics::PixelFormat &format) {
+ // We get this whenever a new resolution is requested. Since Tizen is
+ // using a fixed output size we do nothing like that here.
+ return true;
}
diff --git a/backends/platform/tizen/graphics.h b/backends/platform/tizen/graphics.h
index 27e5a6aaeb..1ed8a7c653 100644
--- a/backends/platform/tizen/graphics.h
+++ b/backends/platform/tizen/graphics.h
@@ -39,28 +39,29 @@ using namespace Tizen::Graphics;
using namespace Tizen::Graphics::Opengl;
using namespace Tizen::App;
-class TizenGraphicsManager : public OpenGLGraphicsManager {
+class TizenGraphicsManager : public OpenGL::OpenGLGraphicsManager {
public:
TizenGraphicsManager(TizenAppForm *appForm);
virtual ~TizenGraphicsManager();
Common::List<Graphics::PixelFormat> getSupportedFormats() const;
bool hasFeature(OSystem::Feature f);
- void updateScreen();
void setFeatureState(OSystem::Feature f, bool enable);
+ void updateScreen();
+
void setReady();
bool isReady() { return !_initState; }
- const Graphics::Font *getFontOSD();
+
bool moveMouse(int16 &x, int16 &y);
-private:
- void internUpdateScreen();
- bool loadGFXMode();
- void loadTextures();
- void unloadGFXMode();
+protected:
void setInternalMousePosition(int x, int y) {}
- void showSplash();
+ bool loadVideoMode(uint requestedWidth, uint requestedHeight, const Graphics::PixelFormat &format);
+
+ const Graphics::Font *getFontOSD();
+
+private:
bool loadEgl();
TizenAppForm *_appForm;
EGLDisplay _eglDisplay;