From 20e4a7f0ce86bc93511643e4943b29044c84263f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 19 Aug 2013 02:10:43 +0200 Subject: TIZEN: Adapt to new OpenGL code. Thanks to Chris Warren-Smith for testing this a bit. --- backends/platform/tizen/graphics.cpp | 99 +++++++++++------------------------- 1 file changed, 30 insertions(+), 69 deletions(-) (limited to 'backends/platform/tizen/graphics.cpp') 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 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; } -- cgit v1.2.3 From 37f71235529f8fd4a4c90389dc6a3b41e355f4a9 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 19 Oct 2013 19:40:10 +0200 Subject: TIZEN: Add some further OpenGL related changes by Chris. --- backends/platform/tizen/graphics.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'backends/platform/tizen/graphics.cpp') diff --git a/backends/platform/tizen/graphics.cpp b/backends/platform/tizen/graphics.cpp index 6af0c2b37e..390796dc0e 100644 --- a/backends/platform/tizen/graphics.cpp +++ b/backends/platform/tizen/graphics.cpp @@ -37,6 +37,20 @@ TizenGraphicsManager::TizenGraphicsManager(TizenAppForm *appForm) : _eglContext(EGL_NO_CONTEXT), _initState(true) { assert(appForm != NULL); +} + +TizenGraphicsManager::~TizenGraphicsManager() { + logEntered(); + + if (_eglDisplay != EGL_NO_DISPLAY) { + eglMakeCurrent(_eglDisplay, NULL, NULL, NULL); + if (_eglContext != EGL_NO_CONTEXT) { + eglDestroyContext(_eglDisplay, _eglContext); + } + } +} + +result TizenGraphicsManager::Construct() { // Initialize our OpenGL ES context. loadEgl(); @@ -51,17 +65,7 @@ TizenGraphicsManager::TizenGraphicsManager(TizenAppForm *appForm) : _appForm->GetBounds(x, y, width, height); AppLog("screen size: %dx%d", width, height); setActualScreenSize(width, height); -} - -TizenGraphicsManager::~TizenGraphicsManager() { - logEntered(); - - if (_eglDisplay != EGL_NO_DISPLAY) { - eglMakeCurrent(_eglDisplay, NULL, NULL, NULL); - if (_eglContext != EGL_NO_CONTEXT) { - eglDestroyContext(_eglDisplay, _eglContext); - } - } + return E_SUCCESS; } const Graphics::Font *TizenGraphicsManager::getFontOSD() { @@ -189,9 +193,6 @@ bool TizenGraphicsManager::loadEgl() { systemError("eglMakeCurrent() failed"); return false; } - if (!_initState) { - _appForm->GetVisualElement()->SetShowState(true); - } logLeaving(); return true; } -- cgit v1.2.3