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
|
|
@ -520,9 +520,6 @@ struct Image_Upload_Data {
|
||||||
};
|
};
|
||||||
|
|
||||||
static Image_Upload_Data generate_image_upload_data(const byte* data, int width, int height, qboolean mipmap, qboolean picmip) {
|
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);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// convert to exact power of 2 sizes
|
// 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 )
|
if ( r_roundImagesDown->integer && scaled_height > height )
|
||||||
scaled_height >>= 1;
|
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;
|
byte* resampled_buffer = nullptr;
|
||||||
if ( scaled_width != width || scaled_height != height ) {
|
if ( scaled_width != width || scaled_height != height ) {
|
||||||
resampled_buffer = (byte*) ri.Hunk_AllocateTempMemory( scaled_width * scaled_height * 4 );
|
resampled_buffer = (byte*) ri.Hunk_AllocateTempMemory( scaled_width * scaled_height * 4 );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user