diff -r 0e9202c0340c -r 7f6e7753e018 graphicsdeviceinterface/screendriver/tsrc/TDirectScreenBitmap.cpp --- a/graphicsdeviceinterface/screendriver/tsrc/TDirectScreenBitmap.cpp Wed Jun 09 11:06:44 2010 +0300 +++ b/graphicsdeviceinterface/screendriver/tsrc/TDirectScreenBitmap.cpp Mon Jun 21 17:08:43 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -126,6 +126,7 @@ { TRequestStatus requestStatus; iDSBitmap->EndUpdate(requestStatus); + User::WaitForRequest(requestStatus); } return ret; } @@ -138,6 +139,7 @@ { TRequestStatus requestStatus; iDSBitmap->EndUpdate(iRect,requestStatus); + User::WaitForRequest(requestStatus); } return ret; } @@ -286,7 +288,7 @@ //A largely visual test to demonstrate regional refreshing of DirectScreenBitmaps and the correct display function //of the Emulator. -class CTDirectScreenBitmap : public CTGraphicsBase +class CTDirectScreenBitmap : public CTGraphicsBase, public MDirectScreenAccess { public: ~CTDirectScreenBitmap(); @@ -300,6 +302,9 @@ void LogColourEvent(TInt aPreMulDestPixColor,TInt aNonPreMulDestPixColor,TInt aPreMulSrcPixelColor,TInt aNonPreMulSrcPixelColor,TReal aVal1,TReal aVal2,TReal aVal3,TRefByValue aMsg,TBool aErr); void TestContinuousRefreshingL(); void TestRefreshingTimeL(); + + void Restart(RDirectScreenAccess::TTerminationReasons aReason); + void AbortNow(RDirectScreenAccess::TTerminationReasons aReason); private: void TestRefreshingWindowsPerDisplayModeL(TDisplayMode aDisplayMode); void TestContinuousRefreshingPerDisplayModeL(const TDisplayMode& aDisplayMode); @@ -330,6 +335,12 @@ TReal iMeasure ; TUint32 iTimeBefore; TUint32 iTimeAfter; + RWsSession iSession; + CWsScreenDevice* iScreenDevice; + RWindow* iWin; + RWindowGroup* iWinGroup; + CDirectScreenAccess* iDSA; + TInt iWindowHandle; }; @@ -352,7 +363,7 @@ }; CTDirectScreenBitmap::CTDirectScreenBitmap(CTestStep* aStep) : - CTGraphicsBase(aStep),iMeasure(0) + CTGraphicsBase(aStep),iMeasure(0), iSession() { } @@ -360,6 +371,18 @@ { Close(); } + +void CTDirectScreenBitmap::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) + { + iDSA->StartL(); + CFbsBitGc* gc = iDSA->Gc(); + RRegion* region = iDSA->DrawingRegion(); + gc->SetClippingRegion(region); + } + +void CTDirectScreenBitmap::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) + { + } //Construct the DirectScreenBitmap and sub-rects for test of the refresh. //Constructs a DirectScreenBitmap for EDoubleBuffer and EIncrementalUpdate @@ -377,6 +400,27 @@ { iDirectScreenBitmap = CDirectScreenBitmap::NewL(); } + iSession.Connect(); + iScreenDevice = new (ELeave) CWsScreenDevice(iSession); + iScreenDevice->Construct(); + + iWinGroup = new (ELeave) RWindowGroup(iSession); + iWinGroup->Construct(++iWindowHandle, iScreenDevice); + iWin = new (ELeave) RWindow(iSession); + iWin->Construct(*iWinGroup, ++iWindowHandle); + iWin->SetExtent(TPoint(0,0), aScreenRect.Size()); + iWin->SetPosition(aScreenRect.iTl); + iWin->Activate(); + iWin->BeginRedraw(); + iWin->EndRedraw(); + iDSA = CDirectScreenAccess::NewL(iSession, *iScreenDevice, *iWin, *this); + iSession.Flush(); + iDSA->StartL(); + + CFbsBitGc* gc = iDSA->Gc(); + RRegion* region = iDSA->DrawingRegion(); + gc->SetClippingRegion(region); + iSettings = aSettings; TInt create=iDirectScreenBitmap->Create(aScreenRect, aSettings); if (create==KErrNone) @@ -412,6 +456,19 @@ iInterface = NULL; delete iRendering; iRendering = NULL; + if (iDSA) + { + iDSA->Cancel(); + delete iDSA; + iDSA = NULL; + } + delete iWin; + iWin = NULL; + delete iScreenDevice; + iScreenDevice = NULL; + delete iWinGroup; + iWinGroup = NULL; + iSession.Close(); } @@ -438,26 +495,26 @@ if (!(iSettings & CDirectScreenBitmap::EIncrementalUpdate)) { iInterface->EndDraw(iRequestStatus); - User::After(WAIT_TIME); + User::WaitForRequest(iRequestStatus); } else { - iInterface->EndDraw(iTopLeft, iRequestStatus); - User::After(WAIT_TIME); + iInterface->EndDraw(iTopLeft, iRequestStatus); + User::WaitForRequest(iRequestStatus); iInterface->BeginDraw(); iInterface->EndDraw(iTopRight, iRequestStatus); - User::After(WAIT_TIME); + User::WaitForRequest(iRequestStatus); iInterface->BeginDraw(); - iInterface->EndDraw(iBotLeft, iRequestStatus); - User::After(WAIT_TIME); + iInterface->EndDraw(iBotLeft, iRequestStatus); + User::WaitForRequest(iRequestStatus); iInterface->BeginDraw(); - iInterface->EndDraw(iBotRight, iRequestStatus); - User::After(WAIT_TIME); + iInterface->EndDraw(iBotRight, iRequestStatus); + User::WaitForRequest(iRequestStatus); iInterface->DrawColor(iMiddle,KRgbCyan); iInterface->BeginDraw(); iInterface->EndDraw(iMiddle, iRequestStatus); - User::After(WAIT_TIME); + User::WaitForRequest(iRequestStatus); } __ASSERT_DEBUG(iInterface->ScreenClear(), User::Invariant());