Fixed bug with insufficient buffer size to store image data (we should use scaled image dimensions, not original ones).
This commit is contained in:
parent
6079758830
commit
02e075e0f5
|
|
@ -519,10 +519,7 @@ struct Image_Upload_Data {
|
|||
int base_level_height;
|
||||
};
|
||||
|
||||
static Image_Upload_Data generate_image_upload_data(const byte* data, int width, int height, qboolean mipmap, qboolean picmip) {
|
||||
Image_Upload_Data upload_data;
|
||||
upload_data.buffer = (byte*) ri.Hunk_AllocateTempMemory(2 * 4 * width * height);
|
||||
|
||||
static Image_Upload_Data generate_image_upload_data(const byte* data, int width, int height, qboolean mipmap, qboolean picmip) {
|
||||
//
|
||||
// convert to exact power of 2 sizes
|
||||
//
|
||||
|
|
@ -537,6 +534,9 @@ static Image_Upload_Data generate_image_upload_data(const byte* data, int width
|
|||
if ( r_roundImagesDown->integer && scaled_height > height )
|
||||
scaled_height >>= 1;
|
||||
|
||||
Image_Upload_Data upload_data;
|
||||
upload_data.buffer = (byte*) ri.Hunk_AllocateTempMemory(2 * 4 * scaled_width * scaled_height);
|
||||
|
||||
byte* resampled_buffer = nullptr;
|
||||
if ( scaled_width != width || scaled_height != height ) {
|
||||
resampled_buffer = (byte*) ri.Hunk_AllocateTempMemory( scaled_width * scaled_height * 4 );
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user