gba-x3dtest
diff src/x3d.c @ 19:62390f9cc93e
texture cache optimization failed
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 30 Jun 2014 09:07:41 +0300 |
parents | 0a7f402892b3 |
children | 2e903e27e35a |
line diff
1.1 --- a/src/x3d.c Thu Jun 26 21:48:09 2014 +0300 1.2 +++ b/src/x3d.c Mon Jun 30 09:07:41 2014 +0300 1.3 @@ -1,5 +1,6 @@ 1.4 #include "config.h" 1.5 #include <stdio.h> 1.6 +#include <stdlib.h> 1.7 #include <string.h> 1.8 #include <math.h> 1.9 #include "x3d.h" 1.10 @@ -351,7 +352,9 @@ 1.11 1.12 for(i=0; i<MAX_TEXTURES; i++) { 1.13 if(!textures[i].pixels) { 1.14 - textures[i].pixels = pixels; 1.15 + /*textures[i].pixels = pixels;*/ 1.16 + textures[i].pixels = malloc(xsz * ysz * 2); 1.17 + memcpy(textures[i].pixels, pixels, xsz * ysz * 2); 1.18 textures[i].xsz = xsz; 1.19 textures[i].ysz = ysz; 1.20 textures[i].umask = xsz - 1; 1.21 @@ -366,6 +369,8 @@ 1.22 } 1.23 } 1.24 1.25 + logmsg(LOG_DBG, "create texture %dx%d: %p\n", xsz, ysz, pixels); 1.26 + 1.27 return i; 1.28 } 1.29 }