issue #2345 refactor CCImage and CCTexture2D

Refactor CCImage and CCTexture2D, update the libjpeg, libpng, libtiff to newest version.