mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-01-22 07:51:20 +00:00
Fixed a segfault with null textures by ignoring them in GL_Upload32 and removed a 'magic number' as well.
This commit is contained in:
parent
22ba7f9f28
commit
6e345718c4
1 changed files with 4 additions and 1 deletions
|
@ -1160,6 +1160,9 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
|
|||
unsigned int *scaled;
|
||||
int scaled_width, scaled_height, samples;
|
||||
|
||||
if (!width || !height)
|
||||
return; // Null texture
|
||||
|
||||
// Snap the height and width to a power of 2.
|
||||
for (scaled_width = 1; scaled_width < width; scaled_width <<= 1);
|
||||
for (scaled_height = 1; scaled_height < height; scaled_height <<= 1);
|
||||
|
@ -1178,7 +1181,7 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
|
|||
// If the real width/height and the 'scaled' width/height then we
|
||||
// rescale it.
|
||||
if (scaled_width == width && scaled_height == height) {
|
||||
memcpy (scaled, data, width * height * 4);
|
||||
memcpy (scaled, data, width * height * sizeof (GLuint));
|
||||
} else {
|
||||
GL_ResampleTexture (data, width, height, scaled, scaled_width,
|
||||
scaled_height);
|
||||
|
|
Loading…
Reference in a new issue