summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraavit <qt-info@nokia.com>2010-11-02 12:14:03 (GMT)
committeraavit <qt-info@nokia.com>2010-11-02 12:14:03 (GMT)
commit57ac6015ab50d96a180a82676e9e1c3b702c0678 (patch)
treea8d63d2d9088f63d95c03a278df49f40a3e4937f /src
parent7c5259e91b4808424482f2a15838418bf4dcc00d (diff)
parent128d0c2d64abec366cec22dfca493e6f5e03aa9d (diff)
downloadQt-57ac6015ab50d96a180a82676e9e1c3b702c0678.zip
Qt-57ac6015ab50d96a180a82676e9e1c3b702c0678.tar.gz
Qt-57ac6015ab50d96a180a82676e9e1c3b702c0678.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2
Diffstat (limited to 'src')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp29
-rw-r--r--src/opengl/qglframebufferobject.cpp4
2 files changed, 33 insertions, 0 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 14c26b9..b90709f 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -872,6 +872,35 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
// Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable
path.makeCacheable();
+ if (!device->format().stencil()) {
+ // If there is no stencil buffer, triangulate the path instead.
+
+ QRectF bbox = path.controlPointRect();
+ // If the path doesn't fit within these limits, it is possible that the triangulation will fail.
+ bool withinLimits = (bbox.left() > -0x8000 * inverseScale)
+ && (bbox.right() < 0x8000 * inverseScale)
+ && (bbox.top() > -0x8000 * inverseScale)
+ && (bbox.bottom() < 0x8000 * inverseScale);
+ if (withinLimits) {
+ QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale));
+
+ QVarLengthArray<float> vertices(polys.vertices.size());
+ for (int i = 0; i < polys.vertices.size(); ++i)
+ vertices[i] = float(inverseScale * polys.vertices.at(i));
+
+ prepareForDraw(currentBrush.isOpaque());
+ setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData());
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint)
+ glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.data());
+ else
+ glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_SHORT, polys.indices.data());
+ } else {
+ // We can't handle big, concave painter paths with OpenGL without stencil buffer.
+ qWarning("Painter path exceeds +/-32767 pixels.");
+ }
+ return;
+ }
+
// The path is too complicated & needs the stencil technique
vertexCoordinateArray.clear();
vertexCoordinateArray.addPath(path, inverseScale, false);
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 6881678..8915b5e 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -324,6 +324,10 @@ void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f,
fboFormat.setStencil(true);
} else if (attachment == QGLFramebufferObject::Depth) {
fboFormat.setDepth(true);
+ fboFormat.setStencil(false);
+ } else {
+ fboFormat.setDepth(false);
+ fboFormat.setStencil(false);
}
GLenum format = f->format().internalTextureFormat();