Canvassing Something or Other #

I've fixed the bug mentioned before. My NewIcon procedure takes a pointer to a FSSpec as its parameter, and it a file is dragged onto the icon then pointer points to the file that was dragged, otherwise it points to nothing. If it's not poiting to anything, then I call the GetFile function to to choose a file. But it's not poiting to anything, then it hasn't been allocated, so callign GetFile would end up writing in random areas in the memory. I called NewPtr before GetFile, and that solved everything.

Then I worked on improving my Display function. Originally, it created a temporary GWorld, copied all the necessary stuff into it, and then copied it into the target rect on the screen. However, when there wasn't enough memory to create this gworld (it could be up to 480x480 at 32 bits) then there would be garbage written on the screen, so I'd have to take this into account when determining if there was enough memory to make a new icon. So instead I decided to switch to having a permament "canvas" gworld where I could composite stuff. This could go into the statics struct I added a few days ago, because it can be shared by all the icons.

Post a Comment