EXPORT_C TInt RMessagingTestUtilityServer::GetDirL(const TDesC& aPath, const TUint aEntryAttMask, const TUint aEntrySortKey, CDir*& aDir)
//
// Obtain directory information regardless of data caging.
// Caller is responsible for deleting CDir object as with RFs::GetDir().
//
	{	
	TPckgBuf<TUint> entryAttMask(aEntryAttMask);
	TPckgBuf<TUint> entrySortKey(aEntrySortKey);
	
	TIpcArgs args1(&aPath, &entryAttMask, &entrySortKey);

	TInt ret = SendReceive(EGetDir, args1);		//Create CDir object on the server.
	
	TPckgBuf<TUint> countBuf;
	TIpcArgs args2(&countBuf);

	ret = SendReceive(EGetDirCount, args2);		//Get the number of dir entries.
	
	TUint count = countBuf();
		
	
	CDirDerived* dirDerived = CDirDerived::NewL();	//Construct a new CDir from CDirDerived.

	TPckgBuf<TEntry> entryBuf;
	
	for (TUint i=0; i<count; i++)
	{
		TPckgBuf<TInt> indexBuf(i);
		TIpcArgs args3(&indexBuf, &entryBuf);
			
		ret = SendReceive(EGetDirEntry, args3);	//Get each dir entry from the server.
		
		TEntry entry = entryBuf();		
		
		dirDerived->AddL(entry);				//Add each entry to the client's CDir object.
	}

	aDir = dirDerived;							//Return pointer to client's CDir object.
	
	TInt c2 = aDir->Count();
			
	return KErrNone;
	}
Ejemplo n.º 2
0
void InternalSpriteRenderer::prepareBuffers(IGraphicsDevice* context, int spriteCount)
{
	if (m_buffersReservedSpriteCount < spriteCount)
	{
		size_t vertexCount = spriteCount * 4;
		if (LN_ENSURE(vertexCount < 0xFFFF)) {
			return;
		}

		size_t vertexBufferSize = sizeof(Vertex) * vertexCount;
		m_vertexBuffer = context->createVertexBuffer(GraphicsResourceUsage::Dynamic, vertexBufferSize, nullptr);

		size_t indexBufferSize = spriteCount * 6;
		std::vector<size_t> indexBuf(sizeof(uint16_t) * indexBufferSize, false);
		uint16_t* ib = (uint16_t*)indexBuf.data();
		int idx = 0;
		int i2 = 0;
		for (int i = 0; i < spriteCount; ++i)
		{
			i2 = i * 6;
			idx = i * 4;
			ib[i2 + 0] = idx;
			ib[i2 + 1] = idx + 1;
			ib[i2 + 2] = idx + 2;
			ib[i2 + 3] = idx + 2;
			ib[i2 + 4] = idx + 1;
			ib[i2 + 5] = idx + 3;
		}
		m_indexBuffer = context->createIndexBuffer(
			GraphicsResourceUsage::Dynamic, IndexBufferFormat::UInt16,
			spriteCount * 6, ib);

		m_spriteIndexList.resize(spriteCount);

		m_buffersReservedSpriteCount = spriteCount;
	}
}