return new wxMemoryDCImpl( owner );
}
-wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap )
+wxDCImpl* wxNativeDCFactory::CreateMemoryDC(wxMemoryDC *owner, wxBitmap& bitmap)
{
- return new wxMemoryDCImpl( owner, bitmap );
+ // the bitmap may be modified when it's selected into a memory DC so make
+ // sure changing this bitmap doesn't affect any other shallow copies of it
+ // (see wxMemoryDC::SelectObject())
+ //
+ // notice that we don't provide any ctor equivalent to SelectObjectAsSource
+ // method because this should be rarely needed and easy to work around by
+ // using the default ctor and calling SelectObjectAsSource itself
+ if ( bitmap.IsOk() )
+ bitmap.UnShare();
+
+ return new wxMemoryDCImpl(owner, bitmap);
}
wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxDC *dc )
} // CalculateEllipticPoints
#endif // __WXWINCE__
+
+float wxDCImpl::GetFontPointSizeAdjustment(float dpi)
+{
+ // wxMSW has long-standing bug where wxFont point size is interpreted as
+ // "pixel size corresponding to given point size *on screen*". In other
+ // words, on a typical 600dpi printer and a typical 96dpi screen, fonts
+ // are ~6 times smaller when printing. Unfortunately, this bug is so severe
+ // that *all* printing code has to account for it and consequently, other
+ // ports need to emulate this bug too:
+ const wxSize screenPPI = wxGetDisplayPPI();
+ return float(screenPPI.y) / dpi;
+}