Browse Source

engine: remove write_to_clipboard, as there was no way to enable it for a long time and no one even asked for this

pull/2/head
Alibek Omarov 6 years ago
parent
commit
b539ed5a3d
  1. 1
      engine/common/common.h
  2. 53
      engine/common/imagelib/img_bmp.c
  3. 2
      engine/common/system.c
  4. 2
      engine/common/system.h

1
engine/common/common.h

@ -419,7 +419,6 @@ typedef struct host_parm_s @@ -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

53
engine/common/imagelib/img_bmp.c

@ -318,7 +318,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix ) @@ -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 ) @@ -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 ) @@ -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 ) @@ -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 ) @@ -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 );

2
engine/common/system.c

@ -91,7 +91,7 @@ Sys_SetClipboardData @@ -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 );
}

2
engine/common/system.h

@ -59,7 +59,7 @@ void Sys_ParseCommandLine( int argc, char **argv ); @@ -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 );

Loading…
Cancel
Save