To get some smooth graphics, I want to draw oversampled by factor 2 and scale down afterwards.
So what I am doing is to draw oversampled on a wxBitmap in a wxMemoryDC, and then scale it down before copying to my dc. The code below works fine, but bitmapOversampled.ConvertToImage(); is extremely slow.
Is there any way to achieve the same without having to convert from wxBitmap to wxImage and vice versa?
void OnPaint
( wxPaintEvent& event )
{
wxBitmap bitmapOversampled(m_width * 2, m_height * 2);
wxMemoryDC memDC(bitmapOversampled);
// Draw the elements.
drawElements(&memDC);
// Scale to correct size.
wxImage image = bitmapOversampled.ConvertToImage();
image.Rescale(m_width, m_height);
memDC.SelectObject(wxBitmap(image));
// Copy to dc.
wxPaintDC dc(this);
dc.Blit(0, 0, m_width, m_height, &memDC, 0, 0);
};