From: Jim I. <ji...@ap...> - 2004-03-19 03:03:22
|
Daniel, Aren't you already using the obdata field for that purpose? I think we=20= are already going to get into trouble if anybody sets this behind our=20 back. So perhaps we can rely on that being non-null for cases where we=20= made out of CGraf's of some sort. The other option is to call IsValidPort on the data from the image, and=20= if it is not a valid port, then treat it as a malloc'ed data buffer. =20 IsValidPort seems reliable - QD keeps a list of ports, and checks=20 against that. So maybe that would be a good way to do it? It's a bit amusing that QDDebugPrintPortInfo doesn't call IsValidPort,=20= but just tries to print the port anyway. I checked the code, and=20 indeed that is true... But it is just a debugging function. Jim On Mar 18, 2004, at 5:59 PM, Daniel A. Steffen wrote: > Matthieu, > > can we keep this on the list please? > > On Friday, Mar 19, 2004, at 02:34 Australia/Sydney, Matthieu Quignard=20= > wrote: > >>> set a breakpoint in gdb on TkMacOSXXPutPixel() (tk/macosx/ >>> tkMacOSXXStubs.c) and check that >>> - image->data is not NULL >>> - image->data is a calid quickdraw port >>> (via gdb function 'call (void) QDDebugPrintPortInfo(image- >>>> data)') >>> - x,y are valid coordinates in the image >>> - cpix is a valid color value >>> >> >> OK I forgot to setenv DYLD_IMAGE_SUFFIX _debug >> >> Here is what I got : >> x =3D 0 >> y =3D 0 >> cPix : red =3D green =3D blue =3D 255 >> image =3D (XImage *) 0xb30b88 >> image->data =3D 0xb44408 "=FF=FF=FF=FF" >> >> BUT : >> (gdb) call (void) QDDebugPrintPortInfo(image->data) >> Program received signal EXC_BAD_ACCESS, Could not access memory. >> 0xb97213f4 in GetPortHiliteColor () > > ok, this means that image->data is not a QuickDraw port, which=20 > explains why SetCPixel() crashes on it. > > currently the aqua X11 emulation doesn't handle generic XImages=20 > created by XCreateImage with e.g. a malloc'd data buffer, I suspect=20 > this is what tkdvi is doing? > > dealing with this properly should not be too difficult to add, e.g. by=20= > adapting the windows code (ImageGetPixel,PutPixel in tkWinImage.c), it=20= > looks like the aqua TkPutImage should already be ok. The only question=20= > is how to distinguish between XImages based on a port (where we want=20= > to use Get/SetCPixel) and XImages with arbitrary data buffers? Jim,=20 > any ideas? > > Cheers, > > Daniel > > --=20 > ** Daniel A. Steffen ** "And now for something completely > ** Dept. of Mathematics ** different" Monty Python > ** Macquarie University ** <mailto:st...@ma...> > ** NSW 2109 Australia ** <http://www.maths.mq.edu.au/~steffen/> > > -- Jim Ingham ji...@ap... Developer Tools Apple Computer |