From b539ed5a3d146bc0c1ff3c13043f3277907ee786 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 13 Jul 2019 23:38:01 +0300 Subject: [PATCH] engine: remove write_to_clipboard, as there was no way to enable it for a long time and no one even asked for this --- engine/common/common.h | 1 - engine/common/imagelib/img_bmp.c | 53 ++++++-------------------------- engine/common/system.c | 2 +- engine/common/system.h | 2 +- 4 files changed, 11 insertions(+), 47 deletions(-) diff --git a/engine/common/common.h b/engine/common/common.h index 1c802c60..d5e776cb 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -419,7 +419,6 @@ typedef struct host_parm_s qboolean shutdown_issued; // engine is shutting down qboolean force_draw_version; // used when fraps is loaded float force_draw_version_time; - qboolean write_to_clipboard; // put image to clipboard instead of disk qboolean apply_game_config; // when true apply only to game cvars and ignore all other commands qboolean apply_opengl_config;// when true apply only to opengl cvars and ignore all other commands qboolean config_executed; // a bit who indicated was config.cfg already executed e.g. from valve.rc diff --git a/engine/common/imagelib/img_bmp.c b/engine/common/imagelib/img_bmp.c index 78f1e871..b99639c5 100644 --- a/engine/common/imagelib/img_bmp.c +++ b/engine/common/imagelib/img_bmp.c @@ -318,7 +318,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix ) int i, x, y; bmp_t hdr; - if( FS_FileExists( name, false ) && !Image_CheckFlag( IL_ALLOW_OVERWRITE ) && !host.write_to_clipboard ) + if( FS_FileExists( name, false ) && !Image_CheckFlag( IL_ALLOW_OVERWRITE ) ) return false; // already existed // bogus parameter check @@ -342,11 +342,8 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix ) return false; } - if( !host.write_to_clipboard ) - { - pfile = FS_Open( name, "wb", false ); - if( !pfile ) return false; - } + pfile = FS_Open( name, "wb", false ); + if( !pfile ) return false; // NOTE: align transparency column will sucessfully removed // after create sprite or lump image, it's just standard requiriments @@ -371,21 +368,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix ) hdr.colors = ( pixel_size == 1 ) ? 256 : 0; hdr.importantColors = 0; - if( host.write_to_clipboard ) - { - // NOTE: the cbPalBytes may be 0 - total_size = BI_SIZE + cbPalBytes + cbBmpBits; - clipbuf = Z_Malloc( total_size ); - memcpy( clipbuf, (byte *)&hdr + ( sizeof( bmp_t ) - BI_SIZE ), BI_SIZE ); - cur_size = BI_SIZE; - } - else - { - // Write header - bmp_t sw = hdr; - - FS_Write( pfile, &sw, sizeof( bmp_t )); - } + FS_Write( pfile, &hdr, sizeof( bmp_t )); pbBmpBits = Mem_Malloc( host.imagepool, cbBmpBits ); @@ -407,16 +390,8 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix ) else rgrgbPalette[i].rgbReserved = 0; } - if( host.write_to_clipboard ) - { - memcpy( clipbuf + cur_size, rgrgbPalette, cbPalBytes ); - cur_size += cbPalBytes; - } - else - { - // write palette - FS_Write( pfile, rgrgbPalette, cbPalBytes ); - } + // write palette + FS_Write( pfile, rgrgbPalette, cbPalBytes ); } pb = pix->buffer; @@ -448,19 +423,9 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix ) pb += pix->width * pixel_size; } - if( host.write_to_clipboard ) - { - memcpy( clipbuf + cur_size, pbBmpBits, cbBmpBits ); - cur_size += cbBmpBits; - Sys_SetClipboardData( clipbuf, total_size ); - Z_Free( clipbuf ); - } - else - { - // write bitmap bits (remainder of file) - FS_Write( pfile, pbBmpBits, cbBmpBits ); - FS_Close( pfile ); - } + // write bitmap bits (remainder of file) + FS_Write( pfile, pbBmpBits, cbBmpBits ); + FS_Close( pfile ); Mem_Free( pbBmpBits ); diff --git a/engine/common/system.c b/engine/common/system.c index 1e1c58f4..7467e672 100644 --- a/engine/common/system.c +++ b/engine/common/system.c @@ -91,7 +91,7 @@ Sys_SetClipboardData write screenshot into clipboard ================ */ -void Sys_SetClipboardData( const byte *buffer, size_t size ) +void Sys_SetClipboardData( const char *buffer, size_t size ) { Platform_SetClipboardText( buffer, size ); } diff --git a/engine/common/system.h b/engine/common/system.h index 170c78af..7232c86f 100644 --- a/engine/common/system.h +++ b/engine/common/system.h @@ -59,7 +59,7 @@ void Sys_ParseCommandLine( int argc, char **argv ); void Sys_MergeCommandLine( void ); void Sys_SetupCrashHandler( void ); void Sys_RestoreCrashHandler( void ); -void Sys_SetClipboardData( const byte *buffer, size_t size ); +void Sys_SetClipboardData( const char *buffer, size_t size ); #define Sys_GetParmFromCmdLine( parm, out ) _Sys_GetParmFromCmdLine( parm, out, sizeof( out )) qboolean _Sys_GetParmFromCmdLine( const char *parm, char *out, size_t size ); qboolean Sys_GetIntFromCmdLine( const char *parm, int *out );