summaryrefslogtreecommitdiffstats
path: root/src/opengl/qpixmapdata_gl.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-06-09 11:23:08 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-06-09 12:06:21 (GMT)
commit923cadc12b993a0b41200750f151d73662856482 (patch)
tree33cbbcae8c8f8cca5b137b092527c8f95d80cf96 /src/opengl/qpixmapdata_gl.cpp
parent6495eb4953c5fca93d8cfe91c66b50ce82ce24cb (diff)
downloadQt-923cadc12b993a0b41200750f151d73662856482.zip
Qt-923cadc12b993a0b41200750f151d73662856482.tar.gz
Qt-923cadc12b993a0b41200750f151d73662856482.tar.bz2
Prevented pixmap FBOs from growing too big.
If we're painting to very wide and then very tall pixmaps we don't want the FBO to grow to max_width * max_height, instead we should recreate the FBO if it grows too large compared to what's being painted. Reviewed-by: Trond
Diffstat (limited to 'src/opengl/qpixmapdata_gl.cpp')
-rw-r--r--src/opengl/qpixmapdata_gl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 8d94c8b..98c406b 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -389,6 +389,11 @@ QPaintEngine* QGLPixmapData::paintEngine() const
sz.setWidth(qMax(m_width, qRound(sz.width() * 1.5)));
if (sz.height() < m_height)
sz.setHeight(qMax(m_height, qRound(sz.height() * 1.5)));
+
+ // wasting too much space?
+ if (sz.width() * sz.height() > m_width * m_height * 2.5)
+ sz = QSize(m_width, m_height);
+
delete textureBufferStack.at(currentTextureBuffer).fbo;
textureBufferStack[currentTextureBuffer] =
createTextureBuffer(sz, textureBufferStack.at(currentTextureBuffer).engine);