Merged changes from Grivan's GSOC2010 project, branches/grivan, r2824:3253. This brings the new canvas code into trunk.