# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1286973255 -10800 # Node ID e1987ab3768a76f3782b42bd8e0fabca26be313a # Parent eaa079afe64c2c59916826d2ceb01742e088b54b Revision: 201039 Kit: 201041 diff -r eaa079afe64c -r e1987ab3768a rom/alfred.iby --- a/rom/alfred.iby Wed Sep 15 13:12:27 2010 +0300 +++ b/rom/alfred.iby Wed Oct 13 15:34:15 2010 +0300 @@ -128,7 +128,6 @@ data=DATAZ_/RESOURCE_FILES_DIR/effects/informationnote_disappear.fxml RESOURCE_FILES_DIR/effects/informationnote_disappear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/layoutswitch_appear.fxml RESOURCE_FILES_DIR/effects/layoutswitch_appear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/layoutswitch_disappear.fxml RESOURCE_FILES_DIR/effects/layoutswitch_disappear.fxml -data=DATAZ_/RESOURCE_FILES_DIR/effects/longappstart_img.mbm RESOURCE_FILES_DIR/effects/longappstart_img.mbm data=DATAZ_/RESOURCE_FILES_DIR/effects/musicplayer_popup_appear.fxml RESOURCE_FILES_DIR/effects/musicplayer_popup_appear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/musicplayer_popup_disappear.fxml RESOURCE_FILES_DIR/effects/musicplayer_popup_disappear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/musicplayer_viewswitch_in.fxml RESOURCE_FILES_DIR/effects/musicplayer_viewswitch_in.fxml diff -r eaa079afe64c -r e1987ab3768a uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h --- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h Wed Oct 13 15:34:15 2010 +0300 @@ -210,6 +210,8 @@ TInt GetLastActiveClient(); RAlfBridgerClient* BridgerClient(); + void ReleaseOptionalGpuMemory(); + private: void CreateHuiEnvL(); diff -r eaa079afe64c -r e1987ab3768a uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h Wed Oct 13 15:34:15 2010 +0300 @@ -433,10 +433,10 @@ IMPORT_C void StoreRenderBufferL(); void DrawStoredVisualRenderBuffer(TInt aCanvasDrawMode) const; void DrawStoredFullScreenRenderBuffer(TInt aCanvasDrawMode, CHuiGc& aGc) const; - void DrawExternalImage(CHuiGc& aGc) const; IMPORT_C void FreeRenderBuffer(); IMPORT_C TRect CommandBufferCoverage(TInt aOrientation); - + TBool KeepCache() const; + protected: virtual void VisualExtension(const TUid& aExtensionUid, TAny** aExtensionParams); @@ -456,7 +456,6 @@ TBool CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const; TBool CanSkipDrawing() const; - TBool KeepNoCache() const; TBool EffectReadyToDrawNextFrame() const; private: diff -r eaa079afe64c -r e1987ab3768a uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/huigifanimationtexture.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/huigifanimationtexture.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/huigifanimationtexture.h Wed Oct 13 15:34:15 2010 +0300 @@ -49,7 +49,6 @@ IMPORT_C void Start(); IMPORT_C void Stop(); IMPORT_C void EnableAnimation(TBool aEnable); - IMPORT_C void DeleteAnimatedTexture(); protected: CHuiGifAnimationTexture(CHuiTextureManager& aManager,THuiTextureUploadFlags aFlags, TInt aId); void ConstructL(const TDesC& aFilename); diff -r eaa079afe64c -r e1987ab3768a uiaccelerator_plat/alf_extension_api/inc/alf/alfconstants.h --- a/uiaccelerator_plat/alf_extension_api/inc/alf/alfconstants.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiaccelerator_plat/alf_extension_api/inc/alf/alfconstants.h Wed Oct 13 15:34:15 2010 +0300 @@ -360,7 +360,6 @@ EAlfTextureNotifySkinChanged, EAlfTextureUpdateOwnerId, EAlfTextureSetAutoSizeParams, - EAlfTextureCleanAnimation, // Display subsession functions EAlfDisplaySetClearBackground =2200, diff -r eaa079afe64c -r e1987ab3768a uiaccelerator_plat/alf_visual_api/inc/alf/alftexture.h --- a/uiaccelerator_plat/alf_visual_api/inc/alf/alftexture.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiaccelerator_plat/alf_visual_api/inc/alf/alftexture.h Wed Oct 13 15:34:15 2010 +0300 @@ -343,12 +343,6 @@ */ IMPORT_C TInt RefCountingAction() const; - /** - * Cleans the content for the animated texture when unloading has happened - * @return - */ - void ClearAnimatedContent(); - /** @endAPI */ enum TAlfTextureReleaseFlags diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/Client/eabi/alfclientu.DEF --- a/uiacceltk/hitchcock/Client/eabi/alfclientu.DEF Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/Client/eabi/alfclientu.DEF Wed Oct 13 15:34:15 2010 +0300 @@ -1347,4 +1347,3 @@ _ZN10CAlfDrawer26FallbackCopyScreenToBitmapER15CWsScreenDeviceP10CFbsBitmapRK5TRect @ 1346 NONAME _ZN17AlfDrawerInternal18CopyScreenToBitmapEP25MAlfDrawerScreenInterfaceP10CFbsBitmapRK5TRect @ 1347 NONAME - diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/Client/inc/alfclient.h --- a/uiacceltk/hitchcock/Client/inc/alfclient.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/Client/inc/alfclient.h Wed Oct 13 15:34:15 2010 +0300 @@ -281,13 +281,6 @@ * @param aParams auto size paramters. */ TInt TextureSetAutoSizeParams( TInt aId, TInt aManagerId, const TAlfTextureAutoSizeParams& aParams ); - - /** - * Cleans the animated texture content - * - * @param aId ID of the texture. - */ - TInt ClearTextureAnimation( TInt aId ); // Misc diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/Client/src/alfclient.cpp --- a/uiacceltk/hitchcock/Client/src/alfclient.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/Client/src/alfclient.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -1114,10 +1114,5 @@ } } -TInt RAlfClient::ClearTextureAnimation( TInt aId ) - { - TPckg idPckg(aId); - return SendReceive(EAlfTextureCleanAnimation, TIpcArgs(aId) ); - } // end of file diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/Client/src/alftexture.cpp --- a/uiacceltk/hitchcock/Client/src/alftexture.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/Client/src/alftexture.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -485,11 +485,4 @@ return manager; } -void CAlfTexture::ClearAnimatedContent() - { - if (iData->iAnimated) - { - iData->iEnv->Client().ClearTextureAnimation( iData->iId ); - } - } diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/Client/src/alftexturemanager.cpp --- a/uiacceltk/hitchcock/Client/src/alftexturemanager.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/Client/src/alftexturemanager.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -778,7 +778,6 @@ else { entry.iTexture->StopAnimation(); - entry.iTexture->ClearAnimatedContent(); } TInt releaseFlags = entry.iTexture->ReleaseFlags(); @@ -805,9 +804,7 @@ } else { - entry.iTexture->StopAnimation(); - - entry.iTexture->ClearAnimatedContent(); + entry.iTexture->StopAnimation(); } TInt releaseFlags = entry.iTexture->ReleaseFlags(); diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/ServerCore/Inc/alfappsrvsession.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfappsrvsession.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfappsrvsession.h Wed Oct 13 15:34:15 2010 +0300 @@ -32,6 +32,7 @@ class CAlfSrvEffectEnv; class THuiTexturePreferredProperties; class CAlfSrvTextureManager; +class MHuiBitmapProvider; /** * Session/service class in the server side. @@ -210,7 +211,7 @@ void DoFocusLostEffect(TInt aEffect, CHuiVisual& aRootVisual ); void DoFocusGainedEffect(TInt aEffect, CHuiVisual& aRootVisual ); - void TextureCleanAnimation(const RMessage2& aMessage); + /** * Checks that texture owner id has been updated. * @param aMessage message. @@ -369,7 +370,17 @@ void EnvForceSwRendering(const RMessage2& aMessage); void EnvGetSizeAndRotation(const RMessage2& aMessage); void EnvReadPixels(const RMessage2& aMessage); - + + /** + * Check if GPU memory should be released before upload. + */ + TBool ShouldReleaseGpuMemoryL(MHuiBitmapProvider& aProvider, TInt aId); + + /** + * Release optional GPU memory (mainly caches). + */ + void ReleaseOptionalGpuMemory(); + private: // Owned items which need to be deleted with the session is terminated. diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h Wed Oct 13 15:34:15 2010 +0300 @@ -248,6 +248,11 @@ void OnLowMemoryModifyAllEffects(); /** + * Releases optional GPU memory. + */ + void ReleaseOptionalGpuMemory(); + + /** * Gets size & rotation. * @param aSize size. * @param aRotation rotation. diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -66,6 +66,13 @@ const TReal32 KAlfUseDefaultFrameRate = 0.f; +/** + * If estimated memory consumption is larger than this constant, + * then ALF will do additional steps to ensure that texture loading succeeds. + * However, client is still responsible of requesting sufficient memory from GOOM. + */ +const TInt KAlfReleaseMemoryThresholdInBytes = 3000000; + TBool RealCompare( TReal32 aCompare1, TReal32 aCompare2, @@ -746,14 +753,6 @@ } break; } - case EAlfTextureCleanAnimation: - { - if ( RequireTextureOwnerId( aMessage ) ) - { - TextureCleanAnimation(aMessage); - } - break; - } case EAlfTextureStartAnimation: { if ( RequireTextureOwnerId( aMessage ) ) @@ -1547,6 +1546,14 @@ TBool textureAlreadyExists = (env->TextureManager().Texture(id) != &env->TextureManager().BlankTexture()); + // If we cannot load alf client texture, then it's quite hard to recover from that situation. + // If texture is sufficiently large, we will release optional GPU RAM automatically. + // Still, client should beforehand use GOOM to make sure there is enough memory. + if ( ShouldReleaseGpuMemoryL( *provider, id ) ) + { + ReleaseOptionalGpuMemory(); + } + CHuiTexture& texture = env->TextureManager().CreateTextureL(id, provider, (THuiTextureUploadFlags)inputFlags); @@ -2912,19 +2919,64 @@ aMessage.Complete( err ); } -void CAlfAppSrvSession::TextureCleanAnimation(const RMessage2& aMessage) +// --------------------------------------------------------------------------- +// ShouldReleaseGpuMemoryL +// --------------------------------------------------------------------------- +// +TBool CAlfAppSrvSession::ShouldReleaseGpuMemoryL(MHuiBitmapProvider& aProvider, TInt aId) { - TInt id = aMessage.Int0(); - CHuiGifAnimationTexture* tex = NULL; - for (TInt index = 0; index < iAnimatedTextures.Count(); index++) + // Estimate GPU RAM requirement. If higher than threshold, memory should be released. + CFbsBitmap* bitmap = NULL; + CFbsBitmap* mask = NULL; + + // ProvideBitmapL will handle bitmap & mask clean up (if it leaves). + aProvider.ProvideBitmapL(aId, bitmap, mask); + + // Calculate estimated memory consumption. + TInt estimatedMemoryConsumption = 0; + + if ( bitmap ) { - tex = iAnimatedTextures.operator[](index); - if (tex->Id() == id) + TSize bitmapSize = bitmap->SizeInPixels(); + + if ( mask ) + { + estimatedMemoryConsumption += bitmapSize.iWidth * bitmapSize.iHeight * 4; + } + else { - tex->DeleteAnimatedTexture(); - break; + switch ( bitmap->DisplayMode() ) + { + case EGray256: + estimatedMemoryConsumption += bitmapSize.iWidth * bitmapSize.iHeight; + break; + + case EColor64K: + estimatedMemoryConsumption += bitmapSize.iWidth * bitmapSize.iHeight * 2; + break; + + default: + estimatedMemoryConsumption += bitmapSize.iWidth * bitmapSize.iHeight * 4; + break; + } } } - aMessage.Complete( KErrNone ); + + // Delete bitmap & mask. + delete bitmap; + delete mask; + + return estimatedMemoryConsumption >= KAlfReleaseMemoryThresholdInBytes; } + +// --------------------------------------------------------------------------- +// ReleaseOptionalGpuMemory +// --------------------------------------------------------------------------- +// +void CAlfAppSrvSession::ReleaseOptionalGpuMemory() + { + // Release optional GPU memory (mainly caches). + AlfAppUi()->ReleaseOptionalGpuMemory(); + } + // End of file diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -1416,4 +1416,9 @@ return 0; } +void CAlfAppUi::ReleaseOptionalGpuMemory() + { + iData->iBridgeObj->ReleaseOptionalGpuMemory(); + } + // end of file diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -7077,6 +7077,16 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // +void CAlfBridge::ReleaseOptionalGpuMemory() + { + __ALFLOGSTRING("CAlfBridge::ReleaseOptionalGpuMemory"); + iHuiEnv->HandleOutOfTextureMemory(); + __ALFLOGSTRING("CAlfBridge::ReleaseOptionalGpuMemory done"); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// TInt CAlfBridge::GetSizeAndRotation(TSize& aSize, TInt& aRotation) { if ( !iAlfScreens.Count() ) diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -394,60 +394,61 @@ // --------------------------------------------------------------------------- // +// --------------------------------------------------------------------------- +// CAlfNode::TraverseNodeTree +// Traverse through node tree and fill node array +// --------------------------------------------------------------------------- +// + void CAlfNode::TraverseNodeTree( CAlfNode* node, RPointerArray& nodes, TBool aTraverseOnlySiblings, TBool aAddMe) { // Exit if we've already finished walking the tree. if ( node == NULL) { - __ALFLOGSTRING("TraverseNodeTree returning - NULL"); + __ALFLOGSTRING(" returning NULL"); return; } - - while ( node ) + if (!aTraverseOnlySiblings) { - if (!aTraverseOnlySiblings) - { - if ( node->iSpriteChild ) - { - CAlfNode* spritenode = node->iSpriteChild ; - while ( spritenode ) - { - nodes.Append( spritenode ); - spritenode = spritenode->iSibling; - } - } - - if( node->iTextCursor ) - { - nodes.Append(node->iTextCursor ); - } - - if( node->iAnimChild ) + if ( node->iSpriteChild ) + { + CAlfNode* spritenode = node->iSpriteChild ; + while ( spritenode ) { - CAlfNode* animnode = node->iAnimChild ; - while ( animnode ) - { - nodes.Append( animnode ); - animnode = animnode->iSibling; - } - } - - if ( node->iChild) - { - TraverseNodeTree(node->iChild , nodes, EFalse, ETrue); + nodes.Append( spritenode ); + spritenode = spritenode->iSibling; } - } - - if (aAddMe) + } + + if( node->iTextCursor ) { - nodes.Append( node ); + nodes.Append(node->iTextCursor ); + } + + if( node->iAnimChild ) + { + CAlfNode* animnode = node->iAnimChild ; + while ( animnode ) + { + nodes.Append( animnode ); + animnode = animnode->iSibling; + } } + + if ( node->iChild) + { + TraverseNodeTree(node->iChild , nodes, EFalse, ETrue); + } + } - // Without recursion, continue with the following: - // TraverseNodeTree(node->iSibling, nodes, ETrue, ETrue); - node = node->iSibling; - aTraverseOnlySiblings = ETrue; - aAddMe = ETrue; + if (aAddMe) + { + nodes.Append( node ); + } + + if ( node->iSibling ) + { + TraverseNodeTree(node->iSibling, nodes, ETrue, ETrue); } } diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF --- a/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF Wed Oct 13 15:34:15 2010 +0300 @@ -1609,5 +1609,4 @@ ?ReleaseAllCachedRenderTargets@CHuiFxGroupLayer@@UAEXAAVCHuiFxEngine@@@Z @ 1608 NONAME ; void CHuiFxGroupLayer::ReleaseAllCachedRenderTargets(class CHuiFxEngine &) ?ReleaseAllCachedRenderTargets@CHuiFxFilterLayer@@UAEXAAVCHuiFxEngine@@@Z @ 1609 NONAME ; void CHuiFxFilterLayer::ReleaseAllCachedRenderTargets(class CHuiFxEngine &) ?ReleaseAllCachedRenderTargets@CHuiFxLayer@@UAEXAAVCHuiFxEngine@@@Z @ 1610 NONAME ; void CHuiFxLayer::ReleaseAllCachedRenderTargets(class CHuiFxEngine &) - ?DeleteAnimatedTexture@CHuiGifAnimationTexture@@QAEXXZ @ 1611 NONAME ; void CHuiGifAnimationTexture::DeleteAnimatedTexture(void) diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF --- a/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF Wed Oct 13 15:34:15 2010 +0300 @@ -2010,5 +2010,4 @@ _ZN16CHuiFxGroupLayer29ReleaseAllCachedRenderTargetsER12CHuiFxEngine @ 2009 NONAME _ZN17CHuiFxFilterLayer29ReleaseAllCachedRenderTargetsER12CHuiFxEngine @ 2010 NONAME _ZN17CHuiFxVisualLayer29ReleaseAllCachedRenderTargetsER12CHuiFxEngine @ 2011 NONAME - _ZN23CHuiGifAnimationTexture21DeleteAnimatedTextureEv @ 2012 NONAME diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/group/huitk_base.mmp --- a/uiacceltk/hitchcock/coretoolkit/group/huitk_base.mmp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/group/huitk_base.mmp Wed Oct 13 15:34:15 2010 +0300 @@ -205,7 +205,7 @@ LIBRARY fbscli.lib LIBRARY gdi.lib LIBRARY bitgdi.lib -LIBRARY libGLES_CM.lib +LIBRARY libEGL.lib LIBRARY imageconversion.lib LIBRARY charconv.lib LIBRARY hal.lib diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/inc/HuiCmdBufferBrush.h --- a/uiacceltk/hitchcock/coretoolkit/inc/HuiCmdBufferBrush.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiCmdBufferBrush.h Wed Oct 13 15:34:15 2010 +0300 @@ -89,10 +89,8 @@ void EffectDrawSelf( CHuiGc &aGc, const TRect & aDisplayRect) const; THuiRealRect EffectDisplayRect() const __SOFTFP; void SetLoadingEffect(TBool aLoading); - void EffectSetSource( THuiFxVisualSrcType aSource ); - THuiFxVisualSrcType EffectGetSource() const; - void SetExternalTexture(CHuiTexture* aTexture); - CHuiTexture* ExternalTexture(); + void EffectSetSource( TBool aIsInput1 ); + TBool EffectGetSource() const; TBool EffectReadyToDrawNextFrame() const; public: // from MHuiCmdBufDestroyObserver diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/inc/HuiFxEngine.h --- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEngine.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEngine.h Wed Oct 13 15:34:15 2010 +0300 @@ -149,7 +149,8 @@ TBool HasActiveEffects() const; TBool HasActiveFadeEffect() const; - void ClearCache(); + void ClearCache(TBool aOnlyCache = EFalse); + void HandleOutOfGpuMemory(); void NotifyEffectEndObservers(); diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/inc/HuiFxVisualLayer.h --- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxVisualLayer.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxVisualLayer.h Wed Oct 13 15:34:15 2010 +0300 @@ -65,8 +65,7 @@ private: void ApplyTransformations(CHuiGc& aGc); - void ReleaseExtTexture(); - + //CHuiVisual* iVisual; MHuiEffectable * iVisual; CHuiFxParameterManager* iParameterManager; @@ -98,7 +97,6 @@ TReal32 iSkewOriginY; TReal32 iSkewOriginZ; - CHuiTexture* iExtTexture; // This is only set for cloned object HBufC* iExtBitmapFile; TReal32 iOpacity; TBool iOpaqueHint; diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h --- a/uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h Wed Oct 13 15:34:15 2010 +0300 @@ -330,11 +330,8 @@ void EffectDrawSelf( CHuiGc &aGc, const TRect & aDisplayRect) const; THuiRealRect EffectDisplayRect() const __SOFTFP; void SetLoadingEffect(TBool aLoading); - void EffectSetSource( THuiFxVisualSrcType aSource ); - THuiFxVisualSrcType EffectGetSource() const; - void SetExternalTexture(CHuiTexture* aTexture); - CHuiTexture* ExternalTexture(); - + void EffectSetSource( TBool aIsInput1 ); + TBool EffectGetSource() const; TBool EffectReadyToDrawNextFrame() const; // From MHuiMemoryLevelObserver @@ -513,7 +510,7 @@ /** Effect */ CHuiFxEffect* iEffect; TReal32 iEffectOpacity; - THuiFxVisualSrcType iEffectSourceType; + TBool iIsInput1; /** Render buffer */ CHuiCanvasGc* iCanvasGc; diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/inc/huicanvaswshwgc.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswshwgc.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswshwgc.h Wed Oct 13 15:34:15 2010 +0300 @@ -207,6 +207,11 @@ */ void UseWsState(); + /** + * Returns true if canvas texture cache should be updated. + */ + TBool IsCacheUpdateNeeded() const; + private: /** diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/inc/huieffectable.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huieffectable.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huieffectable.h Wed Oct 13 15:34:15 2010 +0300 @@ -20,13 +20,9 @@ #ifndef HUIEFFECTABLE_H_ #define HUIEFFECTABLE_H_ -#include "HuiFxConstants.h" - class THuiRealRect; class CHuiFxEffect; class CHuiGc; -class CFbsBitmap; -class CHuiTexture; class MHuiEffectable { @@ -41,10 +37,8 @@ virtual void EffectDrawSelf( CHuiGc &aGc, const TRect & aDisplayRect) const=0; virtual THuiRealRect EffectDisplayRect() const __SOFTFP=0; virtual void SetLoadingEffect(TBool aLoading)=0; - virtual void EffectSetSource( THuiFxVisualSrcType aSource )=0; - virtual THuiFxVisualSrcType EffectGetSource() const=0; - virtual void SetExternalTexture(CHuiTexture* aTexture)=0; - virtual CHuiTexture* ExternalTexture()=0; + virtual void EffectSetSource( TBool aIsInput1 )=0; + virtual TBool EffectGetSource() const=0; virtual TBool EffectReadyToDrawNextFrame() const = 0; }; diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Texture.h --- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Texture.h Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Texture.h Wed Oct 13 15:34:15 2010 +0300 @@ -242,7 +242,14 @@ * Partial bitmap upload. */ void PartialBitmapUpload(THuiTexturePartialBitmapUploadParams* aParams); - + + /** + * Returns ETrue if texture is large. + */ + TBool IsLargeTexture(const TSize& aSize, VGImageFormat aFormat) const; + +private: + /** The render plugin that created this texture. */ CHuiVg10RenderPlugin& iRenderPlugin; diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp --- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -327,6 +327,7 @@ VGbitfield qualityFlags = VG_IMAGE_QUALITY_BETTER | VG_IMAGE_QUALITY_FASTER | VG_IMAGE_QUALITY_NONANTIALIASED; TBool hasAlpha = (aMaskBitmap != NULL); TBool conversionRequired = ETrue; + TSize size = Size(); TSize textureSize = MaxTextureSize(); textureSize.iWidth = Min(size.iWidth, textureSize.iWidth); @@ -402,13 +403,23 @@ imageInternalFormat = imageSourceFormat; } + // For large textures, GPU OOM case is checked. It's expected that client + // uses GOOM to get some space, but even that doesn't guarantee that later + // when texture is created there is continuous space available. + TBool checkErrors = IsLargeTexture(textureSize, imageInternalFormat); + if ( checkErrors ) + { + // To reset error before upload + iRenderPlugin.VgError(); + } + // Create the actual image VGImage image = vgCreateImage(imageInternalFormat, textureSize.iWidth, textureSize.iHeight, qualityFlags); if (image == VG_INVALID_HANDLE) { User::Leave(KErrNoMemory); - } + } if (!conversionRequired) { @@ -455,7 +466,7 @@ const void* data = convBitmap.DataAddress(); TInt stride = CFbsBitmap::ScanLineLength(size.iWidth, convBitmap.DisplayMode()); vgImageSubData(image, data, stride, imageSourceFormat, 0, 0, textureSize.iWidth, textureSize.iHeight); - convBitmap.EndDataAccess( ETrue ); + convBitmap.EndDataAccess( ETrue ); } else { @@ -490,6 +501,18 @@ vgImageSubData(image, data, stride, imageSourceFormat, 0, 0, textureSize.iWidth, textureSize.iHeight); convBitmap.EndDataAccess( ETrue ); } + } + + if ( checkErrors ) + { + // Check if failed + VGErrorCode code = iRenderPlugin.VgError(); + + if (code == VG_OUT_OF_MEMORY_ERROR) + { + vgDestroyImage(image); + User::Leave(KErrNoMemory); + } } // Save the image handle @@ -1256,7 +1279,7 @@ VGImageFormat imageInternalFormat = VG_sARGB_8888; #endif - VGbitfield qualityFlags = VG_IMAGE_QUALITY_NONANTIALIASED | VG_IMAGE_QUALITY_BETTER | VG_IMAGE_QUALITY_FASTER; + VGbitfield qualityFlags = VG_IMAGE_QUALITY_NONANTIALIASED; // | VG_IMAGE_QUALITY_BETTER | VG_IMAGE_QUALITY_FASTER; image = vgCreateImage(imageInternalFormat, aDestSize.iWidth, aDestSize.iHeight, qualityFlags); // Get the configs and displays etc. needed for creating the surface @@ -1780,5 +1803,24 @@ eglMakeCurrent(iPreviousEGLState.iDisplay, iPreviousEGLState.iDrawSurface, iPreviousEGLState.iReadSurface,iPreviousEGLState.iContext); } } + +TBool CHuiVg10Texture::IsLargeTexture(const TSize& aSize, VGImageFormat aFormat) const + { + const TInt KHuiVgLargeTextureLimit = 3000000; + + TInt bytesPerPixel = 4; + if ( aFormat == VG_sRGB_565 ) + { + bytesPerPixel = 2; + } + if ( aFormat == VG_A_8 ) + { + bytesPerPixel = 1; + } + + TInt estimatedMemoryConsumption = aSize.iWidth * bytesPerPixel * aSize.iHeight; + return estimatedMemoryConsumption > KHuiVgLargeTextureLimit; + } + // End of file diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -2651,9 +2651,9 @@ RDebug::Print(_L("EGL Profiling: total mem available: %d"), prof_data[i++]); break; } - case EGL_PROF_THREAD_ID_NOK: + case EGL_PROF_PROCESS_ID_NOK: { - if (sizeof(EGLNativeThreadIdTypeNOK) == 8) + if (sizeof(EGLNativeProcessIdTypeNOK) == 8) { i+=2; } @@ -2663,8 +2663,8 @@ } break; } - case EGL_PROF_THREAD_USED_PRIVATE_MEMORY_NOK: - case EGL_PROF_THREAD_USED_SHARED_MEMORY_NOK: + case EGL_PROF_PROCESS_USED_PRIVATE_MEMORY_NOK: + case EGL_PROF_PROCESS_USED_SHARED_MEMORY_NOK: default: { i++; @@ -3046,6 +3046,16 @@ #ifdef HUI_DEBUG_PRINT_CANVAS_TEXTURE_CACHE RDebug::Print(_L("CHuiCanvasTextureCache::HandleOutOfTextureMemory")); #endif + + iHasReleasedTexts = ETrue; + iHasReleasedImages = ETrue; + iHasReleasedRenderBuffers = ETrue; + + // Clear all unused textures - these will be updated later + iUnusedCanvasTextTextureCacheSizeInKBytes = 0; + iUnusedCanvasImageTextureCacheSizeInKBytes = 0; + iUnusedCanvasRenderBufferCacheSizeInKBytes = 0; + DeleteAllReleasedEntries(EFalse); // TODO: Who you gonna call when texture memory is full and we cannot ourself @@ -3074,6 +3084,14 @@ // Calculate how much there is space for unused textures TInt availableCacheSizeInKBytes = iMaxTextureMemoryInKBytes - (totalUsedTextureMemoryInKBytes - totalUnusedCanvasTextureMemoryUsageInKBytes); + // If there is too much unused, release some textures from cache + if ( availableCacheSizeInKBytes < totalUnusedCanvasTextureMemoryUsageInKBytes ) + { + iHasReleasedTexts = ETrue; + iHasReleasedImages = ETrue; + iHasReleasedRenderBuffers = ETrue; + } + // Divide available space for unused textures between texts and images using defined ratio if (availableCacheSizeInKBytes > 0) { diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -137,6 +137,7 @@ CHuiCanvasVisual::~CHuiCanvasVisual() { + FreeRenderBuffer(); if (iCanvasVisualData) { @@ -303,7 +304,7 @@ if (iCanvasVisualData->iCommandsReceivedWhileNoCache) { Env().CanvasTextureCache().EnableTouchCountCheck( touchCountWasEnabled ); - if ( !KeepNoCache() && aAction == EDrawBuffer ) + if ( KeepCache() && aAction == EDrawBuffer ) { iCanvasVisualData->iCommandsReceivedWhileNoCache = EFalse; } @@ -399,16 +400,12 @@ return; } - if ((IsDelayedEffectSource() || Freezed())) + if ((IsDelayedEffectSource() || Freezed())) { // Select right draw mode THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend; - if(Effectable()->ExternalTexture()) - { - DrawExternalImage(aGc); - return; - } - else if (StoredRenderBuffer()) + + if (StoredRenderBuffer()) { DrawStoredFullScreenRenderBuffer(drawMode, aGc); return; @@ -603,14 +600,7 @@ // Select right draw mode THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend; - THuiFxVisualSrcType effectSource = Effectable()->EffectGetSource(); - - if(effectSource == EVisualSrcBitmap && Effectable()->ExternalTexture()) - { - DrawExternalImage(aGc); - return; - } - else if (effectSource == EVisualSrcInput1 && StoredRenderBuffer()) + if (StoredRenderBuffer()) { DrawStoredFullScreenRenderBuffer(drawMode, aGc); return; @@ -850,7 +840,7 @@ TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->SetCommandSetL(aCommands)); // Memory optimization. Do not prepare cache if visual is inactive. - if (KeepNoCache()) + if (!KeepCache()) { iCanvasVisualData->iCommandsReceivedWhileNoCache = ETrue; ClearCache(); @@ -921,7 +911,7 @@ TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->AddCommandSetL(aMoreCommands)); // Memory optimization. Do not prepare cache if visual is inactive. - if (KeepNoCache()) + if (!KeepCache()) { iCanvasVisualData->iCommandsReceivedWhileNoCache = ETrue; ClearCache(); @@ -1448,57 +1438,17 @@ gc.PopTransformationMatrix(); } - -void CHuiCanvasVisual::DrawExternalImage(CHuiGc& aGc) const - { - if (!Display()) - { - return; - } - - if (!iHuiLayoutPrivateData->iGc) - { - CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer(); - // iHuiLayoutPrivateData->iGc is deleted in CHuiLayout destructor or CHuiCanvasVisual::FreeRenderBuffer when not needed anymore - iHuiLayoutPrivateData->iGc = renderplugin.CreateCanvasGcL(); - } - - TRect displayArea = Display()->VisibleArea(); - - if (Effectable()->ExternalTexture()) - { - CHuiCanvasGc& gc = *iHuiLayoutPrivateData->iGc; - gc.SetGc(aGc); - gc.SetDefaults(); - gc.PushTransformationMatrix(); - - TInt height = displayArea.Height(); - TInt width = displayArea.Width(); - - // Move the center of the image to the center of the screen - TInt tlX = width/2 - Effectable()->ExternalTexture()->Size().iWidth/2; - TInt tlY = height/2 - Effectable()->ExternalTexture()->Size().iHeight/2; - gc.Translate(tlX, tlY, 0.0f); - - // Draw the image and do the cleanup - gc.DrawImage(*Effectable()->ExternalTexture(), displayArea, TRect(TPoint(0,0), Effectable()->ExternalTexture()->Size()), CHuiGc::EStretchNone); - - gc.PopTransformationMatrix(); - - } - } - EXPORT_C void CHuiCanvasVisual::FreeRenderBuffer() { if (iCanvasVisualData) { - delete iCanvasVisualData->iStoredRenderBuffer; - iCanvasVisualData->iStoredRenderBuffer = NULL; - } - if (iHuiLayoutPrivateData) - { - delete iHuiLayoutPrivateData->iGc; - iHuiLayoutPrivateData->iGc = NULL; + if (iCanvasVisualData->iStoredRenderBuffer) + { + delete iCanvasVisualData->iStoredRenderBuffer; + iCanvasVisualData->iStoredRenderBuffer = NULL; + delete iHuiLayoutPrivateData->iGc; + iHuiLayoutPrivateData->iGc = NULL; + } } } @@ -1675,14 +1625,14 @@ return iCanvasVisualData->iCanvasPainter->HasCommandBuffers(EHuiCanvasBufferContainsTransparentClear); } -TBool CHuiCanvasVisual::KeepNoCache() const +TBool CHuiCanvasVisual::KeepCache() const { TBool rosterFrozen = Display() && Display()->Roster().IsVisibleContentFrozen(); TBool inactive = EFalse; inactive |= Flags() & EHuiVisualFlagInactive; inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; - return rosterFrozen || inactive; + return !( rosterFrozen || inactive ); } TBool CHuiCanvasVisual::EffectReadyToDrawNextFrame() const diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/HuiCmdBufferBrush.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiCmdBufferBrush.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCmdBufferBrush.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -236,25 +236,13 @@ { // TODO } -void CHuiCmdBufferBrush::EffectSetSource( THuiFxVisualSrcType /*aSource*/ ) +void CHuiCmdBufferBrush::EffectSetSource( TBool /*aIsInput1*/ ) { } -THuiFxVisualSrcType CHuiCmdBufferBrush::EffectGetSource() const - { - return EVisualSrcVisual; - } - -void CHuiCmdBufferBrush::SetExternalTexture(CHuiTexture* aTexture) +TBool CHuiCmdBufferBrush::EffectGetSource() const { - // Not used + return EFalse; } - -CHuiTexture* CHuiCmdBufferBrush::ExternalTexture() - { - // Not used - return NULL; - } - TBool CHuiCmdBufferBrush::EffectReadyToDrawNextFrame() const { return ETrue; diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -1784,6 +1784,7 @@ EXPORT_C void CHuiEnv::HandleOutOfTextureMemory() { iCanvasTextureCache->HandleOutOfTextureMemory(); + iEffectsEngine->HandleOutOfGpuMemory(); } diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectParser.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectParser.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectParser.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -356,7 +356,7 @@ } if (aLayer && aLayer->Type() == ELayerTypeGroup) { - CHuiFxGroupLayer* group = static_cast(aLayer); + CHuiFxGroupLayer* group = reinterpret_cast(aLayer); group->AddLayerL( visual ); // ownership transferred } else @@ -1196,8 +1196,6 @@ #ifdef _HUI_FX_PARSER_LOGGING __ALFFXLOGSTRING1("CHuiFxEffectParser::GetSrcTypeL - 0x%x ",this); #endif - - if (aNode->NodeType() != CMDXMLNode::EElementNode) { FAIL(KErrGeneral, _L("Text node expected while reading visual source type")); @@ -1213,18 +1211,17 @@ TPtrC attributeValue; TPtrC attributeName; User::LeaveIfError(((CMDXMLElement*)aNode)->AttributeDetails( attributeIndex, attributeName, attributeValue )); - - - if( attributeValue.CompareF( KLitItem ) == 0 ) + + if( attributeValue.Compare( KLitItem ) == 0 ) { return EVisualSrcVisual; } - else if ( attributeValue.CompareF( KLitInput1 ) == 0 ) + else if ( attributeValue.Compare( KLitInput1 ) == 0 ) { // This means that the source is given as a parameter to the effect return EVisualSrcInput1; } - else if ( attributeValue.CompareF( KLitInput2 ) == 0 ) + else if ( attributeValue.Compare( KLitInput2 ) == 0 ) { // This means that the source is given as a parameter to the effect return EVisualSrcInput2; diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/HuiFxEngine.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEngine.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEngine.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -661,12 +661,15 @@ return EFalse; } -void CHuiFxEngine::ClearCache() +void CHuiFxEngine::ClearCache(TBool aOnlyCache) { - // Release cached render targets from effects - for (TInt j=0; jReleaseCachedRenderTarget(); + // Release cached render targets from effects + for (TInt j=0; jReleaseCachedRenderTarget(); + } } if(IsCacheEmpty()) @@ -690,6 +693,13 @@ ASSERT(iBuffersInCache == 0); } +void CHuiFxEngine::HandleOutOfGpuMemory() + { + // Effect might be rendering when this happens, so + // release only cache items. + ClearCache(ETrue); + } + TInt CHuiFxEngine::FindEffectGroup(TInt aGroup) { for (TInt i=0 ; i < iActiveEffectGroups.Count();i++) diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/HuiFxVisualLayer.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxVisualLayer.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxVisualLayer.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -207,16 +207,9 @@ RDebug::Print(_L("CHuiFxVisualLayer::~CHuiFxVisualLayer - 0x%x "), this); #endif - delete iExtBitmapFile; delete iParameterManager; iParameterManager = NULL; - - ReleaseExtTexture(); - if(iVisual) - { - iVisual->SetExternalTexture(NULL); - } } EXPORT_C TBool CHuiFxVisualLayer::Changed() const @@ -247,8 +240,6 @@ { if(iRenderBuffer) { - ReleaseExtTexture(); - aEngine.ReleaseRenderbuffer(iRenderBuffer); iRenderBuffer = NULL; } @@ -280,8 +271,8 @@ forceRefresh = ETrue; } - // Don't update render buffer if visual is not changed or screenshot/external image is used (except in force refresh case) - if(forceRefresh || (iVisualContentChanged && iSrcType==EVisualSrcVisual)) + // don't update render buffer if visual is not changed or screenshot is used + if(forceRefresh || (iVisualContentChanged && iSrcType!=EVisualSrcInput1)) { if(!iVisualContentOpaque) { @@ -305,43 +296,11 @@ aGc.PushClip(); TRect bufferArea = TRect(TPoint(0,0), backbufferSize); aGc.SetClip(bufferArea); // this does not transform bufferArea which is fine for us - - // If needed, create texture if there is a bimap source file set - if(iSrcType==EVisualSrcBitmap && iExtBitmapFile && !iExtTexture) - { - // Note: we are here only if also forceRefresh is true - - CFbsBitmap *bm = new CFbsBitmap; - if (bm) - { - // Load the bitmap file and set it to the linked visual - TInt err = bm->Load(*iExtBitmapFile, 0); - if(!err && bm->Handle()) - { - // Upload as a texture - TRAP(err, - iExtTexture = CHuiTexture::NewL(); - iExtTexture->UploadL(*bm); - ); - if (!err) - { - iVisual->SetExternalTexture(iExtTexture); - } - else - { - delete iExtTexture; - iExtTexture = NULL; - iVisual->SetExternalTexture(NULL); - } - } - delete bm; - } - } - // Draw visual content to aGc - iVisual->EffectSetSource(iSrcType); + // Draw visual content to aTarget + iVisual->EffectSetSource(iSrcType==EVisualSrcInput1); iVisual->EffectDrawSelf( aGc, TargetRect() ); - iVisual->EffectSetSource(EVisualSrcVisual); // set visual source to be default + iVisual->EffectSetSource(EFalse); // Restore original clipping aGc.PopClip(); @@ -543,15 +502,14 @@ #endif delete iExtBitmapFile; iExtBitmapFile = NULL; - - ReleaseExtTexture(); - if ( aFilename.Length() == 0 ) { // don't set an empty filename return; } - iExtBitmapFile = aFilename.AllocL(); + iExtBitmapFile = HBufC::NewL( aFilename.Length() ); + *iExtBitmapFile = aFilename; + //TODO: the bitmap from this filename should be loaded as texture to the visual. } void CHuiFxVisualLayer::FxmlVisualInputs(RArray &aArray) { @@ -594,30 +552,3 @@ iVisualContentOpaque = aOpaque; } -void CHuiFxVisualLayer::ReleaseExtTexture() - { - // Use iRenderBuffer context to make sure there is always active context when iExtTexture is deleted. - // Otherwise the texture will not be freed and cause a memory leak. - // - // The object iRenderBuffer is created in first Draw() call (like iExtTexture), and deleted only in ReleaseAllCachedRenderTargets(). The latter - // function calls ReleaseExtTexture() first. So we can be sure that iRenderBuffer is always set when iExtTexture is set. - // If this class is deleted without calling ReleaseAllCachedRenderTargets(), also destructor calls ReleaseExtTexture(). - - ASSERT(!(iExtTexture && !iRenderBuffer)); - - if (iExtTexture && iRenderBuffer) - { - // just to make sure there is some context active when deleting the texture... - iRenderBuffer->BindAsRenderTarget(); - - delete iExtTexture; - iExtTexture = NULL; - if(iVisual) - { - iVisual->SetExternalTexture(NULL); - } - - iRenderBuffer->UnbindAsRenderTarget(); - } - } - diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/HuiImageVisual.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiImageVisual.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiImageVisual.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -301,11 +301,6 @@ // Actual color of the image. aGc.SetPenAlpha(TInt(effectiveOpacity * 255)); aGc.SetPenColor(iColor); - - // Render Alf image visuals always with high quality. Otherwise scaling etc. with ALF apis - // might produce low-quality - const THuiQuality oldQuality = aGc.Quality(); // store the original quality - aGc.SetQuality(EHuiQualityAccurate); // Apply special color mode. if(iColorMode == EColorDimmed) @@ -391,8 +386,6 @@ } } } - - aGc.SetQuality(oldQuality); // restore quality // Disable special color modes. if(iColorMode == EColorDimmed) diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -1874,25 +1874,14 @@ { // not needed } -void CHuiRosterImpl::EffectSetSource( THuiFxVisualSrcType aSource ) +void CHuiRosterImpl::EffectSetSource( TBool aIsInput1 ) { - iEffectSourceType = aSource; - } - -THuiFxVisualSrcType CHuiRosterImpl::EffectGetSource() const - { - return iEffectSourceType; + iIsInput1 = aIsInput1; } -void CHuiRosterImpl::SetExternalTexture(CHuiTexture* aTexture) +TBool CHuiRosterImpl::EffectGetSource() const { - // Not used - } - -CHuiTexture* CHuiRosterImpl::ExternalTexture() - { - // Not used - return NULL; + return iIsInput1; } TBool CHuiRosterImpl::EffectReadyToDrawNextFrame() const diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -60,8 +60,6 @@ delete iDropShadow; delete iEffectParser; delete iEffect; - delete iEffectable; // Should be after deleting iEffect! - } // structs @@ -85,45 +83,32 @@ { public: // from MHuiEffectable CHuiEffectable(CHuiVisual *aVisual) : iVisual(aVisual) { } - void EffectSetEffect(CHuiFxEffect* aEffect); TReal32 EffectOpacity() const; void EffectSetOpacityAdditive(TReal32 aOpacity, TBool aReplace); void EffectDrawSelf( CHuiGc &aGc, const TRect & aDisplayRect) const; THuiRealRect EffectDisplayRect() const __SOFTFP; void SetLoadingEffect(TBool aLoading); - void EffectSetSource( THuiFxVisualSrcType aSource ); - THuiFxVisualSrcType EffectGetSource() const; - void SetExternalTexture(CHuiTexture* aTexture); - CHuiTexture* ExternalTexture(); + void EffectSetSource( TBool aIsInput1 ); + TBool EffectGetSource() const; TBool EffectReadyToDrawNextFrame() const; + private: - CHuiVisual *iVisual; // not owned - CHuiTexture* iExtTexture; // not owned - THuiFxVisualSrcType iSourceType; + CHuiVisual *iVisual; + TBool iIsInput1; }; void CHuiEffectable::EffectSetEffect(CHuiFxEffect* aEffect) { iVisual->SetEffect(aEffect); } -void CHuiEffectable::EffectSetSource( THuiFxVisualSrcType aSource ) +void CHuiEffectable::EffectSetSource( TBool aIsInput1 ) { - iSourceType = aSource; - } -THuiFxVisualSrcType CHuiEffectable::EffectGetSource() const - { - return iSourceType; + iIsInput1 = aIsInput1; } - -void CHuiEffectable::SetExternalTexture(CHuiTexture* aTexture) +TBool CHuiEffectable::EffectGetSource() const { - iExtTexture = aTexture; - } - -CHuiTexture* CHuiEffectable::ExternalTexture() - { - return iExtTexture; + return iIsInput1; } TBool CHuiEffectable::EffectReadyToDrawNextFrame() const @@ -207,9 +192,9 @@ iVisualData->iFreezed = aEnabled; } TBool CHuiVisual::Freezed() const - { +{ return iVisualData->iFreezed; - } +} EXPORT_C TBool CHuiVisual::EffectReadyToDrawNextFrame() const { @@ -224,6 +209,7 @@ return visual; } + EXPORT_C CHuiVisual::CHuiVisual(MHuiVisualOwner& aOwner) : iOpacity(1.f), iEffectOpacity(1.f), @@ -294,6 +280,7 @@ delete iTransform; if (iVisualData) { + delete iVisualData->iEffectable; if (iVisualData->iStoredRenderBuffer) { iVisualData->iStoredRenderBuffer->UnInitialize(); @@ -2207,24 +2194,14 @@ return EFalse; else { - THuiFxVisualSrcType sourceType = Effectable()->EffectGetSource(); - - if (sourceType == EVisualSrcVisual) - { // if this object has visual source, check the parent - CHuiLayout *layout = Layout(); - if (layout) - { - return (Layout()->IsDelayedEffectSource()); - } - else - { - return EFalse; - } + TBool b = Effectable()->EffectGetSource(); + if (!b) + { // if not found from this object, try the parent + CHuiLayout *l = Layout(); + if (l) + return Layout()->IsDelayedEffectSource(); } - else - { - return ETrue; - } + return b; } } diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -127,11 +127,11 @@ THuiCachedImageParams cachedImageParams; cachedImageParams.iBitmapHandle = aBitmapHandle; cachedImageParams.iGcParams = CachedGcParams(); - - const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); if (IsRenderingEnabled()) { + const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -145,6 +145,13 @@ iCanvasGc->SetDrawMode(oldDrawMode); } } + else + { + if ( IsCacheUpdateNeeded() ) + { + iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + } + } } @@ -156,10 +163,10 @@ cachedImageParams.iBitmapHandle = aBitmapHandle; cachedImageParams.iGcParams = CachedGcParams(); - const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); - if (IsRenderingEnabled()) { + const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -174,6 +181,13 @@ iCanvasGc->SetDrawMode(oldDrawMode); } } + else + { + if ( IsCacheUpdateNeeded() ) + { + iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + } + } } @@ -186,11 +200,11 @@ cachedImageParams.iInvertedMask = aInvertMask; cachedImageParams.iGcParams = CachedGcParams(); - - const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); if (IsRenderingEnabled()) { + const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -201,6 +215,13 @@ iCanvasGc->DrawImage(*texture, destinationRect, aRect, CHuiGc::EStretchNone); } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + } + } } @@ -209,27 +230,26 @@ THuiCachedCombinedImageParams cachedCombinedImageParams; THuiCachedGcParams gcParams = CachedGcParams(); TSize imageSize = aDestinationRect.Size(); - + // Must convert points relative to the image itself - RArray convertedBlits; + RArray convertedBlits; + for (TInt i=0; iEnv().CanvasTextureCache().CreateCombinedCachedImageL( - convertedBlits, - gcParams, - imageSize, - *iVisual); - - convertedBlits.Close(); + } if (IsRenderingEnabled()) - { + { + const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCombinedCachedImageL( + convertedBlits, + gcParams, + imageSize, + *iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -242,6 +262,19 @@ iCanvasGc->DrawImage(*texture, destinationRect, TRect(TPoint(0,0), texture->Size()), CHuiGc::EStretchNone); } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCombinedCachedImageL( + convertedBlits, + gcParams, + imageSize, + *iVisual); + } + } + + convertedBlits.Close(); } @@ -253,10 +286,10 @@ cachedImageParams.iMaskOriginPoint = aPoint2; cachedImageParams.iGcParams = CachedGcParams(); - const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); - if (IsRenderingEnabled()) { + const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -267,6 +300,13 @@ iCanvasGc->DrawImage(*texture, destinationRect, aRect, CHuiGc::EStretchNone); } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsResetClippingRegionL() @@ -431,9 +471,9 @@ cachedImageParams.iBitmapHandle = aBitmapHandle; cachedImageParams.iGcParams = CachedGcParams(); - const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); if (IsRenderingEnabled()) { + const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -445,6 +485,13 @@ iCanvasGc->DrawImage(*texture, destinationRect, TRect(TPoint(0,0), texture->Size()), CHuiGc::EStretchFull); } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawBitmap2L(TInt aBitmapHandle, TRect aRect1, TRect aRect2) @@ -453,10 +500,10 @@ cachedImageParams.iBitmapHandle = aBitmapHandle; cachedImageParams.iGcParams = CachedGcParams(); - const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); - if (IsRenderingEnabled()) { + const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -467,6 +514,13 @@ iCanvasGc->DrawImage(*texture, destinationRect, aRect2, CHuiGc::EStretchFull); } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawBitmap3L(TInt aBitmapHandle, TPoint aPoint) @@ -475,10 +529,10 @@ cachedImageParams.iBitmapHandle = aBitmapHandle; cachedImageParams.iGcParams = CachedGcParams(); - const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); - if (IsRenderingEnabled()) { + const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -490,6 +544,13 @@ iCanvasGc->DrawImage(*texture, destinationRect, TRect(TPoint(0,0), texture->Size()), CHuiGc::EStretchNone); } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawBitmapMaskedL(TInt aBitmapHandle, TInt aMaskHandle, TInt aInvertMask, TRect& aRect1, TRect& aRect2) @@ -499,11 +560,11 @@ cachedImageParams.iMaskHandle = aMaskHandle; cachedImageParams.iInvertedMask = aInvertMask; cachedImageParams.iGcParams = CachedGcParams(); - - const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); - + if (IsRenderingEnabled()) { + const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -514,6 +575,13 @@ iCanvasGc->DrawImage(*texture, destinationRect, aRect2, CHuiGc::EStretchFull); } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawRoundRectL(TPoint aPoint, TRect& aRect) @@ -972,10 +1040,10 @@ cachedtextParams.iTextParams = aTextParameters; cachedtextParams.iGcParams = CachedGcParams(); - const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); - if (IsRenderingEnabled()) { + const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -1004,6 +1072,13 @@ } } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawText2L(TPtr& aTextValue, TPoint& aPoint,THuiCanvasTextParameters& aTextParameters) @@ -1014,10 +1089,11 @@ cachedtextParams.iTextParams = aTextParameters; cachedtextParams.iGcParams = CachedGcParams(); - const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); if (IsRenderingEnabled()) { + const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -1047,6 +1123,13 @@ } } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawText3L(TPtr& aTextValue, TRect& aRect, THuiCanvasTextParameters& aTextParameters) @@ -1058,10 +1141,11 @@ cachedtextParams.iTextBoxMaxSize = aRect.Size(); cachedtextParams.iGcParams = CachedGcParams(); - const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); if (IsRenderingEnabled()) { + const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -1092,6 +1176,13 @@ } } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + } + } } @@ -1107,10 +1198,10 @@ cachedtextParams.iMargin = aTextMargin; cachedtextParams.iGcParams = CachedGcParams(); - const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); - if (IsRenderingEnabled()) { + const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -1141,6 +1232,13 @@ } } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawText5L( TPtr& aTextValue, TRect& aRect, TInt aBaselineOffset, TInt aTextAlign, TInt aTextMargin,TInt aTextWidth, THuiCanvasTextParameters& aTextParameters) @@ -1156,10 +1254,11 @@ cachedtextParams.iTextWidth = aTextWidth; cachedtextParams.iGcParams = CachedGcParams(); - const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); - + if (IsRenderingEnabled()) { + const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -1190,6 +1289,13 @@ } } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawTextVertical1L(TPtr& aTextValue, TInt aTextUp, THuiCanvasTextParameters& aTextParameters) @@ -1203,11 +1309,12 @@ cachedtextParams.iTextParams = aTextParameters; cachedtextParams.iAngle = angle; cachedtextParams.iGcParams = CachedGcParams(); - - const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + if (IsRenderingEnabled()) { + const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -1237,6 +1344,13 @@ } } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawTextVertical2L(TPtr& aTextValue, TInt aTextUp,TPoint& aPoint, THuiCanvasTextParameters& aTextParameters) @@ -1249,11 +1363,12 @@ cachedtextParams.iTextParams = aTextParameters; cachedtextParams.iAngle = angle; cachedtextParams.iGcParams = CachedGcParams(); - - const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + if (IsRenderingEnabled()) { + const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -1283,6 +1398,13 @@ } } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawTextVertical3L(TPtr& aTextValue, TInt aTextUp, TRect& aRect, THuiCanvasTextParameters& aTextParameters) @@ -1297,10 +1419,11 @@ cachedtextParams.iAngle = angle; cachedtextParams.iGcParams = CachedGcParams(); - const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); if (IsRenderingEnabled()) { + const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -1331,13 +1454,19 @@ } } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawTextVertical4L(TPtr& aTextValue, TRect& aRect, TInt aBaselineOffset, TInt aTextUp, TInt aTextAlign, TInt aTextMargin,THuiCanvasTextParameters& aTextParameters) { TInt angle = aTextUp ? -90 : 90; - THuiCachedTextParams cachedtextParams; cachedtextParams.iFindTextPtr = &aTextValue; cachedtextParams.iFontHandle = iWsCurrentFont; @@ -1349,10 +1478,11 @@ cachedtextParams.iMargin = aTextMargin; cachedtextParams.iGcParams = CachedGcParams(); - const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); if (IsRenderingEnabled()) { + const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -1383,6 +1513,13 @@ } } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsDrawTextVertical5L(TPtr& aTextValue, TRect& aRect, TInt aBaselineOffset, TInt aTextUp, TInt aTextAlign, TInt aTextMargin, TInt aTextWidth, THuiCanvasTextParameters& aTextParameters) @@ -1401,10 +1538,11 @@ cachedtextParams.iMargin = aTextMargin; cachedtextParams.iGcParams = CachedGcParams(); - const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); if (IsRenderingEnabled()) { + const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + const CHuiTexture* texture = cachedImage->Texture(); if (texture) { @@ -1435,6 +1573,13 @@ } } } + else + { + if (IsCacheUpdateNeeded()) + { + iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); + } + } } void CHuiCanvasWsHwGc::WsMoveToL( TPoint& aPoint) @@ -2309,3 +2454,14 @@ iCanvasGc->SetPenWidth(iOldPenWidth); iCanvasGc->SetPolygonDrawMode(iOldPolygonDrawMode); } + +TBool CHuiCanvasWsHwGc::IsCacheUpdateNeeded() const + { + TBool result = ETrue; + if ( iVisual ) + { + result = IsRenderingEnabled() || iVisual->KeepCache(); + } + return result; + } + diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp Wed Oct 13 15:34:15 2010 +0300 @@ -56,13 +56,6 @@ { iTexture->SetTextureChanged(ETrue); } - else - { - - iAnimationState = SetFlag(TInt(iAnimationState), TInt(EInitializing)); - iTexture1 = &iManager.LoadTextureL( - *iFilename,EHuiTextureUploadFlagDefault, iTextureId1, 0); - } CHuiStatic::ContinueRefresh(); } @@ -258,23 +251,6 @@ iAnimationState = SetFlag(TInt(iAnimationState), TInt(EEnabled)); } -EXPORT_C void CHuiGifAnimationTexture::DeleteAnimatedTexture() - { - - if (iTexture1) - { - delete iTexture1; - iTexture1 = 0; - } - if (iTexture2) - { - delete iTexture2; - iTexture2 = 0; - } - iTexture = 0; - iFrameCount = 0; - } - EXPORT_C CHuiGifAnimationTexture::~CHuiGifAnimationTexture() { if ( iAnimatedTextureGroupId ) diff -r eaa079afe64c -r e1987ab3768a uiacceltk/hitchcock/goommonitor/data/goomconfig.xml --- a/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml Wed Sep 15 13:12:27 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml Wed Oct 13 15:34:15 2010 +0300 @@ -68,7 +68,9 @@ close_app uid="101FD693" priority="80" sync_mode="check" close_timeout="3000" wait_after_close="5000" --> - + + +