diff -r 627c4a0fd0e7 -r c3690ec91ef8 src/hbcore/image/hbiconsource.cpp --- a/src/hbcore/image/hbiconsource.cpp Fri Jun 11 13:58:22 2010 +0300 +++ b/src/hbcore/image/hbiconsource.cpp Wed Jun 23 18:33:25 2010 +0300 @@ -60,19 +60,18 @@ } if (loweredIconPath.endsWith(QLatin1String(".svg")) - || loweredIconPath.endsWith(QLatin1String(".png")) - || loweredIconPath.endsWith(QLatin1String(".mng")) - || loweredIconPath.endsWith(QLatin1String(".gif")) - || loweredIconPath.endsWith(QLatin1String(".xpm")) - || loweredIconPath.endsWith(QLatin1String(".jpg")) - || loweredIconPath.endsWith(QLatin1String(".nvg"))) { + || loweredIconPath.endsWith(QLatin1String(".png")) + || loweredIconPath.endsWith(QLatin1String(".mng")) + || loweredIconPath.endsWith(QLatin1String(".gif")) + || loweredIconPath.endsWith(QLatin1String(".xpm")) + || loweredIconPath.endsWith(QLatin1String(".jpg")) + || loweredIconPath.endsWith(QLatin1String(".nvg"))) { return iconPath.right(3).toUpper(); } if (loweredIconPath.endsWith(QLatin1String(".xml")) - || loweredIconPath.endsWith(QLatin1String(".axml")) - || loweredIconPath.endsWith(QLatin1String(".fxml"))) - { + || loweredIconPath.endsWith(QLatin1String(".axml")) + || loweredIconPath.endsWith(QLatin1String(".fxml"))) { return "BLOB"; } @@ -86,22 +85,22 @@ // to avoid NVG dependency in ThemeIndexer QSize nvgContentDimensions(const QByteArray &buffer) { - QSize ret(0,0); - if (buffer.length() < static_cast(NVG_VIEWBOX_HEIGHT_OFS + sizeof (float))){ + QSize ret(0, 0); + if (buffer.length() < static_cast(NVG_VIEWBOX_HEIGHT_OFS + sizeof(float))) { ret = QSize(0, 0); - } - - const quint8* lBuf = (quint8*) buffer.data(); - if((buffer.length() > NVG_VIEWBOX_WIDTH_OFS) && (buffer.length() > NVG_VIEWBOX_HEIGHT_OFS)) { + } + + const quint8 *lBuf = (quint8 *) buffer.data(); + if ((buffer.length() > NVG_VIEWBOX_WIDTH_OFS) && (buffer.length() > NVG_VIEWBOX_HEIGHT_OFS)) { // Do not change to qreal, no matter what krazy says. - float lViewboxWidth = * (float*)(lBuf + NVG_VIEWBOX_WIDTH_OFS); - float lViewboxHeight = * (float*)(lBuf + NVG_VIEWBOX_HEIGHT_OFS); + float lViewboxWidth = * (float *)(lBuf + NVG_VIEWBOX_WIDTH_OFS); + float lViewboxHeight = * (float *)(lBuf + NVG_VIEWBOX_HEIGHT_OFS); - if (lViewboxWidth > 0 && lViewboxHeight > 0) { - ret = QSize((int)lViewboxWidth, (int)lViewboxHeight); - } else { - ret = QSize(0, 0); - } + if (lViewboxWidth > 0 && lViewboxHeight > 0) { + ret = QSize((int)lViewboxWidth, (int)lViewboxHeight); + } else { + ret = QSize(0, 0); + } } return ret; } @@ -111,7 +110,7 @@ /*! \class HbIconSource - + \brief Encapsulates access (size and pixel data reading) to image files. \internal @@ -174,37 +173,35 @@ if (mType == "NVG") { #ifndef HB_BOOTSTRAPPED #ifdef HB_NVG_CS_ICON - if(!mByteArray){ - QFile file(mFilename); - if (!file.open(QIODevice::NotOpen | QIODevice::ReadOnly)) { - return QSizeF(); - } - mByteArray = new QByteArray(file.readAll()); - } - HbNvgEngine nvgEngine; - mDefaultSize = nvgEngine.contentDimensions(*mByteArray); + if (!mByteArray) { + QFile file(mFilename); + if (!file.open(QIODevice::NotOpen | QIODevice::ReadOnly)) { + return QSizeF(); + } + mByteArray = new QByteArray(file.readAll()); + } + HbNvgEngine nvgEngine; + mDefaultSize = nvgEngine.contentDimensions(*mByteArray); #endif // HB_NVG_CS_ICON #else // HB_BOOTSTRAPPED - if(!mByteArray){ - QFile file(mFilename); - if (!file.open(QIODevice::NotOpen | QIODevice::ReadOnly)) { - return QSizeF(); - } - mByteArray = new QByteArray (file.readAll()); - } + if (!mByteArray) { + QFile file(mFilename); + if (!file.open(QIODevice::NotOpen | QIODevice::ReadOnly)) { + return QSizeF(); + } + mByteArray = new QByteArray(file.readAll()); + } - mDefaultSize = nvgContentDimensions(*mByteArray); + mDefaultSize = nvgContentDimensions(*mByteArray); #endif - } - else if (mType == "SVG") { + } else if (mType == "SVG") { QSvgRenderer *renderer = svgRenderer(); if (renderer) { // isValid() is already checked in svgRenderer() mDefaultSize = renderer->defaultSize(); } releaseSvgRenderer(); - } - else if (mType == "PIC") { + } else if (mType == "PIC") { if (!mPicture) { mPicture = new QPicture; mPicture->load(mFilename); @@ -230,8 +227,7 @@ } } releaseImageReader(); - } - else if (mType != "BLOB") { + } else if (mType != "BLOB") { if (!mPixmap) { mPixmap = new QPixmap(mFilename); } @@ -271,8 +267,8 @@ { mSvgRenderer = 0; } - -QByteArray* HbIconSource::byteArray() + +QByteArray *HbIconSource::byteArray() { if (!mByteArray) { #ifdef HB_NVG_CS_ICON @@ -283,7 +279,7 @@ mByteArray = new QByteArray(file.readAll()); #endif } - + if (mByteArray && !mByteArray->isEmpty()) { return mByteArray; } else {