Some gfx fixes and tests

All the tests have been validated on a real Nokia Asha 503
Aside: we should define this constant and TYPE_USHORT_565_RGB in variables (up around line 245, where other such constants are defined), even though there are only three occurrences between the two of them, since then we won't have to append a comment just to explain the value.