X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b1263dcfa3fb318e9a48bdbdfe548eb474ae5fde..8a540c887cd30960c77e6c171ecabe30273321a8:/include/wx/mgl/dc.h diff --git a/include/wx/mgl/dc.h b/include/wx/mgl/dc.h index 1777302433..eafae45054 100644 --- a/include/wx/mgl/dc.h +++ b/include/wx/mgl/dc.h @@ -11,10 +11,6 @@ #ifndef _WX_DC_H_ #define _WX_DC_H_ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma interface "dc.h" -#endif - #include "wx/defs.h" #include "wx/region.h" @@ -55,7 +51,7 @@ class WXDLLEXPORT wxDC : public wxDCBase public: wxDC(); - ~wxDC(); + virtual ~wxDC(); // implement base class pure virtuals // ---------------------------------- @@ -105,63 +101,35 @@ public: wxCoord XDEV2LOG(wxCoord x) const { - wxCoord new_x = x - m_deviceOriginX; - if (new_x > 0) - return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; - else - return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX; + return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX; } wxCoord XDEV2LOGREL(wxCoord x) const { - if (x > 0) - return (wxCoord)((double)(x) / m_scaleX + 0.5); - else - return (wxCoord)((double)(x) / m_scaleX - 0.5); + return wxRound((double)(x) / m_scaleX); } wxCoord YDEV2LOG(wxCoord y) const { - wxCoord new_y = y - m_deviceOriginY; - if (new_y > 0) - return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; - else - return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY; + return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY; } wxCoord YDEV2LOGREL(wxCoord y) const { - if (y > 0) - return (wxCoord)((double)(y) / m_scaleY + 0.5); - else - return (wxCoord)((double)(y) / m_scaleY - 0.5); + return wxRound((double)(y) / m_scaleY); } wxCoord XLOG2DEV(wxCoord x) const { - wxCoord new_x = x - m_logicalOriginX; - if (new_x > 0) - return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX; - else - return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX; + return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX; } wxCoord XLOG2DEVREL(wxCoord x) const { - if (x > 0) - return (wxCoord)((double)(x) * m_scaleX + 0.5); - else - return (wxCoord)((double)(x) * m_scaleX - 0.5); + return wxRound((double)(x) * m_scaleX); } wxCoord YLOG2DEV(wxCoord y) const { - wxCoord new_y = y - m_logicalOriginY; - if (new_y > 0) - return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY; - else - return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY; + return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY; } wxCoord YLOG2DEVREL(wxCoord y) const { - if (y > 0) - return (wxCoord)((double)(y) * m_scaleY + 0.5); - else - return (wxCoord)((double)(y) * m_scaleY - 0.5); + return wxRound((double)(y) * m_scaleY); } MGLDevCtx *GetMGLDC() const { return m_MGLDC; }