diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-12-08 16:41:33 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2014-12-13 01:49:24 +0100 |
commit | dfccd78aa671364346bc9c4d1203dcb54d008a07 (patch) | |
tree | 2d96a64e83420ea6b84993658abf0df51bebf0af /tests/auto/other | |
parent | 384388f2cd739fd1416e4016588c79fd9788e898 (diff) |
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>
Diffstat (limited to 'tests/auto/other')
-rw-r--r-- | tests/auto/other/lancelot/scripts/text.qps | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/other/lancelot/scripts/text.qps b/tests/auto/other/lancelot/scripts/text.qps index b3d8475411..344c7a813d 100644 --- a/tests/auto/other/lancelot/scripts/text.qps +++ b/tests/auto/other/lancelot/scripts/text.qps @@ -139,4 +139,24 @@ save setClipPath clip setPen black repeat_block text_drawing +restore + +translate 150 0 +save + setPen black + setFont "sansserif" 10 normal + drawText 0 20 "testing glyph cache textures" + + # Important that this gradient doesn't match any earlier + # gradients, so that it's not cached from before. + gradient_clearStops + gradient_appendStop 0 blue + gradient_appendStop 0.5 #00ff00 + gradient_appendStop 1 red + gradient_setLinear 0 0 100 0 + setPen nopen + drawRect 0 30 100 20 + + setPen black + drawText 0 70 "testing glyph cache textures" restore
\ No newline at end of file |