keeping the OSX specific use of origin for non-native borders

fixes #19108
This commit is contained in:
Stefan Csomor
2021-03-20 22:09:31 +01:00
parent 362012ab9c
commit d1c0d3b18c
4 changed files with 21 additions and 5 deletions

View File

@@ -227,6 +227,10 @@ protected:
// wxGraphicsContext, in the expectation that the derived class will do it
wxGCDCImpl(wxDC* owner, int);
#ifdef __WXOSX__
virtual wxPoint OSXGetOrigin() const { return wxPoint(); }
#endif
// scaling variables
bool m_logicalFunctionSupported;
wxGraphicsMatrix m_matrixOriginal;

View File

@@ -32,9 +32,12 @@ public:
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const wxOVERRIDE;
protected:
virtual wxPoint OSXGetOrigin() const wxOVERRIDE;
bool m_release;
int m_width;
int m_height;
wxPoint m_origin;
wxDECLARE_CLASS(wxWindowDCImpl);
wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl);

View File

@@ -397,7 +397,11 @@ void wxGCDCImpl::DestroyClippingRegion()
// so we must explicitly make sure it only covers the area we want it to draw
int width, height ;
GetOwner()->GetSize( &width , &height ) ;
m_graphicContext->Clip( DeviceToLogicalX(0) , DeviceToLogicalY(0) , DeviceToLogicalXRel(width), DeviceToLogicalYRel(height) );
wxPoint origin;
#ifdef __WXOSX__
origin = OSXGetOrigin();
#endif
m_graphicContext->Clip( DeviceToLogicalX(origin.x) , DeviceToLogicalY(origin.y) , DeviceToLogicalXRel(width), DeviceToLogicalYRel(height) );
m_graphicContext->SetPen( m_pen );
m_graphicContext->SetBrush( m_brush );

View File

@@ -105,6 +105,11 @@ void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
*height = m_height;
}
wxPoint wxWindowDCImpl::OSXGetOrigin() const
{
return m_origin;
}
/*
* wxClientDCImpl
*/
@@ -120,14 +125,14 @@ wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window ) :
wxWindowDCImpl( owner, window )
{
wxCHECK_RET( window, wxT("invalid window in wxClientDCImpl") );
wxPoint origin = window->GetClientAreaOrigin() ;
m_origin = window->GetClientAreaOrigin() ;
m_window->GetClientSize( &m_width , &m_height);
if ( !m_window->IsShownOnScreen() )
m_width = m_height = 0;
int x0,y0;
DoGetDeviceOrigin(&x0,&y0);
SetDeviceOrigin( origin.x + x0, origin.y + y0 );
SetDeviceOrigin( m_origin.x + x0, m_origin.y + y0 );
DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;
}
@@ -152,9 +157,9 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner )
wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) :
wxWindowDCImpl( owner, window )
{
wxPoint origin = window->GetClientAreaOrigin() ;
m_origin = window->GetClientAreaOrigin() ;
m_window->GetClientSize( &m_width , &m_height);
SetDeviceOrigin( origin.x, origin.y );
SetDeviceOrigin( m_origin.x, m_origin.y );
DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;
}