/** 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); }
void XAPlaySessionImpl::MvpuoPrepareComplete(TInt aError) { TRACE_FUNCTION_ENTRY; m_VPError = aError; if (mActiveSchedulerWait->IsStarted()) mActiveSchedulerWait->AsyncStop(); RWindow* window = (RWindow*)mNativeDisplay.hWindow; RWsSession* wssession = (RWsSession*)mNativeDisplay.hDisplay; if (window) { TRect videoExtent = TRect(window->Size()); TRect clipRect = TRect(window->Size()); TRAP_IGNORE(mVideoPlayUtil->AddDisplayWindowL(*wssession, *(CCoeEnv::Static()->ScreenDevice()), *window, videoExtent, clipRect)); TRAP_IGNORE(mVideoPlayUtil->SetAutoScaleL(*window, EAutoScaleBestFit)); } TRACE_FUNCTION_EXIT; }
/** Alpha blends two bitmaps together @param aDisplayMode1 is the source display mode @param aDisplayMode2 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::DoAlphaBlendBitmapsBitmapTestL(TDisplayMode aSrcMode, TDisplayMode aDstMode, RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TInt aNumIterations) { const TSize bitmapSize = aWindow.Size(); CFbsBitmap* bitmapTarget = CreateSoftwareBitmapLC(bitmapSize, aDstMode); CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmapTarget); CleanupStack::PushL(bitmapDevice); CFbsBitGc* bitmapGc=NULL; User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc)); CleanupStack::PushL(bitmapGc); CFbsBitmap* sourceUnder = CreateSoftwareBitmapLC(bitmapSize, aDstMode); CFbsBitmap* sourceOver = CreateSoftwareBitmapLC(bitmapSize, aSrcMode); CFbsBitmap* sourceAlpha = CreateSoftwareBitmapLC(bitmapSize, EGray256); VerticalGradientAlphaL(sourceAlpha, TRgb(0x01010101), TRgb(0xfefefefe)); VerticalGradientAlphaL(sourceUnder, TRgb(0xff000000), TRgb(0x00ffffff)); VerticalGradientAlphaL(sourceOver, TRgb(0x00ffffff), TRgb(0xff000000)); RDebug::Printf("DABBBT 2"); TPoint point(0,0); TRect rect(bitmapSize); bitmapGc->SetBrushStyle(CGraphicsContext::ENullBrush); bitmapGc->SetBrushColor(TRANSPARENT_BLACK); bitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); bitmapGc->Clear(); bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN); bitmapGc->AlphaBlendBitmaps(point, sourceUnder, sourceOver, rect, point, sourceAlpha, point); aGc->Activate(aWindow); aGc->BitBlt(point, bitmapTarget); aGc->Deactivate(); aSession.Flush(); iProfiler->InitResults(); // blend sourceUnder with sourceOver using alpha mask for(TInt i=0; i<aNumIterations; i++) { bitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); bitmapGc->Clear(); bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN); bitmapGc->AlphaBlendBitmaps(point, sourceUnder, sourceOver, rect, point, sourceAlpha, point); iProfiler->MarkResultSetL(); } iProfiler->ResultsAnalysis(_L("DoAlphaBlendBitmapsBitmapTestL"), 0, aSrcMode, aDstMode, aNumIterations); // copy up to screen for sanity check BitBlt(aSession, aWindow, aGc, *bitmapTarget); CleanupStack::PopAndDestroy(6, bitmapTarget); // sourceAlpha, sourceOver, sourceUnder, bitmapGc, bitmapDevice, bitmapTarget }