photosgallery/viewframework/tvout/src/glxhdmisurfaceupdater.cpp
branchRCL_3
changeset 9 6b87b143d312
parent 4 57d388cc48c1
child 13 71da52165949
equal deleted inserted replaced
5:f7f0874bfe7d 9:6b87b143d312
    58 // -----------------------------------------------------------------------------
    58 // -----------------------------------------------------------------------------
    59 CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()
    59 CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()
    60     {
    60     {
    61     TRACER("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()");
    61     TRACER("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()");
    62     ReleaseContent();
    62     ReleaseContent();
       
    63     if(iWindow)
       
    64         {
       
    65         iWindow->RemoveBackgroundSurface(ETrue);
       
    66         }
    63     if(iTimer->IsActive())
    67     if(iTimer->IsActive())
    64         {
    68         {
    65         iTimer->Cancel();
    69         iTimer->Cancel();
    66         }
    70         }
    67     delete iTimer;   
    71     delete iTimer;   
   136     TInt error = iFsSession.Connect ();
   140     TInt error = iFsSession.Connect ();
   137     if ( KErrNone!= iFsSession.Connect () )
   141     if ( KErrNone!= iFsSession.Connect () )
   138         {
   142         {
   139         User::LeaveIfError(error);
   143         User::LeaveIfError(error);
   140         }
   144         }
   141     
   145     iBitmapReady = EFalse;
   142     // Create the active object
   146     // Create the active object
   143     iGlxDecoderAO = CGlxHdmiDecoderAO::NewL(this, iFrameCount);
   147     iGlxDecoderAO = CGlxHdmiDecoderAO::NewL(this, iFrameCount);
   144     CreateImageDecoderL(iImagePath);
   148     CreateImageDecoderL(iImagePath);
   145     CreateBitmapL();
   149     CreateBitmapL();
   146     CreateHdmiL();
   150     CreateHdmiL();
   169 // -----------------------------------------------------------------------------
   173 // -----------------------------------------------------------------------------
   170 void CGlxHdmiSurfaceUpdater::UpdateNewImageL(const TDesC& aImageFile, 
   174 void CGlxHdmiSurfaceUpdater::UpdateNewImageL(const TDesC& aImageFile, 
   171         TInt /*aFrameCount*/)
   175         TInt /*aFrameCount*/)
   172     {
   176     {
   173     TRACER("CGlxHdmiSurfaceUpdater::UpdateNewImageL()");
   177     TRACER("CGlxHdmiSurfaceUpdater::UpdateNewImageL()");
       
   178 	iBitmapReady = EFalse;
   174     ReleaseContent();   
   179     ReleaseContent();   
   175     CreateImageDecoderL(aImageFile);    
   180     CreateImageDecoderL(aImageFile);    
   176     CreateBitmapL();
   181     CreateBitmapL();
   177     CreateHdmiL(EFalse);
   182     CreateHdmiL(EFalse);
   178 #ifdef _DEBUG
   183 #ifdef _DEBUG
   201         {
   206         {
   202         iSurfBufferAO = new(ELeave) CGlxActiveCallBack(TCallBack(SurfBuffer0Ready, this),
   207         iSurfBufferAO = new(ELeave) CGlxActiveCallBack(TCallBack(SurfBuffer0Ready, this),
   203                     CActive::EPriorityStandard-1);
   208                     CActive::EPriorityStandard-1);
   204         CActiveScheduler::Add(iSurfBufferAO);    
   209         CActiveScheduler::Add(iSurfBufferAO);    
   205         }
   210         }
   206     
   211 
   207     //Set the background Surface
       
   208     iWindow->SetBackgroundSurface(iSurfId);
       
   209     }
   212     }
   210 
   213 
   211 // -----------------------------------------------------------------------------
   214 // -----------------------------------------------------------------------------
   212 // CreateSurfaceL 
   215 // CreateSurfaceL 
   213 // -----------------------------------------------------------------------------
   216 // -----------------------------------------------------------------------------
   238         GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL, Creating surface failed with error : %d",error);
   241         GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL, Creating surface failed with error : %d",error);
   239         User::LeaveIfError(error);
   242         User::LeaveIfError(error);
   240         }    
   243         }    
   241     //Map the surface and stride the surface info
   244     //Map the surface and stride the surface info
   242     MapSurfaceL();
   245     MapSurfaceL();
       
   246     //Set the background Surface
       
   247     iWindow->SetBackgroundSurface(iSurfId);
       
   248 
   243     }
   249     }
   244 
   250 
   245 // -----------------------------------------------------------------------------
   251 // -----------------------------------------------------------------------------
   246 // MapSurfaceL 
   252 // MapSurfaceL 
   247 // -----------------------------------------------------------------------------
   253 // -----------------------------------------------------------------------------
   363 #ifdef _DEBUG
   369 #ifdef _DEBUG
   364     iStopTime.HomeTime();
   370     iStopTime.HomeTime();
   365     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::HandleRunL() ConvertImageL took"
   371     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::HandleRunL() ConvertImageL took"
   366             " <%d> us", (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64());
   372             " <%d> us", (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64());
   367 #endif
   373 #endif
   368 
   374 	iBitmapReady = ETrue;
   369     iZoomRectSz = iDecodedBitmap->SizeInPixels(); 
   375     iZoomRectSz = iDecodedBitmap->SizeInPixels(); 
   370     if (iSurfBufferAO->iStatus != KRequestPending && !iSurfBufferAO->IsActive())
   376     if (iSurfBufferAO->iStatus != KRequestPending && !iSurfBufferAO->IsActive())
   371         {
   377         {
   372         Refresh();              
   378         Refresh();              
   373         iSurfBufferAO->iStatus = KRequestPending;
   379         iSurfBufferAO->iStatus = KRequestPending;
   374         iSurfBufferAO->SetActive();    
   380         iSurfBufferAO->SetActive();    
   375         iSurfUpdateSession.NotifyWhenAvailable(iSurfBufferAO->iStatus);
   381         iSurfUpdateSession.NotifyWhenAvailable(iSurfBufferAO->iStatus);
   376         TInt err = iSurfUpdateSession.SubmitUpdate(1, iSurfId, 0, NULL);       
   382         TInt err = iSurfUpdateSession.SubmitUpdate(1, iSurfId, 0, NULL);       
   377         }
   383         }
       
   384 	//release imagedecoder after the conversion is over		
       
   385     if(iImageDecoder)
       
   386         {
       
   387         delete iImageDecoder;
       
   388         iImageDecoder = NULL;    
       
   389         }
   378     }
   390     }
   379 
   391 
   380 // -----------------------------------------------------------------------------
   392 // -----------------------------------------------------------------------------
   381 // CreateImageDecoderL 
   393 // CreateImageDecoderL 
   382 // -----------------------------------------------------------------------------
   394 // -----------------------------------------------------------------------------
   397 void CGlxHdmiSurfaceUpdater::ActivateZoom()
   409 void CGlxHdmiSurfaceUpdater::ActivateZoom()
   398     {
   410     {
   399     TRACER("CGlxHdmiSurfaceUpdater::ActivateZoom()");
   411     TRACER("CGlxHdmiSurfaceUpdater::ActivateZoom()");
   400     iConfig.SetSurfaceId(iSurfId);
   412     iConfig.SetSurfaceId(iSurfId);
   401     iZoom = ETrue;
   413     iZoom = ETrue;
   402     if(!iTimer->IsActive())
   414     if(!iTimer->IsActive() && iBitmapReady)
   403        {
   415        {
   404        iTimer->Start(KZoomDelay,KZoomDelay,TCallBack( TimeOut,this ));
   416        iTimer->Start(KZoomDelay,KZoomDelay,TCallBack( TimeOut,this ));
   405        }
   417        }
   406     }
   418     }
   407 // -----------------------------------------------------------------------------
   419 // -----------------------------------------------------------------------------
   470         iConfig.SetViewport(TRect(iLeftCornerForZoom.iX,iLeftCornerForZoom.iY,iZoomRectSz.iWidth,iZoomRectSz.iHeight));
   482         iConfig.SetViewport(TRect(iLeftCornerForZoom.iX,iLeftCornerForZoom.iY,iZoomRectSz.iWidth,iZoomRectSz.iHeight));
   471         }
   483         }
   472     iConfig.SetExtent(TRect(0,0,KHdTvWidth,KHdTvHeight));    
   484     iConfig.SetExtent(TRect(0,0,KHdTvWidth,KHdTvHeight));    
   473     iWindow->SetBackgroundSurface(iConfig, ETrue);   
   485     iWindow->SetBackgroundSurface(iConfig, ETrue);   
   474     }
   486     }
       
   487 
       
   488 // -----------------------------------------------------------------------------
       
   489 // ShiftToCloningMode 
       
   490 // -----------------------------------------------------------------------------
       
   491 void CGlxHdmiSurfaceUpdater::ShiftToCloningMode()
       
   492 	{
       
   493 	TRACER("CGlxHdmiSurfaceUpdater::ShiftToCloningMode()");
       
   494 	iWindow->RemoveBackgroundSurface(ETrue);
       
   495 	}
       
   496 	
       
   497 // -----------------------------------------------------------------------------
       
   498 // ShiftToPostingMode 
       
   499 // -----------------------------------------------------------------------------
       
   500 void CGlxHdmiSurfaceUpdater::ShiftToPostingMode()
       
   501 	{
       
   502 	TRACER("CGlxHdmiSurfaceUpdater::ShiftToPostingMode()");
       
   503 	iWindow->SetBackgroundSurface(iSurfId);
       
   504 	}