diff options
author | Jani Hautakangas <jani.hautakangas@nokia.com> | 2010-10-04 07:55:11 (GMT) |
---|---|---|
committer | Jani Hautakangas <jani.hautakangas@nokia.com> | 2010-10-04 08:51:43 (GMT) |
commit | 207d9239dc6b67109b5e8cbdea7e5a589c167e85 (patch) | |
tree | 8f4f78085355b1713e132299617aed7231a095be /src/opengl/gl2paintengineex/qtriangulator_p.h | |
parent | 51d007e0fa699339f072956bbd8bfe33db9b7f70 (diff) | |
download | Qt-207d9239dc6b67109b5e8cbdea7e5a589c167e85.zip Qt-207d9239dc6b67109b5e8cbdea7e5a589c167e85.tar.gz Qt-207d9239dc6b67109b5e8cbdea7e5a589c167e85.tar.bz2 |
Enable QtOpenGL vector path caching on Symbian/IVE3
IVE3 doesn't support UNSIGNED_INT <type> index values in DrawElements.
This patch checks if GL_OES_element_index_uint extensions is
supported and determines DrawElement indices type based on that.
On desktop environment UNSIGNED_INT is always supported.
Task-number: QTBUG-13563
Reviewed-by: Gunnar
Diffstat (limited to 'src/opengl/gl2paintengineex/qtriangulator_p.h')
-rw-r--r-- | src/opengl/gl2paintengineex/qtriangulator_p.h | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/src/opengl/gl2paintengineex/qtriangulator_p.h b/src/opengl/gl2paintengineex/qtriangulator_p.h index e5eec39..8f96e9f 100644 --- a/src/opengl/gl2paintengineex/qtriangulator_p.h +++ b/src/opengl/gl2paintengineex/qtriangulator_p.h @@ -58,7 +58,58 @@ QT_BEGIN_NAMESPACE -#define Q_TRIANGULATE_END_OF_POLYGON quint32(-1) +class QVertexIndexVector +{ +public: + enum Type { + UnsignedInt, + UnsignedShort + }; + + inline Type type() const { return t; } + + inline void setDataUint(const QVector<quint32> &data) + { + t = UnsignedInt; + indices32 = data; + } + + inline void setDataUshort(const QVector<quint16> &data) + { + t = UnsignedShort; + indices16 = data; + } + + inline const void* data() const + { + if (t == UnsignedInt) + return indices32.data(); + return indices16.data(); + } + + inline int size() const + { + if (t == UnsignedInt) + return indices32.size(); + return indices16.size(); + } + + inline QVertexIndexVector &operator = (const QVertexIndexVector &other) + { + if (t == UnsignedInt) + indices32 = other.indices32; + else + indices16 = other.indices16; + + return *this; + } + +private: + + Type t; + QVector<quint32> indices32; + QVector<quint16> indices16; +}; struct QTriangleSet { @@ -68,7 +119,7 @@ struct QTriangleSet // The vertices of a triangle are given by: (x[i[n]], y[i[n]]), (x[j[n]], y[j[n]]), (x[k[n]], y[k[n]]), n = 0, 1, ... QVector<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...] - QVector<quint32> indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...] + QVertexIndexVector indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...] }; struct QPolylineSet @@ -78,8 +129,7 @@ struct QPolylineSet QPolylineSet &operator = (const QPolylineSet &other) {vertices = other.vertices; indices = other.indices; return *this;} QVector<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...] - QVector<quint32> indices; - + QVertexIndexVector indices; }; // The vertex coordinates of the returned triangle set will be rounded to a grid with a mesh size |