src/hbcore/gui/hbsplash.cpp
changeset 5 627c4a0fd0e7
parent 3 11d3954df52a
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
    38 #include "hbsplashdefs_p.h"
    38 #include "hbsplashdefs_p.h"
    39 #endif
    39 #endif
    40 
    40 
    41 /*!
    41 /*!
    42   \class HbSplash
    42   \class HbSplash
    43   
    43 
    44   \brief Class with utility functions for accessing splash screens.
    44   \brief Class with utility functions for accessing splash screens.
    45 
    45 
    46   \internal
    46   \internal
    47 */
    47 */
    48 
    48 
    62     }
    62     }
    63 #endif
    63 #endif
    64     return QString("prt");
    64     return QString("prt");
    65 }
    65 }
    66 
    66 
    67 struct Params
    67 struct Params {
    68 {
       
    69     int *w;
    68     int *w;
    70     int *h;
    69     int *h;
    71     int *bpl;
    70     int *bpl;
    72     QImage::Format *fmt;
    71     QImage::Format *fmt;
    73     HbSplashScreen::Flags flags;
    72     HbSplashScreen::Flags flags;
   111     f.read(headerBuf, headerLength);
   110     f.read(headerBuf, headerLength);
   112     quint32 *headerPtr = reinterpret_cast<quint32 *>(headerBuf);
   111     quint32 *headerPtr = reinterpret_cast<quint32 *>(headerBuf);
   113     w = *headerPtr++;
   112     w = *headerPtr++;
   114     h = *headerPtr++;
   113     h = *headerPtr++;
   115     bpl = *headerPtr++;
   114     bpl = *headerPtr++;
   116     fmt = (QImage::Format) *headerPtr++;
   115     fmt = (QImage::Format) * headerPtr++;
   117     params.extra = *headerPtr;
   116     params.extra = *headerPtr;
   118     if (fmt != QImage::Format_ARGB32_Premultiplied) {
   117     if (fmt != QImage::Format_ARGB32_Premultiplied) {
   119         qWarning("[hbsplash] Image format for %s is not ARGB32_PRE (is %d instead)",
   118         qWarning("[hbsplash] Image format for %s is not ARGB32_PRE (is %d instead)",
   120                  qPrintable(f.mFullName), fmt);
   119                  qPrintable(f.mFullName), fmt);
   121     }
   120     }
   255     }
   254     }
   256     return ok;
   255     return ok;
   257 }
   256 }
   258 
   257 
   259 bool HbSplashSrvClient::getSplashFileHandle(RFile &f,
   258 bool HbSplashSrvClient::getSplashFileHandle(RFile &f,
   260                                             const QString &ori,
   259         const QString &ori,
   261                                             const QString &appId,
   260         const QString &appId,
   262                                             const QString &screenId)
   261         const QString &screenId)
   263 {
   262 {
   264     TPtrC oriDes(static_cast<const TUint16 *>(ori.utf16()), ori.length());
   263     TPtrC oriDes(static_cast<const TUint16 *>(ori.utf16()), ori.length());
   265     TPtrC appIdDes(static_cast<const TUint16 *>(appId.utf16()), appId.length());
   264     TPtrC appIdDes(static_cast<const TUint16 *>(appId.utf16()), appId.length());
   266     TPtrC screenIdDes(static_cast<const TUint16 *>(screenId.utf16()), screenId.length());
   265     TPtrC screenIdDes(static_cast<const TUint16 *>(screenId.utf16()), screenId.length());
   267     TInt fileHandle;
   266     TInt fileHandle;
   270     TInt fsHandle = SendReceive(HbSplashSrvGetSplashFile, args);
   269     TInt fsHandle = SendReceive(HbSplashSrvGetSplashFile, args);
   271     return f.AdoptFromServer(fsHandle, fileHandle) == KErrNone;
   270     return f.AdoptFromServer(fsHandle, fileHandle) == KErrNone;
   272 }
   271 }
   273 
   272 
   274 uchar *HbSplashSrvClient::getSplashFromBitmap(const QString &ori,
   273 uchar *HbSplashSrvClient::getSplashFromBitmap(const QString &ori,
   275                                               const QString &appId,
   274         const QString &appId,
   276                                               const QString &screenId,
   275         const QString &screenId,
   277                                               Params &params)
   276         Params &params)
   278 {
   277 {
   279     TPtrC oriDes(static_cast<const TUint16 *>(ori.utf16()), ori.length());
   278     TPtrC oriDes(static_cast<const TUint16 *>(ori.utf16()), ori.length());
   280     TPtrC appIdDes(static_cast<const TUint16 *>(appId.utf16()), appId.length());
   279     TPtrC appIdDes(static_cast<const TUint16 *>(appId.utf16()), appId.length());
   281     TPtrC screenIdDes(static_cast<const TUint16 *>(screenId.utf16()), screenId.length());
   280     TPtrC screenIdDes(static_cast<const TUint16 *>(screenId.utf16()), screenId.length());
   282     TInt bitmapHandle;
   281     TInt bitmapHandle;
   332     QString oriStr(orientationId(params.flags));
   331     QString oriStr(orientationId(params.flags));
   333     QString appIdStr(params.appId);
   332     QString appIdStr(params.appId);
   334     if (appIdStr.isEmpty()) {
   333     if (appIdStr.isEmpty()) {
   335         RProcess process;
   334         RProcess process;
   336         appIdStr = QString::number(process.SecureId().iId, 16);
   335         appIdStr = QString::number(process.SecureId().iId, 16);
       
   336         process.Close();
   337     }
   337     }
   338 
   338 
   339     uchar *data = 0;
   339     uchar *data = 0;
   340     if (!params.forceFile) {
   340     if (!params.forceFile) {
   341         data = client.getSplashFromBitmap(oriStr, appIdStr, params.screenId, params);
   341         data = client.getSplashFromBitmap(oriStr, appIdStr, params.screenId, params);