From: Stefan Csomor Date: Sat, 16 Apr 2011 12:21:37 +0000 (+0000) Subject: support generic flag for pixel offsetting, see #11853 X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0217cfa537f6da6addba21a7fed4899e0eaaec26 support generic flag for pixel offsetting, see #11853 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/graphics.h b/include/wx/graphics.h index 98d8a376f3..b79ba6144c 100644 --- a/include/wx/graphics.h +++ b/include/wx/graphics.h @@ -642,7 +642,14 @@ public: // helper to determine if a 0.5 offset should be applied for the drawing operation virtual bool ShouldOffset() const { return false; } - + + // indicates whether the context should try to offset for pixel boundaries, this only makes sense on + // bitmap devices like screen, by default this is turned off + virtual void EnableOffset(bool enable = true); + + void DisableOffset() { EnableOffset(false); } + bool OffsetEnabled() { return m_enableOffset; } + protected: // These fields must be initialized in the derived class ctors. wxDouble m_width, @@ -653,6 +660,7 @@ protected: wxGraphicsFont m_font; wxAntialiasMode m_antialias; wxCompositionMode m_composition; + bool m_enableOffset; protected: // implementations of overloaded public functions: we use different names diff --git a/src/common/graphcmn.cpp b/src/common/graphcmn.cpp index 1ba501788f..665621e274 100644 --- a/src/common/graphcmn.cpp +++ b/src/common/graphcmn.cpp @@ -534,7 +534,8 @@ IMPLEMENT_ABSTRACT_CLASS(wxGraphicsContext, wxObject) wxGraphicsContext::wxGraphicsContext(wxGraphicsRenderer* renderer) : wxGraphicsObject(renderer), m_antialias(wxANTIALIAS_DEFAULT), - m_composition(wxCOMPOSITION_OVER) + m_composition(wxCOMPOSITION_OVER), + m_enableOffset(false) { } @@ -564,6 +565,11 @@ void wxGraphicsContext::Flush() { } +void wxGraphicsContext::EnableOffset(bool enable) +{ + m_enableOffset = enable; +} + #if 0 void wxGraphicsContext::SetAlpha( wxDouble WXUNUSED(alpha) ) {