summaryrefslogtreecommitdiff
path: root/render/render.c
diff options
context:
space:
mode:
authorDerek Foreman <manmower@gmail.com>2003-04-06 18:03:59 +0000
committerDerek Foreman <manmower@gmail.com>2003-04-06 18:03:59 +0000
commit8ebf2b6a3f095a7404bac3a2867355f33c1582d4 (patch)
tree7b3506b3316d658762c4d17b73f4f39a9c90b7d1 /render/render.c
parent70e4138169f19102854bca49d4f55708fabcbbbf (diff)
Fix reduce color depth to not use original data
(and break parentrel)
Diffstat (limited to 'render/render.c')
-rw-r--r--render/render.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/render/render.c b/render/render.c
index be2b8310..42fdebe8 100644
--- a/render/render.c
+++ b/render/render.c
@@ -377,17 +377,23 @@ void appearance_free(Appearance *a)
void pixel32_to_pixmap(pixel32 *in, Pixmap out, int x, int y, int w, int h)
{
+ unsigned char *scratch;
XImage *im = NULL;
im = XCreateImage(ob_display, render_visual, render_depth,
ZPixmap, 0, NULL, w, h, 32, 0);
g_assert(im != NULL);
im->byte_order = endian;
- im->data = (char *)in;
- reduce_depth((pixel32*)im->data, im);
+/* this malloc is a complete waste of time on normal 32bpp
+ as reduce_depth just sets im->data = data and returns
+*/
+ scratch = malloc(im->width * im->height * sizeof(pixel32));
+ im->data = scratch;
+ reduce_depth(in, im);
XPutImage(ob_display, out, DefaultGC(ob_display, ob_screen),
im, 0, 0, x, y, w, h);
im->data = NULL;
XDestroyImage(im);
+ free(scratch);
}
void appearance_minsize(Appearance *l, Size *s)