From: Daniel A. S. <st...@ic...> - 2001-12-10 07:31:55
|
Dear All, tkMacDraw.c's TkPutImage crashes in CopyBits when using very wide images. I have a case here where a Tk app (which is working fine on unix & win) uses an image 4846 pixels wide (and 32 bits deep), which results in a bytes_per_line value of 0x4BB8. However, according to IM, PixMap's maximal value for rowBytes is 0x3FFF (c.f. [1]) and indeed CopyBits crashes on the PixMap constructed by TkPutImage with pixmap.rowBytes = image->bytes_per_line | 0x8000; (rowBytes is a short whose high 2 bits are used as QD flags, thus the 0x3FFF limit) In practical terms this means that Tk will crash when using any 32bit image wider than 4095 pixels. Not sure what the best solution is here, I've now added a panic before the CopyBits to at least exit gracefully, a better solution would be to split the image into blocks that are maximally 0x4000 bytes wide and do CopyBits on each block... The question is how common is the use of images this wide, is it worth putting in time to get this to work? BTW, this problem almost certainly also exist on TkAqua, as TkPutImage is essentially unchanged in tkMacOSXDraw.c (and Carbon CopyBits still uses Bit 15 as a flag) Cheers, Daniel [1] http://developer.apple.com/techpubs/macosx/Carbon/graphics/QuickDraw/QuickDraw_Manager/DataTypes/PixMap.html -- ** Daniel A. Steffen ** "And now to something completely ** Department of Mathematics ** different" Monty Python ** Macquarie University ** <mailto:st...@ma...> ** NSW 2109 Australia ** <http://www.maths.mq.edu.au/~steffen/> |