photosgallery/viewframework/tvout/src/glxhdmisurfaceupdater.cpp
changeset 4 57d388cc48c1
parent 2 7d9067c6fcb1
child 9 6b87b143d312
equal deleted inserted replaced
3:9a9c174934f5 4:57d388cc48c1
    59 CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()
    59 CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()
    60     {
    60     {
    61     TRACER("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()");
    61     TRACER("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()");
    62     ReleaseContent();
    62     ReleaseContent();
    63     if(iTimer->IsActive())
    63     if(iTimer->IsActive())
    64          {
    64         {
    65          iTimer->Cancel();
    65         iTimer->Cancel();
    66          }
    66         }
    67      delete iTimer;   
    67     delete iTimer;   
    68     if (iGlxDecoderAO)
    68     if (iGlxDecoderAO)
    69         {
    69         {
    70         delete iGlxDecoderAO;
    70         delete iGlxDecoderAO;
    71         }        
    71         }        
    72     iGlxDecoderAO = NULL;
    72     iGlxDecoderAO = NULL;
   143     iGlxDecoderAO = CGlxHdmiDecoderAO::NewL(this, iFrameCount);
   143     iGlxDecoderAO = CGlxHdmiDecoderAO::NewL(this, iFrameCount);
   144     CreateImageDecoderL(iImagePath);
   144     CreateImageDecoderL(iImagePath);
   145     CreateBitmapL();
   145     CreateBitmapL();
   146     CreateHdmiL();
   146     CreateHdmiL();
   147     error = iSurfUpdateSession.Connect();
   147     error = iSurfUpdateSession.Connect();
   148     #ifdef _DEBUG
   148 #ifdef _DEBUG
   149     iStartTime.HomeTime();
   149     iStartTime.HomeTime();
   150     #endif
   150 #endif
   151     //to refresh the HD screen for the first time.
   151     //to refresh the HD screen for the first time.
   152     iFirstTime = ETrue;
   152     iFirstTime = ETrue;
   153     //start decoding the image    
   153     //start decoding the image    
   154     iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,0,iImageDecoder);
   154     iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,0,iImageDecoder);
   155          
   155          
   173     TRACER("CGlxHdmiSurfaceUpdater::UpdateNewImageL()");
   173     TRACER("CGlxHdmiSurfaceUpdater::UpdateNewImageL()");
   174     ReleaseContent();   
   174     ReleaseContent();   
   175     CreateImageDecoderL(aImageFile);    
   175     CreateImageDecoderL(aImageFile);    
   176     CreateBitmapL();
   176     CreateBitmapL();
   177     CreateHdmiL(EFalse);
   177     CreateHdmiL(EFalse);
   178     #ifdef _DEBUG
   178 #ifdef _DEBUG
   179     iStartTime.HomeTime();
   179     iStartTime.HomeTime();
   180     #endif
   180 #endif
   181     //start decoding the image
   181     //start decoding the image
   182     iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,0,iImageDecoder);
   182     iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,0,iImageDecoder);
   183     }
   183     }
   184 
   184 
   185 // -----------------------------------------------------------------------------
   185 // -----------------------------------------------------------------------------
   236     if(error)
   236     if(error)
   237         {
   237         {
   238         GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL, Creating surface failed with error : %d",error);
   238         GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL, Creating surface failed with error : %d",error);
   239         User::LeaveIfError(error);
   239         User::LeaveIfError(error);
   240         }    
   240         }    
   241     //Map the surface and stire the surface info
   241     //Map the surface and stride the surface info
   242     MapSurfaceL();
   242     MapSurfaceL();
   243     }
   243     }
   244 
   244 
       
   245 // -----------------------------------------------------------------------------
       
   246 // MapSurfaceL 
       
   247 // -----------------------------------------------------------------------------
   245 void CGlxHdmiSurfaceUpdater::MapSurfaceL()
   248 void CGlxHdmiSurfaceUpdater::MapSurfaceL()
   246     {
   249     {
   247     TRACER("CGlxHdmiSurfaceUpdater::MapSurfaceL()");
   250     TRACER("CGlxHdmiSurfaceUpdater::MapSurfaceL()");
   248     
   251     
   249     //Create chunk to map it to the surface ID.
   252     //Create chunk to map it to the surface ID.
   281     {
   284     {
   282     TRACER("CGlxHdmiSurfaceUpdater::Refresh()");
   285     TRACER("CGlxHdmiSurfaceUpdater::Refresh()");
   283     SwapBuffers();   
   286     SwapBuffers();   
   284     iCallBack->DoGenCallback();       
   287     iCallBack->DoGenCallback();       
   285     if(iFirstTime)  
   288     if(iFirstTime)  
   286 	{
   289         {
   287 	iFirstTime = EFalse;
   290         iFirstTime = EFalse;
   288 	iWindow->RemoveBackgroundSurface(ETrue);
   291         iWindow->RemoveBackgroundSurface(ETrue);
   289 	iWindow->SetBackgroundSurface(iSurfId);
   292         iWindow->SetBackgroundSurface(iSurfId);
   290 	}
   293         }
   291     }
   294     }
   292 
   295 
   293 // -----------------------------------------------------------------------------
   296 // -----------------------------------------------------------------------------
   294 // SwapBuffers
   297 // SwapBuffers
   295 // This is used to sawp the buffers shown and to be shown 
   298 // This is used to sawp the buffers shown and to be shown 
   354 // HandleRunL 
   357 // HandleRunL 
   355 // -----------------------------------------------------------------------------
   358 // -----------------------------------------------------------------------------
   356 void CGlxHdmiSurfaceUpdater::HandleRunL()
   359 void CGlxHdmiSurfaceUpdater::HandleRunL()
   357     {
   360     {
   358     TRACER("CGlxHdmiSurfaceUpdater::HandleRunL()");
   361     TRACER("CGlxHdmiSurfaceUpdater::HandleRunL()");
   359     
   362 
   360     #ifdef _DEBUG
   363 #ifdef _DEBUG
   361     iStopTime.HomeTime();
   364     iStopTime.HomeTime();
   362     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::HandleRunL() ConvertImageL took"
   365     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::HandleRunL() ConvertImageL took"
   363                 " <%d> us", (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64());
   366             " <%d> us", (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64());
   364     #endif
   367 #endif
   365     
   368 
   366     iZoomRectSz = iDecodedBitmap->SizeInPixels(); 
   369     iZoomRectSz = iDecodedBitmap->SizeInPixels(); 
   367     if (iSurfBufferAO->iStatus != KRequestPending && !iSurfBufferAO->IsActive())
   370     if (iSurfBufferAO->iStatus != KRequestPending && !iSurfBufferAO->IsActive())
   368            {
   371         {
   369            Refresh();              
   372         Refresh();              
   370            iSurfBufferAO->iStatus = KRequestPending;
   373         iSurfBufferAO->iStatus = KRequestPending;
   371            iSurfBufferAO->SetActive();    
   374         iSurfBufferAO->SetActive();    
   372            iSurfUpdateSession.NotifyWhenAvailable(iSurfBufferAO->iStatus);
   375         iSurfUpdateSession.NotifyWhenAvailable(iSurfBufferAO->iStatus);
   373            TInt err = iSurfUpdateSession.SubmitUpdate(1, iSurfId, 0, NULL);       
   376         TInt err = iSurfUpdateSession.SubmitUpdate(1, iSurfId, 0, NULL);       
   374            }
   377         }
   375     }
   378     }
   376 
   379 
   377 // -----------------------------------------------------------------------------
   380 // -----------------------------------------------------------------------------
   378 // CreateImageDecoderL 
   381 // CreateImageDecoderL 
   379 // -----------------------------------------------------------------------------
   382 // -----------------------------------------------------------------------------
   464             iZoom = ETrue;
   467             iZoom = ETrue;
   465             }
   468             }
   466         GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::Zoom()--- 4,iZoomRectSz.iWidth = %d, iZoomRectSz.iHeight = %d", iZoomRectSz.iWidth,iZoomRectSz.iHeight);
   469         GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::Zoom()--- 4,iZoomRectSz.iWidth = %d, iZoomRectSz.iHeight = %d", iZoomRectSz.iWidth,iZoomRectSz.iHeight);
   467         iConfig.SetViewport(TRect(iLeftCornerForZoom.iX,iLeftCornerForZoom.iY,iZoomRectSz.iWidth,iZoomRectSz.iHeight));
   470         iConfig.SetViewport(TRect(iLeftCornerForZoom.iX,iLeftCornerForZoom.iY,iZoomRectSz.iWidth,iZoomRectSz.iHeight));
   468         }
   471         }
   469     TSize bitmapsize = iDecodedBitmap->SizeInPixels();
   472     iConfig.SetExtent(TRect(0,0,KHdTvWidth,KHdTvHeight));    
   470     iConfig.SetExtent(TRect(0,0,bitmapsize.iWidth,bitmapsize.iHeight));    
       
   471     iWindow->SetBackgroundSurface(iConfig, ETrue);   
   473     iWindow->SetBackgroundSurface(iConfig, ETrue);   
   472     }
   474     }