I have a Direct2D native application written in C++. The render function is called about 60 times per second, and it is aimed at displaying around 1,000 graphic geometries (essentially ellipses). Following is the code of the rendering function:
void Render()
{
pRenderTarget->BeginDraw();
pRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::Black));
const auto transform = D2D1::Matrix3x2F::Identity();
pRenderTarget->SetTransform(transform);
// draw all entities
for (auto& e : entities)
{
if (e)
e->Draw(pRenderTarget, transform);
}
pRenderTarget->EndDraw();
}
void Entity::Draw(ID2D1RenderTarget* pTarget, const D2D1_MATRIX_3X2_F& worldTransform) const
{
pTarget->SetTransform(transform * worldTransform);
pTarget->FillEllipse(ellipse, pBrush);
pTarget->SetTransform(worldTransform);
}
Brushes, ellipses and transformations are created at the beginning (entity construcor).
My question is if it is normal that with these parameters my CPU is always around 8/9%. I'd have expected a value close to 0 (if I comment the render function the CPU usage drops to 0, even if the Update function, for example, is always called).