diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-03-07 14:42:59 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-05-13 20:30:26 +0000 |
commit | 30aa0a1cc9812bd2a9ead91e3f412808ebe7daff (patch) | |
tree | 3165986d36f4727bb8ec111b7db22eb45a067867 /src/quick/scenegraph/coreapi | |
parent | 66be8fcc05f0e51f12c215af3d5ab74d729386ba (diff) |
QtQuick: Fix const correctness in old style casts
Found with GCC's -Wcast-qual.
Change-Id: Ia0aac2f09e9245339951ffff13c9589afabc7ade
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/quick/scenegraph/coreapi')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 8 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h | 7 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnode.cpp | 14 |
3 files changed, 17 insertions, 12 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 886e614620..63938d50a9 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -1693,8 +1693,8 @@ void Renderer::uploadMergedElement(Element *e, int vaOffset, char **vertexData, if (((const QMatrix4x4_Accessor &) localx).flagBits == 1) { for (int i=0; i<vCount; ++i) { Pt *p = (Pt *) vdata; - p->x += ((QMatrix4x4_Accessor &) localx).m[3][0]; - p->y += ((QMatrix4x4_Accessor &) localx).m[3][1]; + p->x += ((const QMatrix4x4_Accessor &) localx).m[3][0]; + p->y += ((const QMatrix4x4_Accessor &) localx).m[3][1]; vdata += vSize; } } else if (((const QMatrix4x4_Accessor &) localx).flagBits > 1) { @@ -1935,11 +1935,11 @@ void Renderer::uploadBatch(Batch *b) if (attr.isVertexCoordinate) dump << "* "; for (int t=0; t<attr.tupleSize; ++t) - dump << *(float *)(vd + offset + t * sizeof(float)) << " "; + dump << *(const float *)(vd + offset + t * sizeof(float)) << " "; } else if (attr.type == GL_UNSIGNED_BYTE) { dump << "ubyte "; for (int t=0; t<attr.tupleSize; ++t) - dump << *(unsigned char *)(vd + offset + t * sizeof(unsigned char)) << " "; + dump << *(const unsigned char *)(vd + offset + t * sizeof(unsigned char)) << " "; } dump << ") "; offset += attr.tupleSize * size_of_type(attr.type); diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index 8996d5a092..f87dd75c8c 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -85,7 +85,12 @@ public: for (int i=0; i<PageSize; ++i) blocks[i] = i; } - Type *at(uint index) const + const Type *at(uint index) const + { + return (Type *) &data[index * sizeof(Type)]; + } + + Type *at(uint index) { return (Type *) &data[index * sizeof(Type)]; } diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index e52713e804..71f4f62db9 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -1457,7 +1457,7 @@ QDebug operator<<(QDebug d, const QSGGeometryNode *n) d << "Geometry(null)"; return d; } - d << "GeometryNode(" << hex << (void *) n << dec; + d << "GeometryNode(" << hex << (const void *) n << dec; const QSGGeometry *g = n->geometry(); @@ -1508,7 +1508,7 @@ QDebug operator<<(QDebug d, const QSGClipNode *n) d << "ClipNode(null)"; return d; } - d << "ClipNode(" << hex << (void *) n << dec; + d << "ClipNode(" << hex << (const void *) n << dec; if (n->childCount()) d << "children=" << n->childCount(); @@ -1531,7 +1531,7 @@ QDebug operator<<(QDebug d, const QSGTransformNode *n) } const QMatrix4x4 m = n->matrix(); d << "TransformNode("; - d << hex << (void *) n << dec; + d << hex << (const void *) n << dec; if (m.isIdentity()) d << "identity"; else if (m.determinant() == 1 && m(0, 0) == 1 && m(1, 1) == 1 && m(2, 2) == 1) @@ -1553,7 +1553,7 @@ QDebug operator<<(QDebug d, const QSGOpacityNode *n) return d; } d << "OpacityNode("; - d << hex << (void *) n << dec; + d << hex << (const void *) n << dec; d << "opacity=" << n->opacity() << "combined=" << n->combinedOpacity() << (n->isSubtreeBlocked() ? "*BLOCKED*" : ""); @@ -1571,7 +1571,7 @@ QDebug operator<<(QDebug d, const QSGRootNode *n) d << "RootNode(null)"; return d; } - d << "RootNode" << hex << (void *) n << (n->isSubtreeBlocked() ? "*BLOCKED*" : ""); + d << "RootNode" << hex << (const void *) n << (n->isSubtreeBlocked() ? "*BLOCKED*" : ""); #ifdef QSG_RUNTIME_DESCRIPTION d << QSGNodePrivate::description(n); #endif @@ -1604,7 +1604,7 @@ QDebug operator<<(QDebug d, const QSGNode *n) d << static_cast<const QSGOpacityNode *>(n); break; case QSGNode::RenderNodeType: - d << "RenderNode(" << hex << (void *) n << dec + d << "RenderNode(" << hex << (const void *) n << dec << "flags=" << (int) n->flags() << dec << (n->isSubtreeBlocked() ? "*BLOCKED*" : ""); #ifdef QSG_RUNTIME_DESCRIPTION @@ -1613,7 +1613,7 @@ QDebug operator<<(QDebug d, const QSGNode *n) d << ')'; break; default: - d << "Node(" << hex << (void *) n << dec + d << "Node(" << hex << (const void *) n << dec << "flags=" << (int) n->flags() << dec << (n->isSubtreeBlocked() ? "*BLOCKED*" : ""); #ifdef QSG_RUNTIME_DESCRIPTION |