Make QRawFont usage safer in a multi-threaded environment

QFontEngine must be accessed amd deleted only in a thread in which
it was instantiated, so we remember that thread and check if it
hasn't been changed every time we access the engine.

Change-Id: I28bc0394ced9cbd437dc950d35ffcbd99cfa7152
Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Ensure that GL::updateBrushTexture() activates and binds properly

Calling QOpenGL2GradientCache::getBuffer() will generate the texture the
first time, calling glBindTexture in the process. We did this without
first ensuring that the right texture unit was active, resulting in the
generated gradient texture binding onto the glyph cache mask unit.

We now provide a specialization of bindTexture for a QGradient, which
ensures that the right unit is active before calling getBuffer().

Unfortunately we have no way of knowing if the result of getBuffer()
was a texture that was already bound, or if we need to bind the result,
which means we have to do an unconditional bindTexture of the resulting
texture ID. This means double-bind for the initial texture generation,
but this was already an issue in the original code.

Task-number: QTBUG-43039
Task-number: QTBUG-41244
Change-Id: I20c9b795c8c14f8d58be2b60a284c5a060705ec0
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>