diff -r f7edb3b90816 -r fcf1487b398b src/raytracermodule.cc --- a/src/raytracermodule.cc Mon Apr 28 11:44:11 2008 +0200 +++ b/src/raytracermodule.cc Tue Apr 29 13:56:29 2008 +0200 @@ -801,19 +801,10 @@ return Py_None; } - // convert data to char printf("[pyrit] Converting image data (float to char)\n"); - chardata = (unsigned char *) malloc(w*h*3); - Float *d = data; - for (unsigned char *c = chardata; c != chardata + w*h*3; c++, d++) { - if (*d > 1.0) - *c = 255; - else - *c = (unsigned char)(*d * 255.0); - } - free(data); + chardata = sampler.getPixmap().getCharData(); o = Py_BuildValue("s#", chardata, w*h*3); - free(chardata); + delete[] chardata; printf("[pyrit] Done.\n"); return o; }