applications/Symbian_MiniGUI_TestApp/grid.cpp
author Mike Kinghan <mikek@symbian.org>
Thu, 25 Nov 2010 14:28:39 +0000
branchGCC_SURGE
changeset 135 10852f1a0ae9
parent 66 57a5a30dc911
permissions -rw-r--r--
Merge a pointless head that got away.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
     1
#include <w32std.h> 
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
     2
#include "profiler.h"
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
     3
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
     4
const TSize KSize(64,60);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
     5
const TInt KRow = 4;
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
     6
const TInt KCol = 5; 
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
     7
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
     8
void MainL()	
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
     9
	{	
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    10
	RWsSession ws;
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    11
	ws.Connect();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    12
 	CWsScreenDevice* scr = new(ELeave) CWsScreenDevice(ws);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    13
	scr->Construct();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    14
 	CWindowGc* gc = new(ELeave) CWindowGc(scr);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    15
	gc->Construct();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    16
 	RWindowGroup grp(ws);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    17
	grp.Construct(0xc0decafe, ETrue);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    18
 	RWindow win(ws);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    19
	win.Construct(grp, 0xbeefcafe);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    20
	win.SetExtent(TPoint(20,160), TSize(320,240));
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    21
	win.Activate();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    22
 	win.Invalidate();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    23
	win.BeginRedraw();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    24
	gc->Activate(win);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    25
 	gc->SetPenStyle(CGraphicsContext::ENullPen);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    26
	gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    27
 	TBool color = EFalse;
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    28
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    29
if (Profiler::Start() == KErrNotFound)
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    30
	{
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    31
	_LIT(KProfiler,"profiler");
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    32
	_LIT(KStart,"start -noui -drive=S");
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    33
	RProcess p;
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    34
	if (p.Create(KProfiler,KStart) == KErrNone)
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    35
		{
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    36
		p.Resume();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    37
		p.Close();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    38
		}
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    39
	}
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    40
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    41
	for (TInt col=0; col<KCol; ++col)
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    42
		{
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    43
		color = !color;		
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    44
		for (TInt row=0; row<KRow; ++row)
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    45
			{
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    46
			TRect rect;
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    47
			rect.iTl.iX = col * KSize.iWidth;
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    48
			rect.iTl.iY = row * KSize.iHeight;
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    49
			rect.SetSize(KSize);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    50
			color = !color;
66
57a5a30dc911 Add a yuv based test program for YUV surface support testing.
Faisal Memon <faisal.memon@nokia.com>
parents: 46
diff changeset
    51
			gc->SetBrushColor(color? KRgbBlue : KRgbBlack);
46
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    52
			gc->DrawRect(rect);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    53
			}
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    54
	}
66
57a5a30dc911 Add a yuv based test program for YUV surface support testing.
Faisal Memon <faisal.memon@nokia.com>
parents: 46
diff changeset
    55
	
57a5a30dc911 Add a yuv based test program for YUV surface support testing.
Faisal Memon <faisal.memon@nokia.com>
parents: 46
diff changeset
    56
	
57a5a30dc911 Add a yuv based test program for YUV surface support testing.
Faisal Memon <faisal.memon@nokia.com>
parents: 46
diff changeset
    57
	
46
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    58
	gc->Deactivate();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    59
	win.EndRedraw();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    60
	ws.Flush();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    61
 	User::After(3000000);
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    62
 	win.Close();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    63
	grp.Close();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    64
	delete gc;
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    65
	delete scr;
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    66
	ws.Close();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    67
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    68
	Profiler::Stop();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    69
	Profiler::Close();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    70
	Profiler::Unload();
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    71
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    72
	} 
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    73
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    74
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    75
GLDEF_C TInt E32Main()	
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    76
{	
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    77
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    78
	CTrapCleanup* tc = CTrapCleanup::New();	
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    79
	if (!tc)
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    80
		{		
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    81
		return KErrNoMemory;
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    82
		}
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    83
	TRAPD(err, MainL());
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    84
	delete tc;
b6935a90ca64 Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
diff changeset
    85
 	return err;	
66
57a5a30dc911 Add a yuv based test program for YUV surface support testing.
Faisal Memon <faisal.memon@nokia.com>
parents: 46
diff changeset
    86
}