windowing/windowserver/nga/SERVER/openwfc/wnredraw.cpp
changeset 36 01a6848ebfd7
parent 0 5d03bc08d59c
--- a/windowing/windowserver/nga/SERVER/openwfc/wnredraw.cpp	Tue Feb 02 01:47:50 2010 +0200
+++ b/windowing/windowserver/nga/SERVER/openwfc/wnredraw.cpp	Fri Apr 16 16:21:04 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -252,13 +252,18 @@
 
 	for (CWsSpriteBase * sprite = iWsWin->iSpriteList; sprite; sprite = sprite->Next())
 		{
+        TBool hasRedrawBegun = EFalse;
 		STACK_REGION redrawRegion;
 		sprite->CalcRedrawRegion(aRegion, redrawRegion);
 		if(redrawRegion.CheckError() || !redrawRegion.IsEmpty())
 			{
 			if (sprite->IsFlashingEnabled() || sprite->IsDirty() || sprite->HasAnimation())
 				{
-				AnnotateSpriteRedrawStart(*iWsWin, *sprite, redrawRegion);
+                if (sprite->IsDirty() || sprite->HasAnimation())
+                    {
+                    AnnotateSpriteRedrawStart(*iWsWin, *sprite, redrawRegion);
+                    hasRedrawBegun = ETrue;
+                    }
 				
 				if(sprite->HasAnimation())
 					{
@@ -276,10 +281,16 @@
 					}
 				
 				//...call Redraw on the sprite
-				aGc->Reset();
+				if (hasRedrawBegun)
+				    {
+                    aGc->Reset();
+				    }
 				sprite->Redraw(aGc, redrawRegion);
 				
-				AnnotateSpriteRedrawEnd(*iWsWin, *sprite);
+				if (hasRedrawBegun)
+				    {
+                    AnnotateSpriteRedrawEnd(*iWsWin, *sprite);
+				    }
 				}
 			}
 		redrawRegion.Close();