bool BadaGraphicsManager::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 = 3; // for proportional sized cursor in the launcher AppLog("screen size: %dx%d", _videoMode.hardwareWidth, _videoMode.hardwareHeight); return OpenGLGraphicsManager::loadGFXMode(); }
void WINCESdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) { if (_hasSmartphoneResolution && h == 240) h = 200; // mainly for the launcher if (_isSmartphone && !ConfMan.hasKey("landscape")) { ConfMan.setInt("landscape", 1); ConfMan.flushToDisk(); } _canBeAspectScaled = false; if (w == 320 && h == 200 && !_hasSmartphoneResolution) { _canBeAspectScaled = true; h = 240; // use the extra 40 pixels height for the toolbar } if (h == 400) // touche engine fixup h += 80; if (!_hasSmartphoneResolution) { if (h == 240) _toolbarHandler.setOffset(200); else _toolbarHandler.setOffset(400); } else { if (h == 240) _toolbarHandler.setOffset(200); else // 176x220 _toolbarHandler.setOffset(0); } if (w != (uint) _videoMode.screenWidth || h != (uint) _videoMode.screenHeight) _scalersChanged = false; _videoMode.overlayWidth = w; _videoMode.overlayHeight = h; SurfaceSdlGraphicsManager::initSize(w, h, format); if (_scalersChanged) { unloadGFXMode(); loadGFXMode(); _scalersChanged = false; } update_game_settings(); }
void OSystem_SDL::endGFXTransaction(void) { // for each engine we run initCommonGFX() as first thing in the transaction // and initSize() is called later. If user runs launcher at 320x200 with // 2x overlay, setting to Nomral1x sclaler in that case will be suppressed // and backend is forced to 2x // // This leads to bad results such as 1280x960 window for 640x480 engines. // To prevent that we rerun setGraphicsMode() if there was 1x scaler request if (_transactionDetails.normal1xScaler) setGraphicsMode(GFX_NORMAL); assert (_transactionMode == kTransactionActive); _transactionMode = kTransactionCommit; if (_transactionDetails.modeChanged) setGraphicsMode(_transactionDetails.mode); if (_transactionDetails.sizeChanged) initSize(_transactionDetails.w, _transactionDetails.h); if (_transactionDetails.arChanged) setAspectRatioCorrection(_transactionDetails.ar); if (_transactionDetails.needUnload) { unloadGFXMode(); loadGFXMode(); clearOverlay(); } else { if (!_transactionDetails.fsChanged) { if (_transactionDetails.needHotswap) hotswapGFXMode(); else if (_transactionDetails.needUpdatescreen) internUpdateScreen(); } } if (_transactionDetails.fsChanged) setFullscreenMode(_transactionDetails.fs); _transactionMode = kTransactionNone; }
bool TizenGraphicsManager::loadEgl() { logEntered(); EGLint numConfigs = 1; EGLint eglConfigList[] = { EGL_RED_SIZE, 5, EGL_GREEN_SIZE, 6, EGL_BLUE_SIZE, 5, EGL_ALPHA_SIZE, 0, EGL_DEPTH_SIZE, 8, EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT, EGL_NONE }; EGLint eglContextList[] = { EGL_CONTEXT_CLIENT_VERSION, 1, EGL_NONE }; eglBindAPI(EGL_OPENGL_ES_API); if (_eglDisplay) { unloadGFXMode(); } _eglDisplay = eglGetDisplay((EGLNativeDisplayType) EGL_DEFAULT_DISPLAY); if (EGL_NO_DISPLAY == _eglDisplay) { systemError("eglGetDisplay() failed"); return false; } if (EGL_FALSE == eglInitialize(_eglDisplay, NULL, NULL) || EGL_SUCCESS != eglGetError()) { systemError("eglInitialize() failed"); return false; } if (EGL_FALSE == eglChooseConfig(_eglDisplay, eglConfigList, &_eglConfig, 1, &numConfigs) || EGL_SUCCESS != eglGetError()) { systemError("eglChooseConfig() failed"); return false; } if (!numConfigs) { systemError("eglChooseConfig() failed. Matching config does not exist \n"); return false; } _eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, (EGLNativeWindowType)_appForm, NULL); if (EGL_NO_SURFACE == _eglSurface || EGL_SUCCESS != eglGetError()) { systemError("eglCreateWindowSurface() failed. EGL_NO_SURFACE"); return false; } _eglContext = eglCreateContext(_eglDisplay, _eglConfig, EGL_NO_CONTEXT, eglContextList); if (EGL_NO_CONTEXT == _eglContext || EGL_SUCCESS != eglGetError()) { systemError("eglCreateContext() failed"); return false; } if (false == eglMakeCurrent(_eglDisplay, _eglSurface, _eglSurface, _eglContext) || EGL_SUCCESS != eglGetError()) { systemError("eglMakeCurrent() failed"); return false; } logLeaving(); return true; }