Optimize getBounds() for Sprite and TilingSprite

These are simillar changes to what was done for #703.