windowing/windowserver/ttime/TTTEXT.CPP
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // LOADSTXT.CPP
       
    15 // used for timing text printing
       
    16 // 
       
    17 //
       
    18 
       
    19 #include "TTIME.H"
       
    20 
       
    21 TInt LoadsOfText(TInt aOwningGroup)
       
    22 	{
       
    23 	RWsSession ws;
       
    24 	ws.Connect();
       
    25 	CWsScreenDevice *device=new(ELeave) CWsScreenDevice(ws);
       
    26 	device->Construct();
       
    27 	RWindowGroup group(ws);
       
    28 	group.Construct(ENullWsHandle);
       
    29 	group.SetOwningWindowGroup(aOwningGroup);
       
    30 	TSize scrSize(device->SizeInPixels());
       
    31 //
       
    32 	RWindow window(ws);
       
    33 	window.Construct(group,ENullWsHandle);
       
    34 	window.SetExtent(TPoint(), scrSize);
       
    35 	window.Activate();
       
    36 //
       
    37 	CWindowGc *gc;
       
    38 	device->CreateContext(gc);
       
    39 	window.BeginRedraw();
       
    40 	gc->Activate(window);
       
    41 	gc->Clear();
       
    42 	window.EndRedraw();
       
    43 	TFontSpec fspec(KTestFontTypefaceName,200);
       
    44 	CFbsFont *font;
       
    45 	User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips((CFont *&)font, fspec));
       
    46 	gc->UseFont(font);
       
    47 	TBuf<100> loadsatext(_L("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890zyxwvutsrqponmlkjihgfedcba"));
       
    48 	TInt ascent=font->AscentInPixels();
       
    49 	TInt fheight=font->HeightInPixels();
       
    50 	for(TInt nTimes=0;nTimes<10;nTimes++)
       
    51 		{
       
    52 		TPoint pos;
       
    53 //		for(pos.iY=ascent;pos.iY<scrSize.iHeight;pos.iY+=font->HeightInPixels())
       
    54 //			gc->DrawText(loadsatext,pos);
       
    55 		for(pos.iY=0;pos.iY<scrSize.iHeight;pos.iY+=fheight)
       
    56 			gc->DrawText(loadsatext,TRect(pos,TPoint(scrSize.iWidth,pos.iY+fheight)),ascent);
       
    57 		gc->Clear();
       
    58 		}
       
    59 	gc->Deactivate();
       
    60 //
       
    61 	ws.Flush();
       
    62 	delete gc;
       
    63 	device->ReleaseFont(font);
       
    64 	window.Close();
       
    65 	group.Close();
       
    66 	delete device;
       
    67 	ws.Close();
       
    68 	return(KErrNone);
       
    69 	}
       
    70 
       
    71 GLDEF_D TTimeTestHeader LoadsaText={_S("Loads of text"),LoadsOfText};