我正在尝试在MFC中的CView中渲染大图像(10K x 10K)。 GdiPlus的性能非常慢(准确地说是0.5 fps)。有没有我可以用于此目的的免费或商业图书馆?
DirectX渲染代码
float halfWidth = m_CurWidth/2.0;
float halfHeight = m_CurHeight/2.0;
D3DXMATRIX P;
D3DXMatrixOrthoLH(&P, (float)rect.Width(), (float)rect.Height(), -10, 10);
m_pDevice3D->SetTransform(D3DTS_PROJECTION, &P);
float cornerX = m_Left;
float cornerY = -m_Top;
VERTEX g_vVertices[4];
{
g_vVertices[0] = VERTEX(cornerX + (-1.0f * halfWidth), cornerY + (1.0f * halfHeight), 0.0f, 0.0f, 0.0f );
g_vVertices[1] = VERTEX(cornerX + (1.0f * halfWidth), cornerY + (1.0f * halfHeight), 0.0f, 1.0f, 0.0f );
g_vVertices[2] = VERTEX(cornerX + (-1.0f * halfWidth), cornerY + (-1.0f * halfHeight), 0.0f, 0.0f, 1.0f );
g_vVertices[3] = VERTEX(cornerX + (1.0f * halfWidth), cornerY + (-1.0f * halfHeight), 0.0f, 1.0f, 1.0f );
};
void * pVertices;
m_pVB->Lock( 0, sizeof(pVertices), (void**)&pVertices, 0 );
memcpy( pVertices, g_vVertices, sizeof(g_vVertices));
m_pVB->Unlock();
if(m_pDevice3D){
m_pDevice3D->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
0xffffffff, 1.0f, 0);
m_pDevice3D->BeginScene();
m_pDevice3D->SetFVF(D3DFVF_VERTEX);
m_pDevice3D->SetStreamSource(0, m_pVB, 0, sizeof(VERTEX));
// Draw primitives using presently enabled texture.
m_pDevice3D->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
m_pDevice3D->EndScene();
m_pDevice3D->Present(0, 0, 0, 0);
}