void CL_Gecko_Resize( clgecko_t *instance, int width, int height ) { int newWidth, newHeight; // early out if bad parameters are passed (no resize to a texture size bigger than the original texture size) if( !instance || !instance->browser) { return; } newWidth = CeilPowerOf2( width ); newHeight = CeilPowerOf2( height ); if ((newWidth != instance->texWidth) || (newHeight != instance->texHeight)) { cl_gecko_unlinktexture( instance ); instance->texWidth = newWidth; instance->texHeight = newHeight; cl_gecko_linktexture( instance ); } else { /* The gecko area will only cover a part of the texture; to avoid 'old' pixels bleeding in at the border clear the texture. */ R_ClearTexture( instance->texture ); } osgk_browser_resize( instance->browser, width, height); instance->width = width; instance->height = height; }
/* ==================== SndSys_Init Create "snd_renderbuffer" with the proper sound format if the call is successful May return a suggested format if the requested format isn't available ==================== */ qboolean SndSys_Init (const snd_format_t* requested, snd_format_t* suggested) { unsigned int buffersize; SDL_AudioSpec wantspec; SDL_AudioSpec obtainspec; snd_threaded = false; Con_DPrint ("SndSys_Init: using the SDL module\n"); // Init the SDL Audio subsystem if( SDL_InitSubSystem( SDL_INIT_AUDIO ) ) { Con_Print( "Initializing the SDL Audio subsystem failed!\n" ); return false; } buffersize = (unsigned int)ceil((double)requested->speed / 25.0); // 2048 bytes on 24kHz to 48kHz // Init the SDL Audio subsystem wantspec.callback = Buffer_Callback; wantspec.userdata = NULL; wantspec.freq = requested->speed; wantspec.format = ((requested->width == 1) ? AUDIO_U8 : AUDIO_S16SYS); wantspec.channels = requested->channels; wantspec.samples = CeilPowerOf2(buffersize); // needs to be a power of 2 on some platforms. Con_Printf("Wanted audio Specification:\n" "\tChannels : %i\n" "\tFormat : 0x%X\n" "\tFrequency : %i\n" "\tSamples : %i\n", wantspec.channels, wantspec.format, wantspec.freq, wantspec.samples); if( SDL_OpenAudio( &wantspec, &obtainspec ) ) { Con_Printf( "Failed to open the audio device! (%s)\n", SDL_GetError() ); return false; } Con_Printf("Obtained audio specification:\n" "\tChannels : %i\n" "\tFormat : 0x%X\n" "\tFrequency : %i\n" "\tSamples : %i\n", obtainspec.channels, obtainspec.format, obtainspec.freq, obtainspec.samples); // If we haven't obtained what we wanted if (wantspec.freq != obtainspec.freq || wantspec.format != obtainspec.format || wantspec.channels != obtainspec.channels) { SDL_CloseAudio(); // Pass the obtained format as a suggested format if (suggested != NULL) { suggested->speed = obtainspec.freq; // FIXME: check the format more carefully. There are plenty of unsupported cases suggested->width = ((obtainspec.format == AUDIO_U8) ? 1 : 2); suggested->channels = obtainspec.channels; } return false; } snd_threaded = true; snd_renderbuffer = Snd_CreateRingBuffer(requested, 0, NULL); if (snd_channellayout.integer == SND_CHANNELLAYOUT_AUTO) Cvar_SetValueQuick (&snd_channellayout, SND_CHANNELLAYOUT_STANDARD); sdlaudiotime = 0; SDL_PauseAudio( false ); return true; }