- memdc.SelectObject(bitmap);
- memdc.Blit(0, 0, width, height, dc, 0, 0);
+ wxMemoryDC memdc(bitmap);
+ // match dc scales
+ double sx, sy;
+ dc->GetUserScale(&sx, &sy);
+ memdc.SetUserScale(sx, sy);
+ dc->GetLogicalScale(&sx, &sy);
+ memdc.SetLogicalScale(sx, sy);
+
+ // get logical size and origin
+ const int w_log = dc->DeviceToLogicalXRel(width);
+ const int h_log = dc->DeviceToLogicalYRel(height);
+ const int x0_log = dc->DeviceToLogicalX(0);
+ const int y0_log = dc->DeviceToLogicalY(0);
+
+ memdc.Blit(0, 0, w_log, h_log, dc, x0_log, y0_log);