Remove GetDPIScaleFactor from wxDC and wxGraphicsContext

This reverts most of the changes from ee2b02614e (Add GetDPIScaleFactor to wxDC
and wxGraphicsContext, 2022-04-16).

This is not supposed to be used to scale pixels, FromDIP will be added instead.

Temporary use scale=1 in the drawing sample until FromDIP is added.
This commit is contained in:
Maarten Bent 2022-04-20 00:49:49 +02:00
parent acc32082e8
commit fda41cdd1b
10 changed files with 1 additions and 32 deletions

View File

@ -539,8 +539,6 @@ public:
virtual double GetContentScaleFactor() const { return m_contentScaleFactor; }
virtual double GetDPIScaleFactor() const { return 1.0; }
#ifdef __WXMSW__
// Native Windows functions using the underlying HDC don't honour GDI+
// transformations which may be applied to it. Using this function we can
@ -829,9 +827,6 @@ public:
double GetContentScaleFactor() const
{ return m_pimpl->GetContentScaleFactor(); }
double GetDPIScaleFactor() const
{ return m_pimpl->GetDPIScaleFactor(); }
// Right-To-Left (RTL) modes
void SetLayoutDirection(wxLayoutDirection dir)

View File

@ -101,7 +101,6 @@ public:
virtual bool CanGetTextExtent() const wxOVERRIDE;
virtual int GetDepth() const wxOVERRIDE;
virtual wxSize GetPPI() const wxOVERRIDE;
virtual double GetDPIScaleFactor() const wxOVERRIDE;
virtual void SetLogicalFunction(wxRasterOperationMode function) wxOVERRIDE;

View File

@ -880,7 +880,6 @@ public:
void SetContentScaleFactor(double contentScaleFactor);
double GetContentScaleFactor() const { return m_contentScaleFactor; }
double GetDPIScaleFactor() const;
#ifdef __WXMSW__
virtual WXHDC GetNativeHDC() = 0;

View File

@ -77,7 +77,6 @@ public:
virtual bool CanGetTextExtent() const wxOVERRIDE;
virtual int GetDepth() const wxOVERRIDE;
virtual wxSize GetPPI() const wxOVERRIDE;
virtual double GetDPIScaleFactor() const wxOVERRIDE;
virtual void SetMapMode(wxMappingMode mode) wxOVERRIDE;
virtual void SetUserScale(double x, double y) wxOVERRIDE;

View File

@ -27,7 +27,6 @@ public:
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE;
virtual void DoGetSize(int* width, int* height) const wxOVERRIDE;
virtual void DoSelect(const wxBitmap& bitmap) wxOVERRIDE;
virtual double GetDPIScaleFactor() const wxOVERRIDE;
virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const wxOVERRIDE
{ return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmapOfHDC(*subrect, GetHDC() );}

View File

@ -574,7 +574,7 @@ void MyCanvas::DrawTestPoly(wxDC& dc)
wxBrush brushHatch(*wxRED, wxBRUSHSTYLE_FDIAGONAL_HATCH);
dc.SetBrush(brushHatch);
double scale = dc.GetDPIScaleFactor();
double scale = 1.0;
wxPoint star[5];
star[0] = scale * wxPoint(100, 60);

View File

@ -490,11 +490,6 @@ wxSize wxGCDCImpl::GetPPI() const
return wxDisplay::GetStdPPI();
}
double wxGCDCImpl::GetDPIScaleFactor() const
{
return m_graphicContext ? m_graphicContext->GetDPIScaleFactor() : 1.0;
}
int wxGCDCImpl::GetDepth() const
{
return 32;

View File

@ -613,13 +613,6 @@ void wxGraphicsContext::SetContentScaleFactor(double contentScaleFactor)
m_contentScaleFactor = contentScaleFactor;
}
double wxGraphicsContext::GetDPIScaleFactor() const
{
wxDouble x, y;
GetDPI(&x, &y);
return x / (double)wxDisplay::GetStdPPIValue();
}
#if 0
void wxGraphicsContext::SetAlpha( wxDouble WXUNUSED(alpha) )
{

View File

@ -2661,11 +2661,6 @@ wxSize wxMSWDCImpl::GetPPI() const
return ppi;
}
double wxMSWDCImpl::GetDPIScaleFactor() const
{
return GetPPI().x / 96.0;
}
// ----------------------------------------------------------------------------
// DC caching
// ----------------------------------------------------------------------------

View File

@ -143,11 +143,6 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
SetFont(GetFont());
}
double wxMemoryDCImpl::GetDPIScaleFactor() const
{
return m_contentScaleFactor;
}
void wxMemoryDCImpl::SetFont(const wxFont& font)
{
// We need to adjust the font size by the ratio between the scale factor we