os/graphics/windowing/windowserver/test/t_integ/src/t_pseuodappsurfacedwindow.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/t_integ/src/t_pseuodappsurfacedwindow.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,909 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent
    1.23 +*/
    1.24 +#include <e32const.h>	//KNullUidValue
    1.25 +#include <pixelformats.h>
    1.26 +#include "t_pseudoappsurfacedwindow.h"
    1.27 +
    1.28 +#include "t_testsurfacerasterizer.h"
    1.29 +#include "t_pseudoapputils.h"
    1.30 +#include "t_pseudoappscreen.h" //KScreenWindow
    1.31 +#include "t_pseudoappcfbsbitmapanim.h"
    1.32 +#include "t_pseudoappvganimation.h"
    1.33 +#include "t_pseudoappopenglanimation.h"
    1.34 +#include "t_pseudoappperformanceanim.h"
    1.35 +
    1.36 +
    1.37 +CTestSurfacedWindow* CTestSurfacedWindow::NewL(TInt aScreenNo, TInt aWindowNumber, TDisplayMode aMode, TInt aFrameDuration, const TSize& aScreenSize, TGceTestResults* aGceTestResults,
    1.38 +							const TDesC& aConfigFileName, CTPseudoAppShared& aPseudoAppShared)
    1.39 +	{
    1.40 +	RDebug::Print(_L("Creating CTestSurfacedWindow class\n"));
    1.41 +    CTestSurfacedWindow* self = new (ELeave) CTestSurfacedWindow(aScreenNo, aWindowNumber, aPseudoAppShared);
    1.42 +    CleanupStack::PushL(self);
    1.43 +    self->ConstructL(aScreenNo, aWindowNumber, aMode, aFrameDuration, aScreenSize, aGceTestResults, aConfigFileName);
    1.44 +    CleanupStack::Pop(); // self;
    1.45 +    return self;
    1.46 +	}
    1.47 +
    1.48 +void CTestSurfacedWindow::ConstructL(TInt aScreenNo, TInt aWindowNumber, TDisplayMode aMode, TInt aFrameDuration, const TSize& aScreenSize, TGceTestResults* aGceTestResults,
    1.49 +							const TDesC& aConfigFileName)
    1.50 +	{
    1.51 +	RDebug::Print(_L("Constructing CTestSurfacedWindow for screen %d\n"), aScreenNo);
    1.52 +
    1.53 +	//Create CIniData class for reading in values form ini files
    1.54 +	iUtils = CIniData::NewL(aConfigFileName);
    1.55 +
    1.56 +	TSize surfaceSize;
    1.57 +	TInt surfacePresent = 0;
    1.58 +	TPixelFormat pixelFormat  = EFormatRgb;
    1.59 +
    1.60 +	RDebug::Print(_L("Import configuration for ui window class and create it\n"));
    1.61 +	ImportWindowConfigL(aScreenNo, aWindowNumber, aMode, aFrameDuration, aScreenSize, aGceTestResults);
    1.62 +
    1.63 +	RDebug::Print(_L("Import configuration for test surface class and create it\n"));
    1.64 +	ImportSurfaceConfigL(aScreenNo, aWindowNumber, aScreenSize, surfaceSize, surfacePresent, pixelFormat);
    1.65 +	
    1.66 +	RDebug::Print(_L("Surface height = %d Surface Width = %d\n"),surfaceSize.iHeight, surfaceSize.iWidth);
    1.67 +
    1.68 +	RDebug::Print(_L("Import configuration for test animation class and create it\n"));
    1.69 +	ImportAnimConfigL(aScreenNo, aWindowNumber, aMode, surfaceSize, pixelFormat);
    1.70 +
    1.71 +	if(surfacePresent)
    1.72 +		{
    1.73 +		RDebug::Print(_L("Create Surface Rasterizer\n"));
    1.74 +		iSurfaceRasterizer = CTestSurfaceRasterizer::NewL(iSurfaceId, iSurfaceScreenNumber, &iSurfaceManager);
    1.75 +
    1.76 +		if(iSurfaceRasterizer == 0)
    1.77 +			{
    1.78 +			RDebug::Print(_L("Fatal error creating Surface Rasterizer, aborting\n"));
    1.79 +			User::Exit(0);
    1.80 +			}
    1.81 +		}
    1.82 +
    1.83 +	iGceTestResults = aGceTestResults;
    1.84 +	}
    1.85 +
    1.86 +CTestSurfacedWindow::CTestSurfacedWindow(TInt aScreenNo, TInt aWindowNumber, CTPseudoAppShared& aPseudoAppShared)
    1.87 +:iScreenNo(aScreenNo), iWindowNumber(aWindowNumber), iPseudoAppShared(aPseudoAppShared)
    1.88 +{
    1.89 +}
    1.90 +
    1.91 +void CTestSurfacedWindow::UpdateL(SurfaceDetails& aSurfDetails)
    1.92 +	{
    1.93 +	//Test to see if the surfaced window has an animation associated with it
    1.94 +	if(iTestAnimation)
    1.95 +		   {
    1.96 +		   iTestAnimation->DrawL(iSurfaceRasterizer, aSurfDetails);
    1.97 +		   }
    1.98 +
    1.99 +	//Draw the window last to avoid appearance of "black" surface
   1.100 +	iTestWindow->DrawL();
   1.101 +	}
   1.102 +
   1.103 +CTestSurfacedWindow::~CTestSurfacedWindow()
   1.104 +	{
   1.105 +	delete iUtils;
   1.106 +	if(iSizeArray)
   1.107 +		{
   1.108 +		TInt noElements = iSizeArray->Count();
   1.109 +		iSizeArray->Delete(0, noElements);
   1.110 +		delete iSizeArray;
   1.111 +		iSizeArray = 0;
   1.112 +		}
   1.113 +
   1.114 +	if(iPositionArray)
   1.115 +		{
   1.116 +		TInt noElements = iPositionArray->Count();
   1.117 +		iPositionArray->Delete(0, noElements);
   1.118 +		delete iPositionArray;
   1.119 +		iPositionArray = 0;
   1.120 +		}
   1.121 +
   1.122 +	if(iLoadsarects)
   1.123 +		{
   1.124 +		TInt noElements = iLoadsarects->Count();
   1.125 +		iLoadsarects->Delete(0, noElements);
   1.126 +		delete iLoadsarects;
   1.127 +		iLoadsarects = 0;
   1.128 +		}
   1.129 +
   1.130 +	if(iLoadsaParameters)
   1.131 +		{
   1.132 +		TInt noElements = iLoadsaParameters->Count();
   1.133 +		iLoadsaParameters->Delete(0, noElements);
   1.134 +		delete iLoadsaParameters;
   1.135 +		iLoadsaParameters = 0;
   1.136 +		}
   1.137 +
   1.138 +	delete iSurfaceRasterizer;
   1.139 +	delete iTestWindow;
   1.140 +	delete iTestAnimation;
   1.141 +
   1.142 +	DestroySurface();
   1.143 +	DestroySurfaceManager();
   1.144 +	}
   1.145 +
   1.146 +void CTestSurfacedWindow::RotateL(TInt aScreenNo, TInt aWindowNumber, const TSize& aScreenSize, TInt aFrameNumber)
   1.147 +	{
   1.148 +	if(iTestAnimation)
   1.149 +		{
   1.150 +		//Destroy the current surface and create a new surface with the new screen dimensions
   1.151 +		TSize surfaceSize;
   1.152 +		TInt surfacePresent = 0;
   1.153 +		TPixelFormat pixelFormat  = EFormatRgb;
   1.154 +
   1.155 +		delete iSurfaceRasterizer;
   1.156 +		delete iTestAnimation;
   1.157 +
   1.158 +		DestroySurface();
   1.159 +
   1.160 +		ImportSurfaceConfigL(aScreenNo, aWindowNumber, aScreenSize, surfaceSize, surfacePresent, pixelFormat);
   1.161 +
   1.162 +		RDebug::Print(_L("Surface height = %d Surface Width = %d\n"),surfaceSize.iHeight, surfaceSize.iWidth);
   1.163 +
   1.164 +		RDebug::Print(_L("Import configuration for test animation class and create it\n"));
   1.165 +		ImportAnimConfigL(0, 1, EColor16MA, surfaceSize, pixelFormat);
   1.166 +
   1.167 +		if(surfacePresent)
   1.168 +			{
   1.169 +			RDebug::Print(_L("Create Surface Rasterizer\n"));
   1.170 +
   1.171 +			iSurfaceRasterizer = CTestSurfaceRasterizer::NewL(iSurfaceId, iSurfaceScreenNumber, &iSurfaceManager);
   1.172 +
   1.173 +			if(iSurfaceRasterizer == 0)
   1.174 +				{
   1.175 +				RDebug::Print(_L("Fatal error creating Surface Rasterizer, aborting\n"));
   1.176 +				User::Exit(0);
   1.177 +				}
   1.178 +			}
   1.179 +
   1.180 +		if(iTestAnimation->RotationSupported())
   1.181 +			{
   1.182 +			//Continue animation from the last unrotated frame number
   1.183 +			iTestAnimation->SetFrameNumber(aFrameNumber);
   1.184 +			}
   1.185 +		}
   1.186 +
   1.187 +	iTestWindow->Rotate(aScreenSize);
   1.188 +	}
   1.189 +
   1.190 +TBool CTestSurfacedWindow::RotationSupported()
   1.191 +	{
   1.192 +	if(iPseudoAppShared.RotationSupported(iScreenNo, iWindowNumber, iSurfaceId))
   1.193 +		{
   1.194 +		if(iTestAnimation)
   1.195 +			{
   1.196 +			return iTestAnimation->RotationSupported();
   1.197 +			}
   1.198 +		else
   1.199 +			{
   1.200 +			//If no test animation is present, rotation is possible
   1.201 +			return ETrue;
   1.202 +			}
   1.203 +		}
   1.204 +	else
   1.205 +		{
   1.206 +		return EFalse;
   1.207 +		}
   1.208 +
   1.209 +	}
   1.210 +	
   1.211 +void CTestSurfacedWindow::ImportWindowConfigL(TInt aScreenNo, TInt aWindowNo, TDisplayMode aMode, TInt aFrameDuration, const TSize& aScreenSize, TGceTestResults* aGceTestResults)
   1.212 +	{
   1.213 +	TBuf<KMaxUiBitmapNameLength>	tempStore;
   1.214 +	tempStore.Format(KScreenWindowNumber, aScreenNo, aWindowNo);
   1.215 +
   1.216 +	TSize windowSize;
   1.217 +	TInt windowType;
   1.218 +	TInt windowChangeGeometry;
   1.219 +	TInt windowChangeBehavior;
   1.220 +
   1.221 +	tempStore.Format(KScreenWindowNumber, aScreenNo, aWindowNo);
   1.222 +
   1.223 +	READ_INI3A(tempStore,  type,  ui_window, ecom_window, empty_window,
   1.224 +	           windowType, EUiWindow, EEcomWindow, EEmptyWindow, iUtils);
   1.225 +
   1.226 +	//viewfinder and empty windows are both catered for by the CTestEmptyWindow class
   1.227 +	switch(windowType)
   1.228 +		{
   1.229 +		case EEcomWindow:
   1.230 +			{
   1.231 +			TPtrC multiBitmapEcomFile;
   1.232 +			TInt multiBitmapEcomFileSize;
   1.233 +
   1.234 +			READ_INI1A(tempStore, multi_bitmap_ecom_file, multiBitmapEcomFile, iUtils);
   1.235 +			READ_INI1A(tempStore, multi_bitmap_ecom_file_size, multiBitmapEcomFileSize, iUtils);
   1.236 +
   1.237 +			READ_INI5A(tempStore, window_change_geometry, none, size, position, position_and_size,
   1.238 +			           position_and_size_with_opacity, windowChangeGeometry, ENoChanges, EWindowSize,
   1.239 +			           EWindowPosition, EWindowPositionAndSize, EWindowPositionAndSizeWithOpacity, iUtils);
   1.240 +			READ_INI3A(tempStore, window_change_behavior, none, incremental, cyclic, windowChangeBehavior,
   1.241 +			           ENoChange, EIncremental, ECyclic, iUtils);
   1.242 +
   1.243 +		 	
   1.244 +
   1.245 +			iSizeArray = ImportWindowSizeChangeParamsL(tempStore);
   1.246 +			iPositionArray = ImportWindowPositionChangeParamsL(tempStore);
   1.247 +
   1.248 +			BuildDimensionArrayL(aScreenSize, aFrameDuration, windowChangeGeometry, windowChangeBehavior);
   1.249 +
   1.250 +	 		iTestWindow = CTestEcomWindow::NewL(aScreenNo, aMode, multiBitmapEcomFile, multiBitmapEcomFileSize, aGceTestResults, iLoadsaParameters);
   1.251 +			break;
   1.252 +			}
   1.253 +		case EEmptyWindow:
   1.254 +	 		{
   1.255 +	 		iTestWindow = CTestEmptyWindow::NewL(aScreenNo, aMode, aScreenSize);
   1.256 +	 		break;
   1.257 +	 		}
   1.258 +	 	case EUiWindow:
   1.259 +	 		{
   1.260 +			TPtrC multiBitmapUiFile;
   1.261 +			TInt multiBitmapUiFileSize;
   1.262 +			TInt multiBitmapUiFileTransparency;
   1.263 +
   1.264 +			READ_INI1A(tempStore, multi_bitmap_ui_file, multiBitmapUiFile, iUtils);
   1.265 +			READ_INI1A(tempStore, multi_bitmap_ui_file_size, multiBitmapUiFileSize, iUtils);
   1.266 +			READ_INI2A(tempStore, multi_bitmap_ui_file_transparency, True,  False,
   1.267 +	                   multiBitmapUiFileTransparency, ETrue, EFalse, iUtils);
   1.268 +			READ_INI5A(tempStore, window_change_geometry, none, size, position, position_and_size,
   1.269 +			           position_and_size_with_opacity, windowChangeGeometry, ENoChanges, EWindowSize,
   1.270 +			           EWindowPosition, EWindowPositionAndSize, EWindowPositionAndSizeWithOpacity, iUtils);
   1.271 +			READ_INI3A(tempStore, window_change_behavior, none, incremental, cyclic, windowChangeBehavior,
   1.272 +			           ENoChange, EIncremental, ECyclic, iUtils);
   1.273 +
   1.274 +
   1.275 +			iSizeArray = ImportWindowSizeChangeParamsL(tempStore);
   1.276 +			iPositionArray = ImportWindowPositionChangeParamsL(tempStore);
   1.277 +
   1.278 +			BuildDimensionArrayL(aScreenSize, aFrameDuration, windowChangeGeometry, windowChangeBehavior);
   1.279 +
   1.280 +			iLoadsarects = ImportWindowBitmapParamsL(tempStore, multiBitmapUiFileSize, aScreenSize);
   1.281 +
   1.282 +			iTestWindow = CTestUiWindow::NewL(aScreenNo, aMode, multiBitmapUiFile, multiBitmapUiFileSize, iLoadsarects,
   1.283 +											  aFrameDuration,
   1.284 +											  multiBitmapUiFileTransparency,
   1.285 +											  aGceTestResults, iLoadsaParameters);
   1.286 +			break;
   1.287 +	 		}
   1.288 +	 	default:
   1.289 +	 		{
   1.290 +			break;	//Cannot reach default, Lint warning removal only
   1.291 +			}
   1.292 +		}
   1.293 +	}
   1.294 +
   1.295 +void CTestSurfacedWindow::ImportSurfaceConfigL(TInt aScreenNo, TInt aWindowNo, const TSize& aScreenSize, TSize& aSurfaceSize, TInt& aSurfacePresent, TPixelFormat& aPixelFormat)
   1.296 +	{
   1.297 +	TBuf<KMaxUiBitmapNameLength>	tempStore;
   1.298 +	tempStore.Format(KScreenSurface, aScreenNo, aWindowNo);
   1.299 +
   1.300 +	TInt shareScreenNumber;
   1.301 +	TInt shareWindowNumber;
   1.302 +
   1.303 +	// Check to see if window is sharing surface with another window
   1.304 +	TBool shareSurface = TImportScreenConfig::GetShareSurfaceInfoL(aScreenNo, aWindowNo, shareScreenNumber, shareWindowNumber, iUtils);
   1.305 +
   1.306 +	// Check to see if this window already has a SurfaceId allocated for it s
   1.307 +	iSurfaceId = iPseudoAppShared.GetSurfaceId(aScreenNo, aWindowNo);
   1.308 +	
   1.309 +	if(shareSurface && iSurfaceId.IsNull())
   1.310 +		{
   1.311 +		// SurfaceId not found, but check to see if the sharing window already has a SurfaceId allocated for it
   1.312 +		iSurfaceId = iPseudoAppShared.GetSurfaceId(shareScreenNumber, shareWindowNumber);
   1.313 +		}
   1.314 +
   1.315 +	if(!iSurfaceId.IsNull())
   1.316 +		{
   1.317 +		// SurfaceId found - open surface to use with this window
   1.318 +		
   1.319 +		//Create a surface manager session
   1.320 +		CreateSurfaceManager();
   1.321 +
   1.322 +		iSurfaceManager.OpenSurface(iSurfaceId);
   1.323 +		RSurfaceManager::TInfoBuf infoBuf;
   1.324 +		User::LeaveIfError(KErrNone == iSurfaceManager.SurfaceInfo(iSurfaceId, infoBuf));
   1.325 +		RSurfaceManager::TSurfaceInfoV01& info = infoBuf();
   1.326 +		aSurfaceSize = info.iSize;
   1.327 +		if(info.iPixelFormat == EUidPixelFormatYUV_422Interleaved)
   1.328 +			{
   1.329 +			aPixelFormat =EFormatYuv;
   1.330 +			}
   1.331 +		aSurfacePresent = ETrue;
   1.332 +		shareSurface = ETrue;
   1.333 +		}
   1.334 +	else
   1.335 +		{
   1.336 +		// SurfaceId not found - create surface to use with this window
   1.337 +
   1.338 +		READ_INI2A(tempStore, surface_present, True, False, aSurfacePresent, ETrue, EFalse, iUtils);
   1.339 +		READ_INI1A(tempStore, sneeky_surface_height, aSurfaceSize.iHeight, iUtils);
   1.340 +		READ_INI1A(tempStore, surface_width, aSurfaceSize.iWidth, iUtils);
   1.341 +	
   1.342 +		//Convert surface size percentages to pixel sizes
   1.343 +		if(aScreenSize.iWidth <= 0)
   1.344 +			{
   1.345 +			RDebug::Print(_L("surface_width is zero or less, quitting\n"));
   1.346 +			User::Exit(0);
   1.347 +			}
   1.348 +		else
   1.349 +			{
   1.350 +			aSurfaceSize.iWidth = aSurfaceSize.iWidth*aScreenSize.iWidth/100;
   1.351 +			}
   1.352 +	
   1.353 +		if(aScreenSize.iHeight <= 0)
   1.354 +			{
   1.355 +			RDebug::Print(_L("surface_height is zero or less, quitting\n"));
   1.356 +			User::Exit(0);
   1.357 +			}
   1.358 +		else
   1.359 +			{
   1.360 +			aSurfaceSize.iHeight = aSurfaceSize.iHeight*aScreenSize.iHeight/100;
   1.361 +			}
   1.362 +
   1.363 +		if(!aSurfacePresent && !shareSurface)
   1.364 +			{
   1.365 +			RDebug::Print(_L("Screen %d, Window %d has no backgroung surface\n"),aScreenNo, aWindowNo);
   1.366 +			return;
   1.367 +			}
   1.368 +
   1.369 +		RDebug::Print(_L("Setting up surface attributes\n"));
   1.370 +		TInt bytesPerPixel;
   1.371 +		TInt pixelFormat;
   1.372 +		RSurfaceManager::TSurfaceCreationAttributesBuf attribBuf;
   1.373 +		RSurfaceManager::TSurfaceCreationAttributes& buffer = attribBuf();
   1.374 +	    buffer.iMappable = ETrue;
   1.375 +
   1.376 +		READ_INI4A(tempStore, surface_pixel_format, EUidPixelFormatARGB_8888, EUidPixelFormatRGB_565, EUidPixelFormatARGB_8888_PRE,
   1.377 +		           EUidPixelFormatYUV_422Interleaved, pixelFormat, EUidPixelFormatARGB_8888, EUidPixelFormatRGB_565, EUidPixelFormatARGB_8888_PRE,
   1.378 +		           EUidPixelFormatYUV_422Interleaved, iUtils);
   1.379 +		READ_INI1A(tempStore, surface_bytes_per_pixel, bytesPerPixel, iUtils);
   1.380 +		READ_INI1A(tempStore, surface_offset_to_first_buffer, buffer.iOffsetToFirstBuffer, iUtils);
   1.381 +		READ_INI1A(tempStore, surface_alignment, buffer.iAlignment, iUtils);
   1.382 +		READ_INI2A(tempStore, surface_contiguous, True, False, buffer.iContiguous, ETrue, EFalse, iUtils);
   1.383 +		READ_INI1A(tempStore, surface_buffer_number, buffer.iBuffers, iUtils);
   1.384 +	
   1.385 +		buffer.iPixelFormat = static_cast<TUidPixelFormat>(pixelFormat);
   1.386 +		iSurfaceBufferNumber = buffer.iBuffers;
   1.387 +		iSurfaceScreenNumber = aScreenNo;
   1.388 +		if(buffer.iPixelFormat == EUidPixelFormatYUV_422Interleaved)
   1.389 +			{
   1.390 +			aPixelFormat =EFormatYuv;
   1.391 +			}
   1.392 +	
   1.393 +		//Assign size attribute to surface size calculated above
   1.394 +		buffer.iSize = aSurfaceSize;
   1.395 +	
   1.396 +		//Calculate required stride
   1.397 +		buffer.iStride = buffer.iSize.iWidth * bytesPerPixel;
   1.398 +		RDebug::Print(_L("Stride is %d\n"),buffer.iStride);
   1.399 +
   1.400 +		//Create a surface manager session
   1.401 +		CreateSurfaceManager();
   1.402 +
   1.403 +		RDebug::Print(_L("Call to CreateSurface()\n"));
   1.404 +		TInt err = iSurfaceManager.CreateSurface(attribBuf, iSurfaceId);
   1.405 +		if (err != KErrNone)
   1.406 +			{
   1.407 +			RDebug::Print(_L("Error creating surface, aborting\n"));
   1.408 +			User::Exit(0);
   1.409 +			}
   1.410 +		}
   1.411 +
   1.412 +	//Assign the created surface to be the window background - surface needs to be open to do this ?????
   1.413 +	//Window must be activated at this point for the correct screen mode to be applied
   1.414 +	RDebug::Print(_L("Set Background Surface on the window\n"));
   1.415 +
   1.416 +	TInt ret = iTestWindow->Window()->SetBackgroundSurface(iSurfaceId);
   1.417 +	if(ret != KErrNone)
   1.418 +		{
   1.419 +		RDebug::Print(_L("Error associating surface with window, SetBackgroundSurface returns %d aborting\n"), ret);
   1.420 +	 	User::Exit(0);
   1.421 +	 	}
   1.422 +
   1.423 +	// Update PseudoAppShared SurfaceId array
   1.424 +	iPseudoAppShared.SetSurfaceIdL(aScreenNo, aWindowNo, iSurfaceId);
   1.425 +	if(shareSurface)
   1.426 +		{
   1.427 +		iPseudoAppShared.SetSurfaceIdL(shareScreenNumber, shareWindowNumber, iSurfaceId);
   1.428 +		}
   1.429 +	}
   1.430 +
   1.431 +void CTestSurfacedWindow::ImportAnimConfigL(TInt aScreenNo, TInt aWindowNo, TDisplayMode aMode, const TSize& aSurfaceSize, TPixelFormat aPixelFormat)
   1.432 +	{
   1.433 +	TInt applicationType;
   1.434 +	TBuf<KMaxUiBitmapNameLength>	tempStore;
   1.435 +	tempStore.Format(KScreenAnimation, aScreenNo, aWindowNo);
   1.436 +
   1.437 +	READ_INI5A(tempStore, application_type, none,   cfbsbitmap, openvg,  opengles,  performance,
   1.438 +               applicationType,  ENoApp, EFbsBitmap, EOpenVG, EOpenGLes, EPerformance, iUtils);
   1.439 +
   1.440 +	if(applicationType == ENoApp)
   1.441 +		{
   1.442 +		RDebug::Print(_L("Screen %d, Window %d has no surface animation\n"),aScreenNo, aWindowNo);
   1.443 +		return;
   1.444 +		}
   1.445 +
   1.446 +	TInt imageSize;
   1.447 +	TPtrC multiBitmapAnimFile;
   1.448 +	TInt verticalRate;
   1.449 +	TInt horizontalRate;
   1.450 +
   1.451 +	//Read in the values from the ini file, taking specified action on failure
   1.452 +	READ_INI1A(tempStore, image_size, imageSize, iUtils);
   1.453 +	READ_INI1A(tempStore, multi_bitmap_anim_file, multiBitmapAnimFile, iUtils);
   1.454 +	READ_INI1A(tempStore, vertical_frames_per_traverse, verticalRate, iUtils);
   1.455 +	READ_INI1A(tempStore, horizontal_frames_per_traverse, horizontalRate, iUtils);
   1.456 +
   1.457 +	//Ensure the animation step sizes are sub-multiples of the frame dimensions
   1.458 +	TImportScreenConfig::VerifyFramesPerTraverse(horizontalRate, aSurfaceSize.iWidth);
   1.459 +	TImportScreenConfig::VerifyFramesPerTraverse(verticalRate, aSurfaceSize.iHeight);
   1.460 +
   1.461 +	//Convert image size percentage into a pixel size
   1.462 +	if(imageSize <= 0)
   1.463 +		{
   1.464 +		RDebug::Print(_L("image_size is zero or less, quitting\n"));
   1.465 +		User::Exit(0);
   1.466 +		}
   1.467 +	else
   1.468 +		{
   1.469 +		//Scale the bitmap to the short screen dimension
   1.470 +		if(aSurfaceSize.iWidth > aSurfaceSize.iHeight)
   1.471 +			{
   1.472 +			imageSize = imageSize*aSurfaceSize.iHeight/100;
   1.473 +			}
   1.474 +		else
   1.475 +			{
   1.476 +			imageSize = imageSize*aSurfaceSize.iWidth/100;
   1.477 +			}
   1.478 +		}
   1.479 +
   1.480 +	iTestAnimation = CreateAnimationL(applicationType, TSize(imageSize,imageSize),
   1.481 +		                              aSurfaceSize, multiBitmapAnimFile, aMode,
   1.482 +		                              horizontalRate, verticalRate, aPixelFormat);
   1.483 +	}
   1.484 +
   1.485 +
   1.486 +CTestAnimation*  CTestSurfacedWindow::CreateAnimationL(TInt aAppType, const TSize& aAnimSize, const TSize& aSurfaceSize,
   1.487 +                                                       TPtrC& aBitmapFile, TDisplayMode aDisplayMode,
   1.488 +                                                       TInt aHorizontalRate, TInt aVerticalRate,
   1.489 +                                                       TPixelFormat aPixelFormat)
   1.490 +	{
   1.491 +	CTestAnimation* anim = 0;
   1.492 +	switch(aAppType)
   1.493 +		{
   1.494 +		case EFbsBitmap:
   1.495 +			{
   1.496 +			anim = CCFbsBitmapAnimation::NewL(aDisplayMode,
   1.497 +			                                  aAnimSize,
   1.498 +			                                  aSurfaceSize,
   1.499 +			                                  aBitmapFile,
   1.500 +			                                  aHorizontalRate,
   1.501 +			                                  aVerticalRate,
   1.502 +			                                  aPixelFormat);
   1.503 +			break;
   1.504 +			}
   1.505 +
   1.506 +		case EOpenVG:
   1.507 +			{
   1.508 +			anim = CVgAnimation::NewL(iTestWindow->Window(),
   1.509 +									  aDisplayMode,
   1.510 +			                          aSurfaceSize,
   1.511 +			                          aHorizontalRate,
   1.512 +			                          aVerticalRate);
   1.513 +			break;
   1.514 +			}
   1.515 +		case EOpenGLes:
   1.516 +			{
   1.517 +			anim = COpenGLAnimation::NewL(iTestWindow->Window(),
   1.518 +										  aDisplayMode,
   1.519 +				                          aSurfaceSize,
   1.520 +				                          aHorizontalRate,
   1.521 +				                          aVerticalRate);
   1.522 +			break;
   1.523 +			}
   1.524 +
   1.525 +		case EPerformance:
   1.526 +			{
   1.527 +			anim = CPerformanceAnimation::NewL();
   1.528 +			break;
   1.529 +			}
   1.530 +		case ENoApp:
   1.531 +			{
   1.532 +			break;
   1.533 +			}
   1.534 +		default:
   1.535 +			{
   1.536 +			break;	//Cannot reach the default, Lint warning removal purposes only
   1.537 +			}
   1.538 +		}
   1.539 +	return anim;
   1.540 +	}
   1.541 +
   1.542 +CArrayFixFlat<TRect>* CTestSurfacedWindow::ImportWindowBitmapParamsL(const TDesC& tempStore, TInt aMultiBitmapUiFileSize, const TSize& aScreenSize)
   1.543 +	{
   1.544 +	TBuf<KMaxUiBitmapNameLength>	temp;
   1.545 +	TBuf<KMaxUiBitmapNameLength>	tempStore1;
   1.546 +
   1.547 +	CArrayFixFlat<TRect>* loadsarects = new (ELeave) CArrayFixFlat<TRect>(1);
   1.548 +
   1.549 +	for(TInt i=0; i<aMultiBitmapUiFileSize; i++)
   1.550 +		{
   1.551 +		TPtrC rectString;
   1.552 +		TRect aRect;
   1.553 +
   1.554 +		tempStore1.Format(KUiBitmapScaling, i);
   1.555 +		temp = tempStore;
   1.556 +		temp.Append(tempStore1);
   1.557 +
   1.558 +		TImportScreenConfig::ReadIni(temp, rectString, iUtils);
   1.559 +
   1.560 +		if(TImportScreenConfig::ExtractRect(rectString, aRect, aScreenSize) == KErrNone)
   1.561 +			{
   1.562 +			loadsarects->ExtendL() = aRect;
   1.563 +			}
   1.564 +		else
   1.565 +			{
   1.566 +			RDebug::Print(_L("Cannot determine rectangle dimensions from string: %s\n"), rectString.Ptr());
   1.567 +			RDebug::Print(_L("Undefined behavior may result\n"));
   1.568 +			}
   1.569 +		}
   1.570 +	return loadsarects;
   1.571 +	}
   1.572 +
   1.573 +CArrayFixFlat<TInt>* CTestSurfacedWindow::ImportWindowSizeChangeParamsL(const TDesC& tempStore)
   1.574 +	{
   1.575 +	TBuf<KMaxUiBitmapNameLength> temp = tempStore;
   1.576 +	CArrayFixFlat<TInt>* intArray = new (ELeave) CArrayFixFlat<TInt>(1);
   1.577 +
   1.578 +	TInt windowSizeValues;
   1.579 +	TBuf<KMaxUiBitmapNameLength>	tempStore1;
   1.580 +
   1.581 +	READ_INI1A(tempStore, window_size_values, windowSizeValues, iUtils);
   1.582 +
   1.583 +	TInt windowSize;
   1.584 +	for(TInt i=1; i<windowSizeValues+1; i++)
   1.585 +		{
   1.586 +		tempStore1.Format(KWindowSizes, i);
   1.587 +		temp = tempStore;
   1.588 +		temp.Append(tempStore1);
   1.589 +		TImportScreenConfig::ReadIni(temp, windowSize, iUtils);
   1.590 +		intArray->ExtendL() = windowSize;
   1.591 +		}
   1.592 +
   1.593 +	return intArray;
   1.594 +	}
   1.595 +
   1.596 +CArrayFixFlat<TInt>* CTestSurfacedWindow::ImportWindowPositionChangeParamsL(const TDesC& tempStore)
   1.597 +	{
   1.598 +	TBuf<KMaxUiBitmapNameLength> temp = tempStore;
   1.599 +	CArrayFixFlat<TInt>* intArray = new (ELeave) CArrayFixFlat<TInt>(1);
   1.600 +
   1.601 +	TInt windowPositionValues;
   1.602 +	TBuf<KMaxUiBitmapNameLength>	tempStore1;
   1.603 +
   1.604 +	READ_INI1A(tempStore, window_position_values, windowPositionValues, iUtils);
   1.605 +
   1.606 +	for(TInt i=1; i<windowPositionValues+1; i++)
   1.607 +		{
   1.608 +		TPoint point;
   1.609 +		TPtrC windowPosition;
   1.610 +		tempStore1.Format(KWindowPositions, i);
   1.611 +		temp = tempStore;
   1.612 +		temp.Append(tempStore1);
   1.613 +		TImportScreenConfig::ReadIni(temp, windowPosition, iUtils);
   1.614 +		if(TImportScreenConfig::ExtractPoint(windowPosition, point) == KErrNone)
   1.615 +			{
   1.616 +
   1.617 +			intArray->ExtendL() = point.iX;
   1.618 +			intArray->ExtendL() = point.iY;
   1.619 +			}
   1.620 +		else
   1.621 +			{
   1.622 +			RDebug::Print(_L("Cannot determine point dimensions from string: %s\n"), windowPosition.Ptr());
   1.623 +			RDebug::Print(_L("Undefined behavior may result\n"));
   1.624 +			}
   1.625 +		}
   1.626 +	return intArray;
   1.627 +	}
   1.628 +
   1.629 +void CTestSurfacedWindow::CreateSurfaceManager()
   1.630 +	{
   1.631 +	RDebug::Print(_L("Create Surface Manager\n"));
   1.632 +
   1.633 +	TInt ret;
   1.634 +
   1.635 +	RDebug::Print(_L("Loading the device driver and Opening the Logical Channel\n"));
   1.636 +	ret = iSurfaceManager.Open();
   1.637 +	if(ret==KErrNone)
   1.638 +		{
   1.639 +		RDebug::Print(_L("Surface manager opened ok\n"));
   1.640 +		}
   1.641 +	else
   1.642 +		{
   1.643 +		RDebug::Print(_L("Error opening surface manager\n"));
   1.644 +		}
   1.645 +	}
   1.646 +
   1.647 +void CTestSurfacedWindow::DestroySurfaceManager()
   1.648 +	{
   1.649 +	RDebug::Print(_L("Close the Logical Channel\n"));
   1.650 +	iSurfaceManager.Close();
   1.651 +	}
   1.652 +
   1.653 +void CTestSurfacedWindow::DestroySurface()
   1.654 +	{
   1.655 +	// Remove SurfaceId entry from surface array
   1.656 +	iPseudoAppShared.RemoveSurfaceIdEntry(iScreenNo, iWindowNumber);
   1.657 +
   1.658 +	RDebug::Print(_L("Closing surface\n"));
   1.659 +	TInt ret = iSurfaceManager.CloseSurface(iSurfaceId);
   1.660 +
   1.661 +	if(ret!=KErrNone)
   1.662 +		{
   1.663 +		RDebug::Print(_L("Surface failed to close\n"));
   1.664 +		}
   1.665 +	}
   1.666 +
   1.667 +void CTestSurfacedWindow::BuildDimensionArrayL(const TSize& aScreenSize, TInt aFrameDuration, TInt aWindowChangeGeometry, TInt aWindowChangeBehavior)
   1.668 +	{
   1.669 +	TInt indexX;
   1.670 +	TInt indexY;
   1.671 +
   1.672 +	iLoadsaParameters = new (ELeave) CArrayFixFlat<TDrawParameters>(1);
   1.673 +
   1.674 +	TDrawParameters drawParams;
   1.675 +
   1.676 +	for(TInt i=0; i<aFrameDuration; i++)
   1.677 +		{
   1.678 +		if(i)
   1.679 +			{
   1.680 +			drawParams = (*iLoadsaParameters)[i - 1];
   1.681 +			}
   1.682 +		else
   1.683 +			{
   1.684 +			drawParams.iWindowSize = TSize((aScreenSize.iWidth * (*iSizeArray)[0])/100,
   1.685 +			                         	   (aScreenSize.iHeight * (*iSizeArray)[0])/100);
   1.686 +			drawParams.iWindowPos = TPoint((aScreenSize.iWidth * (*iPositionArray)[0])/100,
   1.687 +			                         	   (aScreenSize.iHeight * (*iPositionArray)[1])/100);
   1.688 +			drawParams.iBitmapScale = (*iSizeArray)[0];
   1.689 +			drawParams.iBitmapAlpha = 127;
   1.690 +			}
   1.691 +
   1.692 +		switch(aWindowChangeBehavior)
   1.693 +			{
   1.694 +			case ECyclic:
   1.695 +				{
   1.696 +				switch(aWindowChangeGeometry)
   1.697 +					{
   1.698 +					case ENoChanges:
   1.699 +						{
   1.700 +						drawParams.iWindowSize = aScreenSize;
   1.701 +						break;
   1.702 +						}
   1.703 +					case EWindowSize:
   1.704 +						{
   1.705 +						if(i < aFrameDuration/2)
   1.706 +							{
   1.707 +							drawParams.iBitmapScale = (*iSizeArray)[0] + (2*((*iSizeArray)[1] - (*iSizeArray)[0])*i)/aFrameDuration;
   1.708 +							}
   1.709 +						else
   1.710 +							{
   1.711 +							drawParams.iBitmapScale = 2*((*iSizeArray)[1]) - (*iSizeArray)[0] + (2*((*iSizeArray)[0] - (*iSizeArray)[1])*i)/aFrameDuration;
   1.712 +							}
   1.713 +
   1.714 +						drawParams.iWindowSize = TSize( (aScreenSize.iWidth*drawParams.iBitmapScale)/100,
   1.715 +														(aScreenSize.iHeight*drawParams.iBitmapScale)/100 );
   1.716 +
   1.717 +						break;
   1.718 +						}
   1.719 +					case EWindowPosition:
   1.720 +						{
   1.721 +						ParamChangeCyclicPosition(drawParams, i, aFrameDuration, aScreenSize);
   1.722 +						break;
   1.723 +						}
   1.724 +					case EWindowPositionAndSize:
   1.725 +						{
   1.726 +						ParamChangeCyclicPositionAndSize(drawParams, i, aFrameDuration, aScreenSize);
   1.727 +						break;
   1.728 +						}
   1.729 +					default:
   1.730 +						{
   1.731 +						break;
   1.732 +						}
   1.733 +					}
   1.734 +				break;
   1.735 +				}
   1.736 +			case EIncremental:
   1.737 +				{
   1.738 +				switch(aWindowChangeGeometry)
   1.739 +					{
   1.740 +					case ENoChanges:
   1.741 +						{
   1.742 +						break;
   1.743 +						}
   1.744 +					case EWindowSize:
   1.745 +						{
   1.746 +						drawParams.iBitmapScale = (*iSizeArray)[ (i*(iSizeArray->Count()))/aFrameDuration];
   1.747 +						drawParams.iWindowSize = TSize( (aScreenSize.iWidth*drawParams.iBitmapScale)/100,
   1.748 +														(aScreenSize.iHeight*drawParams.iBitmapScale)/100 );
   1.749 +						break;
   1.750 +						}
   1.751 +					case EWindowPosition:
   1.752 +						{
   1.753 +						indexX = 2*((((i*(iPositionArray->Count()/2))))/aFrameDuration);
   1.754 +						indexY = 2*((((i*(iPositionArray->Count()/2))))/aFrameDuration) + 1;
   1.755 +						drawParams.iWindowPos.iX = (aScreenSize.iWidth * (*iPositionArray)[indexX])/100;
   1.756 +						drawParams.iWindowPos.iY = (aScreenSize.iHeight * (*iPositionArray)[indexY])/100;
   1.757 +						break;
   1.758 +						}
   1.759 +					case EWindowPositionAndSize:
   1.760 +						{
   1.761 +						drawParams.iBitmapScale = (*iSizeArray)[ (i*(iSizeArray->Count()))/aFrameDuration];
   1.762 +						drawParams.iWindowSize = TSize( (aScreenSize.iWidth*drawParams.iBitmapScale)/100,
   1.763 +														(aScreenSize.iHeight*drawParams.iBitmapScale)/100 );
   1.764 +
   1.765 +						indexX = 2*((((i*(iPositionArray->Count()/2))))/aFrameDuration);
   1.766 +						indexY = 2*((((i*(iPositionArray->Count()/2))))/aFrameDuration) + 1;
   1.767 +						drawParams.iWindowPos.iX = (aScreenSize.iWidth * (*iPositionArray)[indexX])/100;
   1.768 +						drawParams.iWindowPos.iY = (aScreenSize.iHeight * (*iPositionArray)[indexY])/100;
   1.769 +						break;
   1.770 +						}
   1.771 +					case EWindowPositionAndSizeWithOpacity:
   1.772 +						{
   1.773 +						ParamChangeOpacity(i, aFrameDuration, drawParams);
   1.774 +						drawParams.iBitmapScale = (*iSizeArray)[ (i*(iSizeArray->Count()))/aFrameDuration];
   1.775 +						drawParams.iWindowSize = TSize( (aScreenSize.iWidth*drawParams.iBitmapScale)/100,
   1.776 +														(aScreenSize.iHeight*drawParams.iBitmapScale)/100 );
   1.777 +
   1.778 +						indexX = 2*((((i*(iPositionArray->Count()/2))))/aFrameDuration);
   1.779 +						indexY = 2*((((i*(iPositionArray->Count()/2))))/aFrameDuration) + 1;
   1.780 +						drawParams.iWindowPos.iX = (aScreenSize.iWidth * (*iPositionArray)[indexX])/100;
   1.781 +						drawParams.iWindowPos.iY = (aScreenSize.iHeight * (*iPositionArray)[indexY])/100;
   1.782 +						break;
   1.783 +						}
   1.784 +					default:
   1.785 +						{
   1.786 +						break;
   1.787 +						}
   1.788 +					}
   1.789 +				break;
   1.790 +				}
   1.791 +
   1.792 +			case ENoChange:
   1.793 +			default:
   1.794 +				{
   1.795 +				break;
   1.796 +				}
   1.797 +			}
   1.798 +
   1.799 +		iLoadsaParameters->ExtendL() = drawParams;
   1.800 +		}
   1.801 +	}
   1.802 +
   1.803 +void CTestSurfacedWindow::ParamChangeCyclicPosition(TDrawParameters& aDrawParams, TInt aFrameCounter, TInt aFrameDuration, const TSize& aScreenSize)
   1.804 +	{
   1.805 +	TInt increment = (aScreenSize.iHeight * (100 - (*iSizeArray)[0]) +
   1.806 +	                  aScreenSize.iWidth  * (100 - (*iSizeArray)[0]))/(aFrameDuration * 25);
   1.807 +
   1.808 +	if(aFrameCounter < (aFrameDuration/2 - 1))
   1.809 +		{
   1.810 +		CalcNewWindowLocation(aScreenSize, increment, 1, aDrawParams);
   1.811 +		}
   1.812 +	else if(aFrameCounter != (aFrameDuration - 1))
   1.813 +		{
   1.814 +		CalcNewWindowLocation(aScreenSize, increment, -1, aDrawParams);
   1.815 +		}
   1.816 +	else
   1.817 +		{
   1.818 +		aDrawParams.iWindowPos.iY -= increment;
   1.819 +		}
   1.820 +	}
   1.821 +
   1.822 +void CTestSurfacedWindow::ParamChangeCyclicPositionAndSize(TDrawParameters& aDrawParams, TInt aFrameCounter, TInt aFrameDuration, const TSize& aScreenSize)
   1.823 +	{
   1.824 +	TInt incrementX = 2*aScreenSize.iWidth/aFrameDuration;
   1.825 +	TInt incrementY = 2*aScreenSize.iHeight/aFrameDuration;
   1.826 +	TSize incrementSize(incrementX, incrementY);
   1.827 +	TInt eigth = aFrameDuration/8;
   1.828 +
   1.829 +	if(aFrameCounter < eigth)
   1.830 +		{
   1.831 +		aDrawParams.iWindowSize -= incrementSize;
   1.832 +		aDrawParams.iWindowPos.iY += incrementY;
   1.833 +		aDrawParams.iWindowPos.iX = 0;
   1.834 +		}
   1.835 +	else if( (aFrameCounter >= eigth) && (aFrameCounter < 2*eigth) )
   1.836 +		{
   1.837 +		aDrawParams.iWindowSize -= incrementSize;
   1.838 +		aDrawParams.iWindowPos.iY += incrementY;
   1.839 +		aDrawParams.iWindowPos.iX += 2*incrementX;
   1.840 +		}
   1.841 +	else if( (aFrameCounter >= 2*eigth) && (aFrameCounter < 3*eigth) )
   1.842 +		{
   1.843 +		aDrawParams.iWindowSize -= incrementSize;
   1.844 +		aDrawParams.iWindowPos.iY -= 2*incrementY;
   1.845 +		aDrawParams.iWindowPos.iX += incrementX;
   1.846 +		}
   1.847 +	else if( (aFrameCounter >= 3*eigth) && (aFrameCounter < 4*eigth) )
   1.848 +		{
   1.849 +		aDrawParams.iWindowSize -= incrementSize;
   1.850 +		aDrawParams.iWindowPos.iY = 0;
   1.851 +		aDrawParams.iWindowPos.iX -= 3*incrementX;
   1.852 +		}
   1.853 +	else if( (aFrameCounter >= 4*eigth) && (aFrameCounter < 5*eigth) )
   1.854 +		{
   1.855 +		aDrawParams.iWindowSize += incrementSize;
   1.856 +		aDrawParams.iWindowPos.iY = 0;
   1.857 +		aDrawParams.iWindowPos.iX += 3*incrementX;
   1.858 +		}
   1.859 +	else if( (aFrameCounter >= 5*eigth) && (aFrameCounter < 6*eigth) )
   1.860 +		{
   1.861 +		aDrawParams.iWindowSize += incrementSize;
   1.862 +		aDrawParams.iWindowPos.iY += 2*incrementY;
   1.863 +		aDrawParams.iWindowPos.iX -= incrementX;
   1.864 +		}
   1.865 +	else if( (aFrameCounter >= 6*eigth) && (aFrameCounter < 7*eigth) )
   1.866 +		{
   1.867 +		aDrawParams.iWindowSize += incrementSize;
   1.868 +		aDrawParams.iWindowPos.iY -= incrementY;
   1.869 +		aDrawParams.iWindowPos.iX -= 2*incrementX;
   1.870 +		}
   1.871 +	else
   1.872 +		{
   1.873 +		aDrawParams.iWindowSize += incrementSize;
   1.874 +		aDrawParams.iWindowPos.iY -= incrementY;
   1.875 +		aDrawParams.iWindowPos.iX = 0;
   1.876 +		}
   1.877 +	}
   1.878 +
   1.879 +void CTestSurfacedWindow::ParamChangeOpacity(TInt aFrameCounter, TInt aFrameDuration, TDrawParameters& aDrawParams)
   1.880 +	{
   1.881 +	TInt alpha = (512 * aFrameCounter)/(aFrameDuration);
   1.882 +	if(alpha > 255)
   1.883 +		{
   1.884 +		alpha = 511 - alpha;
   1.885 +		}
   1.886 +
   1.887 +	aDrawParams.iBitmapAlpha = alpha;
   1.888 +	}
   1.889 +
   1.890 +void CTestSurfacedWindow::CalcNewWindowLocation(const TSize& aScreensize, TInt aIncrement, TInt aDirection,TDrawParameters& aDrawParams)
   1.891 +	{
   1.892 +	if(aDrawParams.iWindowPos.iX <= 0)
   1.893 +		{
   1.894 +		aDrawParams.iWindowPos.iX = 0;
   1.895 +		aDrawParams.iWindowPos.iY += aIncrement*aDirection;
   1.896 +		}
   1.897 +	if((aDrawParams.iWindowPos.iY + aDrawParams.iWindowSize.iHeight) >= aScreensize.iHeight)
   1.898 +		{
   1.899 +		aDrawParams.iWindowPos.iY = aScreensize.iHeight - aDrawParams.iWindowSize.iHeight;
   1.900 +		aDrawParams.iWindowPos.iX += aIncrement*aDirection;
   1.901 +		}
   1.902 +	if((aDrawParams.iWindowPos.iX + aDrawParams.iWindowSize.iWidth) >= aScreensize.iWidth)
   1.903 +		{
   1.904 +		aDrawParams.iWindowPos.iX = aScreensize.iWidth - aDrawParams.iWindowSize.iWidth;
   1.905 +		aDrawParams.iWindowPos.iY -= aIncrement*aDirection;
   1.906 +		}
   1.907 +	if(aDrawParams.iWindowPos.iY <= 0)
   1.908 +		{
   1.909 +		aDrawParams.iWindowPos.iY = 0;
   1.910 +		aDrawParams.iWindowPos.iX -= aIncrement*aDirection;
   1.911 +		}
   1.912 +	}