Merge 3. Improve performance by switching to less aggressive settings for RI_NUM_TESSELLATED_SEGMENTS and RI_MAX_SAMPLES. Ignored the WIN32 specific API decoration defines when doing the merge. Note the code is now optimised in riPath.cpp to change from RI_NUM_TESSELLATED_SEGMENTS to _QUAD, _CUBIC, _ARC settings which are each now set to 8. SVG Tiger now renders in 5 seconds (15 seconds quicker). The quality of the OVG icons is slightly reduced but still very useable.
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//
/**
@file
@test
@internalComponent - Internal Symbian test code
*/
#include "tflowwindow.h"
#include "surfaceutility.h"
CTWindow* CTFlowWindow::NewL(RWsSession &aWs, const RWindowTreeNode &aParent, const TPoint& aStartingPoint, const TSize& aWindowSize)
{
CTFlowWindow * self = new (ELeave) CTFlowWindow(aStartingPoint, aWindowSize);
CleanupStack::PushL(self);
self->ConstructL(aWs, aParent);
CleanupStack::Pop(self);
return self;
}
CTFlowWindow::CTFlowWindow(const TPoint& aStartingPoint, const TSize& aWindowSize) : CTWindow(aStartingPoint, aWindowSize)
{
iImageInfo.iSizeInPixels = aWindowSize;
iImageInfo.iPixelFormat = EUidPixelFormatXRGB_8888; //todo: is this format okay (EUidPixelFormatARGB_8888)?
iImageInfo.iCpuAccess = ESgCpuAccessNone;
iImageInfo.iUsage = ESgUsageOpenGlesTarget| ESgUsageDirectGdiSource | ESgUsageDirectGdiTarget;
iImageInfo.iShareable = ETrue;
iImageInfo.iScreenId = KSgScreenIdMain;
}
void CTFlowWindow::ConstructL(RWsSession &aWs, const RWindowTreeNode &aParent)
{
CTWindow::ConstructL(aWs, aParent);
User::LeaveIfError(iImageCollection.Create(iImageInfo, 1)); // creates an image collection with 1 image
User::LeaveIfError(iImageCollection.OpenImage(0, iImage)); // opens a handle to the image
// sets the image collection as background surface for the window
User::LeaveIfError(SetBackgroundSurface(iImageCollection.SurfaceId()));
// Connect to surface update session
User::LeaveIfError(iUpdateSession.Connect());
}
CTFlowWindow::~CTFlowWindow()
{
iUpdateSession.Close();
iImage.Close();
iImageCollection.Close();
}
/**
* Scales a bitmap from file to a surface.
*
* @param aUtility Performs the loading of the bitmap and scaling to the surface.
* @param aFileName Location of the bitmap.
*/
void CTFlowWindow::LoadL(CSurfaceUtility* aUtility, TPtrC aFileName)
{
aUtility->ScaleBitmapFromFileToSurfaceL(aFileName, iImageCollection.SurfaceId());
}
void CTFlowWindow::RenderL()
{
CTWindow::RenderL();
TRequestStatus status;
iUpdateSession.NotifyWhenAvailable(status);
User::LeaveIfError(iUpdateSession.SubmitUpdate(KSgScreenIdMain,
iImageCollection.SurfaceId(), 0, &DirtyRegion()));
User::WaitForRequest(status);
}