Revert "qt4: Updated to v4.7.3"
[openembedded.git] / recipes / qt4 / qt-4.6.0 / 1205-Fix-text-rendering-on-GL2-paint-engine.patch
1 From a8c3ed1dbe209488866e687d1a63c6143a04cfe0 Mon Sep 17 00:00:00 2001
2 From: Tom Cooksey <thomas.cooksey@nokia.com>
3 Date: Wed, 23 Dec 2009 10:38:56 +0100
4 Subject: [PATCH 1205/1244] Fix text rendering on GL2 paint engine
5
6 If you draw with a brush, then draw a pixmap, then draw with the
7 same brush, the GL2 engine wouldn't update the fragment shader to
8 use the brush. This is because it detected the brush hadn't changed
9 and so didn't need updating. To fix this, we now set the current
10 brush to noBrush when drawing an image/pixmap so the engine knows
11 it needs to update the GL state for the brush.
12
13 Reviewed-By: Kim
14 ---
15  .../gl2paintengineex/qpaintengineex_opengl2.cpp    |   15 ++++++++++-----
16  .../gl2paintengineex/qpaintengineex_opengl2_p.h    |    1 +
17  2 files changed, 11 insertions(+), 5 deletions(-)
18
19 diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
20 index f52ed92..32fa3dc 100644
21 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
22 +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
23 @@ -388,21 +388,24 @@ inline QColor qt_premultiplyColor(QColor c, GLfloat opacity)
24  
25  void QGL2PaintEngineExPrivate::setBrush(const QBrush& brush)
26  {
27 -    Q_ASSERT(brush.style() != Qt::NoBrush);
28 -
29      if (qbrush_fast_equals(currentBrush, brush))
30          return;
31  
32 +    const Qt::BrushStyle newStyle = qbrush_style(brush);
33 +    Q_ASSERT(newStyle != Qt::NoBrush);
34 +
35      currentBrush = brush;
36 +    brushUniformsDirty = true; // All brushes have at least one uniform
37 +
38 +    if (newStyle > Qt::SolidPattern)
39 +        brushTextureDirty = true;
40  
41 -    brushTextureDirty = true;
42 -    brushUniformsDirty = true;
43      if (currentBrush.style() == Qt::TexturePattern
44          && qHasPixmapTexture(brush) && brush.texture().isQBitmap())
45      {
46          shaderManager->setSrcPixelType(QGLEngineShaderManager::TextureSrcWithPattern);
47      } else {
48 -        shaderManager->setSrcPixelType(currentBrush.style());
49 +        shaderManager->setSrcPixelType(newStyle);
50      }
51      shaderManager->optimiseForBrushTransform(currentBrush.transform());
52  }
53 @@ -700,6 +703,7 @@ static inline void setCoords(GLfloat *coords, const QGLRect &rect)
54  void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern)
55  {
56      // Setup for texture drawing
57 +    currentBrush = noBrush;
58      shaderManager->setSrcPixelType(pattern ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc);
59      if (prepareForDraw(opaque))
60          shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT);
61 @@ -1782,6 +1786,7 @@ void QGL2PaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int d
62                             state()->renderHints & QPainter::SmoothPixmapTransform, texture->id);
63  
64      // Setup for texture drawing
65 +    d->currentBrush = d->noBrush;
66      d->shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc);
67      if (d->prepareForDraw(isOpaque))
68          d->shaderManager->currentProgram()->setUniformValue(d->location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT);
69 diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
70 index f1ec6e6..8de4a82 100644
71 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
72 +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
73 @@ -244,6 +244,7 @@ public:
74      uint maxClip;
75  
76      QBrush currentBrush; // May not be the state's brush!
77 +    const QBrush noBrush;
78  
79      GLfloat     inverseScale;
80  
81 -- 
82 1.6.5
83