mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-08 14:56:12 -04:00
Fix resized to power of two skin initialising the unused area with garbage, which could be seen with custom models
This commit is contained in:
parent
e25df6065c
commit
12ec05879e
@ -301,7 +301,9 @@ static cc_result EnsurePow2Skin(struct Entity* e, struct Bitmap* bmp) {
|
||||
height = Math_NextPowOf2(bmp->height);
|
||||
if (width == bmp->width && height == bmp->height) return 0;
|
||||
|
||||
Bitmap_TryAllocate(&scaled, width, height);
|
||||
scaled.width = width;
|
||||
scaled.height = height;
|
||||
scaled.scan0 = (BitmapCol*)Mem_TryAllocCleared(width * height, BITMAPCOLOR_SIZE);
|
||||
if (!scaled.scan0) return ERR_OUT_OF_MEMORY;
|
||||
|
||||
e->uScale = (float)bmp->width / width;
|
||||
|
@ -115,7 +115,10 @@ static void LBackend_ScaleFlag(struct Bitmap* bmp) {
|
||||
/* at default DPI don't need to rescale it */
|
||||
if (width == bmp->width && height == bmp->height) return;
|
||||
|
||||
Bitmap_TryAllocate(&scaled, width, height);
|
||||
scaled.width = width;
|
||||
scaled.height = height;
|
||||
scaled.scan0 = (BitmapCol*)Mem_TryAlloc(width * height, BITMAPCOLOR_SIZE);
|
||||
|
||||
if (!scaled.scan0) {
|
||||
Logger_SysWarn(ERR_OUT_OF_MEMORY, "resizing flags bitmap"); return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user