src/hbcore/gui/hbsplash.cpp
changeset 21 4633027730f5
parent 5 627c4a0fd0e7
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
   281     TInt bitmapHandle;
   281     TInt bitmapHandle;
   282     TPckg<TInt> bitmapHandlePckg(bitmapHandle);
   282     TPckg<TInt> bitmapHandlePckg(bitmapHandle);
   283     TIpcArgs args(&oriDes, &appIdDes, &screenIdDes, &bitmapHandlePckg);
   283     TIpcArgs args(&oriDes, &appIdDes, &screenIdDes, &bitmapHandlePckg);
   284     if (SendReceive(HbSplashSrvGetSplashData, args) == KErrNone) {
   284     if (SendReceive(HbSplashSrvGetSplashData, args) == KErrNone) {
   285         QScopedPointer<CFbsBitmap> bmp(new CFbsBitmap);
   285         QScopedPointer<CFbsBitmap> bmp(new CFbsBitmap);
   286         if (bmp->Duplicate(bitmapHandle) == KErrNone) {
   286         TInt dupError = bmp->Duplicate(bitmapHandle);
       
   287         if (dupError == KErrNone) {
   287             TSize size = bmp->SizeInPixels();
   288             TSize size = bmp->SizeInPixels();
   288             TDisplayMode mode = bmp->DisplayMode();
   289             TDisplayMode mode = bmp->DisplayMode();
   289             if (size.iWidth > 0 && size.iHeight > 0 && mode == EColor16MAP) {
   290             if (size.iWidth > 0 && size.iHeight > 0 && mode == EColor16MAP) {
   290                 int bpl = CFbsBitmap::ScanLineLength(size.iWidth, mode);
   291                 int bpl = CFbsBitmap::ScanLineLength(size.iWidth, mode);
   291                 const QImage::Format fmt = QImage::Format_ARGB32_Premultiplied;
   292                 const QImage::Format fmt = QImage::Format_ARGB32_Premultiplied;
   297                                                 bpl, fmt, params.allocFuncParam);
   298                                                 bpl, fmt, params.allocFuncParam);
   298                     } else {
   299                     } else {
   299                         data = new uchar[len];
   300                         data = new uchar[len];
   300                     }
   301                     }
   301                     if (data) {
   302                     if (data) {
   302                         memcpy(data, bmp->DataAddress(), len);
   303                         // The data copying cannot really be avoided here
       
   304                         // because there is nobody to manage the CFbsBitmap
       
   305                         // pointer and clients are typically interested in the
       
   306                         // raw pixel data in a platform-independent form.
       
   307                         qMemCopy(data, bmp->DataAddress(), len);
   303                         *params.w = size.iWidth;
   308                         *params.w = size.iWidth;
   304                         *params.h = size.iHeight;
   309                         *params.h = size.iHeight;
   305                         *params.bpl = bpl;
   310                         *params.bpl = bpl;
   306                         *params.fmt = fmt;
   311                         *params.fmt = fmt;
   307                         qDebug("[hbsplash] bitmap data received");
   312                         qDebug("[hbsplash] bitmap data received");
   313             } else {
   318             } else {
   314                 qWarning("[hbsplash] Invalid bitmap (%d %d %d)",
   319                 qWarning("[hbsplash] Invalid bitmap (%d %d %d)",
   315                          size.iWidth, size.iHeight, mode);
   320                          size.iWidth, size.iHeight, mode);
   316             }
   321             }
   317         } else {
   322         } else {
   318             qWarning("[hbsplash] Cannot duplicate bitmap");
   323             qWarning("[hbsplash] Cannot duplicate bitmap handle %d (%d)",
       
   324                      bitmapHandle, dupError);
   319         }
   325         }
   320     }
   326     }
   321     return 0;
   327     return 0;
   322 }
   328 }
   323 
   329