photosgallery/viewframework/tvout/src/glxhdmisurfaceupdater.cpp
branchRCL_3
changeset 11 71da52165949
parent 9 6b87b143d312
child 12 ce1c7ad1f18b
equal deleted inserted replaced
9:6b87b143d312 11:71da52165949
    98 // ReleaseContent 
    98 // ReleaseContent 
    99 // -----------------------------------------------------------------------------
    99 // -----------------------------------------------------------------------------
   100 void CGlxHdmiSurfaceUpdater::ReleaseContent()
   100 void CGlxHdmiSurfaceUpdater::ReleaseContent()
   101     {
   101     {
   102     TRACER("void CGlxHdmiSurfaceUpdater::ReleaseContent()"); 
   102     TRACER("void CGlxHdmiSurfaceUpdater::ReleaseContent()"); 
   103     
   103     if ( iGlxDecoderAO )
   104     iGlxDecoderAO->Cancel();    
   104         {
   105     if(iDecodedBitmap)
   105         iGlxDecoderAO->Cancel();
       
   106         }
       
   107     if ( iDecodedBitmap )
   106         {
   108         {
   107         delete iDecodedBitmap;
   109         delete iDecodedBitmap;
   108         iDecodedBitmap= NULL;
   110         iDecodedBitmap= NULL;
   109         }    
   111         }    
   110     if (iSurfBufferAO->IsActive())
   112     if ( iSurfBufferAO->IsActive() )
   111         {
   113         {
   112         iSurfBufferAO->Cancel();        
   114         iSurfBufferAO->Cancel();        
   113         }
   115         }
   114     if(iImageDecoder)
   116     if ( iImageDecoder )
   115         {
   117         {
   116         delete iImageDecoder;
   118         delete iImageDecoder;
   117         iImageDecoder = NULL;    
   119         iImageDecoder = NULL;    
   118         }
   120         }
   119     iSurfUpdateSession.CancelAllUpdateNotifications();
   121     iSurfUpdateSession.CancelAllUpdateNotifications();
   150     CreateHdmiL();
   152     CreateHdmiL();
   151     error = iSurfUpdateSession.Connect();
   153     error = iSurfUpdateSession.Connect();
   152 #ifdef _DEBUG
   154 #ifdef _DEBUG
   153     iStartTime.HomeTime();
   155     iStartTime.HomeTime();
   154 #endif
   156 #endif
   155     //to refresh the HD screen for the first time.
       
   156     iFirstTime = ETrue;
       
   157     //start decoding the image    
   157     //start decoding the image    
   158     iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,0,iImageDecoder);
   158     iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,0,iImageDecoder);
   159          
   159          
   160     if (KErrNone !=error)
   160     if (KErrNone !=error)
   161         {
   161         {
   170 
   170 
   171 // -----------------------------------------------------------------------------
   171 // -----------------------------------------------------------------------------
   172 // UpdateNewImageL 
   172 // UpdateNewImageL 
   173 // -----------------------------------------------------------------------------
   173 // -----------------------------------------------------------------------------
   174 void CGlxHdmiSurfaceUpdater::UpdateNewImageL(const TDesC& aImageFile, 
   174 void CGlxHdmiSurfaceUpdater::UpdateNewImageL(const TDesC& aImageFile, 
   175         TInt /*aFrameCount*/)
   175         TInt /*aFrameCount*/,TSize aImageDimensions)
   176     {
   176     {
   177     TRACER("CGlxHdmiSurfaceUpdater::UpdateNewImageL()");
   177     TRACER("CGlxHdmiSurfaceUpdater::UpdateNewImageL()");
       
   178     iOrigImageDimensions = aImageDimensions;
   178 	iBitmapReady = EFalse;
   179 	iBitmapReady = EFalse;
   179     ReleaseContent();   
   180     ReleaseContent();   
   180     CreateImageDecoderL(aImageFile);    
   181     CreateImageDecoderL(aImageFile);    
   181     CreateBitmapL();
   182     CreateBitmapL();
   182     CreateHdmiL(EFalse);
   183     CreateHdmiL(EFalse);
   194     {
   195     {
   195     TRACER("CGlxHdmiSurfaceUpdater::CreateHdmiL()");
   196     TRACER("CGlxHdmiSurfaceUpdater::CreateHdmiL()");
   196     
   197     
   197     if (aCreateSurface)
   198     if (aCreateSurface)
   198         {
   199         {
   199         TSize rectSz = iDecodedBitmap->SizeInPixels(); // For animation
   200         GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::CreateHdmiL() Create Surface");
   200         GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::CreateHdmiL() Size height = %d and width = %d", rectSz.iHeight, rectSz.iWidth);
   201         CreateSurfaceL();        
   201         CreateSurfaceL(rectSz);        
       
   202         }
   202         }
   203     
   203     
   204     // Active objects for double buffered draw signalling
   204     // Active objects for double buffered draw signalling
   205     if(!iSurfBufferAO)
   205     if(!iSurfBufferAO)
   206         {
   206         {
   207         iSurfBufferAO = new(ELeave) CGlxActiveCallBack(TCallBack(SurfBuffer0Ready, this),
   207         iSurfBufferAO = new(ELeave) CGlxActiveCallBack(TCallBack(SurfBuffer0Ready, this),
   208                     CActive::EPriorityStandard-1);
   208                     CActive::EPriorityStandard-1);
   209         CActiveScheduler::Add(iSurfBufferAO);    
   209         CActiveScheduler::Add(iSurfBufferAO);    
   210         }
   210         }
   211 
       
   212     }
   211     }
   213 
   212 
   214 // -----------------------------------------------------------------------------
   213 // -----------------------------------------------------------------------------
   215 // CreateSurfaceL 
   214 // CreateSurfaceL 
   216 // -----------------------------------------------------------------------------
   215 // -----------------------------------------------------------------------------
   217 void CGlxHdmiSurfaceUpdater::CreateSurfaceL(TSize aSize)
   216 void CGlxHdmiSurfaceUpdater::CreateSurfaceL()
   218     {
   217     {
   219     TRACER("CGlxHdmiSurfaceUpdater::CreateSurfaceL()");
   218     TRACER("CGlxHdmiSurfaceUpdater::CreateSurfaceL()");
   220        
   219     TSize surfaceSize = iWindow->Size();   // create surface of the screen size, i.e 1280x720
   221     iSurfManager = new(ELeave) RSurfaceManager();
   220     iSurfManager = new(ELeave) RSurfaceManager();
   222     TInt error = iSurfManager->Open();
   221     TInt error = iSurfManager->Open();
   223     if (error != KErrNone)
   222     if (error != KErrNone)
   224         {
   223         {
   225         GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL Open Surface manager failed with error = %d", error);
   224         GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL Open Surface manager failed with error = %d", error);
   226         User::LeaveIfError(error);
   225         User::LeaveIfError(error);
   227         }
   226         }
   228     RSurfaceManager::TSurfaceCreationAttributesBuf attributes;
   227     RSurfaceManager::TSurfaceCreationAttributesBuf attributes;
   229     attributes().iPixelFormat           = EUidPixelFormatARGB_8888;// EUidPixelFormatYUV_420Planar;
   228     attributes().iPixelFormat           = EUidPixelFormatARGB_8888;// EUidPixelFormatYUV_420Planar;
   230     attributes().iSize                  = aSize;
   229     attributes().iSize                  = surfaceSize;
   231     
   230     
   232     attributes().iBuffers               = 1;
   231     attributes().iBuffers               = 1;
   233     attributes().iStride                = aSize.iWidth * KMulFactorToCreateBitmap;  
   232     attributes().iStride                = surfaceSize.iWidth * KMulFactorToCreateBitmap;  
   234     attributes().iAlignment             = KMulFactorToCreateBitmap;
   233     attributes().iAlignment             = KMulFactorToCreateBitmap;
   235     attributes().iContiguous            = EFalse;
   234     attributes().iContiguous            = EFalse;
   236     attributes().iMappable              = ETrue;
   235     attributes().iMappable              = ETrue;
   237         
   236         
   238     error = iSurfManager->CreateSurface(attributes, iSurfId);
   237     error = iSurfManager->CreateSurface(attributes, iSurfId);
   241         GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL, Creating surface failed with error : %d",error);
   240         GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL, Creating surface failed with error : %d",error);
   242         User::LeaveIfError(error);
   241         User::LeaveIfError(error);
   243         }    
   242         }    
   244     //Map the surface and stride the surface info
   243     //Map the surface and stride the surface info
   245     MapSurfaceL();
   244     MapSurfaceL();
   246     //Set the background Surface
   245     // Set the Configuration to the surface ID when creating a surface
   247     iWindow->SetBackgroundSurface(iSurfId);
   246     iConfig.SetSurfaceId(iSurfId);
   248 
       
   249     }
   247     }
   250 
   248 
   251 // -----------------------------------------------------------------------------
   249 // -----------------------------------------------------------------------------
   252 // MapSurfaceL 
   250 // MapSurfaceL 
   253 // -----------------------------------------------------------------------------
   251 // -----------------------------------------------------------------------------
   272     User::LeaveIfError(error);  
   270     User::LeaveIfError(error);  
   273     TInt offset = 0;
   271     TInt offset = 0;
   274     iSurfManager->GetBufferOffset( iSurfId, 0,offset);
   272     iSurfManager->GetBufferOffset( iSurfId, 0,offset);
   275     iSurfBuffer = iSurfChunk->Base()+offset;
   273     iSurfBuffer = iSurfChunk->Base()+offset;
   276     }
   274     }
       
   275 
   277 // -----------------------------------------------------------------------------
   276 // -----------------------------------------------------------------------------
   278 // SurfBuffer0Ready 
   277 // SurfBuffer0Ready 
   279 // -----------------------------------------------------------------------------
   278 // -----------------------------------------------------------------------------
   280 TInt CGlxHdmiSurfaceUpdater::SurfBuffer0Ready(TAny* /*aObject*/)
   279 TInt CGlxHdmiSurfaceUpdater::SurfBuffer0Ready(TAny* /*aObject*/)
   281     {
   280     {
   287 // Refresh 
   286 // Refresh 
   288 // -----------------------------------------------------------------------------
   287 // -----------------------------------------------------------------------------
   289 void CGlxHdmiSurfaceUpdater::Refresh()
   288 void CGlxHdmiSurfaceUpdater::Refresh()
   290     {
   289     {
   291     TRACER("CGlxHdmiSurfaceUpdater::Refresh()");
   290     TRACER("CGlxHdmiSurfaceUpdater::Refresh()");
       
   291     // copy the decoded bitmap on to the surface
   292     SwapBuffers();   
   292     SwapBuffers();   
       
   293     // Modify the surface position with respect to the buffer size 
       
   294 	ModifySurfacePostion();
       
   295 	// refresh the window
   293     iCallBack->DoGenCallback();       
   296     iCallBack->DoGenCallback();       
   294     if(iFirstTime)  
       
   295         {
       
   296         iFirstTime = EFalse;
       
   297         iWindow->RemoveBackgroundSurface(ETrue);
       
   298         iWindow->SetBackgroundSurface(iSurfId);
       
   299         }
       
   300     }
   297     }
   301 
   298 
   302 // -----------------------------------------------------------------------------
   299 // -----------------------------------------------------------------------------
   303 // SwapBuffers
   300 // SwapBuffers
   304 // This is used to sawp the buffers shown and to be shown 
   301 // This is used to sawp the buffers shown and to be shown 
   342 // StartImageDecodeL 
   339 // StartImageDecodeL 
   343 // -----------------------------------------------------------------------------
   340 // -----------------------------------------------------------------------------
   344 void CGlxHdmiSurfaceUpdater::CreateBitmapL()
   341 void CGlxHdmiSurfaceUpdater::CreateBitmapL()
   345     {
   342     {
   346     TRACER("CGlxHdmiSurfaceUpdater::StartImageDecodeL()");
   343     TRACER("CGlxHdmiSurfaceUpdater::StartImageDecodeL()");
   347     TSize decodeSize;
   344     TSize scrnSize = iWindow->Size();
   348     decodeSize.iHeight = (iOrigImageDimensions.iHeight>KHdTvHeight? KHdTvHeight: 
   345     TSize targetBitmapSize;
   349                                     iOrigImageDimensions.iHeight);
   346     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::StartImageDecodeL() - bitmapsize=%d, %d",iOrigImageDimensions.iWidth,iOrigImageDimensions.iHeight);
   350     decodeSize.iWidth = (iOrigImageDimensions.iWidth>KHdTvWidth? KHdTvWidth:
   347     TReal32 scaleFactor = 0.0f;
   351                                     iOrigImageDimensions.iWidth);
   348     if (scrnSize.iWidth * iOrigImageDimensions.iHeight > scrnSize.iHeight
   352     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::StartImageDecodeL() - decodeSize width = %d and height %d",
   349             * iOrigImageDimensions.iWidth)
   353             decodeSize.iWidth, decodeSize.iHeight );
   350         {
   354     
   351         scaleFactor = (TReal32) scrnSize.iHeight
       
   352                 / (TReal32) iOrigImageDimensions.iHeight;
       
   353         }
       
   354     else
       
   355         {
       
   356         scaleFactor = (TReal32) scrnSize.iWidth
       
   357                 / (TReal32) iOrigImageDimensions.iWidth;
       
   358         }
       
   359     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::StartImageDecodeL() - scaleFactor=%f",scaleFactor);
       
   360     targetBitmapSize.iHeight = iOrigImageDimensions.iHeight * scaleFactor;
       
   361     targetBitmapSize.iWidth = iOrigImageDimensions.iWidth * scaleFactor;
       
   362 
       
   363     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::StartImageDecodeL() - targetBitmapSize=%d, %d",targetBitmapSize.iWidth,targetBitmapSize.iHeight);
   355     //create the bitmap for the required size
   364     //create the bitmap for the required size
   356     iDecodedBitmap = new(ELeave) CFbsBitmap();
   365     iDecodedBitmap = new (ELeave) CFbsBitmap();
   357     
   366 
   358     TInt err = iDecodedBitmap->Create(decodeSize,EColor16MU );
   367     TInt err = iDecodedBitmap->Create(targetBitmapSize, EColor16MU);
   359     User::LeaveIfNull(iDecodedBitmap);
   368     User::LeaveIfNull(iDecodedBitmap);
   360     }
   369     }
   361 
   370 
   362 // -----------------------------------------------------------------------------
   371 // -----------------------------------------------------------------------------
   363 // HandleRunL 
   372 // HandleRunL 
   364 // -----------------------------------------------------------------------------
   373 // -----------------------------------------------------------------------------
   365 void CGlxHdmiSurfaceUpdater::HandleRunL()
   374 void CGlxHdmiSurfaceUpdater::HandleRunL(TRequestStatus& aStatus)
   366     {
   375     {
   367     TRACER("CGlxHdmiSurfaceUpdater::HandleRunL()");
   376     TRACER("CGlxHdmiSurfaceUpdater::HandleRunL()");
   368 
   377 
   369 #ifdef _DEBUG
   378 #ifdef _DEBUG
   370     iStopTime.HomeTime();
   379     iStopTime.HomeTime();
   371     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::HandleRunL() ConvertImageL took"
   380     GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::HandleRunL() ConvertImageL took"
   372             " <%d> us", (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64());
   381             " <%d> us", (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64());
   373 #endif
   382 #endif
   374 	iBitmapReady = ETrue;
   383     if(aStatus.Int() !=KErrNone)
   375     iZoomRectSz = iDecodedBitmap->SizeInPixels(); 
   384         {
   376     if (iSurfBufferAO->iStatus != KRequestPending && !iSurfBufferAO->IsActive())
   385         GLX_LOG_INFO("HandleRunL - Convert failed");
   377         {
   386         ShiftToCloningMode();
   378         Refresh();              
   387         }
   379         iSurfBufferAO->iStatus = KRequestPending;
   388     else
   380         iSurfBufferAO->SetActive();    
   389         {
   381         iSurfUpdateSession.NotifyWhenAvailable(iSurfBufferAO->iStatus);
   390         iBitmapReady = ETrue;
   382         TInt err = iSurfUpdateSession.SubmitUpdate(1, iSurfId, 0, NULL);       
   391         iZoomRectSz = iDecodedBitmap->SizeInPixels();
       
   392         if (iSurfBufferAO->iStatus != KRequestPending
       
   393                 && !iSurfBufferAO->IsActive())
       
   394             {
       
   395             Refresh();
       
   396             iSurfBufferAO->iStatus = KRequestPending;
       
   397             iSurfBufferAO->SetActive();
       
   398             iSurfUpdateSession.NotifyWhenAvailable(iSurfBufferAO->iStatus);
       
   399             TInt err = iSurfUpdateSession.SubmitUpdate(1, iSurfId, 0, NULL);
       
   400             }
   383         }
   401         }
   384 	//release imagedecoder after the conversion is over		
   402 	//release imagedecoder after the conversion is over		
   385     if(iImageDecoder)
   403     if(iImageDecoder)
   386         {
   404         {
   387         delete iImageDecoder;
   405         delete iImageDecoder;
   401     if (error!=KErrNone)
   419     if (error!=KErrNone)
   402         {
   420         {
   403         User::Leave(error);
   421         User::Leave(error);
   404         }
   422         }
   405     }
   423     }
       
   424 
   406 // -----------------------------------------------------------------------------
   425 // -----------------------------------------------------------------------------
   407 // ActivateZoom 
   426 // ActivateZoom 
   408 // -----------------------------------------------------------------------------
   427 // -----------------------------------------------------------------------------
   409 void CGlxHdmiSurfaceUpdater::ActivateZoom()
   428 void CGlxHdmiSurfaceUpdater::ActivateZoom()
   410     {
   429     {
   411     TRACER("CGlxHdmiSurfaceUpdater::ActivateZoom()");
   430     TRACER("CGlxHdmiSurfaceUpdater::ActivateZoom()");
   412     iConfig.SetSurfaceId(iSurfId);
       
   413     iZoom = ETrue;
   431     iZoom = ETrue;
   414     if(!iTimer->IsActive() && iBitmapReady)
   432     if(!iTimer->IsActive() && iBitmapReady)
   415        {
   433        {
   416        iTimer->Start(KZoomDelay,KZoomDelay,TCallBack( TimeOut,this ));
   434        iTimer->Start(KZoomDelay,KZoomDelay,TCallBack( TimeOut,this ));
   417        }
   435        }
   418     }
   436     }
       
   437 
   419 // -----------------------------------------------------------------------------
   438 // -----------------------------------------------------------------------------
   420 // DeactivateZoom 
   439 // DeactivateZoom 
   421 // -----------------------------------------------------------------------------
   440 // -----------------------------------------------------------------------------
   422 void CGlxHdmiSurfaceUpdater::DeactivateZoom()
   441 void CGlxHdmiSurfaceUpdater::DeactivateZoom()
   423     {
   442     {
   427         TSize bitmapsize = iDecodedBitmap->SizeInPixels(); 
   446         TSize bitmapsize = iDecodedBitmap->SizeInPixels(); 
   428         iConfig.SetViewport(TRect(0,0,bitmapsize.iWidth,bitmapsize.iHeight));
   447         iConfig.SetViewport(TRect(0,0,bitmapsize.iWidth,bitmapsize.iHeight));
   429         iConfig.SetExtent(TRect(0,0,bitmapsize.iWidth,bitmapsize.iHeight));
   448         iConfig.SetExtent(TRect(0,0,bitmapsize.iWidth,bitmapsize.iHeight));
   430         iWindow->SetBackgroundSurface(iConfig, ETrue);
   449         iWindow->SetBackgroundSurface(iConfig, ETrue);
   431         }
   450         }
   432     
   451     }
   433     }
   452 
   434 // ---------------------------------------------------------------------------
   453 // ---------------------------------------------------------------------------
   435 // TimeOut
   454 // TimeOut
   436 // ---------------------------------------------------------------------------
   455 // ---------------------------------------------------------------------------
   437 //  
   456 //  
   438 TInt CGlxHdmiSurfaceUpdater::TimeOut(TAny* aSelf)
   457 TInt CGlxHdmiSurfaceUpdater::TimeOut(TAny* aSelf)
   446              self->Zoom(ETrue);
   465              self->Zoom(ETrue);
   447             }
   466             }
   448         }
   467         }
   449     return KErrNone;
   468     return KErrNone;
   450     }
   469     }
       
   470 
   451 // -----------------------------------------------------------------------------
   471 // -----------------------------------------------------------------------------
   452 // Zoom 
   472 // Zoom 
   453 // -----------------------------------------------------------------------------
   473 // -----------------------------------------------------------------------------
   454 void CGlxHdmiSurfaceUpdater::Zoom(TBool aZoom)
   474 void CGlxHdmiSurfaceUpdater::Zoom(TBool aZoom)
   455     {
   475     {
   463         iZoomRectSz.iWidth = TInt(iZoomRectSz.iWidth-KSingleStepForZoom);
   483         iZoomRectSz.iWidth = TInt(iZoomRectSz.iWidth-KSingleStepForZoom);
   464         iZoomRectSz.iHeight = TInt(iZoomRectSz.iHeight-KSingleStepForZoom);
   484         iZoomRectSz.iHeight = TInt(iZoomRectSz.iHeight-KSingleStepForZoom);
   465         iLeftCornerForZoom.iX =iLeftCornerForZoom.iX+KSingleStepForZoom/2;
   485         iLeftCornerForZoom.iX =iLeftCornerForZoom.iX+KSingleStepForZoom/2;
   466         iLeftCornerForZoom.iY =iLeftCornerForZoom.iY+KSingleStepForZoom/2;           
   486         iLeftCornerForZoom.iY =iLeftCornerForZoom.iY+KSingleStepForZoom/2;           
   467         GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::Zoom()--- 2,iZoomRectSz.iWidth = %d, iZoomRectSz.iHeight = %d", iZoomRectSz.iWidth,iZoomRectSz.iHeight);
   487         GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::Zoom()--- 2,iZoomRectSz.iWidth = %d, iZoomRectSz.iHeight = %d", iZoomRectSz.iWidth,iZoomRectSz.iHeight);
   468         iConfig.SetViewport(TRect(iLeftCornerForZoom.iX,iLeftCornerForZoom.iY,iZoomRectSz.iWidth,iZoomRectSz.iHeight));
   488         iConfig.SetViewport(TRect(iLeftCornerForZoom.iX,iLeftCornerForZoom.iY,
       
   489                 iZoomRectSz.iWidth,iZoomRectSz.iHeight));
   469         }
   490         }
   470     else
   491     else
   471         {
   492         {
   472         iZoomRectSz.iWidth = TInt(iZoomRectSz.iWidth+KSingleStepForZoom);
   493         iZoomRectSz.iWidth = TInt(iZoomRectSz.iWidth+KSingleStepForZoom);
   473         iZoomRectSz.iHeight = TInt(iZoomRectSz.iHeight+KSingleStepForZoom);
   494         iZoomRectSz.iHeight = TInt(iZoomRectSz.iHeight+KSingleStepForZoom);
   477             {
   498             {
   478             iTimer->Cancel();
   499             iTimer->Cancel();
   479             iZoom = ETrue;
   500             iZoom = ETrue;
   480             }
   501             }
   481         GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::Zoom()--- 4,iZoomRectSz.iWidth = %d, iZoomRectSz.iHeight = %d", iZoomRectSz.iWidth,iZoomRectSz.iHeight);
   502         GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::Zoom()--- 4,iZoomRectSz.iWidth = %d, iZoomRectSz.iHeight = %d", iZoomRectSz.iWidth,iZoomRectSz.iHeight);
   482         iConfig.SetViewport(TRect(iLeftCornerForZoom.iX,iLeftCornerForZoom.iY,iZoomRectSz.iWidth,iZoomRectSz.iHeight));
   503         iConfig.SetViewport(TRect(iLeftCornerForZoom.iX,iLeftCornerForZoom.iY,
   483         }
   504                 iZoomRectSz.iWidth,iZoomRectSz.iHeight));
   484     iConfig.SetExtent(TRect(0,0,KHdTvWidth,KHdTvHeight));    
   505         }
       
   506     iWindow->SetBackgroundSurface(iConfig, ETrue);   
       
   507     }
       
   508 
       
   509 // -----------------------------------------------------------------------------
       
   510 // ModifySurfacePostion 
       
   511 // -----------------------------------------------------------------------------
       
   512 void CGlxHdmiSurfaceUpdater::ModifySurfacePostion()
       
   513 	{
       
   514 	TRACER("CGlxHdmiSurfaceUpdater::ModifySurfacePostion()");
       
   515 	TSize bitmapSize = iDecodedBitmap->SizeInPixels();
       
   516 	TPoint startPoint(0,0);
       
   517 	if (bitmapSize.iWidth <KHdTvWidth)
       
   518 	    {
       
   519 	    startPoint.iX = (KHdTvWidth - bitmapSize.iWidth)/2; 
       
   520 	    }
       
   521 	if (bitmapSize.iHeight <KHdTvHeight)
       
   522 	    {
       
   523 	    startPoint.iY = (KHdTvHeight - bitmapSize.iHeight)/2;
       
   524 	    }
       
   525     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ModifySurfacePostion() - target bitmapsize=%d, %d",bitmapSize.iWidth,bitmapSize.iHeight);
       
   526     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ModifySurfacePostion() - startPoint =%d, %d",startPoint.iX,startPoint.iY);
       
   527 
       
   528     // target
       
   529     iConfig.SetExtent(TRect(startPoint.iX,startPoint.iY,(KHdTvWidth-startPoint.iX),
       
   530             (KHdTvHeight-startPoint.iY)));
       
   531     // source
       
   532     iConfig.SetViewport(TRect(TPoint(0,0),TSize(bitmapSize.iWidth,bitmapSize.iHeight)));
       
   533 #ifdef _DEBUG
       
   534     TRect ex, vp;
       
   535     iConfig.GetExtent(ex);
       
   536     iConfig.GetViewport(vp);
       
   537     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ModifySurfacePostion() - vp - TL=%d, %d",vp.iTl.iX,vp.iTl.iY);
       
   538     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ModifySurfacePostion() - vp - BR=%d, %d",vp.iBr.iX,vp.iBr.iY);
       
   539     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ModifySurfacePostion() - ex - TL=%d, %d",ex.iTl.iX,ex.iTl.iY);
       
   540     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ModifySurfacePostion() - ex - BR=%d, %d",ex.iBr.iX,ex.iBr.iY);
       
   541 #endif
   485     iWindow->SetBackgroundSurface(iConfig, ETrue);   
   542     iWindow->SetBackgroundSurface(iConfig, ETrue);   
   486     }
   543     }
   487 
   544 
   488 // -----------------------------------------------------------------------------
   545 // -----------------------------------------------------------------------------
   489 // ShiftToCloningMode 
   546 // ShiftToCloningMode 
   498 // ShiftToPostingMode 
   555 // ShiftToPostingMode 
   499 // -----------------------------------------------------------------------------
   556 // -----------------------------------------------------------------------------
   500 void CGlxHdmiSurfaceUpdater::ShiftToPostingMode()
   557 void CGlxHdmiSurfaceUpdater::ShiftToPostingMode()
   501 	{
   558 	{
   502 	TRACER("CGlxHdmiSurfaceUpdater::ShiftToPostingMode()");
   559 	TRACER("CGlxHdmiSurfaceUpdater::ShiftToPostingMode()");
   503 	iWindow->SetBackgroundSurface(iSurfId);
   560 #ifdef _DEBUG
       
   561 	TRect ex, vp;
       
   562 	iConfig.GetExtent(ex);
       
   563     iConfig.GetViewport(vp);
       
   564     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - vp - TL=%d, %d",vp.iTl.iX,vp.iTl.iY);
       
   565     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - vp - BR=%d, %d",vp.iBr.iX,vp.iBr.iY);
       
   566     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - ex - TL=%d, %d",ex.iTl.iX,ex.iTl.iY);
       
   567     GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() - ex - BR=%d, %d",ex.iBr.iX,ex.iBr.iY);
       
   568 #endif
       
   569     iWindow->SetBackgroundSurface(iConfig, ETrue);
   504 	}
   570 	}