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
This commit is contained in:
Stefan Csomor
2011-04-16 12:21:37 +00:00
parent e78c47e3b8
commit 0217cfa537
2 changed files with 16 additions and 2 deletions

View File

@@ -643,6 +643,13 @@ 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

View File

@@ -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) )
{