src/tools/uic3/embed.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   175         }
   175         }
   176         EmbedImage *e = new EmbedImage;
   176         EmbedImage *e = new EmbedImage;
   177         e->width = img.width();
   177         e->width = img.width();
   178         e->height = img.height();
   178         e->height = img.height();
   179         e->depth = img.depth();
   179         e->depth = img.depth();
   180         e->numColors = img.numColors();
   180         e->numColors = img.colorCount();
   181         e->colorTable = new QRgb[e->numColors];
   181         e->colorTable = new QRgb[e->numColors];
   182         e->alpha = img.hasAlphaBuffer();
   182         e->alpha = img.hasAlphaBuffer();
   183         QVector<QRgb> ct = img.colorTable();
   183         QVector<QRgb> ct = img.colorTable();
   184         memcpy(e->colorTable, ct.constData(), e->numColors*sizeof(QRgb));
   184         memcpy(e->colorTable, ct.constData(), e->numColors*sizeof(QRgb));
   185         QFileInfo fi( *it );
   185         QFileInfo fi( *it );
   193         out << s.sprintf( "static const unsigned char %s_data[] = {",
   193         out << s.sprintf( "static const unsigned char %s_data[] = {",
   194                           e->cname.latin1() );
   194                           e->cname.latin1() );
   195 #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
   195 #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
   196         e->compressed =
   196         e->compressed =
   197 #endif
   197 #endif
   198             embedData( out, img.bits(), img.numBytes() );
   198             embedData( out, img.bits(), img.byteCount() );
   199         out << "\n};\n\n";
   199         out << "\n};\n\n";
   200         if ( e->numColors ) {
   200         if ( e->numColors ) {
   201             out << s.sprintf( "static const QRgb %s_ctable[] = {",
   201             out << s.sprintf( "static const QRgb %s_ctable[] = {",
   202                               e->cname.latin1() );
   202                               e->cname.latin1() );
   203             embedData( out, e->colorTable, e->numColors );
   203             embedData( out, e->colorTable, e->numColors );