From 80954280ceafd135c375d4cf2c8c9709f058e70a Mon Sep 17 00:00:00 2001 From: thilo Date: Mon, 31 Jul 2006 13:05:15 +0000 Subject: Fix from the VirtualDub people which should make avi files created with the video command playable with numerous windows players. git-svn-id: svn://svn.icculus.org/quake3/trunk@824 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/renderer/tr_init.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'code/renderer') diff --git a/code/renderer/tr_init.c b/code/renderer/tr_init.c index 1b1bfc0..87f47f1 100644 --- a/code/renderer/tr_init.c +++ b/code/renderer/tr_init.c @@ -715,6 +715,7 @@ const void *RB_TakeVideoFrameCmd( const void *data ) const videoFrameCommand_t *cmd; int frameSize; int i; + char swapper; cmd = (const videoFrameCommand_t *)data; @@ -729,22 +730,22 @@ const void *RB_TakeVideoFrameCmd( const void *data ) { frameSize = SaveJPGToBuffer( cmd->encodeBuffer, 95, cmd->width, cmd->height, cmd->captureBuffer ); + ri.CL_WriteAVIVideoFrame( cmd->encodeBuffer, frameSize ); } else { frameSize = cmd->width * cmd->height * 4; - // Vertically flip the image - for( i = 0; i < cmd->height; i++ ) + for( i = 0; i < frameSize; i = i + 4) // Swap R and B { - Com_Memcpy( &cmd->encodeBuffer[ i * ( cmd->width * 4 ) ], - &cmd->captureBuffer[ ( cmd->height - i - 1 ) * ( cmd->width * 4 ) ], - cmd->width * 4 ); + swapper = cmd->captureBuffer[ i ]; + cmd->captureBuffer[ i ] = cmd->captureBuffer[ i + 2 ]; + cmd->captureBuffer[ i + 2 ] = swapper; + } + ri.CL_WriteAVIVideoFrame( cmd->captureBuffer, frameSize ); } - ri.CL_WriteAVIVideoFrame( cmd->encodeBuffer, frameSize ); - return (const void *)(cmd + 1); } -- cgit v1.2.3