supprting flag for pixel offsetting for osx, see #11853

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67504 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2011-04-16 13:05:17 +00:00
parent 136a1de914
commit ad967c5b98

View File

@@ -1457,6 +1457,9 @@ public:
virtual bool ShouldOffset() const virtual bool ShouldOffset() const
{ {
if ( !m_enableOffset )
return false;
int penwidth = 0 ; int penwidth = 0 ;
if ( !m_pen.IsNull() ) if ( !m_pen.IsNull() )
{ {
@@ -1585,6 +1588,7 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer
{ {
Init(); Init();
m_windowRef = window; m_windowRef = window;
m_enableOffset = true;
} }
#endif #endif
@@ -1592,6 +1596,7 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer
{ {
Init(); Init();
m_enableOffset = true;
wxSize sz = window->GetSize(); wxSize sz = window->GetSize();
m_width = sz.x; m_width = sz.x;
m_height = sz.y; m_height = sz.y;
@@ -2742,7 +2747,10 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxWindowDC&
// having a cgctx being NULL is fine (will be created on demand) // having a cgctx being NULL is fine (will be created on demand)
// this is the case for all wxWindowDCs except wxPaintDC // this is the case for all wxWindowDCs except wxPaintDC
return new wxMacCoreGraphicsContext( this, cgctx, (wxDouble) w, (wxDouble) h ); wxMacCoreGraphicsContext *context =
new wxMacCoreGraphicsContext( this, cgctx, (wxDouble) w, (wxDouble) h );
context->EnableOffset(true);
return context;
} }
return NULL; return NULL;
} }
@@ -2756,8 +2764,10 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxMemoryDC&
{ {
int w, h; int w, h;
mem_impl->GetSize( &w, &h ); mem_impl->GetSize( &w, &h );
return new wxMacCoreGraphicsContext( this, wxMacCoreGraphicsContext* context = new wxMacCoreGraphicsContext( this,
(CGContextRef)(mem_impl->GetGraphicsContext()->GetNativeContext()), (wxDouble) w, (wxDouble) h ); (CGContextRef)(mem_impl->GetGraphicsContext()->GetNativeContext()), (wxDouble) w, (wxDouble) h );
context->EnableOffset(true);
return context;
} }
#endif #endif
return NULL; return NULL;
@@ -2789,7 +2799,9 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeContext( v
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeWindow( void * window ) wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeWindow( void * window )
{ {
#if wxOSX_USE_CARBON #if wxOSX_USE_CARBON
return new wxMacCoreGraphicsContext(this,(WindowRef)window); wxMacCoreGraphicsContext* context = new wxMacCoreGraphicsContext(this,(WindowRef)window);
context->EnableOffset(true);
return context;
#else #else
wxUnusedVar(window); wxUnusedVar(window);
return NULL; return NULL;