Don't create the opacity buffer for images that lack a mask.
Remove unneeded srcOffset arguments from createRgbBuffer.
Don't create the RGB buffer for images that don't need resizing.
Merge pull request #4139 from nnethercote/RGBA

Write color and opacity values directly to the final RGBA array when possible, so as to avoid allocating unnecessary memory.