From: Jim I. <ji...@ap...> - 2001-12-10 18:23:07
|
Daniel, On Sunday, December 9, 2001, at 11:31 PM, Daniel A. Steffen wrote: > 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? > This depends on how much free time you have. Not many screens can display an image this big, so I wouldn't imagine this is all that common. > 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) > Yes, but I would solve this problem on X not by breaking the image up, as you would have to on 9, but by replacing CopyBits with a CoreGraphics problem at some point, since that would also open the possibility of compositing with alpha channels as well. So I don't think this is a motivation to do this work on 9 (of course, who knows when I will get around to this...) Jim -- Jim Ingham ji...@ap... Developer Tools - gdb Apple Computer |