本文整理汇总了C++中CFbsBitmapDevice类的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitmapDevice类的具体用法?C++ CFbsBitmapDevice怎么用?C++ CFbsBitmapDevice使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFbsBitmapDevice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
void CMMABitmapWindow::SetDestinationBitmapL(CFbsBitmap* aBitmap)
{
CFbsBitmap* bitmap = new(ELeave)CFbsBitmap();
CleanupStack::PushL(bitmap);
User::LeaveIfError(bitmap->Duplicate(aBitmap->Handle()));
// create context for bitmap
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(aBitmap);
CleanupStack::PushL(bitmapDevice);
CGraphicsContext* bitmapContext = NULL;
User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext));
CleanupStack::Pop(bitmapDevice); // bitmapDevice
CleanupStack::Pop(bitmap); // bitmap
delete iBitmap;
iBitmap = bitmap;
delete iBitmapDevice;
iBitmapDevice = bitmapDevice;
delete iBitmapContext;
iBitmapContext = bitmapContext;
if (iDrawRect.IsEmpty())
{
iDrawRect.SetSize(iBitmap->SizeInPixels());
}
}
示例2: bitmap
/**
Copy a bitmap into another bitmap (generally in a different displaymode)
tiles destination bitmap with source
*/
void CTe_graphicsperformanceSuiteStepBase::CopyBitmapL(CFbsBitmap* aDst, CFbsBitmap* aSrc)
{
TSize srcSize = aSrc->SizeInPixels();
TSize dstSize = aDst->SizeInPixels();
CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(aDst);
CleanupStack::PushL(dev);
CFbsBitGc* gc = NULL;
if ( 0 == dev->CreateContext(gc) )
{
CleanupStack::PushL(gc);
TPoint point;
gc->SetBrushColor(TRANSPARENT_BLACK);
gc->SetBrushStyle(CGraphicsContext::ENullBrush);
gc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
gc->Clear();
gc->SetDrawMode(CGraphicsContext::EDrawModePEN);
for(point.iY=0; point.iY<dstSize.iHeight; point.iY+=srcSize.iHeight)
{
for(point.iX=0; point.iX<dstSize.iWidth; point.iX+=srcSize.iWidth)
{
gc->BitBlt(point, aSrc);
}
}
CleanupStack::PopAndDestroy(gc);
}
CleanupStack::PopAndDestroy(dev);
}
示例3: new
void CSliderControl::LoadPicture()
{
CFbsBitmap* BitMap = new (ELeave) CFbsBitmap();
BitMap->Create(Size(),EColor16M);
CAknsBasicBackgroundControlContext* iContext =
CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain,Rect(),ETrue);
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(BitMap);
CBitmapContext* bitGc = NULL;
bitmapDevice->CreateBitmapContext(bitGc);
///
CleanupStack::PushL(iContext);
CleanupStack::PushL(bitmapDevice);
CleanupStack::PushL(bitGc);
AknsDrawUtils::DrawBackground(AknsUtils::SkinInstance(),iContext,NULL,*bitGc,TPoint(0,0),Rect(),0);
CleanupStack::PopAndDestroy(3);
iIcon=BitMap;
/*
CFbsBitmap* mask;
CFbsBitmap* icon;
_LIT(KPath,"\\resource\\apps\\TweakS_ui.mif");
AknIconUtils::CreateIconL(icon,mask,KPath,EMbmTweaks_uiButton_dlg_bg,EMbmTweaks_uiButton_dlg_bg_mask);
AknIconUtils::SetSize(icon,Size(),EAspectRatioNotPreserved);
AknIconUtils::SetSize(mask,Size(),EAspectRatioNotPreserved);
iIcon=CGulIcon::NewL(icon,mask);
*/
}
示例4: new
/**
Create a checked board
@param aPixelFormat The pixel format for create the target bitmap
@param aSize The size of the bitmap
@param aChecksPerAxis Number of checks on X and Y.
*/
CFbsBitmap* CTe_graphicsperformanceSuiteStepBase::CreateCheckedBoardL(TDisplayMode aDisplayMode, TSize aSize, TSize aChecksPerAxis) const
{
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
CleanupStack::PushL(bitmap);
bitmap->Create(aSize, aDisplayMode);
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmap);
CleanupStack::PushL(bitmapDevice);
CFbsBitGc* bitGc = NULL;
User::LeaveIfError(bitmapDevice->CreateContext(bitGc));
CleanupStack::PushL(bitGc);
bitGc->Clear();
bitGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
bitGc->SetPenStyle(CGraphicsContext::ENullPen);
TPoint point(0,0);
const TSize checkerSize((TReal)aSize.iWidth/aChecksPerAxis.iWidth,(TReal)aSize.iHeight/aChecksPerAxis.iHeight);
TInt brushColour = 0;
for(point.iY = 0; point.iY < aSize.iHeight; point.iY += checkerSize.iHeight)
{
for(point.iX = 0; point.iX < aSize.iWidth; point.iX += checkerSize.iWidth)
{
bitGc->SetBrushColor(KColor16Table[brushColour++ & 0x0F]);
TRect rect(point, checkerSize);
bitGc->DrawRect(rect);
}
}
CleanupStack::PopAndDestroy(2, bitmapDevice);
CleanupStack::Pop(bitmap);
return bitmap;
}
示例5: CreateSoftwareBitmapLC
/**
Draws a stretched bitmap with or without a mask.
@param aUseMask set to ETrue to use a alpha mask. Normally used for 16MU display modes that do not store the alpha.
@param aSrcMode is the source display mode
@param aDstMode is the destination display mode
@param aSession is the windows server session
@param aWindow is a reference to the window
@param aGc is the graphics context of the window
@param aNumIterations is the number of iterations to run the test
*/
void CAlphaBlendTest::DoDrawBitmapL(TBool aUseMask, TDisplayMode aSrcMode, TDisplayMode aDstMode, RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TInt aNumIterations)
{
const TSize bitmapSize = aWindow.Size();
// Construct target bitmap.
CFbsBitmap* bitmapTarget = CreateSoftwareBitmapLC(bitmapSize, aDstMode);
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmapTarget);
CleanupStack::PushL(bitmapDevice);
// Construct GC.
CFbsBitGc* bitmapGc = NULL;
User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc));
CleanupStack::PushL(bitmapGc);
// Construct source bitmap.
TSize smallerSize(bitmapSize.iWidth/2, bitmapSize.iHeight/2);
CFbsBitmap* source = CreateSoftwareBitmapLC(smallerSize, aSrcMode);
VerticalGradientAlphaL(source, TRgb(0x00000000), TRgb(0xffffffff));
CFbsBitmap* sourceAlpha = CreateSoftwareBitmapLC(smallerSize, EGray256); // match size to src
VerticalGradientAlphaL(sourceAlpha, TRgb(0x01010101), TRgb(0xfefefefe));
bitmapGc->SetBrushStyle(CGraphicsContext::ENullBrush);
bitmapGc->SetBrushColor(TRANSPARENT_BLACK);
bitmapGc->Clear();
bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
aGc->Activate(aWindow);
TPoint point(0,0);
bitmapGc->BitBlt(point, bitmapTarget);
aGc->Deactivate();
aSession.Flush();
TBuf <20> testName;
if (!aUseMask)
{
testName=_L("DrawBitmap");
iProfiler->InitResults();
for(int i=0; i<aNumIterations; i++)
{
bitmapGc->DrawBitmap(TRect(point, bitmapSize), source);
iProfiler->MarkResultSetL();
}
}
else
{
testName=_L("DrawBitmapMasked");
iProfiler->InitResults();
for(int i=0; i<aNumIterations; i++)
{
bitmapGc->DrawBitmapMasked(TRect(point, bitmapSize), source,TRect(point, smallerSize), sourceAlpha, EFalse);
iProfiler->MarkResultSetL();
}
}
INFO_PRINTF4(_L("%S(Stretched) with src = %S, dst = %S"), &testName, &ColorModeName(aSrcMode), &ColorModeName(aDstMode));
iProfiler->ResultsAnalysis(testName, 0, aSrcMode, aDstMode, aNumIterations);
// copy up to screen for sanity check
BitBlt(aSession, aWindow, aGc, *bitmapTarget);
CleanupStack::PopAndDestroy(5, bitmapTarget);
}
示例6: new
CFbsBitmap* AknBitmapMirrorUtils::CreateBitmapL(CFbsBitmap* aSourceBitmap, TInt aMirrorDirection)
{
User::LeaveIfNull(aSourceBitmap);
CFbsBitmap* destinationBitmap = new (ELeave) CFbsBitmap();
CleanupStack::PushL(destinationBitmap);
TSize sourceBitmapSize = aSourceBitmap->SizeInPixels();
TRect sourceRect = TRect(TPoint(0,0), sourceBitmapSize);
TSize destinationBitmapSize(sourceRect.Width(), sourceRect.Height());
User::LeaveIfError(destinationBitmap->Create(destinationBitmapSize, aSourceBitmap->DisplayMode()));
CFbsBitmapDevice* destinationDevice = CFbsBitmapDevice::NewL( destinationBitmap );
CleanupStack::PushL(destinationDevice);
CFbsBitGc* destinationGc;
User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );
switch (aMirrorDirection)
{
case EAknVerticalMirroring:
{
TRect sourceBitmapBlittingRect( sourceRect.iTl.iX,sourceRect.iTl.iY,sourceRect.iBr.iX,sourceRect.iTl.iY + 1 );
for ( TInt yPos=destinationBitmapSize.iHeight-1; yPos >= 0; yPos-- )
{
destinationGc->BitBlt( TPoint(0,yPos), aSourceBitmap, sourceBitmapBlittingRect );
sourceBitmapBlittingRect.iTl.iY++;
sourceBitmapBlittingRect.iBr.iY++;
}
break;
}
case EAknHorizontalMirroring:
{
TRect sourceBitmapBlittingRect( sourceRect.iTl.iX,sourceRect.iTl.iY,sourceRect.iTl.iX + 1,sourceRect.iBr.iY );
for ( TInt xPos=destinationBitmapSize.iWidth-1; xPos >= 0; xPos-- )
{
destinationGc->BitBlt( TPoint(xPos,0), aSourceBitmap, sourceBitmapBlittingRect );
sourceBitmapBlittingRect.iTl.iX++;
sourceBitmapBlittingRect.iBr.iX++;
}
break;
}
default:
{
destinationGc->BitBlt( TPoint(0,0), aSourceBitmap, sourceRect );
break;
}
}
delete destinationGc;
CleanupStack::Pop(2); // destinationBitmap, destinationDevice
delete destinationDevice;
return destinationBitmap;
}
示例7: BG_ASSERT_ALWAYS
/** Allocates and constructs the device with the bitmap. Also creates a 2D graphics
accelerator which is owned and used by the device.
@param aFbsBitmap A pointer to the font and bitmap server managed bitmap.
@leave KErrArgument The bitmap's handle is zero.
@leave KErrAccessDenied The bitmap is in the ROM.
@return A pointer to the newly constructed device.
@panic EBitgdiPanicInvalidBitmap aFbsBitmap is NULL. */
EXPORT_C CFbsBitmapDevice* CFbsBitmapDevice::NewL(CFbsBitmap* aFbsBitmap)
{
BG_ASSERT_ALWAYS(aFbsBitmap != NULL,EBitgdiPanicInvalidBitmap);
CFbsBitmapDevice* self = new(ELeave) CFbsBitmapDevice;
CleanupStack::PushL(self);
self->ConstructL(aFbsBitmap);
CleanupStack::Pop(); // self
return self;
}
示例8:
void CTap2MenuAppUi::CopyBitmapL(CFbsBitmap *aSource, CFbsBitmap *aTarget)
{
if(aSource != NULL && aTarget != NULL)
{
if(aSource->SizeInPixels() != aTarget->SizeInPixels() || aSource->DisplayMode() != aTarget->DisplayMode())
{User::Leave(KErrArgument);}
CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(aTarget);
CleanupStack::PushL(device);
CFbsBitGc* gc = NULL;
User::LeaveIfError(device->CreateContext(gc));
CleanupStack::PushL(gc);
gc->BitBlt(TPoint(0, 0), aSource);
CleanupStack::PopAndDestroy(gc);
CleanupStack::PopAndDestroy(device);
}
}
示例9: defined
void tst_NativeImageHandleProvider::bitmap()
{
#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG)
QPixmap tmp(10, 20);
if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) {
BitmapProvider prov;
// This should fail because of null ptr.
QPixmap pm = pixmapFromNativeImageHandleProvider(&prov);
QVERIFY(pm.isNull());
pm = QPixmap();
QCOMPARE(prov.refCount, 0);
prov.bmp = new CFbsBitmap;
QCOMPARE(prov.bmp->Create(TSize(prov.w, prov.h), EColor16MAP), KErrNone);
CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(prov.bmp);
CBitmapContext *bitmapContext = 0;
QCOMPARE(bitmapDevice->CreateBitmapContext(bitmapContext), KErrNone);
TRgb symbianColor = TRgb(255, 200, 100);
bitmapContext->SetBrushColor(symbianColor);
bitmapContext->Clear();
delete bitmapContext;
delete bitmapDevice;
pm = pixmapFromNativeImageHandleProvider(&prov);
QVERIFY(!pm.isNull());
QCOMPARE(pm.width(), prov.w);
QCOMPARE(pm.height(), prov.h);
QVERIFY(prov.refCount == 1);
QImage img = pm.toImage();
QVERIFY(prov.refCount == 1);
QRgb pix = img.pixel(QPoint(1, 2));
QCOMPARE(qRed(pix), symbianColor.Red());
QCOMPARE(qGreen(pix), symbianColor.Green());
QCOMPARE(qBlue(pix), symbianColor.Blue());
pm = QPixmap(); // should result in calling release
QCOMPARE(prov.refCount, 0);
delete prov.bmp;
} else {
QSKIP("Not openvg", SkipSingle);
}
#else
QSKIP("Not applicable", SkipSingle);
#endif
}
示例10: new
void CTestCamSnapshot::DoStartSnapshotL()
{
CFbsBitmap* snapshot = new(ELeave) CFbsBitmap;
CleanupStack::PushL(snapshot);
User::LeaveIfError(snapshot->Create(iSnapshotImageRect.Size(), iSnapshotImage->DisplayMode()));
CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(snapshot);
CleanupStack::PushL(dev);
CFbsBitGc* gc = NULL;
User::LeaveIfError(dev->CreateContext(gc));
CleanupStack::Pop(dev);
CleanupStack::Pop(snapshot);
iSnapshot = snapshot;
iSnapshotDev = dev;
iSnapshotGc = gc;
iSnapshotActive = ETrue;
}
示例11: DoProcessMaskL
// ============================================================================
// CIconConverter::DoProcessMaskL()
// process the bitmap mask
//
// @since 3.1
// ============================================================================
void CIconConverter::DoProcessMaskL()
{
// we use white to mean transparent at this stage, simply for efficiency
// since all the canvases we will copy in to begin as white
if ( iOriginalBitmapMask->Handle() == 0 )
{
// Create a mask that shows the whole bitmap as an icon
// (all black)
User::LeaveIfError( iOriginalBitmapMask->Create(
iOriginalBitmap->SizeInPixels(), EGray2 ) );
CFbsBitmapDevice* device =
CFbsBitmapDevice::NewL( iOriginalBitmapMask );
CleanupStack::PushL( device );
CFbsBitGc* gc;
User::LeaveIfError( device->CreateContext( gc ) );
gc->SetBrushStyle( CGraphicsContext::ESolidBrush );
gc->SetDrawMode( CGraphicsContext::EDrawModePEN );
gc->SetBrushColor( KRgbBlack );
// Create a big black image
gc->Clear();
delete gc;
CleanupStack::PopAndDestroy( device );
}
else
{
// Invert the mask obtained from the PNG
CFbsBitmapDevice* device =
CFbsBitmapDevice::NewL( iOriginalBitmapMask );
CleanupStack::PushL(device);
CFbsBitGc* gc;
User::LeaveIfError( device->CreateContext( gc ) );
gc->SetDrawMode( CGraphicsContext::EDrawModeNOTSCREEN );
gc->Clear();
delete gc;
CleanupStack::PopAndDestroy( device );
}
// Scale the icon to the sizes required
iCurrentSizeIndex = 0;
DoIconScalingL();
}
示例12: GetTempIconName
// ============================================================================
// CIconConverter::DoIconStoreL()
// Store icon and mask files
//
// @since 3.1
// ============================================================================
void CIconConverter::DoIconStoreL()
{
// Store the icon and its mask in temporary files until we are ready
// to create the final icon
// Icon is stored at index n, mask at index n+1
TInt iconIndex = iCurrentSizeIndex * 2;
TFileName iconFile = *iTempPath;
GetTempIconName( iconIndex++, iconFile );
TFileName maskFile = *iTempPath;
GetTempIconName( iconIndex, maskFile );
// invert the masks before saving
CFbsBitmapDevice* device = CFbsBitmapDevice::NewL( iTempBitmapMask );
CleanupStack::PushL( device );
CFbsBitGc* gc;
User::LeaveIfError( device->CreateContext( gc ) );
gc->SetDrawMode( CGraphicsContext::EDrawModeNOTSCREEN );
gc->Clear();
delete gc;
CleanupStack::PopAndDestroy( device );
// save the bitmaps
User::LeaveIfError( iTempBitmap->Save( iconFile ) );
User::LeaveIfError( iTempBitmapMask->Save( maskFile ) );
if ( ++iCurrentSizeIndex < iIconSizes->Count() )
{
// do the next icon size
DoIconScalingL();
}
else
{
DoCreateFinalIconL();
}
}
示例13: new
//-----------------------------------------------------------------------------
// CBrowserViewImagesListBox::CreateIconL(
// CFbsBitmap* aBitmap, TBool aShrinkIt )
//-----------------------------------------------------------------------------
//
CGulIcon* CBrowserViewImagesListBox::CreateIconL(
CFbsBitmap* aBitmap, TBool aShrinkIt)
{
CGulIcon* icon = NULL;
// create icon
if(aShrinkIt)
{
CFbsBitmap* bmp = new(ELeave)CFbsBitmap;
CleanupStack::PushL(bmp);
User::LeaveIfError(bmp->Create(TSize(42,32), EColor16M));
// create bitmap device
CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(bmp);
CleanupStack::PushL(dev);
// create graphics context for bitmap device
CGraphicsContext* ctx = NULL;
User::LeaveIfError( dev->CreateContext(ctx) );
CleanupStack::PushL(ctx);
// calculate aspect ratio
TSize targetSize = Fit(aBitmap->SizeInPixels(), bmp->SizeInPixels());
// copy bitmap to temporary bitmap
ctx->DrawBitmap(TRect(TPoint(0,0), targetSize), aBitmap, TRect(TPoint(0,0), aBitmap->SizeInPixels()));
CleanupStack::PopAndDestroy(2); // ctx, dev
icon = CGulIcon::NewL(bmp); // bmp is owned, no mask used
CleanupStack::Pop(); // bmp
delete aBitmap;
}
else
{
icon = CGulIcon::NewL(aBitmap); // bitmap is owned, no mask used
}
return icon;
}
示例14: _LIT
/*
* Landmark objects will make use of an SVG file for rendering (demo purposes)
*/
void CLMXObject::ConstructL()
{
_LIT(KIconFile, "\\resource\\apps\\Landmarks_0x2002E1AF.mif");
CGulIcon* icon = CreateIconL(KIconFile, EMbmLandmarks_0x2002e1afIcon, EMbmLandmarks_0x2002e1afIcon_mask);
CleanupStack::PushL(icon);
CFbsBitmap* bitmap = icon->Bitmap(); // Ownership NOT transferred
CFbsBitmap* mask = icon->Mask(); // Ownership NOT transferred
// Always expect 16M bitmap to make conversion to GL_RGBA easier
if (bitmap->DisplayMode() != EColor16M)
{
bitmap = new(ELeave) CFbsBitmap;
CleanupStack::PushL(bitmap);
User::LeaveIfError(bitmap->Create(icon->Bitmap()->SizeInPixels(), EColor16M));
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmap);
CleanupStack::PushL(bitmapDevice);
CFbsBitGc* bitmapContext = 0;
User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext));
CleanupStack::PushL(bitmapContext);
bitmapContext->BitBlt(TPoint(0, 0), icon->Bitmap());
CleanupStack::PopAndDestroy(2, bitmapDevice);
icon->SetBitmap(bitmap); // Ownership transferred
CleanupStack::Pop(bitmap);
}
// Always expect 256 mask to make conversion to GL_RGBA easier
if (mask->DisplayMode() != EGray256)
{
mask = new(ELeave) CFbsBitmap;
CleanupStack::PushL(mask);
User::LeaveIfError(mask->Create(icon->Mask()->SizeInPixels(), EGray256));
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(mask);
CleanupStack::PushL(bitmapDevice);
CFbsBitGc* bitmapContext = 0;
User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext));
CleanupStack::PushL(bitmapContext);
bitmapContext->BitBlt(TPoint(0, 0), icon->Mask());
CleanupStack::PopAndDestroy(2, bitmapDevice);
icon->SetMask(mask); // Ownership transferred
CleanupStack::Pop(mask);
}
// Now bitmap and mask point to either original or converted bitmaps,
// and ownership belongs to icon
const TSize bitmapSize = bitmap->SizeInPixels();
// sizeof(TUint32) == sizeof(RGBA)
const TInt dataSize = bitmapSize.iWidth * bitmapSize.iHeight * sizeof(TUint32);
TUint8* data = new(ELeave) TUint8[dataSize];
// Perform copy and conversion from BGR(A) to RGB(A)
bitmap->LockHeap();
mask->LockHeap();
// TODO: Alpha component removed, as it seems to be corrupted from
// subsequent reads from SVG file
TUint8* rgb = reinterpret_cast<TUint8*>(bitmap->DataAddress());
// TUint8* alpha = reinterpret_cast<TUint8*>(mask->DataAddress());
for(TInt i = 0, j = 0; i < dataSize; i += 4, j += 3)
{
data[i + 0] = rgb[j + 2];
data[i + 1] = rgb[j + 1];
data[i + 2] = rgb[j + 0];
data[i + 3] = 0xc0; //alpha[i / 4];
}
// Generate OpenGL texture
::glGenTextures(1, &iTextureId);
::glBindTexture(GL_TEXTURE_2D, iTextureId);
::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bitmapSize.iWidth, bitmapSize.iHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
mask->UnlockHeap();
//.........这里部分代码省略.........
示例15: switch
CFbsBitmap* AknBitmapMirrorUtils::CreateBitmapOptimizedL(CFbsBitmap* aSourceBitmap, TInt aMirrorDirection)
{
// Check if displaymode is optimized, fallback to non-optimized version if not.
TBool fallback = ETrue;
TDisplayMode displayMode = aSourceBitmap->DisplayMode();
switch( displayMode )
{
case EGray256:
case EColor256:
case EColor4K:
case EColor64K:
fallback = EFalse;
break;
default:
fallback = ETrue;
}
// Check if mirroring mode is supported, fallback to non-optimized version if not.
if ((aMirrorDirection != EAknVerticalMirroring) && (aMirrorDirection != EAknHorizontalMirroring))
{
fallback = ETrue;
}
if( fallback )
return CreateBitmapL(aSourceBitmap, aMirrorDirection);
// Prepare destination bitmap
User::LeaveIfNull(aSourceBitmap);
CFbsBitmap* destinationBitmap = new (ELeave) CFbsBitmap();
CleanupStack::PushL(destinationBitmap);
TSize sourceBitmapSize = aSourceBitmap->SizeInPixels();
TRect sourceRect = TRect(TPoint(0,0), sourceBitmapSize);
TSize destinationBitmapSize(sourceRect.Width(), sourceRect.Height());
User::LeaveIfError(destinationBitmap->Create(destinationBitmapSize, aSourceBitmap->DisplayMode()));
// Check source, if rom bitmap or compressed then create uncompressed ram bitmap
TBool srcTemporary = EFalse;
if( aSourceBitmap->IsRomBitmap() )
{
srcTemporary = ETrue;
}
// Heap lock for FBServ large chunk to prevent background
// compression of aSrcBitmap after if IsCompressedInRAM returns EFalse
aSourceBitmap->LockHeapLC( ETrue ); // fbsheaplock
TBool fbsHeapLock = ETrue;
if( aSourceBitmap->IsCompressedInRAM() )
{
srcTemporary = ETrue;
}
if( aSourceBitmap->ExtendedBitmapType() != KNullUid )
{
srcTemporary = ETrue;
}
CFbsBitmap* realSource = aSourceBitmap;
if( srcTemporary )
{
CleanupStack::PopAndDestroy(); // fbsheaplock
fbsHeapLock = EFalse;
realSource = new (ELeave) CFbsBitmap();
CleanupStack::PushL( realSource );
User::LeaveIfError( realSource->Create( sourceBitmapSize, aSourceBitmap->DisplayMode() ) );
CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL( realSource );
CleanupStack::PushL( dev );
CFbsBitGc* gc = NULL;
User::LeaveIfError( dev->CreateContext( gc ) );
CleanupStack::PushL( gc );
gc->BitBlt( TPoint(0,0), aSourceBitmap );
CleanupStack::PopAndDestroy(2); // dev, gc
}
// Heap lock for FBServ large chunk is only needed with large bitmaps.
if (!fbsHeapLock)
{
if ( realSource->IsLargeBitmap() || destinationBitmap->IsLargeBitmap() )
{
destinationBitmap->LockHeapLC( ETrue ); // fbsheaplock
}
else
{
CleanupStack::PushL( (TAny*)NULL );
}
}
TUint32* srcAddress = realSource->DataAddress();
TUint32* trgAddress = destinationBitmap->DataAddress();
if ( displayMode == EColor4K || displayMode == EColor64K )
{
TInt srcScanLen16 = CFbsBitmap::ScanLineLength(sourceBitmapSize.iWidth, displayMode) / 2;
TInt trgScanLen16 = CFbsBitmap::ScanLineLength(destinationBitmapSize.iWidth, displayMode) / 2;
TInt srcScanLen32 = CFbsBitmap::ScanLineLength(sourceBitmapSize.iWidth, displayMode) / 4;
TInt trgScanLen32 = CFbsBitmap::ScanLineLength(destinationBitmapSize.iWidth, displayMode) / 4;
switch (aMirrorDirection)
//.........这里部分代码省略.........