Fix tile rendering bug for context2d
authorCharles Yin <charles.yin@nokia.com>
Fri, 4 May 2012 01:21:14 +0000 (11:21 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 4 May 2012 06:47:38 +0000 (08:47 +0200)
aboutToDraw() should be called before checking the painter device,
if no device, aboutToDraw() will create a new one.

Also just release the FBO when delete tile, not need to release the fbo
after each draw.

Change-Id: Ida5954f1c65f25f0ce273f732c1608ed49bc148c
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
src/quick/items/context2d/qquickcontext2dtile.cpp

index dd416e1..046300a 100644 (file)
@@ -65,8 +65,8 @@ QPainter* QQuickContext2DTile::createPainter(bool smooth)
     if (m_painter.isActive())
         m_painter.end();
 
+    aboutToDraw();
     if (m_device) {
-        aboutToDraw();
         m_painter.begin(m_device);
         m_painter.resetTransform();
         m_painter.setCompositionMode(QPainter::CompositionMode_Source);
@@ -104,6 +104,8 @@ QQuickContext2DFBOTile::QQuickContext2DFBOTile()
 
 QQuickContext2DFBOTile::~QQuickContext2DFBOTile()
 {
+    if (m_fbo)
+        m_fbo->release();
     delete m_fbo;
 }
 
@@ -121,7 +123,6 @@ void QQuickContext2DFBOTile::aboutToDraw()
 
 void QQuickContext2DFBOTile::drawFinished()
 {
-    m_fbo->release();
 }
 
 void QQuickContext2DFBOTile::setRect(const QRect& r)