// -----------------------------------------------------------------------------
// Blit
//
// Blits given image to gc.
//
// -----------------------------------------------------------------------------
//
inline static TBool Blit(
    MAknsSkinInstance* aSkin, CBitmapContext& aGc, const TRect& aTrgRect,
    CAknsImageItemData* aImgData, const TAknsItemID& aIID,
    const TAknsBackground* aLayout, const TPoint& aPADelta,
    const TInt aDrawParam )
    {
    CAknsAppSkinInstance* appInstance = 
        static_cast<CAknsAppSkinInstance*>(aSkin);
        
    if ( IsBackgroundItem( aIID,appInstance ) && 
            appInstance && appInstance->AnimBackgroundState() )
        {
        if( (aDrawParam&KAknsDrawParamPrepareOnly) )
            {
            return ETrue;
            }        
        
        TRgb color = KRgbWhite;
        color.SetAlpha(0x00);
        aGc.SetPenColor(color);
        aGc.SetBrushColor(color);
        aGc.SetPenStyle(CGraphicsContext::ESolidPen);
        aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
        aGc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
        TRect layoutRect( aTrgRect );
        if( aLayout )
            {
            layoutRect = aLayout->iRect;
            }
        layoutRect.Move( -aPADelta );

        TRect drawRect = aTrgRect;
        drawRect.Intersection( layoutRect );

        aGc.Clear(drawRect);
        return ETrue;
        }

    TRect layoutRect( aTrgRect );

    const TAknsImageAttributeData* attr = NULL;

    if( aLayout )
        {
        layoutRect = aLayout->iRect;

        if( aLayout->iAttr.iAttributes != EAknsImageAttributeNone )
            {
            attr = &(aLayout->iAttr);
            }
        }

    layoutRect.Move( -aPADelta );

    TRect drawRect(aTrgRect);
    drawRect.Intersection( layoutRect );

    return DrawPartialCachedImage( aSkin, aGc, layoutRect, drawRect,
        aImgData, aIID, attr, aDrawParam );
    }
void CWsBackedUpWindow::Scroll(const TRect &aClipRect, const TPoint &aOffset,const TRect &aRect)
	{
	TRect winBorder=TRect(iWsWin->Size());
	TRect clipRect=aClipRect;
	TRect srcRect = aRect;		
	clipRect.Intersection(winBorder);	
	if (!clipRect.IsEmpty())
		{	// If we have to do something (a visible part will change)
		srcRect.Intersection(clipRect);

		STACK_REGION regionToClear;
		regionToClear.AddRect(aRect);
		regionToClear.SubRect(srcRect);
		regionToClear.Offset(aOffset);
		
		ActivateGc();
		iBitGc->SetClippingRect(clipRect);
		iBitGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
		iBitGc->CopyRect(aOffset,srcRect);				
		for (TInt k=0;k<regionToClear.Count();k++)
			{
			iBitGc->Clear(regionToClear[k]);
			}
		iBitGc->SetClippingRect(winBorder);
		iBitGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
		TRegionFix<1> fixRegion(iWsWin->AbsRect());
		UpdateScreen(fixRegion);
		regionToClear.Close();
		}
	}
void CCameraEngine::StartDirectViewFinderL(RWsSession& aSession,
                            CWsScreenDevice& aScreenDevice,
                            RWindowBase& aWindow,
                            TRect& aScreenRect,
                            TRect& aClipRect)
{
    if (iEngineState < EEngineIdle)
        User::Leave(KErrNotReady);

    if (0 == (iCameraInfo.iOptionsSupported & TCameraInfo::EViewFinderDirectSupported))
        User::Leave(KErrNotSupported);

    if (!iCamera->ViewFinderActive()) {
        // Viewfinder extent needs to be clipped according to the clip rect.
        // This is because the native camera framework does not support
        // clipping and starting viewfinder with bigger than the display(S60
        // 5.0 and older)/window(Symbian^3 and later) would cause viewfinder
        // starting to fail entirely. This causes shrinking effect in some
        // cases, but is better than not having the viewfinder at all.
        if (aScreenRect.Intersects(aClipRect))
            aScreenRect.Intersection(aClipRect);

        if (iCameraIndex != 0)
            iCamera->SetViewFinderMirrorL(true);
        if (aScreenRect.Width() > 0 && aScreenRect.Height() > 0) {
            iCamera->StartViewFinderDirectL(aSession, aScreenDevice, aWindow, aScreenRect);
        } else {
            if (iObserver)
                iObserver->MceoHandleError(EErrViewFinderReady, KErrArgument);
        }
    }
}
Example #4
0
EXPORT_C TBool CHuiFxEffect::Draw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aHasSurface)
    {
    // Prepare all layers
#ifdef HUIFX_TRACE    
    RDebug::Print(_L("CHuiFxEffect::Draw - 0x%x"), this);
#endif
    iFramesDrawn++;
    if (!CHuiStatic::Renderer().Allows(EHuiRenderPluginAllowVisualPBufferSurfaces))
        {
        return EFalse;
        }
            
    TRect displayArea = aGc.DisplayArea();
    TRect targetArea = aDisplayRect;
    targetArea.Intersection(displayArea);

    if (targetArea.Width() <= 0 || targetArea.Height() <= 0)
        {
        // Not visible
        return ETrue;
        }

    if (!iEngine || !iRoot)
        {
        return EFalse;
        }

    if (iEngine->LowMemoryState())
        {
        // No memory, no effects.
        return EFalse;
        }
    
    // Check if margins are allowed to be used for this effect
    if (EffectFlags() & KHuiFxEffectDisableMarginsFlag)
        {
        iRoot->EnableMargin(EFalse);
        }
    
    iRoot->SetDisplayArea(displayArea);
    iRoot->SetTargetRect(targetArea);
    iRoot->SetSourceRect(targetArea);
    
    TRAPD(err, iRoot->PrepareDrawL(*iEngine));
    
    if (err != KErrNone)
        {
        return EFalse;
        }
    
    CHuiFxRenderbuffer* target = iEngine->DefaultRenderbuffer();
    
    if (!target)
        {
        return EFalse;
        }

    iRoot->Draw(*iEngine, aGc, *target, *target, aHasSurface);
    return ETrue;
    }
void CHuiVg10CanvasGc::ClearWithBackgroundItems(const THuiRealRect& /*aRect*/, const RArray<THuiDisplayBackgroundItem>& aItems)
    {
    if (!iGc)
        return;

    THuiDisplayBackgroundItem item;   
    CHuiS60Skin* s60skin = static_cast<CHuiS60Skin*>(&CHuiStatic::Env().Skin());
    CHuiTexture* backgroundTexture = NULL;

    for (TInt index = 0; index < aItems.Count(); index++)
        {        
        item = aItems[index];    
        switch (item.ClearMode())
            {
            case CHuiDisplay::EClearNone:
                // do nothing...
                break;
            case CHuiDisplay::EClearWithColor:
                iGc->SetPenColor(item.Color());
                iGc->SetPenAlpha(TInt(item.Color().Alpha() * 255));
                iGc->SetAlign(EHuiAlignHLeft, EHuiAlignVTop);            
                iGc->Disable(CHuiGc::EFeatureBlending);
                iGc->Enable(CHuiGc::EFeatureClipping);            
                iGc->PushClip();
                iGc->Clip(item.Rect());  // takes transformations into account                              
                iGc->Clear();
                iGc->PopClip();
                break;
            case CHuiDisplay::EClearWithSkinBackground:
                 backgroundTexture = s60skin->BackgroundTexture(item.SkinBackground());
                 if (backgroundTexture)
                    {
                    TRect skinRect;
                    TRect dummy;
                    GetRectForItem(item.SkinBackground(), dummy, skinRect);

                    THuiImage background(*backgroundTexture);

                    TPoint screenOrigin(0, 0);
                    CHuiStatic::CurrentRenderSurface()->GetScreenOrigin(screenOrigin);
                    screenOrigin.iX = -screenOrigin.iX;
                    screenOrigin.iY = -screenOrigin.iY;
                    screenOrigin+=skinRect.iTl;
                    iGc->SetPenColor(KRgbWhite);
                    iGc->SetPenAlpha(255);
                    iGc->SetAlign(EHuiAlignHLeft, EHuiAlignVTop);            
                    iGc->Disable(CHuiGc::EFeatureBlending);
                    iGc->Enable(CHuiGc::EFeatureClipping);            
                    skinRect.Intersection(item.Rect());
                    iGc->PushClip();
                    iGc->Clip(skinRect); // takes transformations into account
                    iGc->DrawImage(background, screenOrigin, background.Texture().Size());                     
                    iGc->PopClip();
                    }
                 break;                                                    
             }
        }             
    }
Example #6
0
/**
@see MAnimSpriteFunctions::UpdateMember
@param aFullUpdate	Not used. Wserv2 always do full back to front rendering, so there is no distinction between changes needing aFullUpdate or not 
 */
void CWsSprite::Update(TInt aMember,TRect aRect,TBool /*aFullUpdate*/) 
	{
	if (iCurIndex!=aMember)
		return;
	aRect.Move(Pos());
	aRect.Intersection(iScreen->CurrentScreenSize());
	SetDirty(ETrue);
	Screen()->SpriteManager()->Schedule(this, &aRect);
	}
Example #7
0
void CWsWindow::ClipRectToViewport(TRect& aRect) const
	{
	const CWsWindowBase * win = this;
	while (win)
		{
		if (win->WinType() != EWinTypeGroup)
			{
			aRect.Intersection(win->AbsRect());
			}
		win = win->BaseParent();
		}
	}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
TBool CMmGridContainer::ItemIsVisible( TInt aItemIndex ) const
    {
    CListBoxView* v = iGrid->View();
    TRect itemRect( v->ItemPos( aItemIndex ), v->ItemSize( aItemIndex ) );
    TRect viewRect = v->ViewRect();
    TBool isVisible = EFalse;
    if ( itemRect.Intersects( viewRect ) )
        {
        TRect intersection = itemRect;
        intersection.Intersection( viewRect );
        isVisible = intersection.Height() > 1 && intersection.Width() > 1;
        }
    return isVisible;
    }
// ---------------------------------------------------------------------------
// Sets visible area.
// ---------------------------------------------------------------------------
//
void CAlfSrvDisplaySubSession::SetVisibleAreaL( const RMessage2& aMessage, TBool aForce )
    {
    // Parse parameters

    // 1: area rect (in)
    TRect rect;
    TPckg<TRect> rectPckg(rect); 
    aMessage.Read(1,rectPckg);
	        
		CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session());	        
	           
    // Set clipping rect for display visible area to e.g. avoid unnecesssary 
    // drawing under Avkon status/control pane areas. TV out does not show
    // those so no clipping in that case.
    if (UseVisualAreaClipping())
       {
       iRect = rect;
		
			if ( session.IsFocused() )
        		{
    	      TRect clipped = Session().AlfAppUi()->Container()->Rect();
#ifndef SYMBIAN_BUILD_GCE
		       	if (clipped.Intersects(rect))
		           {
		           clipped.Intersection(rect);        
		           }
#endif           
		       	iDisplay->SetVisibleAreaClippingRect(clipped);        
		       	iDisplay->SetDirty();
	        	}
	       }           
	           
    // Set visible area        
			if ( session.IsFocused() || aForce )
        		{
    		    static_cast<CAlfAppSrvSession&>(Session()).SetClientDrawingArea( rect );
        		}
    // Complete
    aMessage.Complete( KErrNone );
    }
Example #10
0
void CWsSpriteManager::Schedule(CWsSpriteBase* aSprite, TRect* aRect)
	{
	if (aRect != NULL && aRect->IsEmpty())
		return;

	TRect rect = aSprite->Rect();
	if (aRect)
		rect.Intersection(*aRect);
		
	const TAnimType type = aSprite->Win() ? EWindowSprite : EFloatingSprite;
	
	if(aSprite->IsFlashingEnabled())
		{
		aSprite->Screen()->ScheduleAnimation(type, rect,NextSpriteFlashStateChange(aSprite),0,0, aSprite->Win());
		}
	else
		{
		//Scheduling an animation "now" means it will take place at next animation which might 
		//be the full animation grace period into the future (see KAnimationGrace in server.cpp)
		aSprite->Screen()->ScheduleAnimation(type, rect,0,0,0, aSprite->Win());
		}
	}	
/*!
    Constructs the CVideoPlayerUtility2 object with given \a service and \a object.
    And Registers for Video Loading Notifications.
*/
S60VideoPlayerSession::S60VideoPlayerSession(QMediaService *service, S60MediaNetworkAccessControl *object)
    : S60MediaPlayerSession(service)
    , m_accessPointId(0)
    , m_wsSession(&CCoeEnv::Static()->WsSession())
    , m_screenDevice(CCoeEnv::Static()->ScreenDevice())
    , m_service(service)
    , m_player(0)
#ifndef VIDEOOUTPUT_GRAPHICS_SURFACES
    , m_dsaActive(false)
    , m_dsaStopped(false)
#endif
    , m_videoOutputControl(0)
    , m_videoOutputDisplay(0)
    , m_displayWindow(0)
#ifdef HAS_AUDIOROUTING_IN_VIDEOPLAYER
    , m_audioOutput(0)
#endif
    , m_audioEndpoint(DefaultAudioEndpoint)
    , m_pendingChanges(0)
    , m_backendInitiatedPause(false)
{
    DP0("S60VideoPlayerSession::S60VideoPlayerSession +++");

    m_networkAccessControl = object;
#ifdef VIDEOOUTPUT_GRAPHICS_SURFACES
    QT_TRAP_THROWING(m_player = CVideoPlayerUtility2::NewL(
                                    *this,
                                    0,
                                    EMdaPriorityPreferenceNone
                                ));
    m_player->RegisterForVideoLoadingNotification(*this);
#else
    RWindow *window = 0;
    QRect extentRect;
    QWidget *widget = QApplication::activeWindow();
    if (!widget)
        widget = QApplication::allWidgets().at(0);
    Q_ASSERT(widget);
    WId wid = widget->effectiveWinId();
    if (!wid)
        wid = widget->winId();
    window = static_cast<RWindow *>(wid->DrawableWindow());
    extentRect = QRect(widget->mapToGlobal(widget->pos()), widget->size());
    TRect clipRect = QRect2TRect(extentRect);
    const TRect desktopRect = QRect2TRect(QApplication::desktop()->screenGeometry());
    clipRect.Intersection(desktopRect);
    QT_TRAP_THROWING(m_player = CVideoPlayerUtility::NewL(
                                    *this,
                                    0,
                                    EMdaPriorityPreferenceNone,
                                    *m_wsSession,
                                    *m_screenDevice,
                                    *window,
                                    QRect2TRect(extentRect),
                                    clipRect));
    m_dsaActive = true;
    m_player->RegisterForVideoLoadingNotification(*this);
#endif // VIDEOOUTPUT_GRAPHICS_SURFACES
    S60VideoPlayerEventHandler::instance()->addApplicationFocusObserver(this);
    DP0("S60VideoPlayerSession::S60VideoPlayerSession ---");
}
Example #12
0
// TODO: effect area should be reduced if aClipRegion is smaller than aDisplayRect.
TBool CHuiFxEffect::CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque, const TRegion& aClipRegion, TBool aHasSurface, TInt aAlpha)
    {
#ifdef HUIFX_TRACE    
    RDebug::Print(_L("CHuiFxEffect::CachedDraw - 0x%x"), this);
#endif    
    iFramesDrawn++;
    if (!CHuiStatic::Renderer().Allows(EHuiRenderPluginAllowVisualPBufferSurfaces))
        {
        return EFalse;
        }
            
    
    CHuiFxRenderbuffer* target = NULL;
    
    // Prepare all layers
    TRect displayArea = aGc.DisplayArea();
    TRect targetArea = aDisplayRect;
    targetArea.Intersection(displayArea);

    if (targetArea.Width() <= 0 || targetArea.Height() <= 0)
        {
        // Not visible
        return ETrue;
        }

    if (!iEngine || !iRoot)
        {
        return EFalse;
        }

    if (iEngine->LowMemoryState())
        {
        // No memory, no effects.
        return EFalse;
        }
    
    // Check if margins are allowed to be used for this effect
    if (EffectFlags() & KHuiFxEffectDisableMarginsFlag)
        {
        iRoot->EnableMargin(EFalse);
        }

    // Check if surface pixels are to be used for this effect in all layers.
    if (EffectFlags() & KHuiFxEnableBackgroundInAllLayers)
        {
        iRoot->SetAlwaysReadSurfacePixels(ETrue);
        }
    
    iRoot->SetTargetRect(targetArea);
    iRoot->SetSourceRect(targetArea);        
    iRoot->SetDisplayArea(displayArea);
    
    TRAPD(err, iRoot->PrepareDrawL(*iEngine));
    
    if (err != KErrNone)
        {
        return EFalse;
        }

    if (IsCachedRenderTargetSupported() && IsCachedRenderTargetPreferred())
        {
        // Background needs to be captured from surface if effect uses background AND 
        // Visual is transparent or margin is enabled AND
        // Background has not been disabled with a effect specific flag
        TBool enableBackground = IsAppliedToBackground() && (!aOpaque || iRoot->IsMarginEnabled()) && !(EffectFlags() & KHuiFxDisableBackground);
        
        if (EffectFlags() & KHuiFxEnableBackgroundInAllLayers)
            {
            enableBackground = ETrue;
            }
        
        TBool useFrozenBackground = (EffectFlags() & KHuiFxFrozenBackground);
        
        // Check if cache is up-to date or does it need to be refreshed
        TBool cachedRenderTargetNeedsRefresh = (iRoot->Changed() || aRefreshCachedRenderTarget || (enableBackground && !useFrozenBackground));
        if (!iCachedRenderTarget || (iCachedRenderTarget && iCachedRenderTarget->Size() !=  iRoot->VisualRect().Size())) 
            {
            cachedRenderTargetNeedsRefresh = ETrue;
            }

        // Try to apply also margins, we cannot just use aDisplayRect directly
        TRect targetRect = iRoot->VisualRect();
        
        // Size is always same as target rect. It contains margins if those are enabled.
        TSize cachedRenderTargetSize = targetRect.Size();        
                
        // Prepare cached offscreen render target
        PrepareCachedRenderTarget(targetRect.iTl, cachedRenderTargetSize, cachedRenderTargetNeedsRefresh, enableBackground);
        
        // If it is available, then lets do it 
        if (iCachedRenderTarget)
            {
            // Disable clipping, otherwise strange things happen.
            aGc.Disable(CHuiGc::EFeatureClipping);             
            if (cachedRenderTargetNeedsRefresh)
                {
                // Render to cached render target
                iRoot->Draw(*iEngine, aGc, *iCachedRenderTarget, *iCachedRenderTarget, aHasSurface);                
#ifdef HUIFX_TRACE    
                RDebug::Print(_L("CHuiFxEffect::CachedDraw - refreshed cached render buffer 0x%x"), this);
#endif
                }            

            if (aClipRegion.Count())
                {
                aGc.Enable(CHuiGc::EFeatureClipping);
                aGc.PushClip();
                aGc.Clip(aClipRegion);
                }
            
            // Write cached buffer to the display
           
	       iEngine->Composite(aGc, *iCachedRenderTarget, targetRect.iTl, aOpaque && !(EffectFlags() & KHuiFxAlwaysBlend), aAlpha);
           

            if (aClipRegion.Count())
                {
                aGc.PopClip();
                }
            
            aGc.Enable(CHuiGc::EFeatureClipping);
#ifdef HUIFX_TRACE    
            RDebug::Print(_L("CHuiFxEffect::CachedDraw - Cached render buffer drawn 0x%x"), this);
            RDebug::Print(_L("CHuiFxEffect::CachedDraw - displayrect: %i,%i, %i,%i "), 
                    aDisplayRect.iTl.iX,
                    aDisplayRect.iTl.iY,
                    aDisplayRect.iBr.iX,
                    aDisplayRect.iBr.iY);
#endif            
            }
        else
            {
            // It might not be available e.g. in low memory situations, just indiacte that we could not draw.
            return EFalse;
            }
        }
    else
        {
        // Release cached render target just in case it is reserved for some reason
        ReleaseCachedRenderTarget();

        // Use default onscreen render target
        if (!target)
            {
            target = iEngine->DefaultRenderbuffer();
            }
        
        if (!target)
            {
            return EFalse;
            }
        
        // Normal drawing
        iRoot->Draw(*iEngine, aGc, *target, *target, aHasSurface);
        }
                
    return ETrue;    
    }
// ---------------------------------------------------------------------------
// 2nd phasse constructor
// ---------------------------------------------------------------------------
//
void CAlfSrvDisplaySubSession::ConstructL()
    {
    CAlfSrvSubSessionBase::ConstructL();
    
    // With one display, use the existing one or create one if there aren't any.
    const TRect& rect = CHuiStatic::ScreenDevice()->SizeInPixels();
    
    // when running oldstyle, we may have rect different from whole screen
    if (Session().AlfAppUi()->Container())
        {
        const TRect& rect = Session().AlfAppUi()->Container()->Rect();
        }
    
    // Shared normal screen 0
    if ((iDisplayType == CHuiDisplay::EDisplayLcd0) || 
       ((iDisplayType == CHuiDisplay::EDisplayNormal) && (iScreenBufferUid == KHuiUidBackBufferScreen0)))
        {            
        iDisplay = 
            Session().SharedHuiEnv()->DisplayCount() ? 
                &Session().SharedHuiEnv()->PrimaryDisplay() : 
                &Session().SharedHuiEnv()->NewDisplayL( rect, Session().AlfAppUi()->Container(), 0,
                	NULL,  CHuiDisplay::EDisplayNormal, iScreenBufferUid );
                
        Session().AlfAppUi()->AppendDisplayOnSharedWindowL(*iDisplay);
        
        #ifdef TFXSERVER_API_V2
		// Register to Tfx Server
        MTransitionServer2* tfxServer = Session().AlfServer()->TfxServer();
        if (tfxServer)
        	{
        	// Note: if this returns KErrNotFound, it is also send to Tfx server
        	TInt wgId = Session().ClientWindowGroup();
       		// Just ignore returned error code. Can this cause trouble? 
       		tfxServer->RegisterApp(MTransitionServer2::ETypeAlf, wgId, KNullUid, KNullUid);
        	}
   		#endif
        }
        
    // Off screen buffer    
    else if (iDisplayType == CHuiDisplay::EDisplayOffScreenBuffer)
        {            
        iDisplay = &Session().SharedHuiEnv()->NewDisplayL( rect, Session().AlfAppUi()->Container(), 0, NULL, iDisplayType, iScreenBufferUid );

        TRect clipped = rect;
        if (clipped.Intersects(iRect))
            {
            clipped.Intersection(iRect);        
            }

        iDisplay->SetVisibleArea(clipped);        
        }
        
    // Shared TV-out display    
    else if (IsTvOut())
        {
        if (Session().SharedHuiEnv()->DisplayCount() == 0)
            {
            // Primary lcd must exist before tv out is created            
            User::Leave(KErrNotFound);                    
            }                
        else
            {                
            iDisplay = &Session().SharedHuiEnv()->NewDisplayL( iRect,
                 Session().AlfAppUi()->Container(),
                 0, 
                 &Session().SharedHuiEnv()->PrimaryDisplay(), 
                 CHuiDisplay::EDisplayNormal, 
                 KHuiUidBackBufferTvOutNormal
                 );                  
            }
        }  
     else
     	{
     	User::Leave(KErrNotFound); 
     	} 
     
    // If we have screen buffer observers for the new display, add Alf server as an observer 	
    TAlfScreenBufferEvent event = {iScreenBufferUid, MHuiScreenBufferObserver::ECreated, TRect(), TRect()};
    if (Session().AlfServer()->ScreenBufferManager().TriggerScreenBufferEvent(event))
    	{
    	iDisplay->AddScreenBufferObserverL(&Session().AlfServer()->ScreenBufferManager());
    	}
	
    }
void CAlfSrvDisplaySubSession::SetSessionFocused(TBool aFocused)
    {
    if ( iDisplay )
        {
        if (aFocused)
            {
            // Set clipping rect for display visible area to e.g. avoid unnecesssary 
            // drawing under Avkon status/control pane areas. TV out does not show
            // those so no clipping in that case.
            if (UseVisualAreaClipping())
                {
                TRect clipped = Session().AlfAppUi()->Container()->Rect();
                if (clipped.Intersects(iRect))
                    {
                    clipped.Intersection(iRect);        
                    }
                iDisplay->SetVisibleAreaClippingRect(clipped);        
                iDisplay->SetDirty();
                }

            // If background items are used
            if (iBackgroundItems.Count() != 0)
                {
                TRAP_IGNORE(iDisplay->SetBackgroundItemsL(iBackgroundItems))                        
                }
            else
                {
                TRAP_IGNORE(iDisplay->SetClearBackgroundL(
                        CHuiDisplay::TClearMode(iDisplayClearBackground)))                                        
                }    

            if ( KAlfSrvClientQualitySupport )
                {
                iDisplay->SetQuality(THuiQuality(iDisplayRenderingQuality));
                }
            iDisplay->SetUseDepth(iDisplayUseDepthTest);
            
            UpdateAutomaticFading(); // update non-fading to app ui container
            }
        else
            {
            // Disable clipping rect 
            if (UseVisualAreaClipping())
                {
                iDisplay->SetVisibleAreaClippingRect(TRect(0,0,0,0));        
                iDisplay->SetDirty();
                }                
            }    
        
        if (IsTvOut())
            {
            if (aFocused)
                {
                TRAP_IGNORE(
                    {
                    iDisplay->RestoreL();
                    Session().AlfAppUi()->AppendTvDisplayOnSharedWindowL(*iDisplay);
                    })
                }
            else
                {
                Session().AlfAppUi()->RemoveTvDisplayOnSharedWindow(*iDisplay);
                iDisplay->Release();    
                }                
            }