photosgallery/viewframework/views/zoomview/src/glxzoomcontrol.cpp
branchRCL_3
changeset 75 01504893d9cb
parent 60 5b3385a43d68
equal deleted inserted replaced
68:5b238bc8ffb6 75:01504893d9cb
   488         iEventHandler->CancelUITimer();
   488         iEventHandler->CancelUITimer();
   489         iEventHandler->CancelAnimationTimer();
   489         iEventHandler->CancelAnimationTimer();
   490         }
   490         }
   491     else
   491     else
   492         {
   492         {
       
   493         TInt focus = iMediaList.FocusIndex();
       
   494         const TGlxMedia item = iMediaList.Item(focus);
       
   495         TGlxIdSpaceId spaceId = iMediaList.IdSpaceId(focus);
       
   496         GLX_LOG_INFO("CGlxZoomControl::HandleZoomForegroundEvent - Get the FS texture");
       
   497         // Get the texture created in fullscreen view.
       
   498         TRAPD(err, iImageTexture = &(iTextureMgr->CreateNewTextureForMediaL(
       
   499                                 ScreenSize(), item, spaceId, this)));
       
   500 
       
   501         if (iImageTexture && iImageTexture->HasContent() && KErrNone == err)
       
   502             {
       
   503             GLX_LOG_INFO("CGlxZoomControl::HandleZoomForegroundEvent - Show the FS texture");
       
   504             iImageVisual->SetImage(*iImageTexture);
       
   505             }
   493         iGPUMemMonitor->RequestMemory();
   506         iGPUMemMonitor->RequestMemory();
   494         }
   507         }
   495     } 
   508     } 
   496 
   509 
   497 // -----------------------------------------------------------------------------
   510 // -----------------------------------------------------------------------------
   550 
   563 
   551 // -----------------------------------------------------------------------------
   564 // -----------------------------------------------------------------------------
   552 // TextureContentChangedL
   565 // TextureContentChangedL
   553 // -----------------------------------------------------------------------------
   566 // -----------------------------------------------------------------------------
   554 //
   567 //
   555 void CGlxZoomControl::TextureContentChangedL( TBool /*aHasContent*/ , CAlfTexture* aNewTexture)
   568 void CGlxZoomControl::TextureContentChangedL(TBool aHasContent,
       
   569         CAlfTexture* aNewTexture)
   556     {
   570     {
   557     TRACER("CGlxZoomControl::TextureContentChangedL ");
   571     TRACER("CGlxZoomControl::TextureContentChangedL ");
       
   572     GLX_LOG_INFO2("CGlxZoomControl::TextureContentChangedL() aNewTexture=%x, aHasContent=%d", aNewTexture, aHasContent);
   558     //if both the textures are null that means we do not have memory to 
   573     //if both the textures are null that means we do not have memory to 
   559     //decode and show anything. So try and check if the fullscreen texture 
   574     //decode and show anything. So try and check if the fullscreen texture 
   560     //is created by now if not then go to fullscreen view.
   575     //is created by now if not then go to fullscreen view.
   561 
   576 
   562     if(NULL == aNewTexture )
   577     if(NULL == aNewTexture )
   563         {
   578         {
   564         if(NULL == iImageTexture)
   579         if(NULL == iImageTexture)
   565             {
   580             {
   566             TSize TextureSize = ScreenSize();
   581             TSize textureSize = ScreenSize();
   567             TInt focus = iMediaList.FocusIndex();
   582             TInt focus = iMediaList.FocusIndex();
   568             TGlxMedia item = iMediaList.Item( focus );
   583             TGlxMedia item = iMediaList.Item( focus );
   569             TGlxIdSpaceId idspace = iMediaList.IdSpaceId( focus );
   584             TGlxIdSpaceId idspace = iMediaList.IdSpaceId( focus );
   570     
   585     
   571             CAlfTexture* newTexture = NULL;
   586             CAlfTexture* newTexture = NULL;
   572             //Get the texture Created in fullscreen View.
   587             // Get the texture created in fullscreen view.
   573             TRAPD(errtexture, newTexture = &(iTextureMgr->CreateNewTextureForMediaL(
   588             TRAPD(err, newTexture = &(iTextureMgr->CreateNewTextureForMediaL(
   574                             TextureSize,item, idspace, this )));
   589                             textureSize,item, idspace, this)));
   575             
   590             
   576             if(errtexture != KErrNone)
   591             GLX_LOG_INFO2("CGlxZoomControl::TextureContentChangedL(1) newTexture=%x, err=%d", newTexture, err);
       
   592             if(newTexture && newTexture->HasContent() && err == KErrNone)
   577                 {
   593                 {
   578                 GLX_LOG_INFO( "CGlxTextureManagerImpl::HandleBitmapDecodedL::CreateNewTextureForMediaL Failed");
   594                 GLX_LOG_INFO("CGlxZoomControl::TextureContentChangedL:Show FS texture");
   579                 //Exit zoom and goto fullscreen
   595                 // Show the fullscreen texture.
   580                 HandleZoomOutL(KGlxZoomOutCommand);
   596                 iImageTexture = newTexture;
       
   597                 iImageVisual->SetImage(*iImageTexture);
   581                 }
   598                 }
   582             else
   599             else
   583                 {
   600                 {
   584                 //show the fullscreen texture.
   601                 GLX_LOG_INFO("CGlxZoomControl::TextureContentChangedL:CreateNewTextureForMediaL Failed");
   585                 iImageTexture = newTexture;
   602                 // Exit zoom and goto fullscreen
   586                 iImageVisual->SetImage( *iImageTexture );   
   603                 HandleZoomOutL(KGlxZoomOutCommand);
   587                 }           
   604                 }           
   588             }
   605             }
   589          else
   606          else if (iImageTexture->HasContent())
   590             {
   607             {
   591             //show the existing first level decoded image texture in case second level
   608             // Show the existing decoded image texture
   592             //decoding fails
   609             GLX_LOG_INFO("CGlxZoomControl::TextureContentChangedL - Show the existing texture");
   593             iImageVisual->SetImage( *iImageTexture );   
   610             iImageVisual->SetImage(*iImageTexture);
   594             }                   
   611             }                   
   595         }
   612         }
   596     else
   613     else if (aHasContent && aNewTexture->HasContent())
   597         {
   614         {
       
   615         GLX_LOG_INFO("CGlxZoomControl::TextureContentChangedL - Show the NEW texture");
   598         iImageTexture = aNewTexture;
   616         iImageTexture = aNewTexture;
   599         iImageVisual->SetImage( *iImageTexture );        
   617         iImageVisual->SetImage(*iImageTexture);
   600         }
   618         }
   601     }
   619     }
   602 
   620 
   603 // -----------------------------------------------------------------------------
   621 // -----------------------------------------------------------------------------
   604 //  VisualLayoutUpdated:updates the co-ordinates when phone is tilted
   622 //  VisualLayoutUpdated:updates the co-ordinates when phone is tilted
   958     TRACER("CGlxZoomControl::HandleGoomMemoryReleased");
   976     TRACER("CGlxZoomControl::HandleGoomMemoryReleased");
   959     if (aStatus == KErrNone)
   977     if (aStatus == KErrNone)
   960         {
   978         {
   961         //Refeed the textures if we are coming back to foreground from background
   979         //Refeed the textures if we are coming back to foreground from background
   962         //To Retrive the image details
   980         //To Retrive the image details
   963         TMPXAttribute thumbNailAttribute(0, 0);
       
   964         TInt focusIndex = iMediaList.FocusIndex();
   981         TInt focusIndex = iMediaList.FocusIndex();
   965         TGlxIdSpaceId idspace = iMediaList.IdSpaceId(focusIndex);
   982         TGlxIdSpaceId idspace = iMediaList.IdSpaceId(focusIndex);
   966         //Get the texture Created in fullscreen View.
   983         //Get the texture Created in fullscreen View.
   967         TGlxMedia item = iMediaList.Item(focusIndex);
   984         TGlxMedia item = iMediaList.Item(focusIndex);
   968 
   985 
   969         // if we already have the decoded zoomed image bitmap use the texture corresponding to that.
   986         // if we already have the decoded zoomed image bitmap use the texture corresponding to that.
   970         // Else make do with the fullscreen texture till that happens.  
   987         // Else make do with the fullscreen texture till that happens.  
   971         TRAP_IGNORE(iImageTexture =
   988         TRAPD(err, iImageTexture = iTextureMgr->CreateZoomedTextureL());
   972                 iTextureMgr->CreateZoomedTextureL());
   989 
   973 
   990         GLX_LOG_INFO2("CGlxZoomControl::HandleGoomMemoryReleased(1) iImageTexture=%x err=%d", iImageTexture, err);
   974         if (NULL == iImageTexture)
   991         if (!iImageTexture || KErrNone != err)
   975             {
   992             {
   976             TRAP_IGNORE(iImageTexture = &(iTextureMgr->CreateNewTextureForMediaL(
   993             TRAP(err, iImageTexture = &(iTextureMgr->CreateNewTextureForMediaL(
   977                                     ScreenSize(), item, idspace, this)))
   994                                     ScreenSize(), item, idspace, this)))
   978             }
   995             }
   979 
   996 
   980         if (NULL != iImageTexture)
   997         GLX_LOG_INFO2("CGlxZoomControl::HandleGoomMemoryReleased(2) iImageTexture=%x err=%d", iImageTexture, err);
       
   998         if (iImageTexture && iImageTexture->HasContent() && KErrNone == err)
   981             {
   999             {
   982             iImageVisual->SetImage(*iImageTexture);
  1000             iImageVisual->SetImage(*iImageTexture);
   983             return;
  1001             return;
   984             }
  1002             }
   985         }
  1003         }