diff --git a/engine/common/common.h b/engine/common/common.h index ad168866..02c72621 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -492,7 +492,7 @@ void Image_AddCmdFlags( uint flags ); void FS_FreeImage( rgbdata_t *pack ); rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size ) MALLOC_LIKE( FS_FreeImage, 1 ) WARN_UNUSED_RESULT; qboolean FS_SaveImage( const char *filename, rgbdata_t *pix ); -rgbdata_t *FS_CopyImage( rgbdata_t *in ) MALLOC_LIKE( FS_FreeImage, 1 ) WARN_UNUSED_RESULT; +rgbdata_t *FS_CopyImage( const rgbdata_t *in ) MALLOC_LIKE( FS_FreeImage, 1 ) WARN_UNUSED_RESULT; extern const bpc_desc_t PFDesc[]; // image get pixelformat qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, float reserved ); void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end, int pal_size ); diff --git a/engine/common/imagelib/img_main.c b/engine/common/imagelib/img_main.c index a7446cad..80e26fcc 100644 --- a/engine/common/imagelib/img_main.c +++ b/engine/common/imagelib/img_main.c @@ -597,14 +597,15 @@ FS_CopyImage make an image copy ================ */ -rgbdata_t *FS_CopyImage( rgbdata_t *in ) +rgbdata_t *FS_CopyImage( const rgbdata_t *in ) { rgbdata_t *out; int palSize = 0; - if( !in ) return NULL; + if( !in ) + return NULL; - out = Mem_Malloc( host.imagepool, sizeof( rgbdata_t )); + out = Mem_Malloc( host.imagepool, sizeof( *out )); *out = *in; switch( in->type ) diff --git a/engine/ref_api.h b/engine/ref_api.h index ed119f69..e71543e0 100644 --- a/engine/ref_api.h +++ b/engine/ref_api.h @@ -467,7 +467,7 @@ typedef struct ref_api_s qboolean (*Image_Process)( rgbdata_t **pix, int width, int height, uint flags, float reserved ); rgbdata_t *(*FS_LoadImage)( const char *filename, const byte *buffer, size_t size ); qboolean (*FS_SaveImage)( const char *filename, rgbdata_t *pix ); - rgbdata_t *(*FS_CopyImage)( rgbdata_t *in ); + rgbdata_t *(*FS_CopyImage)( const rgbdata_t *in ); void (*FS_FreeImage)( rgbdata_t *pack ); void (*Image_SetMDLPointer)( byte *p ); const struct bpc_desc_s *(*Image_GetPFDesc)( int idx );