Fixed Texture::copyToImage()

It had three mistakes.