116 iZoomActive = EFalse; |
116 iZoomActive = EFalse; |
117 |
117 |
118 //To know if HDMi cable is connected. |
118 //To know if HDMi cable is connected. |
119 iGlxTvOut = CGlxTv::NewL(*this); |
119 iGlxTvOut = CGlxTv::NewL(*this); |
120 iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
120 iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
121 iGPUMemMonitor = CGlxRelaseGPUMemory::NewL(*this); |
121 } |
122 } |
122 |
123 |
123 // ----------------------------------------------------------------------------- |
124 // ----------------------------------------------------------------------------- |
124 // ScreenSize : gets the screensize, Note that , this is not stored in member variable as |
125 // ScreenSize : gets the screensize, Note that , this is not stored in member variable as |
125 // Screen rect can change based on orientation |
126 // Screen rect can change based on orientation |
442 // ---------------------------------------------------------------------------------- |
448 // ---------------------------------------------------------------------------------- |
443 // |
449 // |
444 EXPORT_C void CGlxZoomControl::Deactivate() |
450 EXPORT_C void CGlxZoomControl::Deactivate() |
445 { |
451 { |
446 TRACER("CGlxZoomControl::Deactivate()"); |
452 TRACER("CGlxZoomControl::Deactivate()"); |
447 |
453 if (iZoomActive) |
448 if ( iZoomActive ) |
454 { |
449 { |
455 if (iTimer->IsActive()) |
450 if(iTimer->IsActive()) |
456 { |
451 { |
457 iTimer->Cancel(); |
452 iTimer->Cancel(); |
458 } |
453 } |
|
454 iZoomSliderWidget.RemoveEventHandler(*this); |
459 iZoomSliderWidget.RemoveEventHandler(*this); |
455 iZoomBackKey->MakeVisible( EFalse ); |
460 iZoomBackKey->MakeVisible(EFalse); |
456 iTextureMgr->RemoveZoomList(); |
461 iTextureMgr->RemoveZoomList(); |
457 |
462 |
458 iImageVisual->SetImage(*iImageTexture); |
463 iImageVisual->SetImage(*iImageTexture); |
459 iEventHandler->DeactivateZoom(); |
464 iEventHandler->DeactivateZoom(); |
460 CleanUpVisual(); |
465 CleanUpVisual(); |
461 |
466 |
462 iZoomActive = EFalse; |
467 iZoomActive = EFalse; |
463 iEventHandler->SetZoomActivated(EFalse); |
468 iEventHandler->SetZoomActivated(EFalse); |
464 } |
469 } |
465 // Hide the Zoom View |
470 // Hide the Zoom View |
466 ShowZoom(EFalse); |
471 ShowZoom(EFalse); |
467 } |
472 } |
468 |
473 |
471 // ---------------------------------------------------------------------------------- |
476 // ---------------------------------------------------------------------------------- |
472 // |
477 // |
473 EXPORT_C void CGlxZoomControl::HandleZoomForegroundEvent(TBool aForeground) |
478 EXPORT_C void CGlxZoomControl::HandleZoomForegroundEvent(TBool aForeground) |
474 { |
479 { |
475 TRACER("CGlxZoomControl::HandleZoomForegroundEventL()"); |
480 TRACER("CGlxZoomControl::HandleZoomForegroundEventL()"); |
476 |
|
477 //Refeed the textures if we are coming back to foreground from background |
|
478 //To Retrive the image details |
|
479 TMPXAttribute thumbNailAttribute(0,0); |
|
480 TInt focusIndex = iMediaList.FocusIndex(); |
|
481 TGlxIdSpaceId idspace = iMediaList.IdSpaceId( focusIndex ); |
|
482 //Get the texture Created in fullscreen View. |
|
483 TGlxMedia item = iMediaList.Item( focusIndex ); |
|
484 |
481 |
485 if (!aForeground) |
482 if (!aForeground) |
486 { |
483 { |
|
484 ShowUi(EFalse); |
487 iEventHandler->CancelZoomPanTimer(); |
485 iEventHandler->CancelZoomPanTimer(); |
488 iEventHandler->CancelUITimer(); |
486 iEventHandler->CancelUITimer(); |
489 iEventHandler->CancelAnimationTimer(); |
487 iEventHandler->CancelAnimationTimer(); |
490 } |
488 } |
491 else |
489 else |
492 { |
490 { |
493 // if we already have the decoded zoomed image bitmap use the texture corresponding to that. |
491 iGPUMemMonitor->RequestMemory(); |
494 // Else make do with the fullscreen texture till that happens. |
|
495 TRAP_IGNORE(iImageTexture = |
|
496 iTextureMgr->CreateZoomedTextureL()); |
|
497 |
|
498 if (NULL == iImageTexture) |
|
499 { |
|
500 iImageTexture = &(iTextureMgr->CreateNewTextureForMediaL( |
|
501 ScreenSize(),item, idspace, this )); |
|
502 } |
|
503 |
|
504 iImageVisual->SetImage(*iImageTexture); |
|
505 } |
492 } |
506 } |
493 } |
507 |
494 |
508 // ----------------------------------------------------------------------------- |
495 // ----------------------------------------------------------------------------- |
509 // CleanUpVisual:reset the values of the variables. |
496 // CleanUpVisual:reset the values of the variables. |
641 iViewPort->SetViewportSize(TAlfRealSize(iScreenSize.iWidth,iScreenSize.iHeight), 0); |
628 iViewPort->SetViewportSize(TAlfRealSize(iScreenSize.iWidth,iScreenSize.iHeight), 0); |
642 if(Activated()) |
629 if(Activated()) |
643 { |
630 { |
644 iEventHandler->OrientationChanged(rect); |
631 iEventHandler->OrientationChanged(rect); |
645 } |
632 } |
|
633 iCommandHandler.HandleCommandL(KGlxZoomOrientationChange, this); |
646 } |
634 } |
647 } |
635 } |
648 |
636 |
649 // --------------------------------------------------------------------------- |
637 // --------------------------------------------------------------------------- |
650 // ShowUi |
638 // ShowUi |
979 EXPORT_C TUiState CGlxZoomControl::ZoomUiState() |
967 EXPORT_C TUiState CGlxZoomControl::ZoomUiState() |
980 { |
968 { |
981 TRACER("CGlxZoomControl::ZoomUiState"); |
969 TRACER("CGlxZoomControl::ZoomUiState"); |
982 return iEventHandler->ZoomUiState(); |
970 return iEventHandler->ZoomUiState(); |
983 } |
971 } |
|
972 |
|
973 // --------------------------------------------------------------------------- |
|
974 // HandleGoomMemoryReleased |
|
975 // Callback from memMonitor CGlxRelaseGPUMemory |
|
976 // --------------------------------------------------------------------------- |
|
977 // |
|
978 void CGlxZoomControl::HandleGoomMemoryReleased(TInt aStatus) |
|
979 { |
|
980 TRACER("CGlxZoomControl::HandleGoomMemoryReleased"); |
|
981 if (aStatus == KErrNone) |
|
982 { |
|
983 //Refeed the textures if we are coming back to foreground from background |
|
984 //To Retrive the image details |
|
985 TMPXAttribute thumbNailAttribute(0, 0); |
|
986 TInt focusIndex = iMediaList.FocusIndex(); |
|
987 TGlxIdSpaceId idspace = iMediaList.IdSpaceId(focusIndex); |
|
988 //Get the texture Created in fullscreen View. |
|
989 TGlxMedia item = iMediaList.Item(focusIndex); |
|
990 |
|
991 // if we already have the decoded zoomed image bitmap use the texture corresponding to that. |
|
992 // Else make do with the fullscreen texture till that happens. |
|
993 TRAP_IGNORE(iImageTexture = |
|
994 iTextureMgr->CreateZoomedTextureL()); |
|
995 |
|
996 if (NULL == iImageTexture) |
|
997 { |
|
998 TRAP_IGNORE(iImageTexture = &(iTextureMgr->CreateNewTextureForMediaL( |
|
999 ScreenSize(), item, idspace, this))) |
|
1000 } |
|
1001 |
|
1002 if (NULL != iImageTexture) |
|
1003 { |
|
1004 iImageVisual->SetImage(*iImageTexture); |
|
1005 return; |
|
1006 } |
|
1007 } |
|
1008 |
|
1009 // No GPU Memory, return back to Fullscreenview |
|
1010 ActivateFullscreen(); |
|
1011 } |
984 // End of File |
1012 // End of File |