From c96c1d152c8506afb3993f23ac7cf35e46fb808f Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Fri, 4 May 2012 11:21:14 +1000 Subject: [PATCH] Fix tile rendering bug for context2d 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 --- src/quick/items/context2d/qquickcontext2dtile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/quick/items/context2d/qquickcontext2dtile.cpp b/src/quick/items/context2d/qquickcontext2dtile.cpp index dd416e1..046300a 100644 --- a/src/quick/items/context2d/qquickcontext2dtile.cpp +++ b/src/quick/items/context2d/qquickcontext2dtile.cpp @@ -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) -- 2.7.4