void ph_DestroyImage(_THIS, SDL_Surface* screen) { #ifdef HAVE_OPENGL if ((screen->flags & SDL_OPENGL)==SDL_OPENGL) { if (oglctx) { PhDCSetCurrent(NULL); PhDCRelease(oglctx); oglctx=NULL; oglflags=0; oglbpp=0; } return; } #endif /* HAVE_OPENGL */ if (currently_fullscreen) { /* if we right now in 8bpp fullscreen we must release palette */ if ((screen->format->BitsPerPixel==8) && (desktopbpp!=8)) { PgSetPalette(syspalph, 0, -1, 0, 0, 0); PgSetPalette(savedpal, 0, 0, _Pg_MAX_PALETTE, Pg_PALSET_GLOBAL | Pg_PALSET_FORCE_EXPOSE, 0); PgFlush(); } ph_LeaveFullScreen(this); } if (OCImage.offscreen_context != NULL) { PhDCRelease(OCImage.offscreen_context); OCImage.offscreen_context = NULL; OCImage.FrameData0 = NULL; } if (OCImage.offscreen_backcontext != NULL) { PhDCRelease(OCImage.offscreen_backcontext); OCImage.offscreen_backcontext = NULL; OCImage.FrameData1 = NULL; } OCImage.CurrentFrameData = NULL; if (SDL_Image) { /* if palette allocated, free it */ if (SDL_Image->palette) { free(SDL_Image->palette); } PgShmemDestroy(SDL_Image->image); free(SDL_Image); } /* Must be zeroed everytime */ SDL_Image = NULL; if (screen) { screen->pixels = NULL; } }
int ph_EnterFullScreen(_THIS, SDL_Surface* screen, int fmode) { PgDisplaySettings_t settings; int mode; char* refreshrate; int refreshratenum; if (!currently_fullscreen) { /* Get the video mode and set it */ if (screen->flags & SDL_ANYFORMAT) { if ((mode = get_mode_any_format(screen->w, screen->h, screen->format->BitsPerPixel)) == 0) { SDL_SetError("ph_EnterFullScreen(): can't find appropriate video mode !\n"); return 0; } } else { if ((mode = ph_GetVideoMode(screen->w, screen->h, screen->format->BitsPerPixel)) == 0) { SDL_SetError("ph_EnterFullScreen(): can't find appropriate video mode !\n"); return 0; } if (PgGetVideoModeInfo(mode, &mode_info) < 0) { SDL_SetError("ph_EnterFullScreen(): can't get video mode capabilities !\n"); return 0; } if (mode_info.height != screen->h) { if ((mode_info.height==480) && (screen->h==400)) { videomode_emulatemode=1; } } else { videomode_emulatemode=0; } } /* save old video mode caps */ PgGetVideoMode(&settings); old_video_mode=settings.mode; old_refresh_rate=settings.refresh; /* setup new video mode */ settings.mode = mode; settings.refresh = 0; settings.flags = 0; refreshrate=SDL_getenv("SDL_PHOTON_FULLSCREEN_REFRESH"); if (refreshrate!=NULL) { if (SDL_sscanf(refreshrate, "%d", &refreshratenum)==1) { settings.refresh = refreshratenum; } } if (PgSetVideoMode(&settings) < 0) { SDL_SetError("ph_EnterFullScreen(): PgSetVideoMode() call failed !\n"); return 0; } if (this->screen) { if ((this->screen->flags & SDL_OPENGL)==SDL_OPENGL) { #if !SDL_VIDEO_OPENGL || (_NTO_VERSION < 630) return 0; /* 6.3.0 */ #endif } } if (fmode==0) { if (OCImage.direct_context==NULL) { OCImage.direct_context=(PdDirectContext_t*)PdCreateDirectContext(); if (!OCImage.direct_context) { SDL_SetError("ph_EnterFullScreen(): Can't create direct context !\n"); ph_LeaveFullScreen(this); return 0; } } OCImage.oldDC=PdDirectStart(OCImage.direct_context); } currently_fullscreen = 1; } PgFlush(); return 1; }