summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lua5/imlua_image.c6
-rw-r--r--src/process/im_quantize.cpp5
2 files changed, 6 insertions, 5 deletions
diff --git a/src/lua5/imlua_image.c b/src/lua5/imlua_image.c
index 6d5ea2b..40b1e9c 100644
--- a/src/lua5/imlua_image.c
+++ b/src/lua5/imlua_image.c
@@ -2,7 +2,7 @@
* \brief IM Lua 5 Binding
*
* See Copyright Notice in im_lib.h
- * $Id: imlua_image.c,v 1.4 2009/08/19 21:33:55 scuri Exp $
+ * $Id: imlua_image.c,v 1.5 2009/09/25 18:40:31 scuri Exp $
*/
#include <string.h>
@@ -479,7 +479,9 @@ static int imluaImageSetPalette (lua_State *L)
{
imImage *image = imlua_checkimage(L, 1);
imluaPalette *pal = imlua_checkpalette(L, 2);
- imImageSetPalette(image, pal->color, pal->count);
+ long* palette = (long*)malloc(sizeof(long)*256);
+ memcpy(palette, pal->color, pal->count*sizeof(long));
+ imImageSetPalette(image, palette, pal->count);
return 0;
}
diff --git a/src/process/im_quantize.cpp b/src/process/im_quantize.cpp
index 9a65f4c..de78cf4 100644
--- a/src/process/im_quantize.cpp
+++ b/src/process/im_quantize.cpp
@@ -2,7 +2,7 @@
* \brief Additional Image Quantization Operations
*
* See Copyright Notice in im_lib.h
- * $Id: im_quantize.cpp,v 1.1 2008/10/17 06:16:33 scuri Exp $
+ * $Id: im_quantize.cpp,v 1.2 2009/09/25 18:40:32 scuri Exp $
*/
@@ -24,8 +24,7 @@ void imProcessQuantizeRGBUniform(const imImage* src_image, imImage* dst_image, i
*green_map=(imbyte*)src_image->data[1],
*blue_map=(imbyte*)src_image->data[2];
- long *palette = imPaletteUniform();
- imImageSetPalette(dst_image, palette, 256);
+ imImageSetPalette(dst_image, imPaletteUniform(), 256);
for (int y = 0; y < src_image->height; y++)
{