photosgallery/viewframework/tvout/src/glxhdmisurfaceupdater.cpp
branchRCL_3
changeset 22 2dac0fdba72b
parent 18 bcb43dc84c44
child 25 191387a8b767
equal deleted inserted replaced
18:bcb43dc84c44 22:2dac0fdba72b
    22 
    22 
    23 #include <imageconversion.h> 
    23 #include <imageconversion.h> 
    24 #include <fbs.h>
    24 #include <fbs.h>
    25 #include <glxtracer.h>
    25 #include <glxtracer.h>
    26 #include <glxlog.h>
    26 #include <glxlog.h>
       
    27 #include <glxgeneraluiutilities.h>
    27 
    28 
    28 #include "glxactivecallback.h"
    29 #include "glxactivecallback.h"
    29 #include "glxhdmisurfaceupdater.h"
    30 #include "glxhdmisurfaceupdater.h"
    30 #include "glxactivedecoder.h"
    31 #include "glxactivedecoder.h"
    31 
    32 
    62     ReleaseContent();
    63     ReleaseContent();
    63     if(iWindow)
    64     if(iWindow)
    64         {
    65         {
    65         iWindow->RemoveBackgroundSurface(ETrue);
    66         iWindow->RemoveBackgroundSurface(ETrue);
    66         }
    67         }
    67     if(iTimer->IsActive())
    68 	if(iTimer && iTimer->IsActive())	 	 	 // Check for a CPeriodic Instance
    68         {
    69         {
    69         iTimer->Cancel();
    70         iTimer->Cancel();
    70         }
    71         }
    71     delete iTimer;   
    72     delete iTimer;   
    72     if (iGlxDecoderAO)
    73     if (iGlxDecoderAO)
   152     TInt error = iFsSession.Connect ();
   153     TInt error = iFsSession.Connect ();
   153     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::ConstructL() FsSession Connect error = %d", error);
   154     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::ConstructL() FsSession Connect error = %d", error);
   154     User::LeaveIfError(error);
   155     User::LeaveIfError(error);
   155     
   156     
   156     iBitmapReady = EFalse;
   157     iBitmapReady = EFalse;
       
   158     iShiftToCloning = EFalse;
   157     // Create the active object
   159     // Create the active object
   158     iGlxDecoderAO = CGlxHdmiDecoderAO::NewL(this);
   160     iGlxDecoderAO = CGlxHdmiDecoderAO::NewL(this);
   159     CreateImageDecoderL(iImagePath);
   161     CreateImageDecoderL(iImagePath);
   160     CreateBitmapL();
   162     CreateBitmapL();
   161     CreateHdmiL();
   163     TRAP_IGNORE(CreateHdmiL());
   162     error = iSurfUpdateSession.Connect();
   164     if(iSurfManager)
   163     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::ConstructL() Surface update Session Connect error = %d", error);
   165     	{
   164     User::LeaveIfError(error);
   166 		error = iSurfUpdateSession.Connect();
   165     iSurfSessionConnected = ETrue;
   167 		GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::ConstructL() Surface update Session Connect error = %d", error);
   166     
   168 		User::LeaveIfError(error);
       
   169 		iSurfSessionConnected = ETrue;
       
   170 		
   167 #ifdef _DEBUG
   171 #ifdef _DEBUG
   168     iStartTime.HomeTime();
   172 		iStartTime.HomeTime();
   169 #endif
   173 #endif
   170     //start decoding the image    
   174 		//start decoding the image    
   171     iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,iImageDecoder);    
   175 		iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,iImageDecoder);    
   172     
   176     	}
   173     iLeftCornerForZoom.iX = 0; 
   177     iLeftCornerForZoom.iX = 0; 
   174     iLeftCornerForZoom.iY = 0;
   178     iLeftCornerForZoom.iY = 0;
   175     iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   179     iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   176     iZoom = ETrue;
   180     iZoom = ETrue;
   177     }
   181     }
   193 	iLeftCornerForZoom.iX = 0; 
   197 	iLeftCornerForZoom.iX = 0; 
   194 	iLeftCornerForZoom.iY = 0;
   198 	iLeftCornerForZoom.iY = 0;
   195     ReleaseContent();   
   199     ReleaseContent();   
   196     CreateImageDecoderL(aImageFile);    
   200     CreateImageDecoderL(aImageFile);    
   197     CreateBitmapL();
   201     CreateBitmapL();
   198     CreateHdmiL(EFalse);
   202     if(iSurfManager)
       
   203     	{
       
   204     	CreateHdmiL(EFalse);
       
   205     	}
       
   206     else
       
   207     	{
       
   208     	TRAP_IGNORE(CreateHdmiL(ETrue));
       
   209     	}
   199 #ifdef _DEBUG
   210 #ifdef _DEBUG
   200     iStartTime.HomeTime();
   211     iStartTime.HomeTime();
   201 #endif
   212 #endif
   202     //start decoding the image
   213     if(iSurfManager)
   203     iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,iImageDecoder);
   214     	{
       
   215 		//start decoding the image
       
   216 		iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,iImageDecoder);
       
   217     	}
   204     }
   218     }
   205 
   219 
   206 // -----------------------------------------------------------------------------
   220 // -----------------------------------------------------------------------------
   207 // CreateHDMI 
   221 // CreateHDMI 
   208 // -----------------------------------------------------------------------------
   222 // -----------------------------------------------------------------------------
   247     attributes().iContiguous            = EFalse;
   261     attributes().iContiguous            = EFalse;
   248     attributes().iMappable              = ETrue;
   262     attributes().iMappable              = ETrue;
   249         
   263         
   250     error = iSurfManager->CreateSurface(attributes, iSurfId);
   264     error = iSurfManager->CreateSurface(attributes, iSurfId);
   251     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL, Creating surface error : %d",error);
   265     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL, Creating surface error : %d",error);
       
   266     if(error == KErrNoMemory)
       
   267     	{
       
   268     	GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::CreateSurfaceL(). iSurfManager->Close()"); 
       
   269 		iSurfManager->Close();
       
   270 		delete iSurfManager;
       
   271 		iSurfManager = NULL;
       
   272     	if(iShiftToCloning == EFalse)
       
   273     		{
       
   274     		GlxGeneralUiUtilities::ShowErrorNoteL(error); // Show Low Memory Popup Once before shifting to Cloning Mode
       
   275     		iShiftToCloning = ETrue;
       
   276     		}
       
   277     	ShiftToCloningMode();	 	 	 	 	 	 	  // Shift from Posting Mode to Cloning Mode
       
   278     	}
   252     User::LeaveIfError(error);
   279     User::LeaveIfError(error);
   253         
   280         
   254     //Map the surface and stride the surface info
   281     //Map the surface and stride the surface info
   255     MapSurfaceL();
   282     MapSurfaceL();
   256     // Set the Configuration to the surface ID when creating a surface
   283     // Set the Configuration to the surface ID when creating a surface
   395     if(aStatus.Int() !=KErrNone)
   422     if(aStatus.Int() !=KErrNone)
   396         {
   423         {
   397         GLX_LOG_INFO("HandleRunL - Convert failed");
   424         GLX_LOG_INFO("HandleRunL - Convert failed");
   398         ShiftToCloningMode();
   425         ShiftToCloningMode();
   399         }
   426         }
   400     else
   427     else if(iSurfManager)
   401         {        
   428         {        
   402         iZoomRectSz = iDecodedBitmap->SizeInPixels();
   429         iZoomRectSz = iDecodedBitmap->SizeInPixels();
   403         if (iSurfBufferAO->iStatus != KRequestPending
   430         if (iSurfBufferAO->iStatus != KRequestPending
   404                 && !iSurfBufferAO->IsActive())
   431                 && !iSurfBufferAO->IsActive())
   405             {
   432             {
   591 // ShiftToPostingMode 
   618 // ShiftToPostingMode 
   592 // -----------------------------------------------------------------------------
   619 // -----------------------------------------------------------------------------
   593 void CGlxHdmiSurfaceUpdater::ShiftToPostingMode()
   620 void CGlxHdmiSurfaceUpdater::ShiftToPostingMode()
   594 	{
   621 	{
   595 	TRACER("CGlxHdmiSurfaceUpdater::ShiftToPostingMode()");
   622 	TRACER("CGlxHdmiSurfaceUpdater::ShiftToPostingMode()");
       
   623 	if(iSurfManager)
       
   624 		{
   596 #ifdef _DEBUG
   625 #ifdef _DEBUG
   597 	TRect ex, vp;
   626 		TRect ex, vp;
   598 	iConfig.GetExtent(ex);
   627 		iConfig.GetExtent(ex);
   599     iConfig.GetViewport(vp);
   628 		iConfig.GetViewport(vp);
   600     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - vp - TL=%d, %d",vp.iTl.iX,vp.iTl.iY);
   629 		GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - vp - TL=%d, %d",vp.iTl.iX,vp.iTl.iY);
   601     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - vp - BR=%d, %d",vp.iBr.iX,vp.iBr.iY);
   630 		GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - vp - BR=%d, %d",vp.iBr.iX,vp.iBr.iY);
   602     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - ex - TL=%d, %d",ex.iTl.iX,ex.iTl.iY);
   631 		GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - ex - TL=%d, %d",ex.iTl.iX,ex.iTl.iY);
   603     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - ex - BR=%d, %d",ex.iBr.iX,ex.iBr.iY);
   632 		GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - ex - BR=%d, %d",ex.iBr.iX,ex.iBr.iY);
   604 #endif
   633 #endif
   605     iWindow->SetBackgroundSurface(iConfig, ETrue);
   634 		iWindow->SetBackgroundSurface(iConfig, ETrue);
       
   635 		iShiftToCloning = EFalse;
       
   636 		}
   606 	}
   637 	}