summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/data/qcustom3dvolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/datavisualization/data/qcustom3dvolume.cpp')
-rw-r--r--src/datavisualization/data/qcustom3dvolume.cpp81
1 files changed, 40 insertions, 41 deletions
diff --git a/src/datavisualization/data/qcustom3dvolume.cpp b/src/datavisualization/data/qcustom3dvolume.cpp
index d54f34d1..8f524c2b 100644
--- a/src/datavisualization/data/qcustom3dvolume.cpp
+++ b/src/datavisualization/data/qcustom3dvolume.cpp
@@ -278,13 +278,14 @@ QCustom3DVolume::QCustom3DVolume(QObject *parent) :
* \sa textureData, setTextureFormat(), colorTable
*/
QCustom3DVolume::QCustom3DVolume(const QVector3D &position, const QVector3D &scaling,
- const QQuaternion &rotation, int textureWidth,
- int textureHeight, int textureDepth,
- QVector<uchar> *textureData, QImage::Format textureFormat,
- const QVector<QRgb> &colorTable, QObject *parent) :
- QCustom3DItem(new QCustom3DVolumePrivate(this, position, scaling, rotation, textureWidth,
- textureHeight, textureDepth,
- textureData, textureFormat, colorTable), parent)
+ const QQuaternion &rotation, int textureWidth, int textureHeight,
+ int textureDepth, QList<uchar> *textureData,
+ QImage::Format textureFormat, const QList<QRgb> &colorTable,
+ QObject *parent)
+ : QCustom3DItem(new QCustom3DVolumePrivate(this, position, scaling, rotation, textureWidth,
+ textureHeight, textureDepth, textureData,
+ textureFormat, colorTable),
+ parent)
{
}
@@ -526,7 +527,7 @@ void QCustom3DVolume::setSliceIndices(int x, int y, int z)
*
* \sa textureData, setTextureFormat(), QImage::colorTable()
*/
-void QCustom3DVolume::setColorTable(const QVector<QRgb> &colors)
+void QCustom3DVolume::setColorTable(const QList<QRgb> &colors)
{
if (dptr()->m_colorTable != colors) {
dptr()->m_colorTable = colors;
@@ -536,7 +537,7 @@ void QCustom3DVolume::setColorTable(const QVector<QRgb> &colors)
}
}
-QVector<QRgb> QCustom3DVolume::colorTable() const
+QList<QRgb> QCustom3DVolume::colorTable() const
{
return dptrc()->m_colorTable;
}
@@ -570,7 +571,7 @@ QVector<QRgb> QCustom3DVolume::colorTable() const
*
* \sa colorTable, setTextureFormat(), setSubTextureData(), textureDataWidth()
*/
-void QCustom3DVolume::setTextureData(QVector<uchar> *data)
+void QCustom3DVolume::setTextureData(QList<uchar> *data)
{
if (dptr()->m_textureData != data)
delete dptr()->m_textureData;
@@ -596,7 +597,7 @@ void QCustom3DVolume::setTextureData(QVector<uchar> *data)
*
* \sa textureData, textureWidth, textureHeight, textureDepth, setTextureFormat()
*/
-QVector<uchar> *QCustom3DVolume::createTextureData(const QVector<QImage *> &images)
+QList<uchar> *QCustom3DVolume::createTextureData(const QList<QImage *> &images)
{
int imageCount = images.size();
if (imageCount) {
@@ -631,7 +632,7 @@ QVector<uchar> *QCustom3DVolume::createTextureData(const QVector<QImage *> &imag
int imageByteWidth = (imageFormat == QImage::Format_Indexed8)
? currentImage->bytesPerLine() : imageWidth;
int frameSize = imageByteWidth * imageHeight * colorBytes;
- QVector<uchar> *newTextureData = new QVector<uchar>;
+ QList<uchar> *newTextureData = new QList<uchar>;
newTextureData->resize(frameSize * imageCount);
uchar *texturePtr = newTextureData->data();
QImage convertedImage;
@@ -662,7 +663,7 @@ QVector<uchar> *QCustom3DVolume::createTextureData(const QVector<QImage *> &imag
return dptr()->m_textureData;
}
-QVector<uchar> *QCustom3DVolume::textureData() const
+QList<uchar> *QCustom3DVolume::textureData() const
{
return dptrc()->m_textureData;
}
@@ -1177,32 +1178,30 @@ QCustom3DVolumePrivate::QCustom3DVolumePrivate(QCustom3DVolume *q) :
m_meshFile = QStringLiteral(":/defaultMeshes/barFull");
}
-QCustom3DVolumePrivate::QCustom3DVolumePrivate(QCustom3DVolume *q, const QVector3D &position,
- const QVector3D &scaling,
- const QQuaternion &rotation,
- int textureWidth, int textureHeight,
- int textureDepth, QVector<uchar> *textureData,
- QImage::Format textureFormat,
- const QVector<QRgb> &colorTable) :
- QCustom3DItemPrivate(q, QStringLiteral(":/defaultMeshes/barFull"), position, scaling, rotation),
- m_textureWidth(textureWidth),
- m_textureHeight(textureHeight),
- m_textureDepth(textureDepth),
- m_sliceIndexX(-1),
- m_sliceIndexY(-1),
- m_sliceIndexZ(-1),
- m_textureFormat(textureFormat),
- m_colorTable(colorTable),
- m_textureData(textureData),
- m_alphaMultiplier(1.0f),
- m_preserveOpacity(true),
- m_useHighDefShader(true),
- m_drawSlices(false),
- m_drawSliceFrames(false),
- m_sliceFrameColor(Qt::black),
- m_sliceFrameWidths(QVector3D(0.01f, 0.01f, 0.01f)),
- m_sliceFrameGaps(QVector3D(0.01f, 0.01f, 0.01f)),
- m_sliceFrameThicknesses(QVector3D(0.01f, 0.01f, 0.01f))
+QCustom3DVolumePrivate::QCustom3DVolumePrivate(
+ QCustom3DVolume *q, const QVector3D &position, const QVector3D &scaling,
+ const QQuaternion &rotation, int textureWidth, int textureHeight, int textureDepth,
+ QList<uchar> *textureData, QImage::Format textureFormat, const QList<QRgb> &colorTable)
+ : QCustom3DItemPrivate(q, QStringLiteral(":/defaultMeshes/barFull"), position, scaling,
+ rotation),
+ m_textureWidth(textureWidth),
+ m_textureHeight(textureHeight),
+ m_textureDepth(textureDepth),
+ m_sliceIndexX(-1),
+ m_sliceIndexY(-1),
+ m_sliceIndexZ(-1),
+ m_textureFormat(textureFormat),
+ m_colorTable(colorTable),
+ m_textureData(textureData),
+ m_alphaMultiplier(1.0f),
+ m_preserveOpacity(true),
+ m_useHighDefShader(true),
+ m_drawSlices(false),
+ m_drawSliceFrames(false),
+ m_sliceFrameColor(Qt::black),
+ m_sliceFrameWidths(QVector3D(0.01f, 0.01f, 0.01f)),
+ m_sliceFrameGaps(QVector3D(0.01f, 0.01f, 0.01f)),
+ m_sliceFrameThicknesses(QVector3D(0.01f, 0.01f, 0.01f))
{
m_isVolumeItem = true;
m_shadowCasting = false;
@@ -1268,7 +1267,7 @@ QImage QCustom3DVolumePrivate::renderSlice(Qt::Axis axis, int index)
padding = x % 4;
pixelWidth = 1;
}
- QVector<uchar> data((x + padding) * y * pixelWidth);
+ QList<uchar> data((x + padding) * y * pixelWidth);
int frameSize = qptr()->textureDataWidth() * m_textureHeight;
int dataIndex = 0;
@@ -1309,7 +1308,7 @@ QImage QCustom3DVolumePrivate::renderSlice(Qt::Axis axis, int index)
QImage image(data.constData(), x, y, x * pixelWidth, m_textureFormat);
image.bits(); // Call bits() to detach the new image from local data
if (m_textureFormat == QImage::Format_Indexed8) {
- QVector<QRgb> colorTable = m_colorTable;
+ QList<QRgb> colorTable = m_colorTable;
if (m_alphaMultiplier != 1.0f) {
for (int i = 0; i < colorTable.size(); i++) {
QRgb curCol = colorTable.at(i);