// -------------------------------------------------------------------------------------------------------- bool KikiController::changeScreenSize ( int width, int height, bool fullscreen) { bool result; int oldGamma = gamma; setGamma(0); // hack to restore gamma after failed resolution test result = KEventHandler::setScreenSize (width, height, fullscreen); setGamma(oldGamma); return result; }
bool Exponential::setSlotGamma(const Number* const x) { bool ok = false; if(x != 0) ok = setGamma(x->getDouble()); return ok; }
int main(int argc, char *argv[]) { int mFd = open("/dev/fb0", O_RDWR); if (!strcmp(argv[1], "contrast")) { setContrast(mFd, atoi(argv[2])); printf("please enter a number (0 ~ 100)\n"); } if (!strcmp(argv[1], "brightness")) { setBrightness(mFd, atoi(argv[2])); printf("please enter a number (0 ~ 100)\n"); } if (!strcmp(argv[1], "hue")) { setHue(mFd, atoi(argv[2])); printf("please enter a number (0 ~ 100)\n"); } if (!strcmp(argv[1], "saturation")) { setSaturation(mFd, atoi(argv[2])); printf("please enter a number (0 ~ 100)\n"); } if (!strcmp(argv[1], "gamma")) { setGamma(mFd, atoi(argv[2])); printf("please enter a number (0 ~ 100)\n"); } if (!strcmp(argv[1], "vee")) { setVee(mFd, atoi(argv[2])); printf("please enter a number (0 ~ 100)\n"); } return 0; }
// __________________________________________________________________________________________________ void KikiController::initOpenGL () { // openGL init glShadeModel(GL_SMOOTH); glCullFace (GL_BACK); glEnable (GL_CULL_FACE); glEnable (GL_DEPTH_TEST); glEnable (GL_NORMALIZE); glEnable (GL_LIGHTING); glEnable (GL_LIGHT0); glEnable (GL_COLOR_MATERIAL); glEnable (GL_BLEND); glDepthRange(0.0, 0.5); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnableClientState (GL_VERTEX_ARRAY); glEnableClientState (GL_NORMAL_ARRAY); glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glViewport(0, 0, SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h); float white[4] = {1.0, 1.0, 1.0, 1.0}; float gray[4] = {0.5, 0.5, 0.5, 0.5}; float none[4] = {0.0, 0.0, 0.0, 0.0}; glLightfv (GL_LIGHT0, GL_AMBIENT, none); glLightfv (GL_LIGHT0, GL_DIFFUSE, white); glLightfv (GL_LIGHT0, GL_SPECULAR, white); glLightf (GL_LIGHT0, GL_SPOT_CUTOFF, 180.0); glLightf (GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1.0); glLightf (GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.0); glLightf (GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.0); glLightModelfv (GL_LIGHT_MODEL_AMBIENT, none); glLightModeli (GL_LIGHT_MODEL_LOCAL_VIEWER, 0); glColorMaterial (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, none); glMaterialfv (GL_FRONT_AND_BACK, GL_EMISSION, none); glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, gray); glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 60.0); GLint maxLights; glGetIntegerv (GL_MAX_LIGHTS, &maxLights); for (GLenum l = GL_LIGHT1; l < (GL_LIGHT0+(GLuint)maxLights); l++) { glDisable(l); } glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); setGamma (gamma); }
void ac::DarkImageMedianBlend(cv::Mat &frame) { if(blend_set == true) { SmoothImageAlphaBlend(frame); cv::Mat frame_copy = frame.clone(); setGamma(frame_copy,frame,5); MedianBlend(frame); } }
void BCGFilter::filterImage() { setGamma(d->settings.gamma); setBrightness(d->settings.brightness); setContrast(d->settings.contrast); applyBCG(m_orgImage); m_destImage = m_orgImage; }
FboBlendEdge::FboBlendEdge(){ enabled = true; blackLevel = 0; blendPoint = 0.5; shape = 1; setAngle(0); setGamma(2.2, 2.2, 2.2); //gammaTable.setGamma(2.2); }
void BlackScholesGreeks::setValues(double premium, double delta, double gamma, double theta, double vega, double rho) { setPremium(premium); setDelta(delta); setGamma(gamma); setTheta(theta); setVega(vega); setRho(rho); }
MovieWriter::Format::Format( const ICMCompressionSessionOptionsRef options, uint32_t codec, float quality, float frameRate, bool enableMultiPass ) : mCodec( codec ), mEnableMultiPass( enableMultiPass ) { ::ICMCompressionSessionOptionsCreateCopy( NULL, options, &mOptions ); setQuality( quality ); setTimeScale( (long)(frameRate * 100) ); setDefaultDuration( 1.0f / frameRate ); setGamma( PLATFORM_DEFAULT_GAMMA ); }
void StandardShader::setUntextured() { // Activate an internal 1x1 A8 texture. m_ColorModel = 2; m_pWhiteTex->activate(GL_TEXTURE0); disableColorspaceMatrix(); setGamma(glm::vec4(1.f,1.f,1.f,1.f)); setPremultipliedAlpha(false); setMask(false); }
IdealGas<_partT>() : NA(6.02214179e23) { R = 9.6485e11; // erg/eV/mol ( 1eV ^= 11604.505 K ) k = 1.3806504e-16; // erg/K hp = 6.62606896e-27; // erg s setGamma(1.4); setMolarmass(1.007977); // g/mol for hydrogen }
void LevelsCommand::readProperties(boost::property_tree::wptree& pt) { AbstractCommand::readProperties(pt); setMinIn(pt.get(L"minin", Mixer::DEFAULT_LEVELS_MIN_IN)); setMaxIn(pt.get(L"maxin", Mixer::DEFAULT_LEVELS_MAX_IN)); setMinOut(pt.get(L"minout", Mixer::DEFAULT_LEVELS_MIN_OUT)); setMaxOut(pt.get(L"maxout", Mixer::DEFAULT_LEVELS_MAX_OUT)); setGamma(pt.get(L"gamma", Mixer::DEFAULT_LEVELS_GAMMA)); setTransitionDuration(pt.get(L"transtitionDuration", Mixer::DEFAULT_DURATION)); setTween(QString::fromStdWString(pt.get(L"tween", Mixer::DEFAULT_TWEEN.toStdWString()))); setDefer(pt.get(L"defer", Mixer::DEFAULT_DEFER)); }
void TImageSnapshot::showParams() { QImage tempImg = wgt->image; if (manipulatorIsClosed) { manip = new ImageManipulator(QList<QVariant>() << imageParams.brightness << imageParams.contrast << wgt->imageTransform.rotate + serverValues[0] << imageParams.gamma << picMode->getLBorder() << picMode->getRBorder() << wgt->imageTransform.horFlip << wgt->imageTransform.verFlip << wgt->imageTransform.imageScale << picMode->_maxContrast << _timer << picMode->getPictureMode() << wgt->imageTransform.fullPictureMode << wgt->moveX << wgt->moveY << dimX / picMode->getDelimitr() << dimY, val16, tempImg); manip->setAttribute(Qt::WA_DeleteOnClose); manipulatorIsClosed = false; manip->setModal(true); connect(manip, SIGNAL(destroyed()), this, SLOT(manipDestroed())); connect(manip, SIGNAL(setBr(QVariant)), this, SLOT(setBrightness(QVariant))); connect(manip, SIGNAL(setCon(QVariant)), this, SLOT(setContrast(QVariant))); connect(manip, SIGNAL(setGm(QVariant)), this, SLOT(setGamma(QVariant))); connect(manip, SIGNAL(setLBorder(unsigned short)), this, SLOT(setLBorder(unsigned short))); connect(manip, SIGNAL(setRBorder(unsigned short)), this, SLOT(setRBorder(unsigned short))); connect(manip, SIGNAL(sendRotationVal(QVariant)), this, SLOT(setRotate(QVariant))); connect(manip, SIGNAL(sendHorFlipVal(QVariant)), this, SLOT(setHFlip(QVariant))); connect(manip, SIGNAL(sendVerFlipVal(QVariant)), this, SLOT(setVFlip(QVariant))); //connect(manip, SIGNAL(changeFormatOfColor(int)), this, SLOT(setImageType(int))); connect(manip, SIGNAL(changePictureModeSignal(int)), this, SLOT(setImageType(int))); connect(manip, SIGNAL(setTime(int)), this, SLOT(sendTimer(int))); connect(manip, SIGNAL(setScaleSignal(double)), this, SLOT(setScale(double))); connect(manip, SIGNAL(fullScreenMode(bool)), this, SLOT(setFullscreenMode(bool))); connect(manip, SIGNAL(getDataHistogram()), this, SLOT(drawHistogram())); connect(manip, SIGNAL(chPicX(int)), wgt, SLOT(setMoveX(int))); connect(manip, SIGNAL(chPicY(int)), wgt, SLOT(setMoveY(int))); connect(wgt, SIGNAL(showPictureSize(int, int, int, int)), manip, SLOT(setShowPicSize(int, int, int, int))); setImage(wgt->image); manip->show(); } }
AdaptiveSO2CPGSynPlas::AdaptiveSO2CPGSynPlas(Neuron* perturbingNeuron) : ExtendedSO2CPG(perturbingNeuron){ setAlpha(1.01); setPhi(0.3); setMu(1.00); setGamma(0.02); setEpsilon(0.03); setBeta(0.00); // for a range of P from -1 to 1 setBetaDynamics (-1.0, 0.003, 0.0000); setGammaDynamics (-1.0, 0.003, 1.0000); setEpsilonDynamics(0.04, 0.003, 0.0001); }
explicit hextree(unsigned max_colors=256, double g=2.0) : max_colors_(max_colors), colors_(0), has_holes_(false), root_(new node()), #ifdef USE_DENSE_HASH_MAP // TODO - test for any benefit to initializing at a larger size color_hashmap_(), #endif trans_mode_(FULL_TRANSPARENCY) { setGamma(g); #ifdef USE_DENSE_HASH_MAP color_hashmap_.set_empty_key(0); #endif }
void AdaptiveSO2CPGSynPlas::updateWeights() { const double& phi = getPhi(); const double& beta = getBeta(); const double& gamma = getGamma(); const double& epsilon = getEpsilon(); const double& mu = getMu(); const double& F = getOutput(2); const double& w01 = getWeight(0,1); const double& x = getOutput(0); const double& y = getOutput(1); const double& P = getPerturbation(); // general approach setPhi ( phi + mu * gamma * F * w01 * y ); setBeta ( beta + betaHebbRate * x * F - betaDecayRate * (beta - betaZero) ); setGamma ( gamma + gammaHebbRate * x * F - gammaDecayRate * (gamma - gammaZero) ); setEpsilon( epsilon + epsilonHebbRate * F * P - epsilonDecayRate * (epsilon - epsilonZero) ); }
void cParameters::read() { QSettings settings(QApplication::organizationName(), QApplication::applicationName()); #ifdef _DEBUG std::cout << "settings location: " << settings.fileName().toStdString().c_str() << std::endl; #endif settings.beginGroup("MainWindow"); setNbFen( settings.value("NbFen", QPoint(1, 1) ).toPoint()); setFullScreen( settings.value("openInFullScreen", false).toBool()); setPosition( settings.value("pos", QPoint(200, 200)).toPoint()); setSzFen( settings.value("size", QSize(800, 600) ).toSize()); settings.endGroup(); settings.beginGroup("Drawing settings"); setLineThickness( settings.value("linethickness", 2.f ).toFloat()); setPointDiameter( settings.value("pointdiameter",4.f ).toFloat()); setGamma( settings.value("gamma",1.f ).toFloat()); setForceGray( settings.value("forceGray", false ).toBool()); setShowMasks( settings.value("showMasks", false ).toBool()); setCenterType( settings.value("SceneCenterType", 0 ).toInt()); setENavigation((eNavigationType)settings.value("NavigationType", 0 ).toInt()); settings.endGroup(); settings.beginGroup("Misc"); setDefPtName( settings.value("defPtName", QString("100")).toString()); setPostFix( settings.value("postFix", QString("_mask")).toString()); setZoomWindowValue(zoomClip( settings.value("zoom", 3.0).toFloat())); setSelectionRadius( settings.value("radius",50).toInt()); setShiftStep(settings.value("shiftStep", 0.5f).toFloat()); settings.endGroup(); settings.beginGroup("Point creation"); setPtCreationMode( static_cast<qTypePts> (settings.value("Mode", qNSM_Pts).toInt())); setPtCreationWindowSize( settings.value("WindowSize",3.f).toFloat()); settings.endGroup(); settings.beginGroup("Language"); setLanguage( settings.value("lang", 0).toInt() ); settings.endGroup(); }
void GraphicsManager::init() { Common::enforceMainThread(); uint32 sdlInitFlags = SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK; // TODO: Is this actually needed on any systems? It seems to make MacOS X fail to // receive any events, too. /* // Might be needed on unixoid OS, but it crashes Windows. Nice. #ifndef WIN32 sdlInitFlags |= SDL_INIT_EVENTTHREAD; #endif */ if (SDL_Init(sdlInitFlags) < 0) throw Common::Exception("Failed to initialize SDL: %s", SDL_GetError()); int width = ConfigMan.getInt ("width" , 800); int height = ConfigMan.getInt ("height" , 600); bool fs = ConfigMan.getBool("fullscreen", false); initSize(width, height, fs); setupScene(); // Try to change the FSAA settings to the config value if (_fsaa != ConfigMan.getInt("fsaa")) if (!setFSAA(ConfigMan.getInt("fsaa"))) // If that fails, set the config to the current level ConfigMan.setInt("fsaa", _fsaa); // Set the gamma correction to what the config specifies if (ConfigMan.hasKey("gamma")) setGamma(ConfigMan.getDouble("gamma", 1.0)); // Set the window title to our name setWindowTitle(PACKAGE_STRING); _ready = true; }
QVFbView::QVFbView( int display_id, int w, int h, int d, QWidget *parent, const char *name, uint flags ) : QScrollView( parent, name, flags ), emulateTouchscreen(FALSE), qwslock(NULL) { displayid = display_id; viewport()->setMouseTracking( TRUE ); viewport()->setFocusPolicy( StrongFocus ); zm = 1; animation = 0; int actualdepth=d; switch ( d ) { case 12: actualdepth=16; break; case 1: case 4: case 8: case 16: case 32: break; default: qFatal( "Unsupported bit depth %d\n", d ); } mousePipe = QString(QT_VFB_MOUSE_PIPE).arg(display_id); keyboardPipe = QString(QT_VFB_KEYBOARD_PIPE).arg(display_id); unlink( mousePipe.latin1() ); mkfifo( mousePipe.latin1(), 0666 ); mouseFd = open( mousePipe.latin1(), O_RDWR | O_NDELAY ); if ( mouseFd == -1 ) { qFatal( "Cannot open mouse pipe" ); } unlink( keyboardPipe ); mkfifo( keyboardPipe, 0666 ); keyboardFd = open( keyboardPipe, O_RDWR | O_NDELAY ); if ( keyboardFd == -1 ) { qFatal( "Cannot open keyboard pipe" ); } key_t key = ftok( mousePipe.latin1(), 'b' ); int bpl; if ( d == 1 ) bpl = (w*d+7)/8; else bpl = ((w*actualdepth+31)/32)*4; int dataSize = bpl * h + sizeof( QVFbHeader ); shmId = shmget( key, dataSize, IPC_CREAT|0666); if ( shmId != -1 ) data = (unsigned char *)shmat( shmId, 0, 0 ); else { struct shmid_ds shm; shmctl( shmId, IPC_RMID, &shm ); shmId = shmget( key, dataSize, IPC_CREAT|0666); data = (unsigned char *)shmat( shmId, 0, 0 ); } if ( (size_t)data == -1 ) qFatal( "Cannot attach to shared memory" ); hdr = (QVFbHeader *)data; hdr->width = w; hdr->height = h; viewdepth = d; hdr->depth = actualdepth; hdr->linestep = bpl; hdr->numcols = 0; hdr->dataoffset = sizeof( QVFbHeader ); hdr->update = QRect(); resizeContents( w, h ); timer = new QTimer( this ); connect( timer, SIGNAL(timeout()), this, SLOT(timeout()) ); gammatable=0; setGamma(1.0,1.0,1.0); setRate( 30 ); }
void ac::GammaDarken10(cv::Mat &frame) { cv::Mat frame_copy = frame.clone(); setGamma(frame_copy, frame, 10); }
ImageStack() : width(0), height(0) { setGamma(2.2f); }
void WinWindow::createChild() { // get parent size int width, height; getSize(width, height); // make window hwndChild = CreateWindow("BZFLAG", "opengl", WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CHILD | WS_VISIBLE, 0, 0, width, height, hwnd, NULL, display->getRep()->hInstance, NULL); if (hwndChild == NULL) return; if (display->isFullScreenOnly()) setFullscreen(); // get DC hDCChild = GetDC(hwndChild); // force visual to recalculate the PFD visual.reset(); // set pixel format const PIXELFORMATDESCRIPTOR* tmpPFD; const int pixelFormat = visual.get(hDCChild, &tmpPFD); if (pixelFormat == 0 || !SetPixelFormat(hDCChild, pixelFormat, tmpPFD)) { ReleaseDC(hwndChild, hDCChild); DestroyWindow(hwndChild); hwndChild = NULL; hDCChild = NULL; return; } // get pixel format description DescribePixelFormat(hDCChild, pixelFormat, sizeof(pfd), &pfd); // make colormap useColormap = ((pfd.dwFlags & PFD_NEED_PALETTE) != 0); if (colormap == NULL && useColormap) makeColormap(pfd); if (colormap) ::SelectPalette(hDCChild, colormap, FALSE); // if no colormap then adjust gamma ramps if (!useColormap) { getGammaRamps(origGammaRamps); setGamma(gammaVal); } // make OpenGL context hRC = wglCreateContext(hDCChild); if (hRC == NULL) { ReleaseDC(hwndChild, hDCChild); DestroyWindow(hwnd); hwndChild = NULL; hDCChild = NULL; return; } if (colormap) ::RealizePalette(hDCChild); // other initialization SetMapMode(hDCChild, MM_TEXT); }
int SDLHardwareRenderDevice::createContext(bool allow_fallback) { bool settings_changed = (fullscreen != FULLSCREEN || hwsurface != HWSURFACE || vsync != VSYNC || texture_filter != TEXTURE_FILTER); Uint32 w_flags = 0; Uint32 r_flags = 0; int window_w = SCREEN_W; int window_h = SCREEN_H; if (FULLSCREEN) { w_flags = w_flags | SDL_WINDOW_FULLSCREEN_DESKTOP; // make the window the same size as the desktop resolution SDL_DisplayMode desktop; if (SDL_GetDesktopDisplayMode(0, &desktop) == 0) { window_w = desktop.w; window_h = desktop.h; } } else if (fullscreen && is_initialized) { // if the game was previously in fullscreen, resize the window when returning to windowed mode window_w = MIN_SCREEN_W; window_h = MIN_SCREEN_H; w_flags = w_flags | SDL_WINDOW_SHOWN; } else { w_flags = w_flags | SDL_WINDOW_SHOWN; } w_flags = w_flags | SDL_WINDOW_RESIZABLE; if (HWSURFACE) { r_flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE; } else { r_flags = SDL_RENDERER_SOFTWARE | SDL_RENDERER_TARGETTEXTURE; VSYNC = false; // can't have software mode & vsync at the same time } if (VSYNC) r_flags = r_flags | SDL_RENDERER_PRESENTVSYNC; if (settings_changed || !is_initialized) { destroyContext(); window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_w, window_h, w_flags); if (window) { renderer = SDL_CreateRenderer(window, -1, r_flags); if (renderer) { if (TEXTURE_FILTER && !IGNORE_TEXTURE_FILTER) SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"); else SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); windowResize(); } SDL_SetWindowMinimumSize(window, MIN_SCREEN_W, MIN_SCREEN_H); // setting minimum size might move the window, so set position again SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); } bool window_created = window != NULL && renderer != NULL; if (!window_created) { if (allow_fallback) { // try previous setting first FULLSCREEN = fullscreen; HWSURFACE = hwsurface; VSYNC = vsync; TEXTURE_FILTER = texture_filter; if (createContext(false) == -1) { // last resort, try turning everything off FULLSCREEN = false; HWSURFACE = false; VSYNC = false; TEXTURE_FILTER = false; int last_resort = createContext(false); if (last_resort == -1 && !is_initialized) { // If this is the first attempt and it failed we are not // getting anywhere. logError("SDLHardwareRenderDevice: createContext() failed: %s", SDL_GetError()); logErrorDialog("SDLHardwareRenderDevice: createContext() failed: %s", SDL_GetError()); Exit(1); } return last_resort; } else { return 0; } } } else { if (!is_initialized) { // save the system gamma levels if we just created the window SDL_GetWindowGammaRamp(window, gamma_r, gamma_g, gamma_b); logInfo("RenderDevice: Window size is %dx%d", SCREEN_W, SCREEN_H); } fullscreen = FULLSCREEN; hwsurface = HWSURFACE; vsync = VSYNC; texture_filter = TEXTURE_FILTER; is_initialized = true; logInfo("RenderDevice: Fullscreen=%d, Hardward surfaces=%d, Vsync=%d, Texture Filter=%d", fullscreen, hwsurface, vsync, texture_filter); } } if (is_initialized) { // update minimum window size if it has changed if (min_screen.x != MIN_SCREEN_W || min_screen.y != MIN_SCREEN_H) { min_screen.x = MIN_SCREEN_W; min_screen.y = MIN_SCREEN_H; SDL_SetWindowMinimumSize(window, MIN_SCREEN_W, MIN_SCREEN_H); SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); } windowResize(); // update title bar text and icon updateTitleBar(); // load persistent resources delete icons; icons = new IconManager(); delete curs; curs = new CursorManager(); if (CHANGE_GAMMA) setGamma(GAMMA); else { resetGamma(); CHANGE_GAMMA = false; GAMMA = 1.0; } } return (is_initialized ? 0 : -1); }
int SDLHardwareRenderDevice::createContextInternal() { bool settings_changed = (fullscreen != settings->fullscreen || hwsurface != settings->hwsurface || vsync != settings->vsync || texture_filter != settings->texture_filter || ignore_texture_filter != eset->resolutions.ignore_texture_filter); Uint32 w_flags = 0; Uint32 r_flags = 0; int window_w = settings->screen_w; int window_h = settings->screen_h; if (settings->fullscreen) { w_flags = w_flags | SDL_WINDOW_FULLSCREEN_DESKTOP; // make the window the same size as the desktop resolution SDL_DisplayMode desktop; if (SDL_GetDesktopDisplayMode(0, &desktop) == 0) { window_w = desktop.w; window_h = desktop.h; } } else if (fullscreen && is_initialized) { // if the game was previously in fullscreen, resize the window when returning to windowed mode window_w = eset->resolutions.min_screen_w; window_h = eset->resolutions.min_screen_h; w_flags = w_flags | SDL_WINDOW_SHOWN; } else { w_flags = w_flags | SDL_WINDOW_SHOWN; } w_flags = w_flags | SDL_WINDOW_RESIZABLE; if (settings->hwsurface) { r_flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE; } else { r_flags = SDL_RENDERER_SOFTWARE | SDL_RENDERER_TARGETTEXTURE; settings->vsync = false; // can't have software mode & vsync at the same time } if (settings->vsync) r_flags = r_flags | SDL_RENDERER_PRESENTVSYNC; if (settings_changed || !is_initialized) { destroyContext(); window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_w, window_h, w_flags); if (window) { renderer = SDL_CreateRenderer(window, -1, r_flags); if (renderer) { if (settings->texture_filter && !eset->resolutions.ignore_texture_filter) SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"); else SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); windowResize(); } SDL_SetWindowMinimumSize(window, eset->resolutions.min_screen_w, eset->resolutions.min_screen_h); // setting minimum size might move the window, so set position again SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); } if (window && renderer) { if (!is_initialized) { // save the system gamma levels if we just created the window SDL_GetWindowGammaRamp(window, gamma_r, gamma_g, gamma_b); Utils::logInfo("RenderDevice: Window size is %dx%d", settings->screen_w, settings->screen_h); } fullscreen = settings->fullscreen; hwsurface = settings->hwsurface; vsync = settings->vsync; texture_filter = settings->texture_filter; ignore_texture_filter = eset->resolutions.ignore_texture_filter; is_initialized = true; Utils::logInfo("RenderDevice: Fullscreen=%d, Hardware surfaces=%d, Vsync=%d, Texture Filter=%d", fullscreen, hwsurface, vsync, texture_filter); #if SDL_VERSION_ATLEAST(2, 0, 4) SDL_GetDisplayDPI(0, &ddpi, 0, 0); Utils::logInfo("RenderDevice: Display DPI is %f", ddpi); #else Utils::logError("RenderDevice: The SDL version used to compile Flare does not support SDL_GetDisplayDPI(). The virtual_dpi setting will be ignored."); #endif } } if (is_initialized) { // update minimum window size if it has changed if (min_screen.x != eset->resolutions.min_screen_w || min_screen.y != eset->resolutions.min_screen_h) { min_screen.x = eset->resolutions.min_screen_w; min_screen.y = eset->resolutions.min_screen_h; SDL_SetWindowMinimumSize(window, eset->resolutions.min_screen_w, eset->resolutions.min_screen_h); SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); } windowResize(); // update title bar text and icon updateTitleBar(); // load persistent resources delete icons; icons = new IconManager(); delete curs; curs = new CursorManager(); if (settings->change_gamma) setGamma(settings->gamma); else { resetGamma(); settings->change_gamma = false; settings->gamma = 1.0; } } return (is_initialized ? 0 : -1); }