shithub: riscv

Download patch

ref: e00c53cf7433c0a8562190dde75cf17cb9ae7f08
parent: d1225403d777b7294d14214578f369874a6f047c
author: ftrvxmtrx <[email protected]>
date: Thu Jan 24 17:10:27 EST 2013

tga, file: 15-bit tga images

--- a/sys/src/cmd/file.c
+++ b/sys/src/cmd/file.c
@@ -1211,7 +1211,7 @@
 		return 0;
 	if((p[14] | p[15]<<8) == 0)	/* height */
 		return 0;
-	if(p[16] != 8 && p[16] != 16 && p[16] != 24 && p[16] != 32)	/* bpp */
+	if(p[16] != 8 && p[16] != 15 && p[16] != 16 && p[16] != 24 && p[16] != 32)	/* bpp */
 		return 0;
 	if(((p[2]|(1<<3)) & (~3)) != (1<<3))	/* rle flag */
 		return 0;
--- a/sys/src/cmd/jpg/readtga.c
+++ b/sys/src/cmd/jpg/readtga.c
@@ -89,6 +89,7 @@
 		}
 		break;
 	case 16:
+	case 15:
 		/* convert to 24-bit colormap */
 		if((cmap = realloc(cmap, 3*cmaplen)) == nil)
 			return -1;
@@ -245,6 +246,7 @@
 
 	switch(bpp){
 	case 16:
+	case 15:
 		for(i = 0; i < num; i++){
 			if(Bread(bp, buf, 2) != 2)
 				break;