Exemple #1
0
void CWsSpriteManager::SendState(MWsWindowTreeObserver& aWindowTreeObserver) const
	{
	for(TInt i=iFloatingSprites.Count()-1; i>=0; i--)
		{
		CWsSpriteBase* sprite = iFloatingSprites[i];
		sprite->SendState(aWindowTreeObserver);
		}
	}
Exemple #2
0
void CWsWindow::DeactivateAllSprites()
	{
	CWsSpriteBase * current = iSpriteList;
	while (current)
		{
		CWsSpriteBase * next = current->Next();
		current->Deactivate();
		current = next;
		}
	}
Exemple #3
0
static void LogSpriteRedrawEnd(const CWsSpriteBase& aSprite)
    {
    if (wsDebugLog)
        {
        _LIT(KAnnotateSpriteRedrawEnd, "<< MWsDrawAnnotationObserver::FloatingSpriteRedrawEnd [%S][app %d]");
        const TDesC& clientName = aSprite.WsOwner()->Client().FullName();
        TBuf<LogTBufSize> log;
        TTruncateOverflow overflow;
        log.AppendFormat(KAnnotateSpriteRedrawEnd, &overflow, &clientName, aSprite.WsOwner()->ConnectionHandle());
        wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything, log);
        }
    }
Exemple #4
0
static void AnnotateSpriteFlash(const CWsSpriteBase& aSprite, TBool aFlashOn)
	{
	LOG_SPRITE_FLASH(aSprite);
	MWsDrawAnnotationObserver* annoObs = aSprite.Screen()->DrawAnnotationObserver();
	if(annoObs)
		{
		annoObs->SpriteFlash(aSprite, aFlashOn);
		}	
	}
Exemple #5
0
static void AnnotateSpriteRedrawEnd(const CWsSpriteBase& aSprite)
	{
	LOG_SPRITE_REDRAW_END(aSprite);
	MWsDrawAnnotationObserver* annoObs = aSprite.Screen()->DrawAnnotationObserver();
	if(annoObs)
		{
		annoObs->SpriteRedrawEnd(aSprite);
		}		
	}
Exemple #6
0
void CWsSpriteManager::CalcFloatingSpriteRgn( TRegion& aResultRgn, const TRect& aDefaultRect )
	{
	aResultRgn.Clear();
	for (TInt i=0 ; i<iFloatingSprites.Count() && !aResultRgn.CheckError(); i++)
		{
		CWsSpriteBase* sprite = iFloatingSprites[i]; 
		if ( sprite->CanBeSeen() && ( sprite->IsActive() || sprite->IsActivated() ) )
			{
			aResultRgn.AddRect( sprite->Rect() );
			}
		}
	aResultRgn.Tidy();
	if ( aResultRgn.CheckError() && iFloatingSprites.Count() > 0 )
		{
		aResultRgn.Clear();
		aResultRgn.AddRect( aDefaultRect );
		}
	}
Exemple #7
0
static void AnnotateSpriteRedrawStart(const CWsSpriteBase& aSprite, const TRegion& aRegion)
	{
	LOG_SPRITE_REDRAW_START(aSprite);
	MWsDrawAnnotationObserver* annoObs = aSprite.Screen()->DrawAnnotationObserver();
	if(annoObs)
		{
		annoObs->SpriteRedrawStart(aSprite, aRegion);
		}
	}
Exemple #8
0
void CWsWindow::RemoveSprite(CWsSpriteBase * aSprite)
	{
	if (aSprite == iSpriteList)
		{
		iSpriteList = aSprite->Next();
		}
	else
		{
		for (CWsSpriteBase * sprite = iSpriteList; sprite; sprite = sprite->Next())
			{
			if (sprite->Next() == aSprite)
				{
				sprite->SetNext(aSprite->Next());
				}
			}
		}
	aSprite->SetNext(0);
	}
Exemple #9
0
void CWsSpriteManager::DrawFloatingSprites(MWsGraphicsContext* aGc,const TRegion& aRegion)
	{
	if (iFloatingSprites.Count() == 0)
		return; //avoid sending events unless necessary

	for (TInt i = iFloatingSprites.Count() - 1; i >= 0 ; i--)
		{
		STACK_REGION redrawRegion;
		CWsSpriteBase* sprite = iFloatingSprites[i];
		sprite->CalcRedrawRegion(aRegion, redrawRegion);
		if(redrawRegion.CheckError() || !redrawRegion.IsEmpty())
			{
			if (sprite->IsFlashingEnabled() || sprite->IsDirty() || sprite->HasAnimation())
				{
				AnnotateSpriteRedrawStart(*sprite, redrawRegion);
				
				if(sprite->HasAnimation())
					{
					CWsAnim* anim = static_cast<CWsSprite*>(sprite)->iAnim;
					ASSERT(anim);
					
					TRAPD(err, anim->AnimateSpriteAnimL(sprite->Screen()->Now()));
					if(err!=KErrNone)
						{
						AnnotateSpriteRedrawEnd(*sprite);						
						anim->Panic(EWservPanicAnimLeave);
						continue;
						}
					}
				
				aGc->Reset();
				sprite->Redraw(aGc, redrawRegion);
				
				AnnotateSpriteRedrawEnd(*sprite);
				}
			}
		redrawRegion.Close();
		}
	}
Exemple #10
0
void CWsWindow::RestartAnimations(const TRegion& aNewRegion)
	{
	 //When not ChangeTracking, restarting is handled by AddRedrawRegion (called from CWsWindow::SetVisibleRegion) and TWalkWindowTreeScheduleRegions
	WS_ASSERT_DEBUG(iScreen->ChangeTracking(),EWsPanicNoChangetracking);
	
	//Restart uncovered window animations 
	for (CWsAnim* anim = iAnimList; anim; anim = anim->Next())
		{
		if(!iScreen->IsScheduled(EWindowAnim, anim->BestRect(), this) && aNewRegion.Intersects(anim->BestRect()))
			{
			iScreen->ScheduleAnimation(EWindowAnim, anim->BestRect(), 0, 0, 0, this);
			}
		}
	//Restart uncovered sprite animations 
	for (CWsSpriteBase* sprite = iSpriteList; sprite; sprite = sprite->Next())
		{
		if(!iScreen->IsScheduled(ESpriteAnim, sprite->Rect(), sprite->Win()) && aNewRegion.Intersects(sprite->Rect()))
			{
			iScreen->ScheduleAnimation(ESpriteAnim, sprite->Rect(), 0, 0, 0, sprite->Win());
			}
		}
	}
Exemple #11
0
//This function sets up the quick fadable region.
//It removes anything that cannot be quick faded, and schedules it to be drawn in the normal fashion.
void CWsWindow::SetFadeableRegion(const TRegion& aNewFadableRegion, const TRegion& aTop)
	{
	WS_ASSERT_DEBUG(iScreen, EWsPanicNoScreen);
	iFadableRegion.Copy(aNewFadableRegion);

	//Try to figure out if any part of iFadableRegion can be quick faded (i.e. fading applied to 
	//the screen without first having to redraw all visible windows intersecting the region).
	if ( !iFadableRegion.IsEmpty() && iScreen->IsQuickFadeScheduled(this) )
		{
		if (IsTranslucent())
			{
			//If a window is semitransparent, then we cannot apply a quickfade to it if
			//the window below is faded too.
			iScreen->AddRedrawRegion(iVisibleRegion, EFalse, ERedrawAll);
			iScreen->RemoveFromQuickFadeList(this);
			}
		else
			{
			iQuickFadeRegion.Intersection(iFadableRegion, aTop);
			
			//Remove any regions not possible to quick fade from iQuickFadeRegion and
			//schedule these regions for full back-front rendering instead.
			STACK_REGION nonQuickFadableRegion;

			for(CWsSpriteBase * sprite = iSpriteList; sprite; sprite = sprite->Next())
				{
				nonQuickFadableRegion.AddRect(sprite->Rect());
				}

			for(CWsAnim * anim = iAnimList; anim; anim = anim->Next())
				{
				nonQuickFadableRegion.AddRect(anim->BestRect());
				}

			RWsTextCursor* const cursor = CWsTop::CurrentTextCursor();
			if( cursor && (cursor->Window()==this) && cursor->IsStandardCursorActive() )
				{
				nonQuickFadableRegion.AddRect(cursor->Rect());
				}

			//Any regions scheduled for fading but partly or fully covered by transparent windows above them
			STACK_REGION coveredFadableRegion;
			coveredFadableRegion.Copy(iFadableRegion);
			coveredFadableRegion.SubRegion(iQuickFadeRegion);
			nonQuickFadableRegion.Union(coveredFadableRegion);
			coveredFadableRegion.Close();

			nonQuickFadableRegion.Tidy();

			//Remove any regions not possible to quick fade from iQuickFadeRegion
			iQuickFadeRegion.SubRegion(nonQuickFadableRegion);

			if (!nonQuickFadableRegion.CheckError())
				{
				//Schedule normal drawing (full back to front rendering) for the region not possible to quick fade
				if (!nonQuickFadableRegion.IsEmpty())
					{ 
					iScreen->AddRedrawRegion(nonQuickFadableRegion, EFalse, ERedrawAll);
					}
				}
			else
				{
				//Schedule normal drawing for the whole iVisibleRegion if the calculations are broken
				iScreen->AddRedrawRegion(iVisibleRegion, EFalse, ERedrawAll);
				}
			nonQuickFadableRegion.Close();
			}
		}
	else
		{
		iQuickFadeRegion.Reset();
		}
	}