Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!pasteur!cory.Berkeley.EDU!dheller From: dheller@cory.Berkeley.EDU (Dan Heller) Newsgroups: comp.windows.x Subject: Re: XCreateImage/XDestroyImage question Message-ID: <14737@pasteur.Berkeley.EDU> Date: 17 Jun 89 17:39:00 GMT References: <1202@masscomp.UUCP> Sender: news@pasteur.Berkeley.EDU Reply-To: dheller@cory.Berkeley.EDU.UUCP (Dan Heller) Organization: University of California, Berkeley Lines: 29 In article karenb@masscomp.UUCP (Karen ) writes: > 1. You have some image data statically defined, say in an array. By > static I mean it wasn't allocated using malloc. I question whether this is the best thing to do. I can't say for sure, but it sounds like you're making assumptions on the bit/byte ordering of your image and when you eventually try to XPutImage this thing to a drawable, you might not get what you want if you are talking to an X server on a different architecture. I can certainly understand the motivation, however. If I can venture a guess as to why you want to do this --it's because it's very expensive to create a large pixmap, send the whole thing over the wire to the client, twiddle the bits, send it back and free the pixmap. There are four very expensive operations here: creating the pixmap sending it to client sending it back to server freeing memory > Is there a "best" way to do this? Should you set the data pointer in the image > structure to NULL before calling XDestroyImage? Or call Xfree on the image > structure? Or am I totally missing something? Just as a thought -- you could set the data pointer to malloc(1) :-} > /__/_______/ / karenb@westford.ccur.com Dan Heller