shithub: qk1

Download patch

ref: 85eb6d45853f5eee23c79717a6a878469a08de92
parent: f81982ffa0530056c16b224bd3b5cd4a4494735c
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Mon Dec 18 01:20:28 EST 2023

Load_ExternalTexture: use the original image for all mip levels when scaling

--- a/i_external.c
+++ b/i_external.c
@@ -50,14 +50,14 @@
 	tx->offsets[0] = 0;
 	for(i = 1; i < MIPLEVELS; i++){
 		tx->offsets[i] = tx->offsets[i-1] + n;
-		stbir_resize_uint8_srgb(
-			(byte*)(tx->pixels+tx->offsets[i-1]), w, h, w*sizeof(pixel_t),
-			(byte*)(tx->pixels+tx->offsets[i-0]), w/2, h/2, w/2*sizeof(pixel_t),
-			premult ? STBIR_RGBA_PM : STBIR_RGBA
-		);
 		w /= 2;
 		h /= 2;
 		n = w*h;
+		stbir_resize_uint8_srgb(
+			(byte*)(tx->pixels+tx->offsets[0]), tx->width, tx->height, tx->width*sizeof(pixel_t),
+			(byte*)(tx->pixels+tx->offsets[i]), w, h, w*sizeof(pixel_t),
+			premult ? STBIR_RGBA_PM : STBIR_RGBA
+		);
 	}
 
 	return tx;