Changeset 651 for trunk/src/openvg/qpixmapdata_vg.cpp
- Timestamp:
- Mar 8, 2010, 12:52:58 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.2 (added) merged: 650 /branches/vendor/nokia/qt/current merged: 649 /branches/vendor/nokia/qt/4.6.1 removed
- Property svn:mergeinfo changed
-
trunk/src/openvg/qpixmapdata_vg.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 47 47 48 48 #ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE 49 #include <private/qt_s60_p.h> 50 #include <fbs.h> 49 51 #include <graphics/sgimage.h> 50 52 typedef EGLImageKHR (*pfnEglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, EGLint*); 51 53 typedef EGLBoolean (*pfnEglDestroyImageKHR)(EGLDisplay, EGLImageKHR); 52 54 typedef VGImage (*pfnVgCreateEGLImageTargetKHR)(VGeglImageKHR); 53 #endif 55 #endif // QT_SYMBIAN_SUPPORTS_SGIMAGE 54 56 55 57 QT_BEGIN_NAMESPACE … … 426 428 427 429 #if defined(Q_OS_SYMBIAN) 430 431 static CFbsBitmap* createBlitCopy(CFbsBitmap* bitmap) 432 { 433 CFbsBitmap *copy = q_check_ptr(new CFbsBitmap); 434 if(!copy) 435 return 0; 436 437 if (copy->Create(bitmap->SizeInPixels(), bitmap->DisplayMode()) != KErrNone) { 438 delete copy; 439 copy = 0; 440 441 return 0; 442 } 443 444 CFbsBitmapDevice* bitmapDevice = 0; 445 CFbsBitGc *bitmapGc = 0; 446 QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(copy)); 447 QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL()); 448 bitmapGc->Activate(bitmapDevice); 449 450 bitmapGc->BitBlt(TPoint(), bitmap); 451 452 delete bitmapGc; 453 delete bitmapDevice; 454 455 return copy; 456 } 457 428 458 void QVGPixmapData::cleanup() 429 459 { … … 511 541 SgDriver::Close(); 512 542 } else if (type == QPixmapData::FbsBitmap) { 513 543 CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap); 544 545 bool deleteSourceBitmap = false; 546 547 #ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE 548 549 // Rasterize extended bitmaps 550 551 TUid extendedBitmapType = bitmap->ExtendedBitmapType(); 552 if (extendedBitmapType != KNullUid) { 553 bitmap = createBlitCopy(bitmap); 554 deleteSourceBitmap = true; 555 } 556 #endif 557 558 if (bitmap->IsCompressedInRAM()) { 559 bitmap = createBlitCopy(bitmap); 560 deleteSourceBitmap = true; 561 } 562 563 TDisplayMode displayMode = bitmap->DisplayMode(); 564 QImage::Format format = qt_TDisplayMode2Format(displayMode); 565 566 TSize size = bitmap->SizeInPixels(); 567 568 bitmap->BeginDataAccess(); 569 uchar *bytes = (uchar*)bitmap->DataAddress(); 570 QImage img = QImage(bytes, size.iWidth, size.iHeight, format); 571 img = img.copy(); 572 bitmap->EndDataAccess(); 573 574 if(displayMode == EGray2) { 575 //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid 576 //So invert mono bitmaps so that masks work correctly. 577 img.invertPixels(); 578 } else if(displayMode == EColor16M) { 579 img = img.rgbSwapped(); // EColor16M is BGR 580 } 581 582 fromImage(img, Qt::AutoColor); 583 584 if(deleteSourceBitmap) 585 delete bitmap; 514 586 } 515 587 #else … … 594 666 return reinterpret_cast<void*>(sgImage); 595 667 } else if (type == QPixmapData::FbsBitmap) { 596 return 0; 668 CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); 669 670 if (bitmap) { 671 if (bitmap->Create(TSize(source.width(), source.height()), 672 EColor16MAP) == KErrNone) { 673 const uchar *sptr = qt_vg_imageBits(source); 674 bitmap->BeginDataAccess(); 675 676 uchar *dptr = (uchar*)bitmap->DataAddress(); 677 Mem::Copy(dptr, sptr, source.byteCount()); 678 679 bitmap->EndDataAccess(); 680 } else { 681 delete bitmap; 682 bitmap = 0; 683 } 684 } 685 686 return reinterpret_cast<void*>(bitmap); 597 687 } 598 688 #else
Note:
See TracChangeset
for help on using the changeset viewer.