I'm having a problem with zooming rasters. I have a HUGE raster (aproximately 1200x1200, it's derived from a Digital Terrain Elevation Data map). I put inside a nifty scrolling/zooming viewport that I've written and it scrolls nicely.
The raster also zooms nicely, albeit slowly, up to a point. After expanding or shrinking too much, I run into problems. Here's the symptoms:
Hit shrink button, wait for a year, nicely shrunk
Hit shrink button, go to lunch, yep, it's smaller
Hit shrink button, read net news, does OK
.
.
Hit shrink button, then immediately the raster is redrawn, same size, just offset.
Taking a look at the code (xcanvas.c, tx_raster(), lines 845-950), it seems that after you zoom a raster, the resulting raster gets stored in a hash table, keyed by the transformation that put it there. The problem I'm having seems to result from the fact that tx_key responds with the same key for the old and new transformation matrices. The Table2 hash table doesn't seem to compare values, just keys, and thus, instead of generating the new raster for the shrunk map, tx_raster says, "great, I can use the
previous raster and get a faster update." So it quickly and efficiently returns the wrong raster.
This happens upon extreme enlargments as well.
I'm not completely sure this is the cause of my problems, but it fits the symptoms. What can I do to change this? Is it a bug or a feature?