/*! Replaces the elements of this index buffer, starting at \a index, with the contents of \a values. All other elements keep their current values. If the index buffer has been uploaded to the GL server, then this function must be called with a current GL context that is compatible with the uploaded buffer. The index buffer must have been originally created with the int element type. OpenGL/ES systems usually do not support 32-bit index values unless they have a special extension for that purpose. On systems without 32-bit index values, this function will need to convert all values to 16-bit which may incur a performance penalty and lose information. \sa setIndexes() */ void QGLIndexBuffer::replaceIndexes(int index, const QArray<uint>& values) { Q_D(QGLIndexBuffer); Q_ASSERT_X(d->elementType == GL_UNSIGNED_INT || !d->hasIntBuffers, "QGLIndexBuffer::replaceIndexes()", "buffer created with ushort element type, replacing with int"); if (d->elementType != GL_UNSIGNED_INT && d->hasIntBuffers) return; if (d->buffer.isCreated()) { if (d->hasIntBuffers) { d->buffer.bind(); d->buffer.write(index * sizeof(int), values.constData(), values.size() * sizeof(int)); d->buffer.release(); } else { QArray<ushort> svalues = qt_qarray_uint_to_ushort(values); d->buffer.bind(); d->buffer.write(index * sizeof(ushort), svalues.constData(), svalues.size() * sizeof(ushort)); d->buffer.release(); } } else if (d->elementType == GL_UNSIGNED_INT) { d->indexesInt.replace(index, values.constData(), values.size()); d->indexCount = d->indexesInt.size(); } else { QArray<ushort> svalues = qt_qarray_uint_to_ushort(values); d->indexesShort.replace(index, svalues.constData(), svalues.size()); d->indexCount = d->indexesShort.size(); } }
string ClsFEGroupPlot::wSpacePlotSelected2Range(QArray<int> &qarraySelected){ string strRange; if(dynamic_cast<ClsTopologySparse*>(ClsFESystemManager::Instance()->getFEGroup( strGroupID )->getTopology())){ ClsTopologySparse *clsTopologySparse = dynamic_cast<ClsTopologySparse*>(ClsFESystemManager::Instance()->getFEGroup( strGroupID )->getTopology()); iGroupWidth = clsTopologySparse->nrCellsHorizontal(); iGroupHeight = clsTopologySparse->nrCellsVertical(); for(unsigned int ii = 0; ii< qarraySelected.size(); ii++){ int iy = int(qarraySelected[ii] / iGroupWidth) + 1; int ix = qarraySelected[ii] - int(qarraySelected[ii] / iGroupWidth) * iGroupWidth + 1; if(clsTopologySparse->isValidCell(ix, iy)){ // cout << "clsTopologySparse->pos2index(ix, iy): " << clsTopologySparse->pos2index(ix, iy) << endl; // cout << __FILE__ << ": ix, iy: " << ix << ", " << iy << endl; strRange = iqrUtils::int2string(clsTopologySparse->pos2index(ix, iy)) + ";" + strRange ; } } } else { for(unsigned int ii = 0; ii< qarraySelected.size(); ii++){ strRange = iqrUtils::int2string(qarraySelected[ii]) + ";" + strRange ; } } return strRange; }
/*! Sets the index \a values in this index buffer, replacing the entire current contents. If the index buffer has been uploaded to the GL server, then this function must be called with a current GL context that is compatible with the uploaded buffer. OpenGL/ES systems usually do not support 32-bit index values unless they have a special extension for that purpose. On systems without 32-bit index values, this function will need to convert all values to 16-bit which may incur a performance penalty and lose information. \sa replaceIndexes() */ void QGLIndexBuffer::setIndexes(const QArray<uint>& values) { Q_D(QGLIndexBuffer); if (d->buffer.isCreated()) { if (d->hasIntBuffers) { d->buffer.bind(); d->buffer.allocate(values.constData(), values.size() * sizeof(int)); d->buffer.release(); // The element type may have changed from ushort to int. d->elementType = GL_UNSIGNED_INT; } else { QArray<ushort> svalues = qt_qarray_uint_to_ushort(values); d->buffer.bind(); d->buffer.allocate(svalues.constData(), svalues.size() * sizeof(ushort)); d->buffer.release(); } } else if (d->hasIntBuffers) { d->indexesInt = values; d->elementType = GL_UNSIGNED_INT; d->indexesShort = QArray<ushort>(); } else { d->indexesShort = qt_qarray_uint_to_ushort(values); d->elementType = GL_UNSIGNED_SHORT; d->indexesInt = QArray<uint>(); } d->indexCount = values.size(); }
/*! Sets the index \a values in this index buffer, replacing the entire current contents. If the index buffer has been uploaded to the GL server, then this function must be called with a current GL context that is compatible with the uploaded buffer. \sa replaceIndexes() */ void QGLIndexBuffer::setIndexes(const QArray<ushort>& values) { Q_D(QGLIndexBuffer); if (d->buffer.isCreated()) { d->buffer.bind(); d->buffer.allocate(values.constData(), values.size() * sizeof(ushort)); d->buffer.release(); // The element type may have changed from int to ushort. d->elementType = GL_UNSIGNED_SHORT; } else { d->indexesShort = values; d->elementType = GL_UNSIGNED_SHORT; d->indexesInt = QArray<uint>(); } d->indexCount = values.size(); }
/** Get a vector of Rfcomm channels of the services having "uuid" in the class ID List*/ QArray<int> OTPeer::rfcommList( const OTUUID & uuid) { QArray<int> rfcommList; unsigned int channel; for( unsigned int i = 0; i < serviceList.count(); i ++ ) { if( serviceList[i]->hasClassID(uuid)) { if( serviceList[i]->rfcommChannel(channel) ) { rfcommList.resize( rfcommList.size()+1 ); rfcommList[rfcommList.size()-1] = channel; } } } return rfcommList; }
/*! Replaces the elements of this index buffer, starting at \a index, with the contents of \a values. All other elements keep their current values. If the index buffer has been uploaded to the GL server, then this function must be called with a current GL context that is compatible with the uploaded buffer. The index buffer must have been originally created with the ushort element type. \sa setIndexes() */ void QGLIndexBuffer::replaceIndexes(int index, const QArray<ushort>& values) { Q_D(QGLIndexBuffer); Q_ASSERT_X(d->elementType == GL_UNSIGNED_SHORT, "QGLIndexBuffer::replaceIndexes()", "buffer created with int element type, replacing with ushort"); if (d->elementType != GL_UNSIGNED_SHORT) return; if (d->buffer.isCreated()) { d->buffer.bind(); d->buffer.write(index * sizeof(ushort), values.constData(), values.size() * sizeof(ushort)); d->buffer.release(); } else { d->indexesShort.replace(index, values.constData(), values.size()); d->indexCount = d->indexesShort.size(); } }
QColor QGLContext::overlayTransparentColor() const { //### make more efficient using the transpColor member if ( isValid() ) { if ( !trans_colors_init ) find_trans_colors(); VisualID myVisualId = ((XVisualInfo*)vi)->visualid; for ( int i = 0; i < (int)trans_colors.size(); i++ ) { if ( trans_colors[i].vis == myVisualId ) return QColor( qRgb( 1, 2, 3 ), trans_colors[i].color ); } } return QColor(); // Invalid color }
/*! Returns all ids associated with the application CategoryGroup \a app and the passed in \a labels in that group. */ QArray<int> Categories::ids( const QString &app, const QStringList &labels) const { QArray<int> results; QStringList::ConstIterator it; int i; for ( i=0, it=labels.begin(); it!=labels.end(); i++, ++it ) { int value = id( app, *it ); if ( value != 0 ) { int tmp = results.size(); results.resize( tmp + 1 ); results[ tmp ] = value; } } return results; }
static QArray<ushort> qt_qarray_uint_to_ushort(const QArray<uint> &array) { QArray<ushort> result; const uint *values = array.constData(); int size = array.size(); bool largeValue = false; result.reserve(size); while (size-- > 0) { uint value = *values++; if (ushort(value) != value) largeValue = true; result.append(ushort(value)); } if (largeValue) qWarning("QGLIndexBuffer::setIndexes: large 32-bit value provided to a 16-bit only buffer"); return result; }
void TodoManager::remove( const QArray<int>& ids) { for ( uint i=0; i < ids.size(); i++ ) remove( ids[i] ); }
bool QGLFormat::hasOpenGLOverlays() { if ( !trans_colors_init ) find_trans_colors(); return trans_colors.size() > 0; }