// // V_InitScreenVBuffer // static void V_InitScreenVBuffer(void) { if(vbscreenneedsfree) { V_FreeVBuffer(&vbscreen); V_FreeVBuffer(&backscreen1); V_FreeVBuffer(&backscreen2); V_FreeVBuffer(&backscreen3); V_FreeVBuffer(&subscreen43); } else vbscreenneedsfree = true; V_InitVBufferFrom(&vbscreen, video.width, video.height, video.pitch, video.bitdepth, video.screens[0]); V_SetScaling(&vbscreen, SCREENWIDTH, SCREENHEIGHT); V_InitVBufferFrom(&backscreen1, video.width, video.height, video.width, video.bitdepth, video.screens[1]); V_SetScaling(&backscreen1, SCREENWIDTH, SCREENHEIGHT); // Only vbscreen and backscreen1 need scaling set. V_InitVBufferFrom(&backscreen2, video.width, video.height, video.width, video.bitdepth, video.screens[2]); V_InitVBufferFrom(&backscreen3, video.width, video.height, video.width, video.bitdepth, video.screens[3]); // Init subscreen43 V_initSubScreen43(); }
// // SDLVideoDriver::InitDiskFlash // // killough 10/98: init disk icon // void SDLVideoDriver::InitDiskFlash() { SDL_Surface *disktmp = NULL; VBuffer diskvb; if(disk) { SDL_FreeSurface(disk); SDL_FreeSurface(disk_bg); } if(vbscreen.scaled) { drect.x = vbscreen.x1lookup[vbscreen.unscaledw - 16]; drect.y = vbscreen.y1lookup[vbscreen.unscaledh - 15]; drect.w = vbscreen.x2lookup[vbscreen.unscaledw - 1] - drect.x + 1; drect.h = vbscreen.y2lookup[vbscreen.unscaledh - 1] - drect.y + 1; } else { drect.x = vbscreen.width - 16; drect.y = vbscreen.height - 15; drect.w = 16; drect.h = 15; } // haleyjd 12/26/09: create disk in a temporary 8-bit surface, unconditionally disktmp = SDL_CreateRGBSurface(0, drect.w, drect.h, 8, 0, 0, 0, 0); SDL_SetPalette(disktmp, SDL_LOGPAL, colors, 0, 256); // setup VBuffer and point it into the SDL_Surface V_InitVBufferFrom(&diskvb, drect.w, drect.h, disktmp->pitch, 8, (byte *)(disktmp->pixels)); V_SetScaling(&diskvb, 16, 15); // draw the disk graphic into the VBuffer V_DrawPatch(0, -1, &diskvb, PatchLoader::CacheName(wGlobalDir, /*cdrom_mode ? "STCDROM" :*/ "STDISK", PU_CACHE)); // Done with VBuffer object V_FreeVBuffer(&diskvb); // Convert 8-bit disk into a surface-format surface - let SDL handle the // specifics of the process, as it's designed for it. disk = SDL_DisplayFormat(disktmp); disk_bg = SDL_DisplayFormat(disktmp); // Done with the temporary 8-bit disk. SDL_FreeSurface(disktmp); }
// // V_initSubScreen43 // // Initialize a 4:3 subscreen on top of the vbscreen VBuffer. // static void V_initSubScreen43() { int subwidth; int offset; if(vbscreen.getVirtualAspectRatio() <= 4 * FRACUNIT / 3) { subwidth = vbscreen.width; offset = 0; } else { subwidth = vbscreen.height * 4 / 3; offset = (vbscreen.width - subwidth) / 2; } V_InitSubVBuffer(&subscreen43, &vbscreen, offset, 0, subwidth, vbscreen.height); V_SetScaling(&subscreen43, SCREENWIDTH, SCREENHEIGHT); }