Code: Select all
void bmImage::paintEvent(wxPaintEvent &event) {
wxPaintDC dc(this);
render(dc);
}
void bmImage::paintNow() {
wxClientDC dc(this);
render(dc);
}
void bmImage::render(wxDC& dc) {
bitmap = wxBitmap(aswxImage);
dc.Clear();
dc.SetUserScale(((bmImageFrame*)this->GetParent())->scale[0], ((bmImageFrame*)this->GetParent())->scale[1]);
dc.DrawBitmap(bitmap, wxPoint(0, 0), false);
}
But before I scale the loaded image, it looks like this: (the image is clipped because of resized window)
And after I scale the image then resize the window, it looks like this:
How should I fix this so that it redraws the scaled image over clean background? Obviously there is a problem with drawing and clearing canvas here.