Screen orientation change causes exception!

Login to reply to this topic.
Tue, 2006-04-04 09:50
Joined: 2005-12-29
Forum posts: 17
Here is my code for deal with screen rotation:

TPixelsAndRotation iLandscape;
   
TSize iMySize(302,208);

iLandscape.iPixelSize=iMySize;

iLandscape.iRotation=CFbsBitGc::EGraphicsOrientationNormal;

(static_cast<CWsScreenDevice*>(iBackBufferGc->Device()))->SetScreenSizeAndRotation(iLandscape);

   
But it causes exception on last operator... Is anybody know, how to deal with CWsScreenDevice correctly ?
Thanks in advance!!!

Tue, 2006-04-04 17:44
Joined: 2004-07-10
Forum posts: 364
Re: Screen orientation change causes exception!
An exception is usually caused by a duff pointer, so does
iBackBufferGc have a valid value and does iBackBufferGc->Device() return a non null pointer?
Wed, 2006-04-05 15:25
Joined: 2005-12-29
Forum posts: 17
Re: Screen orientation change causes exception!
Thanks to all, friends.

Unfortunately in UIq 2.1 IMPOSSIBLE to rotate screen with API functions. Screen device is not able to rotate! We can rotate bitmaps only... by ourself... 

Thu, 2006-04-06 08:12
NewLC AdministratorSymbian AccreditedForum Nokia Champion
Joined: 2003-01-14
Forum posts: 2009
Re: Screen orientation change causes exception!
Looks like it is the same for S60 (v2 FP2)... I have not investigated very far but we have an app which should be able to rotate the screen. On the emulator, it rotates..... the whole emulator and crashes  Evil

Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant

Wed, 2006-04-12 11:44
Joined: 2006-02-13
Forum posts: 13
Re: Screen orientation change causes exception!
hi, Andres

i has the same problem: with hardware screen rotating, but my situation has that difference: my code does't crash, but calling this method not give my any result (screen rotate stay as default) here is my code:

iWsSession = new RWsSession;
   iWsSession->Connect();

   iWsScreenDevice = new(ELeave)CWsScreenDevice(*iWsSession);
   iWsScreenDevice->Construct();   

   iFbsScreenDevice = CFbsScreenDevice::NewL(_L("Elecard Video Renderer"), iWsScreenDevice->DisplayMode());

TInt aMode = iWsScreenDevice->CurrentScreenMode();
   TPixelsAndRotation aScreenMode, aScreenMode2;
   iWsScreenDevice->GetScreenModeSizeAndRotation(aMode, aScreenMode);
   aScreenMode2.iPixelSize.iWidth  = aScreenMode.iPixelSize.iHeight;
   aScreenMode2.iPixelSize.iHeight = aScreenMode.iPixelSize.iWidth;

   if (aScreenMode.iRotation == CFbsBitGc::EGraphicsOrientationNormal)
      aScreenMode2.iRotation = CFbsBitGc::EGraphicsOrientationRotated270;

   iWsScreenDevice->SetCurrentRotations(aMode, CFbsBitGc::EGraphicsOrientationRotated270);
   iWsScreenDevice->SetScreenSizeAndRotation(aScreenMode2);

   iFbsBitGc = CFbsBitGc::NewL();
   
   iFbsBitGc->SetOrientation(CFbsBitGc::EGraphicsOrientationRotated270);   

   iFbsScreenDevice->CreateContext((CGraphicsContext*&)iFbsBitGc);
   iFbsScreenDevice->SetAutoUpdate(ETrue);   

   iFbsBitGc->Activate(iFbsScreenDevice);
   iFbsBitGc->Reset();   

   iWsSession->Flush();

--
Wbr, Yuri

--
Wbr, Yuri

  • Login to reply to this topic.