GL2PaintEngine: Prevent fillInPendingGlyphs from breaking gradients

The glyph cache internally uses the image texture unit when blitting,
but doesn't always activate the unit before binding its texture,
resulting in sometimes binding the glyph cache texture to the
wrong unit.

The image texture unit is also the same as the brush texture unit,
so any time we fill in pending glyphs we need to re-bind the brush
texture, otherwise drawing text with eg. gradients will fail after
the new glyphs have been filled.

The new hasPendingGlyphs() member function of the glyph cache
is an optimization so that we don't need to activate and rebind
unless there are glyphs that need to be filled.

Change-Id: Iac74130145d2d6d7bf95206b5e8a2fc760743cb5
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>