From 621b83d9b34572321873cf3d54920a7749b2f53c Mon Sep 17 00:00:00 2001
From: Robert Roebling <robert@roebling.de>
Date: Tue, 1 May 2007 21:28:29 +0000
Subject: [PATCH]   Made device to logical and vv conversion methods    
 virtual and implement them like any other method     in the wxDC classes, not
 only in the their files     but somehow belonging to the wxDCBase class.  
 This is required for plugging in differnt DC backends     with different
 conversions.   Ideally (and absolutely possible ) all these methods    
 should be removed and just the one in wxDCBase     should stay using values
 set in the various     derived classes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45741 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/dc.tex       |  16 +-
 include/wx/dc.h            |  16 +-
 include/wx/dcsvg.h         | 313 ++++++++++---------------------------
 include/wx/dfb/dc.h        |   9 ++
 include/wx/gtk/dc.h        |  46 ++----
 include/wx/gtk1/dc.h       |   9 ++
 include/wx/mac/carbon/dc.h |   9 ++
 include/wx/msw/dc.h        |   9 ++
 include/wx/os2/dc.h        |   9 ++
 include/wx/palmos/dc.h     |   9 ++
 src/common/dcsvg.cpp       | 229 +++++++++++----------------
 src/dfb/dc.cpp             |  32 ++--
 src/gtk/dc.cpp             |  40 +++++
 src/gtk1/dc.cpp            |  40 +++++
 src/mac/carbon/dc.cpp      |  32 ++--
 src/msw/dc.cpp             |  16 +-
 src/os2/dc.cpp             |  12 +-
 src/palmos/dc.cpp          |  16 +-
 18 files changed, 380 insertions(+), 482 deletions(-)

diff --git a/docs/latex/wx/dc.tex b/docs/latex/wx/dc.tex
index c8d929e22a..e5ce0687ed 100644
--- a/docs/latex/wx/dc.tex
+++ b/docs/latex/wx/dc.tex
@@ -199,7 +199,7 @@ See also \helpref{wxDC::SetClippingRegion}{wxdcsetclippingregion}.
 
 \membersection{wxDC::DeviceToLogicalX}\label{wxdcdevicetologicalx}
 
-\func{wxCoord}{DeviceToLogicalX}{\param{wxCoord}{ x}}
+\func{virtual wxCoord}{DeviceToLogicalX}{\param{wxCoord}{ x}}
 
 Convert device X coordinate to logical coordinate, using the current
 mapping mode.
@@ -207,7 +207,7 @@ mapping mode.
 
 \membersection{wxDC::DeviceToLogicalXRel}\label{wxdcdevicetologicalxrel}
 
-\func{wxCoord}{DeviceToLogicalXRel}{\param{wxCoord}{ x}}
+\func{virtual wxCoord}{DeviceToLogicalXRel}{\param{wxCoord}{ x}}
 
 Convert device X coordinate to relative logical coordinate, using the current
 mapping mode but ignoring the x axis orientation.
@@ -216,7 +216,7 @@ Use this function for converting a width, for example.
 
 \membersection{wxDC::DeviceToLogicalY}\label{wxdcdevicetologicaly}
 
-\func{wxCoord}{DeviceToLogicalY}{\param{wxCoord}{ y}}
+\func{virtual wxCoord}{DeviceToLogicalY}{\param{wxCoord}{ y}}
 
 Converts device Y coordinate to logical coordinate, using the current
 mapping mode.
@@ -224,7 +224,7 @@ mapping mode.
 
 \membersection{wxDC::DeviceToLogicalYRel}\label{wxdcdevicetologicalyrel}
 
-\func{wxCoord}{DeviceToLogicalYRel}{\param{wxCoord}{ y}}
+\func{virtual wxCoord}{DeviceToLogicalYRel}{\param{wxCoord}{ y}}
 
 Convert device Y coordinate to relative logical coordinate, using the current
 mapping mode but ignoring the y axis orientation.
@@ -880,7 +880,7 @@ use \arg{initialColour} on the left part of the rectangle and
 
 \membersection{wxDC::LogicalToDeviceX}\label{wxdclogicaltodevicex}
 
-\func{wxCoord}{LogicalToDeviceX}{\param{wxCoord}{ x}}
+\func{virtual wxCoord}{LogicalToDeviceX}{\param{wxCoord}{ x}}
 
 Converts logical X coordinate to device coordinate, using the current
 mapping mode.
@@ -888,7 +888,7 @@ mapping mode.
 
 \membersection{wxDC::LogicalToDeviceXRel}\label{wxdclogicaltodevicexrel}
 
-\func{wxCoord}{LogicalToDeviceXRel}{\param{wxCoord}{ x}}
+\func{virtual wxCoord}{LogicalToDeviceXRel}{\param{wxCoord}{ x}}
 
 Converts logical X coordinate to relative device coordinate, using the current
 mapping mode but ignoring the x axis orientation.
@@ -897,7 +897,7 @@ Use this for converting a width, for example.
 
 \membersection{wxDC::LogicalToDeviceY}\label{wxdclogicaltodevicey}
 
-\func{wxCoord}{LogicalToDeviceY}{\param{wxCoord}{ y}}
+\func{virtual wxCoord}{LogicalToDeviceY}{\param{wxCoord}{ y}}
 
 Converts logical Y coordinate to device coordinate, using the current
 mapping mode.
@@ -905,7 +905,7 @@ mapping mode.
 
 \membersection{wxDC::LogicalToDeviceYRel}\label{wxdclogicaltodeviceyrel}
 
-\func{wxCoord}{LogicalToDeviceYRel}{\param{wxCoord}{ y}}
+\func{virtual wxCoord}{LogicalToDeviceYRel}{\param{wxCoord}{ y}}
 
 Converts logical Y coordinate to relative device coordinate, using the current
 mapping mode but ignoring the y axis orientation.
diff --git a/include/wx/dc.h b/include/wx/dc.h
index 7551b99905..e0ace2828f 100644
--- a/include/wx/dc.h
+++ b/include/wx/dc.h
@@ -516,14 +516,14 @@ public:
 
     // This group of functions does actual conversion of the input, as you'd
     // expect.
-    wxCoord DeviceToLogicalX(wxCoord x) const;
-    wxCoord DeviceToLogicalY(wxCoord y) const;
-    wxCoord DeviceToLogicalXRel(wxCoord x) const;
-    wxCoord DeviceToLogicalYRel(wxCoord y) const;
-    wxCoord LogicalToDeviceX(wxCoord x) const;
-    wxCoord LogicalToDeviceY(wxCoord y) const;
-    wxCoord LogicalToDeviceXRel(wxCoord x) const;
-    wxCoord LogicalToDeviceYRel(wxCoord y) const;
+    virtual wxCoord DeviceToLogicalX(wxCoord x) const = 0;
+    virtual wxCoord DeviceToLogicalY(wxCoord y) const = 0;
+    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const = 0;
+    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const = 0;
+    virtual wxCoord LogicalToDeviceX(wxCoord x) const = 0;
+    virtual wxCoord LogicalToDeviceY(wxCoord y) const = 0;
+    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const = 0;
+    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const = 0;
 
     // query DC capabilities
     // ---------------------
diff --git a/include/wx/dcsvg.h b/include/wx/dcsvg.h
index f700ffd07c..14d922409c 100644
--- a/include/wx/dcsvg.h
+++ b/include/wx/dcsvg.h
@@ -24,32 +24,71 @@
 
 class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC
 {
+public:
+    wxSVGFileDC (wxString f);
+    wxSVGFileDC (wxString f, int Width, int Height);
+    wxSVGFileDC (wxString f, int Width, int Height, float dpi);
+    
+    ~wxSVGFileDC();
 
-    private:
-        wxFileOutputStream * m_outfile ;
-        wxString m_filename ;
-        //holds number of png format images we have
-        int m_sub_images ;
-        bool m_OK, m_graphics_changed ;
-        int m_width, m_height ;
-
-        double
-            m_logicalScaleX,
-            m_logicalScaleY,
-            m_userScaleX,
-            m_userScaleY,
-            m_scaleX,
-            m_scaleY,
-            m_OriginX,
-            m_OriginY,
-            m_mm_to_pix_x,
-            m_mm_to_pix_y;
-
-        bool
-            m_needComputeScaleX,
-            m_needComputeScaleY; // not yet used
+    bool CanDrawBitmap() const { return true; }
+    bool CanGetTextExtent() const { return true; }
 
+    int GetDepth() const
+            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; }
+
+    void Clear()
+            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?")); return ; }
+
+    void DestroyClippingRegion()
+            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::void Call not yet implemented")); return ; }
+
+    wxCoord GetCharHeight() const;
+    wxCoord GetCharWidth() const;
+
+        void SetClippingRegion(wxCoord  WXUNUSED(x), wxCoord  WXUNUSED(y), wxCoord  WXUNUSED(width), wxCoord  WXUNUSED(height))
+            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetClippingRegion not implemented")); return ; }
+
+        void SetPalette(const wxPalette&  WXUNUSED(palette))
+            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetPalette not implemented")); return ; }
+
+        void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y), wxCoord * WXUNUSED(width), wxCoord * WXUNUSED(height))
+            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetClippingBox not implemented")); return ; }
+
+        void SetLogicalFunction(int  WXUNUSED(function))
+            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented")); return ; }
+
+        int GetLogicalFunction() const
+            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetLogicalFunction() not implemented")); return wxCOPY ; }
+
+        void SetBackground( const wxBrush &brush ) ;
+        void SetBackgroundMode( int mode ) ;
+        void SetBrush(const wxBrush& brush) ;
+        void SetFont(const wxFont& font) ;
+        void SetPen(const wxPen& pen)  ;
+          
+        bool IsOk() const {return m_OK;}
+
+    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
+    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
+
+    virtual void SetMapMode( int mode );
+    virtual void SetUserScale( double x, double y );
+    virtual void SetLogicalScale( double x, double y );
+    virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
+    virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
+
+    virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
+
+    virtual void ComputeScaleAndOrigin();
 
+private:
         bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const
             { wxASSERT_MSG (false, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return true; }
 
@@ -73,6 +112,8 @@ class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC
 
         void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) ;
 
+        void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0) ;
+
         void DoDrawPoint(wxCoord, wxCoord) ;
 
         void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle) ;
@@ -98,217 +139,21 @@ class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC
 
        void Init (wxString f, int Width, int Height, float dpi);
 
-       void NewGraphics () ;
-
-#ifdef XDEV2LOG
-#undef XDEV2LOG
-#endif
-        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;
-        }
-#ifdef XDEV2LOGREL
-#undef XDEV2LOGREL
-#endif
-        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);
-        }
-#ifdef YDEV2LOG
-#undef YDEV2LOG
-#endif
-        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;
-        }
-#ifdef YDEV2LOGREL
-#undef YDEV2LOGREL
-#endif
-        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);
-        }
-#ifdef XLOG2DEV
-#undef XLOG2DEV
-#endif
-        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;
-        }
-#ifdef XLOG2DEVREL
-#undef XLOG2DEVREL
-#endif
-        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);
-        }
-#ifdef YLOG2DEV
-#undef YLOG2DEV
-#endif
-        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;
-        }
-#ifdef YLOG2DEVREL
-#undef YLOG2DEVREL
-#endif
-        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);
-        }
-
-        void write(const wxString &s);
-
-    public:
-
-        wxSVGFileDC (wxString f);
-        wxSVGFileDC (wxString f, int Width, int Height);
-        wxSVGFileDC (wxString f, int Width, int Height, float dpi);
-        ~wxSVGFileDC();
-
-
-        bool CanDrawBitmap() const { return true; }
-
-        bool CanGetTextExtent() const { return true; }
-
-        int GetDepth() const
-            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; }
-
-        void BeginDrawing() { return;}
-
-        bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC* source, wxCoord xsrc, wxCoord ysrc, int logicalFunc = wxCOPY, bool useMask = false)
-            { return DoBlit(xdest, ydest, width, height, source, xsrc, ysrc, logicalFunc, useMask); }
-
-        void Clear()
-            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?")); return ; }
-
-        void CrossHair(wxCoord x, wxCoord y)
-            { DoCrossHair (x,y); return; }
-
-        virtual void ComputeScaleAndOrigin();
-
-        void DestroyClippingRegion()
-            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::void Call not yet implemented")); return ; }
-
-        wxCoord DeviceToLogicalX(wxCoord x) const ;
-
-        wxCoord DeviceToLogicalXRel(wxCoord x)  const ;
-
-        wxCoord DeviceToLogicalY(wxCoord y)  const ;
-
-        wxCoord DeviceToLogicalYRel(wxCoord y)  const ;
-
-        void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool transparent)
-            {  DoDrawBitmap ( bitmap, x, y, transparent ) ; return ;}
-
-        void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
-            {DoDrawIcon(icon, x, y) ; return ; }
-
-        void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0) ;
-
-        void EndDoc()
-            { return ; }
-
-        void EndDrawing()
-            { return ; }
-
-        void EndPage()
-            {  return ; }
-
-        void FloodFill(wxCoord x, wxCoord y, wxColour *colour, int style=wxFLOOD_SURFACE)
-            { DoFloodFill (x, y, *colour, style); return ;}
-
-        wxCoord GetCharHeight() const;
-
-        wxCoord GetCharWidth() const;
-
-        void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y), wxCoord * WXUNUSED(width), wxCoord * WXUNUSED(height))
-            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetClippingBox Call not yet implemented")); return ; }
-
-        int GetLogicalFunction() const
-            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetLogicalFunction()  Call not implemented")); return wxCOPY ; }
-
-        int GetMapMode() const ;
-
-        bool GetPixel(wxCoord x, wxCoord y, wxColour *colour)
-            { return DoGetPixel (x, y, colour) ; }
-
-        void GetUserScale(double *x, double *y) const ;
-
-        wxCoord LogicalToDeviceX(wxCoord x)  const ;
-
-        wxCoord LogicalToDeviceXRel(wxCoord x)  const ;
-
-        wxCoord LogicalToDeviceY(wxCoord y)  const ;
-
-        wxCoord LogicalToDeviceYRel(wxCoord y)  const ;
-
-        bool Ok() const {return m_OK;}
-
-        void SetAxisOrientation( bool xLeftRight, bool yBottomUp ) ;
-
-        void SetClippingRegion(wxCoord  WXUNUSED(x), wxCoord  WXUNUSED(y), wxCoord  WXUNUSED(width), wxCoord  WXUNUSED(height))
-            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetClippingRegion Call not yet implemented")); return ; }
-
-        void SetPalette(const wxPalette&  WXUNUSED(palette))
-            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetPalette Call not yet implemented")); return ; }
-
-        void SetBackground( const wxBrush &brush ) ;
-
-        void SetBackgroundMode( int mode ) ;
-
-        void SetBrush(const wxBrush& brush) ;
-
-        void SetFont(const wxFont& font) ;
-
-        void SetLogicalFunction(int  WXUNUSED(function))
-            { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented")); return ; }
-
-        void SetLogicalScale( double x, double y ) ;
-
-        void SetLogicalOrigin( wxCoord x, wxCoord y ) ;
-
-        void SetDeviceOrigin( wxCoord x, wxCoord y ) ;
-
-        void SetMapMode(int anint) ;
-
-        void SetPen(const wxPen& pen)  ;
-
-        void SetUserScale(double xScale, double yScale) ;
-
-        bool StartDoc(const wxString&  WXUNUSED(message))
-            {  return false; }
-
-        void StartPage()
-            {  return ; }
+       void NewGraphics();
+       
+       void write( const wxString &s );
+
+private:
+    wxFileOutputStream *m_outfile;
+    wxString            m_filename;
+    int                 m_sub_images; // number of png format images we have
+    bool                m_OK;
+    bool                m_graphics_changed;
+    int                 m_width, m_height;
+    double              m_mm_to_pix_x, m_mm_to_pix_y;
+    
+private:
+    DECLARE_ABSTRACT_CLASS(wxSVGFileDC)
 };
 
 #endif      // __DCSVG_H
diff --git a/include/wx/dfb/dc.h b/include/wx/dfb/dc.h
index d78dc83262..5bfed574b7 100644
--- a/include/wx/dfb/dc.h
+++ b/include/wx/dfb/dc.h
@@ -73,6 +73,15 @@ public:
     virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
     virtual void SetLogicalFunction(int function);
 
+    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
+    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
+    
     // implementation from now on
     // --------------------------
 
diff --git a/include/wx/gtk/dc.h b/include/wx/gtk/dc.h
index 19f11b607c..3faf7252e2 100644
--- a/include/wx/gtk/dc.h
+++ b/include/wx/gtk/dc.h
@@ -25,43 +25,6 @@
 #define MM_METRIC       7
 #endif
 
-//-----------------------------------------------------------------------------
-// coordinates transformations
-//-----------------------------------------------------------------------------
-
-inline wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
-{
-    return wxRound((x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
-}
-inline wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
-{
-    return wxRound((y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
-}
-inline wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
-{
-    return wxRound(x / m_scaleX);
-}
-inline wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
-{
-    return wxRound(y / m_scaleY);
-}
-inline wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
-{
-    return wxRound((x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
-}
-inline wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
-{
-    return wxRound((y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
-}
-inline wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
-{
-    return wxRound(x * m_scaleX);
-}
-inline wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
-{
-    return wxRound(y * m_scaleY);
-}
-
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
@@ -84,6 +47,15 @@ public:
     virtual void StartPage() { }
     virtual void EndPage() { }
 
+    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
+    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
+
     virtual void SetMapMode( int mode );
     virtual void SetUserScale( double x, double y );
     virtual void SetLogicalScale( double x, double y );
diff --git a/include/wx/gtk1/dc.h b/include/wx/gtk1/dc.h
index b020c081bc..dcd541b5a8 100644
--- a/include/wx/gtk1/dc.h
+++ b/include/wx/gtk1/dc.h
@@ -53,6 +53,15 @@ public:
     virtual void StartPage() { }
     virtual void EndPage() { }
 
+    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
+    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
+
     virtual void SetMapMode( int mode );
     virtual void SetUserScale( double x, double y );
     virtual void SetLogicalScale( double x, double y );
diff --git a/include/wx/mac/carbon/dc.h b/include/wx/mac/carbon/dc.h
index b7945f9575..0996cabe44 100644
--- a/include/wx/mac/carbon/dc.h
+++ b/include/wx/mac/carbon/dc.h
@@ -155,6 +155,15 @@ public:
 
     virtual void ComputeScaleAndOrigin();
 
+    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
+    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
+
 public:
     wxCoord XDEV2LOG(wxCoord x) const
     {
diff --git a/include/wx/msw/dc.h b/include/wx/msw/dc.h
index ee1ab8d4ec..a1e235225f 100644
--- a/include/wx/msw/dc.h
+++ b/include/wx/msw/dc.h
@@ -78,6 +78,15 @@ public:
     virtual int GetDepth() const;
     virtual wxSize GetPPI() const;
 
+    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
+    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
+
     virtual void SetMapMode(int mode);
     virtual void SetUserScale(double x, double y);
     virtual void SetSystemScale(double x, double y);
diff --git a/include/wx/os2/dc.h b/include/wx/os2/dc.h
index 01d7df0ef1..f9d51c9798 100644
--- a/include/wx/os2/dc.h
+++ b/include/wx/os2/dc.h
@@ -157,6 +157,15 @@ public:
                                       );
     virtual void    SetLogicalFunction(int nFunction);
 
+    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
+    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
+    
     // implementation from now on
     // --------------------------
 
diff --git a/include/wx/palmos/dc.h b/include/wx/palmos/dc.h
index cd85d57973..56ce10b190 100644
--- a/include/wx/palmos/dc.h
+++ b/include/wx/palmos/dc.h
@@ -92,6 +92,15 @@ public:
     virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
     virtual void SetLogicalFunction(int function);
 
+    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
+    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
+    
     // implementation from now on
     // --------------------------
 
diff --git a/src/common/dcsvg.cpp b/src/common/dcsvg.cpp
index 79e0e48297..ebc4e74c6f 100644
--- a/src/common/dcsvg.cpp
+++ b/src/common/dcsvg.cpp
@@ -65,34 +65,23 @@ wxString wxBrushString ( wxColour c, int style )
     return s ;
 }
 
+// ----------------------------------------------------------
+//   wxSVGFileDC
+// ----------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxSVGFileDC, wxDC)
 
 void wxSVGFileDC::Init (wxString f, int Width, int Height, float dpi)
 
 {
-    //set up things first  wxDCBase does all this?
     m_width = Width ;
     m_height = Height ;
 
-    m_clipping = FALSE;
     m_OK = TRUE;
 
     m_mm_to_pix_x = dpi/25.4;
     m_mm_to_pix_y = dpi/25.4;
 
-    m_signX = m_signY = 1;
-
-    m_userScaleX = m_userScaleY =
-        m_deviceOriginX = m_deviceOriginY = 0;
-
-    m_OriginX = m_OriginY = 0;
-    m_logicalOriginX = m_logicalOriginY = 0;
-    m_logicalScaleX = m_logicalScaleY = 0 ;
-    m_scaleX = m_scaleY = 1.0 ;
-
-    m_logicalFunction = wxCOPY;
-    m_backgroundMode = wxTRANSPARENT;
-    m_mappingMode = wxMM_TEXT;
-
     m_backgroundBrush = *wxTRANSPARENT_BRUSH;
     m_textForegroundColour = *wxBLACK;
     m_textBackgroundColour = *wxWHITE;
@@ -578,8 +567,8 @@ void wxSVGFileDC::NewGraphics ()
             sWarn = sWarn + wxT("<!--- wxSVGFileDC::SetPen Call called to set a Style which is not available --> \n") ;
     }
 
-    sLast.Printf (   wxT("stroke-width:%d\" \n   transform=\"translate(%.2g %.2g) scale(%.2g %.2g)\">"),
-                  w, m_OriginX, m_OriginY, m_scaleX, m_scaleY  );
+    sLast.Printf( wxT("stroke-width:%d\" \n   transform=\"translate(%.2g %.2g) scale(%.2g %.2g)\">"),
+                  w, (double)m_logicalOriginX, m_logicalOriginY, m_scaleX, m_scaleY  );
 
     s = sBrush + sPenCap + sPenJoin + sPenStyle + sLast + newline + sWarn;
     write(s);
@@ -597,107 +586,6 @@ void wxSVGFileDC::SetFont(const wxFont& font)
 }
 
 
-void wxSVGFileDC::ComputeScaleAndOrigin()
-{
-    m_scaleX = m_logicalScaleX * m_userScaleX;
-    m_scaleY = m_logicalScaleY * m_userScaleY;
-    m_OriginX = m_logicalOriginX * m_logicalScaleX + m_deviceOriginX ;
-    m_OriginY = m_logicalOriginY * m_logicalScaleY + m_deviceOriginY ;
-    m_graphics_changed = TRUE;
-}
-
-
-int wxSVGFileDC::GetMapMode() const
-{
-    return m_mappingMode ;
-}
-
-
-void wxSVGFileDC::SetMapMode( int mode )
-{
-    switch (mode)
-    {
-        case wxMM_TWIPS:
-            SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
-            break;
-        case wxMM_POINTS:
-            SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
-            break;
-        case wxMM_METRIC:
-            SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
-            break;
-        case wxMM_LOMETRIC:
-            SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
-            break;
-        default:
-        case wxMM_TEXT:
-            SetLogicalScale( 1.0, 1.0 );
-            break;
-    }
-    m_mappingMode = mode;
-
-    /*  we don't do this mega optimisation
-        if (mode != wxMM_TEXT)
-        {
-            m_needComputeScaleX = TRUE;
-            m_needComputeScaleY = TRUE;
-        }
-    */
-}
-
-
-void wxSVGFileDC::GetUserScale(double *x, double *y) const
-{
-    *x = m_userScaleX ;
-    *y = m_userScaleY ;
-}
-
-
-void wxSVGFileDC::SetUserScale( double x, double y )
-{
-    // allow negative ? -> no
-    m_userScaleX = x;
-    m_userScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-
-void wxSVGFileDC::SetLogicalScale( double x, double y )
-{
-    // allow negative ?
-    m_logicalScaleX = x;
-    m_logicalScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-
-void wxSVGFileDC::SetLogicalOrigin( wxCoord x, wxCoord y )
-{
-    // is this still correct ?
-    m_logicalOriginX = x * m_signX;
-    m_logicalOriginY = y * m_signY;
-    ComputeScaleAndOrigin();
-}
-
-
-void wxSVGFileDC::SetDeviceOrigin( wxCoord x, wxCoord y )
-{
-    // only wxPostScripDC has m_signX = -1,
-    m_deviceOriginX = x;
-    m_deviceOriginY = y;
-    ComputeScaleAndOrigin();
-}
-
-
-void wxSVGFileDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
-{
-    // only wxPostScripDC has m_signX = -1,
-    m_signX = (xLeftRight ?  1 : -1);
-    m_signY = (yBottomUp  ? -1 :  1);
-    ComputeScaleAndOrigin();
-}
-
-
 // export a bitmap as a raster image in png
 bool wxSVGFileDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
                          wxDC* source, wxCoord xsrc, wxCoord ysrc,
@@ -724,7 +612,6 @@ bool wxSVGFileDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
     return FALSE ;
 }
 
-
 void wxSVGFileDC::DoDrawIcon(const class wxIcon & myIcon, wxCoord x, wxCoord y)
 {
     wxBitmap myBitmap (myIcon.GetWidth(), myIcon.GetHeight() ) ;
@@ -737,8 +624,6 @@ void wxSVGFileDC::DoDrawIcon(const class wxIcon & myIcon, wxCoord x, wxCoord y)
     return ;
 }
 
-
-
 void wxSVGFileDC::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoord y , bool  WXUNUSED(bTransparent) /*=0*/ )
 {
     if (m_graphics_changed) NewGraphics ();
@@ -779,6 +664,12 @@ void wxSVGFileDC::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoord y
     return  ;
 }
 
+void wxSVGFileDC::write(const wxString &s)
+{
+    const wxWX2MBbuf buf = s.mb_str(wxConvUTF8);
+    m_outfile->Write(buf, strlen((const char *)buf));
+    m_OK = m_outfile->Ok();
+}
 
 // ---------------------------------------------------------------------------
 // coordinates transformations
@@ -786,58 +677,114 @@ void wxSVGFileDC::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoord y
 
 wxCoord wxSVGFileDC::DeviceToLogicalX(wxCoord x) const
 {
-    return XDEV2LOG(x);
+    return wxRound((x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
 }
 
-
 wxCoord wxSVGFileDC::DeviceToLogicalY(wxCoord y) const
 {
-    return YDEV2LOG(y);
+    return wxRound((y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
 }
 
-
 wxCoord wxSVGFileDC::DeviceToLogicalXRel(wxCoord x) const
 {
-    return XDEV2LOGREL(x);
+    return wxRound(x / m_scaleX);
 }
 
-
 wxCoord wxSVGFileDC::DeviceToLogicalYRel(wxCoord y) const
 {
-    return YDEV2LOGREL(y);
+    return wxRound(y / m_scaleY);
 }
 
-
 wxCoord wxSVGFileDC::LogicalToDeviceX(wxCoord x) const
 {
-    return XLOG2DEV(x);
+    return wxRound((x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
 }
 
-
 wxCoord wxSVGFileDC::LogicalToDeviceY(wxCoord y) const
 {
-    return YLOG2DEV(y);
+    return wxRound((y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
 }
 
-
 wxCoord wxSVGFileDC::LogicalToDeviceXRel(wxCoord x) const
 {
-    return XLOG2DEVREL(x);
+    return wxRound(x * m_scaleX);
 }
 
-
 wxCoord wxSVGFileDC::LogicalToDeviceYRel(wxCoord y) const
 {
-    return YLOG2DEVREL(y);
+    return wxRound(y * m_scaleY);
 }
 
-void wxSVGFileDC::write(const wxString &s)
+void wxSVGFileDC::ComputeScaleAndOrigin()
 {
-    const wxWX2MBbuf buf = s.mb_str(wxConvUTF8);
-    m_outfile->Write(buf, strlen((const char *)buf));
-    m_OK = m_outfile->Ok();
+    m_scaleX = m_logicalScaleX * m_userScaleX;
+    m_scaleY = m_logicalScaleY * m_userScaleY;
 }
 
+void wxSVGFileDC::SetMapMode( int mode )
+{
+    switch (mode)
+    {
+        case wxMM_TWIPS:
+            SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
+            break;
+        case wxMM_POINTS:
+            SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
+            break;
+        case wxMM_METRIC:
+            SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
+            break;
+        case wxMM_LOMETRIC:
+            SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
+            break;
+        default:
+        case wxMM_TEXT:
+            SetLogicalScale( 1.0, 1.0 );
+            break;
+    }
+    m_mappingMode = mode;
+}
+
+void wxSVGFileDC::SetUserScale( double x, double y )
+{
+    // allow negative ? -> no
+    m_userScaleX = x;
+    m_userScaleY = y;
+    ComputeScaleAndOrigin();
+}
+
+void wxSVGFileDC::SetLogicalScale( double x, double y )
+{
+    // allow negative ?
+    m_logicalScaleX = x;
+    m_logicalScaleY = y;
+    ComputeScaleAndOrigin();
+}
+
+void wxSVGFileDC::SetLogicalOrigin( wxCoord x, wxCoord y )
+{
+    m_logicalOriginX = x * m_signX;   // is this still correct ?
+    m_logicalOriginY = y * m_signY;
+    ComputeScaleAndOrigin();
+}
+
+void wxSVGFileDC::SetDeviceOrigin( wxCoord x, wxCoord y )
+{
+    // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
+    m_deviceOriginX = x;
+    m_deviceOriginY = y;
+    ComputeScaleAndOrigin();
+}
+
+void wxSVGFileDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
+{
+    // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
+    m_signX = (xLeftRight ?  1 : -1);
+    m_signY = (yBottomUp  ? -1 :  1);
+    ComputeScaleAndOrigin();
+}
+
+
 #ifdef __BORLANDC__
 #pragma warn .rch
 #pragma warn .ccc
diff --git a/src/dfb/dc.cpp b/src/dfb/dc.cpp
index 3415cc1806..acfa1eb5b7 100644
--- a/src/dfb/dc.cpp
+++ b/src/dfb/dc.cpp
@@ -613,44 +613,44 @@ void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
 // coordinates transformations
 // ---------------------------------------------------------------------------
 
-wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
+wxCoord wxDC::DeviceToLogicalX(wxCoord x) const
 {
-    return ((wxDC *)this)->XDEV2LOG(x);
+    return XDEV2LOG(x);
 }
 
-wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
+wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
 {
-    return ((wxDC *)this)->YDEV2LOG(y);
+    return YDEV2LOG(y);
 }
 
-wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
+wxCoord wxDC::DeviceToLogicalXRel(wxCoord x) const
 {
-    return ((wxDC *)this)->XDEV2LOGREL(x);
+    return XDEV2LOGREL(x);
 }
 
-wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
+wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
 {
-    return ((wxDC *)this)->YDEV2LOGREL(y);
+    return YDEV2LOGREL(y);
 }
 
-wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
+wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
 {
-    return ((wxDC *)this)->XLOG2DEV(x);
+    return XLOG2DEV(x);
 }
 
-wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
+wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
 {
-    return ((wxDC *)this)->YLOG2DEV(y);
+    return YLOG2DEV(y);
 }
 
-wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
+wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
 {
-    return ((wxDC *)this)->XLOG2DEVREL(x);
+    return XLOG2DEVREL(x);
 }
 
-wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
+wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
 {
-    return ((wxDC *)this)->YLOG2DEVREL(y);
+    return YLOG2DEVREL(y);
 }
 
 
diff --git a/src/gtk/dc.cpp b/src/gtk/dc.cpp
index a89dcbabf6..8264117512 100644
--- a/src/gtk/dc.cpp
+++ b/src/gtk/dc.cpp
@@ -70,6 +70,46 @@ wxSize wxDC::GetPPI() const
 // set various DC parameters
 // ---------------------------------------------------------------------------
 
+wxCoord wxDC::DeviceToLogicalX(wxCoord x) const
+{
+    return wxRound((x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
+}
+
+wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
+{
+    return wxRound((y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
+}
+
+wxCoord wxDC::DeviceToLogicalXRel(wxCoord x) const
+{
+    return wxRound(x / m_scaleX);
+}
+
+wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
+{
+    return wxRound(y / m_scaleY);
+}
+
+wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
+{
+    return wxRound((x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
+}
+
+wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
+{
+    return wxRound((y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
+}
+
+wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
+{
+    return wxRound(x * m_scaleX);
+}
+
+wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
+{
+    return wxRound(y * m_scaleY);
+}
+
 void wxDC::ComputeScaleAndOrigin()
 {
     m_scaleX = m_logicalScaleX * m_userScaleX;
diff --git a/src/gtk1/dc.cpp b/src/gtk1/dc.cpp
index 80d08c5b01..7247e564c3 100644
--- a/src/gtk1/dc.cpp
+++ b/src/gtk1/dc.cpp
@@ -73,6 +73,46 @@ wxSize wxDC::GetPPI() const
 // set various DC parameters
 // ---------------------------------------------------------------------------
 
+wxCoord wxDC::DeviceToLogicalX(wxCoord x) const
+{
+    return wxRound((x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
+}
+
+wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
+{
+    return wxRound((y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
+}
+
+wxCoord wxDC::DeviceToLogicalXRel(wxCoord x) const
+{
+    return wxRound(x / m_scaleX);
+}
+
+wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
+{
+    return wxRound(y / m_scaleY);
+}
+
+wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
+{
+    return wxRound((x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
+}
+
+wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
+{
+    return wxRound((y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
+}
+
+wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
+{
+    return wxRound(x * m_scaleX);
+}
+
+wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
+{
+    return wxRound(y * m_scaleY);
+}
+
 void wxDC::ComputeScaleAndOrigin()
 {
     m_scaleX = m_logicalScaleX * m_userScaleX;
diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp
index 761ab396fd..45d060c38a 100644
--- a/src/mac/carbon/dc.cpp
+++ b/src/mac/carbon/dc.cpp
@@ -2250,44 +2250,44 @@ void wxDC::MacInstallBrush() const
 // coordinates transformations
 // ---------------------------------------------------------------------------
 
-wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
+wxCoord wxDC::DeviceToLogicalX(wxCoord x) const
 {
-    return ((wxDC *)this)->XDEV2LOG(x);
+    return XDEV2LOG(x);
 }
 
-wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
+wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
 {
-    return ((wxDC *)this)->YDEV2LOG(y);
+    return YDEV2LOG(y);
 }
 
-wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
+wxCoord wxDC::DeviceToLogicalXRel(wxCoord x) const
 {
-    return ((wxDC *)this)->XDEV2LOGREL(x);
+    return XDEV2LOGREL(x);
 }
 
-wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
+wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
 {
-    return ((wxDC *)this)->YDEV2LOGREL(y);
+    return YDEV2LOGREL(y);
 }
 
-wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
+wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
 {
-    return ((wxDC *)this)->XLOG2DEV(x);
+    return XLOG2DEV(x);
 }
 
-wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
+wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
 {
-    return ((wxDC *)this)->YLOG2DEV(y);
+    return YLOG2DEV(y);
 }
 
-wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
+wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
 {
-    return ((wxDC *)this)->XLOG2DEVREL(x);
+    return XLOG2DEVREL(x);
 }
 
-wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
+wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
 {
-    return ((wxDC *)this)->YLOG2DEVREL(y);
+    return YLOG2DEVREL(y);
 }
 
 #endif // !wxMAC_USE_CORE_GRAPHICS
diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp
index 3605e4a5b1..d13264eec0 100644
--- a/src/msw/dc.cpp
+++ b/src/msw/dc.cpp
@@ -2004,45 +2004,45 @@ void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y)
 // coordinates transformations
 // ---------------------------------------------------------------------------
 
-wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
+wxCoord wxDC::DeviceToLogicalX(wxCoord x) const
 {
     return DeviceToLogicalXRel(x - m_deviceOriginX)*m_signX + m_logicalOriginX;
 }
 
-wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
+wxCoord wxDC::DeviceToLogicalXRel(wxCoord x) const
 {
     // axis orientation is not taken into account for conversion of a distance
     return (wxCoord)(x / (m_logicalScaleX*m_userScaleX*m_scaleX));
 }
 
-wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
+wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
 {
     return DeviceToLogicalYRel(y - m_deviceOriginY)*m_signY + m_logicalOriginY;
 }
 
-wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
+wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
 {
     // axis orientation is not taken into account for conversion of a distance
     return (wxCoord)( y / (m_logicalScaleY*m_userScaleY*m_scaleY));
 }
 
-wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
+wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
 {
     return LogicalToDeviceXRel(x - m_logicalOriginX)*m_signX + m_deviceOriginX;
 }
 
-wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
+wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
 {
     // axis orientation is not taken into account for conversion of a distance
     return (wxCoord) (x*m_logicalScaleX*m_userScaleX*m_scaleX);
 }
 
-wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
+wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
 {
     return LogicalToDeviceYRel(y - m_logicalOriginY)*m_signY + m_deviceOriginY;
 }
 
-wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
+wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
 {
     // axis orientation is not taken into account for conversion of a distance
     return (wxCoord) (y*m_logicalScaleY*m_userScaleY*m_scaleY);
diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp
index 9df4246a61..ab694e6a95 100644
--- a/src/os2/dc.cpp
+++ b/src/os2/dc.cpp
@@ -2380,34 +2380,34 @@ wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
     return (wxCoord) ((x)/(m_logicalScaleX*m_userScaleX*m_scaleX));
 }
 
-wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
+wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
 {
     return (wxCoord) (((y) - m_deviceOriginY)/(m_logicalScaleY*m_userScaleY*m_signY*m_scaleY) - m_logicalOriginY);
 }
 
-wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
+wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
 {
     // axis orientation is not taken into account for conversion of a distance
     return (wxCoord) ((y)/(m_logicalScaleY*m_userScaleY*m_scaleY));
 }
 
-wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
+wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
 {
     return (wxCoord) ((x - m_logicalOriginX)*m_logicalScaleX*m_userScaleX*m_signX*m_scaleX + m_deviceOriginX);
 }
 
-wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
+wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
 {
     // axis orientation is not taken into account for conversion of a distance
     return (wxCoord) (x*m_logicalScaleX*m_userScaleX*m_scaleX);
 }
 
-wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
+wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
 {
     return (wxCoord) ((y - m_logicalOriginY)*m_logicalScaleY*m_userScaleY*m_signY*m_scaleY + m_deviceOriginY);
 }
 
-wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
+wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
 {
     // axis orientation is not taken into account for conversion of a distance
     return (wxCoord) (y*m_logicalScaleY*m_userScaleY*m_scaleY);
diff --git a/src/palmos/dc.cpp b/src/palmos/dc.cpp
index 3dbbc7b11d..38c0ae1d51 100644
--- a/src/palmos/dc.cpp
+++ b/src/palmos/dc.cpp
@@ -371,42 +371,42 @@ void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y)
 // coordinates transformations
 // ---------------------------------------------------------------------------
 
-wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
+wxCoord wxDC::DeviceToLogicalX(wxCoord x) const
 {
     return 0;
 }
 
-wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
+wxCoord wxDC::DeviceToLogicalXRel(wxCoord x) const
 {
     return 0;
 }
 
-wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
+wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
 {
     return 0;
 }
 
-wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
+wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
 {
     return 0;
 }
 
-wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
+wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
 {
     return 0;
 }
 
-wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
+wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
 {
     return 0;
 }
 
-wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
+wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
 {
     return 0;
 }
 
-wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
+wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
 {
     return 0;
 }
-- 
2.50.0

