Introduce yuv tool and catch up with the head. YUV support in the OS is still experimental.
authorFaisal Memon <faisal.memon@nokia.com>
Fri, 07 May 2010 16:13:43 +0100
changeset 70 634f7e208f90
parent 69 c9d64fb26f98 (diff)
parent 66 28a25193bdd9 (current diff)
child 71 5158c0d3bde3
Introduce yuv tool and catch up with the head. YUV support in the OS is still experimental.
applications/Symbian_MiniGUI_TestApp/Grid.mmp
--- a/applications/Symbian_MiniGUI_TestApp/BLD.INF	Fri May 07 09:29:01 2010 +0100
+++ b/applications/Symbian_MiniGUI_TestApp/BLD.INF	Fri May 07 16:13:43 2010 +0100
@@ -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	Fri May 07 09:29:01 2010 +0100
+++ b/applications/Symbian_MiniGUI_TestApp/Grid.mmp	Fri May 07 16:13:43 2010 +0100
@@ -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
+
+#include <platform_paths.hrh>
 OS_LAYER_SYSTEMINCLUDE
+
 LIBRARY			efsrv.lib euser.lib hal.lib ws32.lib 
--- a/applications/Symbian_MiniGUI_TestApp/grid.cpp	Fri May 07 09:29:01 2010 +0100
+++ b/applications/Symbian_MiniGUI_TestApp/grid.cpp	Fri May 07 16:13:43 2010 +0100
@@ -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	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,131 @@
+#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;
+			// Semitransparent green or black
+			gc->SetBrushColor(color? TRgb(0x00ff00, 30) : TRgb(0x000000, 30));
+			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(320, 240);      // w > 0, h > 0
+	attributes.iBuffers = 4;                // > 0, <= 4
+	attributes.iPixelFormat = EUidPixelFormatYUV_422Interleaved; // 1bpp
+	attributes.iStride = 320;              // > 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.RemoveBackgroundSurface(ETrue);
+ 	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	Fri May 07 16:13:43 2010 +0100
@@ -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	Fri May 07 16:13:43 2010 +0100
@@ -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