Add a yuv based test program for YUV surface support testing.
authorFaisal Memon <faisal.memon@nokia.com>
Thu, 25 Mar 2010 22:08:14 +0000
changeset 67 57a5a30dc911
parent 46 b6935a90ca64
child 68 535d0a02b797
Add a yuv based test program for YUV surface support testing.
applications/Symbian_MiniGUI_TestApp/BLD.INF
applications/Symbian_MiniGUI_TestApp/Grid.mmp
applications/Symbian_MiniGUI_TestApp/grid.cpp
applications/Symbian_MiniGUI_TestApp/yuv.cpp
applications/Symbian_MiniGUI_TestApp/yuv.iby
applications/Symbian_MiniGUI_TestApp/yuv.mmp
--- a/applications/Symbian_MiniGUI_TestApp/BLD.INF	Mon Mar 08 18:45:03 2010 +0000
+++ b/applications/Symbian_MiniGUI_TestApp/BLD.INF	Thu Mar 25 22:08:14 2010 +0000
@@ -12,10 +12,12 @@
 
 PRJ_PLATFORMS
 ARMV5
+WINSCW
 
 PRJ_EXPORTS
 grid.iby \epoc32\rom\include\grid.iby
+yuv.iby \epoc32\rom\include\yuv.iby
 
 PRJ_MMPFILES
 grid
-
+yuv
--- a/applications/Symbian_MiniGUI_TestApp/Grid.mmp	Mon Mar 08 18:45:03 2010 +0000
+++ b/applications/Symbian_MiniGUI_TestApp/Grid.mmp	Thu Mar 25 22:08:14 2010 +0000
@@ -1,5 +1,7 @@
 /*******************************************************************************
 * Copyright (c) 2009 Accenture
+* Portions Copyright (c) 2010 Nokia Corporation. All rights reserved.
+*
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
@@ -7,12 +9,15 @@
 *
 * Contributors:
 * Accenture - Johnathan White
-
+*
 *******************************************************************************/
 
 TARGET			grid.EXE
 TARGETTYPE		EXE
 SOURCEPATH		.
 SOURCE			grid.cpp
-SYSTEMINCLUDE		\epoc32\include
+
+#include <platform_paths.hrh>
+OS_LAYER_SYSTEMINCLUDE
+
 LIBRARY			efsrv.lib euser.lib hal.lib ws32.lib 
--- a/applications/Symbian_MiniGUI_TestApp/grid.cpp	Mon Mar 08 18:45:03 2010 +0000
+++ b/applications/Symbian_MiniGUI_TestApp/grid.cpp	Thu Mar 25 22:08:14 2010 +0000
@@ -48,10 +48,13 @@
 			rect.iTl.iY = row * KSize.iHeight;
 			rect.SetSize(KSize);
 			color = !color;
-			gc->SetBrushColor(color? KRgbGray : KRgbBlack);
+			gc->SetBrushColor(color? KRgbBlue : KRgbBlack);
 			gc->DrawRect(rect);
 			}
 	}
+	
+	
+	
 	gc->Deactivate();
 	win.EndRedraw();
 	ws.Flush();
@@ -80,4 +83,4 @@
 	TRAPD(err, MainL());
 	delete tc;
  	return err;	
-}
\ No newline at end of file
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/applications/Symbian_MiniGUI_TestApp/yuv.cpp	Thu Mar 25 22:08:14 2010 +0000
@@ -0,0 +1,127 @@
+#include <w32std.h> 
+#include "profiler.h"
+
+#include <graphics/surfacemanager.h>
+#include <graphics/surfaceupdateclient.h>
+const TSize KSize(64,60);
+const TInt KRow = 4;
+const TInt KCol = 5; 
+
+void MainL()	
+	{	
+	RWsSession ws;
+	ws.Connect();
+ 	CWsScreenDevice* scr = new(ELeave) CWsScreenDevice(ws);
+	scr->Construct();
+ 	CWindowGc* gc = new(ELeave) CWindowGc(scr);
+	gc->Construct();
+ 	RWindowGroup grp(ws);
+	grp.Construct(0xc0decafe, ETrue);
+ 	RWindow win(ws);
+	win.Construct(grp, 0xbeefcafe);
+	win.SetExtent(TPoint(20,160), TSize(320,240));
+	win.Activate();
+ 	win.Invalidate();
+	win.BeginRedraw();
+	gc->Activate(win);
+ 	gc->SetPenStyle(CGraphicsContext::ENullPen);
+	gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
+ 	TBool color = EFalse;
+
+if (Profiler::Start() == KErrNotFound)
+	{
+	_LIT(KProfiler,"profiler");
+	_LIT(KStart,"start -noui -drive=S");
+	RProcess p;
+	if (p.Create(KProfiler,KStart) == KErrNone)
+		{
+		p.Resume();
+		p.Close();
+		}
+	}
+
+	for (TInt col=0; col<KCol; ++col)
+		{
+		color = !color;		
+		for (TInt row=0; row<KRow; ++row)
+			{
+			TRect rect;
+			rect.iTl.iX = col * KSize.iWidth;
+			rect.iTl.iY = row * KSize.iHeight;
+			rect.SetSize(KSize);
+			color = !color;
+			gc->SetBrushColor(color? KRgbGreen : KRgbBlack);
+			gc->DrawRect(rect);
+			}
+	}
+	
+	// Open the surface manager
+	RSurfaceManager surfaceManager;
+	User::LeaveIfError(surfaceManager.Open());
+	// Store the attributes used to create the Surface
+	RSurfaceManager::TSurfaceCreationAttributesBuf buf;
+	RSurfaceManager::TSurfaceCreationAttributes& attributes = buf();
+
+	attributes.iSize = TSize(361,341);      // w > 0, h > 0
+	attributes.iBuffers = 4;                // > 0, <= 4
+	attributes.iPixelFormat = EUidPixelFormatYUV_422Planar; // 2bpp
+	attributes.iStride = 1400;              // > 0,  width * bpp
+	attributes.iOffsetToFirstBuffer = 184;  // > 0, divisible by alignment
+	attributes.iAlignment = 4;              // 1 || 2 || 4 || 8
+	attributes.iContiguous = EFalse;
+	attributes.iMappable = ETrue;
+
+	RSurfaceManager::THintPair hints[2];         // two hint pairs specified
+	attributes.iHintCount=2;
+	hints[0].Set(TUid::Uid(0x124578), 20, ETrue);
+	hints[1].Set(TUid::Uid(0x237755), 50, EFalse);
+	attributes.iSurfaceHints = hints;
+
+	attributes.iOffsetBetweenBuffers = 0;
+	// Create a surface
+	TSurfaceId surfaceId;
+	User::LeaveIfError(surfaceManager.CreateSurface(buf, surfaceId));
+
+	// We have a surface, so map it in.
+	RChunk chunk;
+	TInt err = surfaceManager.MapSurface(surfaceId, chunk);
+	if ( err == KErrNone)
+	    { 
+	    // Get info about it
+	    RSurfaceManager::TInfoBuf buf;
+	    RSurfaceManager::TSurfaceInfoV01& surfaceInfo = buf(); 
+
+	    surfaceManager.SurfaceInfo(surfaceId, buf); 
+	    }
+
+	
+	win.SetBackgroundSurface(surfaceId);
+	gc->Deactivate();
+	win.EndRedraw();
+	ws.Flush();
+ 	User::After(3000000);
+ 	win.Close();
+	grp.Close();
+	delete gc;
+	delete scr;
+	ws.Close();
+
+	Profiler::Stop();
+	Profiler::Close();
+	Profiler::Unload();
+
+	} 
+
+
+GLDEF_C TInt E32Main()	
+{	
+
+	CTrapCleanup* tc = CTrapCleanup::New();	
+	if (!tc)
+		{		
+		return KErrNoMemory;
+		}
+	TRAPD(err, MainL());
+	delete tc;
+ 	return err;	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/applications/Symbian_MiniGUI_TestApp/yuv.iby	Thu Mar 25 22:08:14 2010 +0000
@@ -0,0 +1,23 @@
+/*******************************************************************************
+* Copyright (c) 2009 Accenture
+* Portions Copyright (c) 2010 Nokia Corporation. All rights reserved.
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* Accenture - Johnathan White
+*
+*******************************************************************************/
+
+#ifndef __SYMBIANMINIGUI_TESTAPP_IBY__
+#define __SYMBIANMINIGUI_TESTAPP_IBY__
+
+
+//demo app which requests a YUV format surface
+file=\epoc32\release\armv5\urel\yuv.exe sys\bin\yuv.exe
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/applications/Symbian_MiniGUI_TestApp/yuv.mmp	Thu Mar 25 22:08:14 2010 +0000
@@ -0,0 +1,24 @@
+/*******************************************************************************
+* Copyright (c) 2009 Accenture
+* Portions Copyright (c) 2010 Nokia Corporation. All rights reserved.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* Accenture - Johnathan White
+
+*******************************************************************************/
+
+TARGET			yuv.EXE
+TARGETTYPE		EXE
+SOURCEPATH		.
+SOURCE			yuv.cpp
+
+#include <platform_paths.hrh>
+OS_LAYER_SYSTEMINCLUDE
+
+LIBRARY			efsrv.lib euser.lib hal.lib ws32.lib 
+LIBRARY			surfacemanager.lib
+LIBRARY			surfaceupdateclient.lib