Applied patch 1586499: wxCoordRound function
Centralises rounding and adds nearest-value rounding to prntbase.cpp. by Robert J. Lang git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -58,6 +58,7 @@ the corresponding topic.
|
|||||||
\helpref{wxCONCAT}{wxconcat}\\
|
\helpref{wxCONCAT}{wxconcat}\\
|
||||||
\helpref{wxConcatFiles}{wxconcatfiles}\\
|
\helpref{wxConcatFiles}{wxconcatfiles}\\
|
||||||
\helpref{wxConstCast}{wxconstcast}\\
|
\helpref{wxConstCast}{wxconstcast}\\
|
||||||
|
\helpref{wxCoordRound}{wxcoordround}\\
|
||||||
\helpref{wxCopyFile}{wxcopyfile}\\
|
\helpref{wxCopyFile}{wxcopyfile}\\
|
||||||
\helpref{wxCreateDynamicObject}{wxcreatedynamicobject}\\
|
\helpref{wxCreateDynamicObject}{wxcreatedynamicobject}\\
|
||||||
\helpref{wxCreateFileTipProvider}{wxcreatefiletipprovider}\\
|
\helpref{wxCreateFileTipProvider}{wxcreatefiletipprovider}\\
|
||||||
@@ -2846,6 +2847,21 @@ code which might have to be compiled with an old compiler without support for
|
|||||||
this language feature but still take advantage of it when it is available.
|
this language feature but still take advantage of it when it is available.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{::wxCoordRound}\label{wxcoordround}
|
||||||
|
|
||||||
|
\func{wxCoord}{wxCoordRound}{\param{const float\& }{f}}
|
||||||
|
|
||||||
|
\func{wxCoord}{wxCoordRound}{\param{const double\& }{f}}
|
||||||
|
|
||||||
|
Convert \em{f} to a wxCoord, using round-to-nearest. This is commonly used
|
||||||
|
in scaling calculations.
|
||||||
|
|
||||||
|
\wxheading{Include files}
|
||||||
|
|
||||||
|
<wx/defs.h>
|
||||||
|
|
||||||
|
|
||||||
\membersection{::wxGetKeyState}\label{wxgetkeystate}
|
\membersection{::wxGetKeyState}\label{wxgetkeystate}
|
||||||
|
|
||||||
\func{bool}{wxGetKeyState}{\param{wxKeyCode }{key}}
|
\func{bool}{wxGetKeyState}{\param{wxKeyCode }{key}}
|
||||||
|
@@ -658,6 +658,18 @@ typedef int wxCoord;
|
|||||||
|
|
||||||
enum { wxDefaultCoord = -1 };
|
enum { wxDefaultCoord = -1 };
|
||||||
|
|
||||||
|
/* round-to-nearest (used in scaling) */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
inline wxCoord wxCoordRound(const float& f)
|
||||||
|
{
|
||||||
|
return (f > 0) ? (wxCoord)(f + 0.5) : (f < 0) ? (wxCoord)(f - 0.5) : 0;
|
||||||
|
}
|
||||||
|
inline wxCoord wxCoordRound(const double& f)
|
||||||
|
{
|
||||||
|
return (f > 0) ? (wxCoord)(f + 0.5) : (f < 0) ? (wxCoord)(f - 0.5) : 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------- */
|
||||||
/* define fixed length types */
|
/* define fixed length types */
|
||||||
/* ---------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------- */
|
||||||
|
@@ -80,63 +80,35 @@ public:
|
|||||||
|
|
||||||
wxCoord XDEV2LOG(wxCoord x) const
|
wxCoord XDEV2LOG(wxCoord x) const
|
||||||
{
|
{
|
||||||
wxCoord new_x = x - m_deviceOriginX;
|
return wxCoordRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord XDEV2LOGREL(wxCoord x) const
|
wxCoord XDEV2LOGREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) / m_scaleX);
|
||||||
return (wxCoord)((double)(x) / m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) / m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOG(wxCoord y) const
|
wxCoord YDEV2LOG(wxCoord y) const
|
||||||
{
|
{
|
||||||
wxCoord new_y = y - m_deviceOriginY;
|
return wxCoordRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOGREL(wxCoord y) const
|
wxCoord YDEV2LOGREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wCoordRound((double)(y) / m_scaleY);
|
||||||
return (wxCoord)((double)(y) / m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) / m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEV(wxCoord x) const
|
wxCoord XLOG2DEV(wxCoord x) const
|
||||||
{
|
{
|
||||||
wxCoord new_x = x - m_logicalOriginX;
|
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEVREL(wxCoord x) const
|
wxCoord XLOG2DEVREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) * m_scaleX);
|
||||||
return (wxCoord)((double)(x) * m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) * m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEV(wxCoord y) const
|
wxCoord YLOG2DEV(wxCoord y) const
|
||||||
{
|
{
|
||||||
wxCoord new_y = y - m_logicalOriginY;
|
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEVREL(wxCoord y) const
|
wxCoord YLOG2DEVREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wxCoordRound((double)(y) * m_scaleY);
|
||||||
return (wxCoord)((double)(y) * m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) * m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the surface (and increases its ref count)
|
// Returns the surface (and increases its ref count)
|
||||||
|
@@ -296,63 +296,35 @@ private:
|
|||||||
private:
|
private:
|
||||||
wxCoord XDEV2LOG(wxCoord x) const
|
wxCoord XDEV2LOG(wxCoord x) const
|
||||||
{
|
{
|
||||||
wxCoord new_x = x - m_deviceOriginX;
|
return wxCoordRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord XDEV2LOGREL(wxCoord x) const
|
wxCoord XDEV2LOGREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) / m_scaleX);
|
||||||
return (wxCoord)((double)(x) / m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) / m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOG(wxCoord y) const
|
wxCoord YDEV2LOG(wxCoord y) const
|
||||||
{
|
{
|
||||||
wxCoord new_y = y - m_deviceOriginY;
|
return wxCoordRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOGREL(wxCoord y) const
|
wxCoord YDEV2LOGREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wCoordRound((double)(y) / m_scaleY);
|
||||||
return (wxCoord)((double)(y) / m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) / m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEV(wxCoord x) const
|
wxCoord XLOG2DEV(wxCoord x) const
|
||||||
{
|
{
|
||||||
wxCoord new_x = x - m_logicalOriginX;
|
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEVREL(wxCoord x) const
|
wxCoord XLOG2DEVREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) * m_scaleX);
|
||||||
return (wxCoord)((double)(x) * m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) * m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEV(wxCoord y) const
|
wxCoord YLOG2DEV(wxCoord y) const
|
||||||
{
|
{
|
||||||
wxCoord new_y = y - m_logicalOriginY;
|
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEVREL(wxCoord y) const
|
wxCoord YLOG2DEVREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wxCoordRound((double)(y) * m_scaleY);
|
||||||
return (wxCoord)((double)(y) * m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) * m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxGnomePrintDC)
|
DECLARE_DYNAMIC_CLASS(wxGnomePrintDC)
|
||||||
|
@@ -70,63 +70,35 @@ public:
|
|||||||
|
|
||||||
wxCoord XDEV2LOG(wxCoord x) const
|
wxCoord XDEV2LOG(wxCoord x) const
|
||||||
{
|
{
|
||||||
wxCoord new_x = x - m_deviceOriginX;
|
return wxCoordRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord XDEV2LOGREL(wxCoord x) const
|
wxCoord XDEV2LOGREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) / m_scaleX);
|
||||||
return (wxCoord)((double)(x) / m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) / m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOG(wxCoord y) const
|
wxCoord YDEV2LOG(wxCoord y) const
|
||||||
{
|
{
|
||||||
wxCoord new_y = y - m_deviceOriginY;
|
return wxCoordRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOGREL(wxCoord y) const
|
wxCoord YDEV2LOGREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wCoordRound((double)(y) / m_scaleY);
|
||||||
return (wxCoord)((double)(y) / m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) / m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEV(wxCoord x) const
|
wxCoord XLOG2DEV(wxCoord x) const
|
||||||
{
|
{
|
||||||
wxCoord new_x = x - m_logicalOriginX;
|
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEVREL(wxCoord x) const
|
wxCoord XLOG2DEVREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) * m_scaleX);
|
||||||
return (wxCoord)((double)(x) * m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) * m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEV(wxCoord y) const
|
wxCoord YLOG2DEV(wxCoord y) const
|
||||||
{
|
{
|
||||||
wxCoord new_y = y - m_logicalOriginY;
|
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEVREL(wxCoord y) const
|
wxCoord YLOG2DEVREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wxCoordRound((double)(y) * m_scaleY);
|
||||||
return (wxCoord)((double)(y) * m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) * m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -158,88 +158,45 @@ public:
|
|||||||
public:
|
public:
|
||||||
wxCoord XDEV2LOG(wxCoord x) const
|
wxCoord XDEV2LOG(wxCoord x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_deviceOriginX;
|
return wxCoordRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord XDEV2LOGREL(wxCoord x) const
|
wxCoord XDEV2LOGREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) / m_scaleX);
|
||||||
return (wxCoord)((double)x / m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)x / m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord YDEV2LOG(wxCoord y) const
|
wxCoord YDEV2LOG(wxCoord y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_deviceOriginY;
|
return wxCoordRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord YDEV2LOGREL(wxCoord y) const
|
wxCoord YDEV2LOGREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wCoordRound((double)(y) / m_scaleY);
|
||||||
return (wxCoord)((double)y / m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)y / m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord XLOG2DEV(wxCoord x) const
|
wxCoord XLOG2DEV(wxCoord x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_logicalOriginX;
|
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord XLOG2DEVREL(wxCoord x) const
|
wxCoord XLOG2DEVREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) * m_scaleX);
|
||||||
return (wxCoord)((double)x * m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)x * m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord YLOG2DEV(wxCoord y) const
|
wxCoord YLOG2DEV(wxCoord y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_logicalOriginY;
|
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord YLOG2DEVREL(wxCoord y) const
|
wxCoord YLOG2DEVREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wxCoordRound((double)(y) * m_scaleY);
|
||||||
return (wxCoord)((double)y * m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)y * m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord XLOG2DEVMAC(wxCoord x) const
|
wxCoord XLOG2DEVMAC(wxCoord x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_logicalOriginX;
|
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX + m_macLocalOrigin.x;
|
||||||
if (new_x > 0)
|
|
||||||
return (wxCoord)((double)new_x * m_scaleX + 0.5) * m_signX + m_deviceOriginX + m_macLocalOrigin.x;
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)new_x * m_scaleX - 0.5) * m_signX + m_deviceOriginX + m_macLocalOrigin.x;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord YLOG2DEVMAC(wxCoord y) const
|
wxCoord YLOG2DEVMAC(wxCoord y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_logicalOriginY;
|
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY + m_macLocalOrigin.y;
|
||||||
if (new_y > 0)
|
|
||||||
return (wxCoord)((double)new_y * m_scaleY + 0.5) * m_signY + m_deviceOriginY + m_macLocalOrigin.y;
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)new_y * m_scaleY - 0.5) * m_signY + m_deviceOriginY + m_macLocalOrigin.y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
|
@@ -105,79 +105,45 @@ class WXDLLEXPORT wxDC: public wxDCBase
|
|||||||
|
|
||||||
wxCoord XDEV2LOG(wxCoord x) const
|
wxCoord XDEV2LOG(wxCoord x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_deviceOriginX ;
|
return wxCoordRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord XDEV2LOGREL(wxCoord x) const
|
wxCoord XDEV2LOGREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) / m_scaleX);
|
||||||
return (wxCoord)((double)(x) / m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) / m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOG(wxCoord y) const
|
wxCoord YDEV2LOG(wxCoord y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_deviceOriginY ;
|
return wxCoordRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOGREL(wxCoord y) const
|
wxCoord YDEV2LOGREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wCoordRound((double)(y) / m_scaleY);
|
||||||
return (wxCoord)((double)(y) / m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) / m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEV(wxCoord x) const
|
wxCoord XLOG2DEV(wxCoord x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_logicalOriginX;
|
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
|
||||||
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 ;
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEVREL(wxCoord x) const
|
wxCoord XLOG2DEVREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) * m_scaleX);
|
||||||
return (wxCoord)((double)(x) * m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) * m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEV(wxCoord y) const
|
wxCoord YLOG2DEV(wxCoord y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_logicalOriginY ;
|
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
|
||||||
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 ;
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEVREL(wxCoord y) const
|
wxCoord YLOG2DEVREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wxCoordRound((double)(y) * m_scaleY);
|
||||||
return (wxCoord)((double)(y) * m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) * m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord XLOG2DEVMAC(wxCoord x) const
|
wxCoord XLOG2DEVMAC(wxCoord x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_logicalOriginX;
|
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX + m_macLocalOrigin.x;
|
||||||
if (new_x > 0)
|
|
||||||
return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX + m_macLocalOrigin.x ;
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX + m_macLocalOrigin.x ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord YLOG2DEVMAC(wxCoord y) const
|
wxCoord YLOG2DEVMAC(wxCoord y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_logicalOriginY ;
|
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY + m_macLocalOrigin.y;
|
||||||
if (new_y > 0)
|
|
||||||
return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY + m_macLocalOrigin.y ;
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY + m_macLocalOrigin.y ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WXHRGN MacGetCurrentClipRgn() { return m_macCurrentClipRgn ; }
|
WXHRGN MacGetCurrentClipRgn() { return m_macCurrentClipRgn ; }
|
||||||
|
@@ -101,63 +101,35 @@ public:
|
|||||||
|
|
||||||
wxCoord XDEV2LOG(wxCoord x) const
|
wxCoord XDEV2LOG(wxCoord x) const
|
||||||
{
|
{
|
||||||
wxCoord new_x = x - m_deviceOriginX;
|
return wxCoordRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord XDEV2LOGREL(wxCoord x) const
|
wxCoord XDEV2LOGREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) / m_scaleX);
|
||||||
return (wxCoord)((double)(x) / m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) / m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOG(wxCoord y) const
|
wxCoord YDEV2LOG(wxCoord y) const
|
||||||
{
|
{
|
||||||
wxCoord new_y = y - m_deviceOriginY;
|
return wxCoordRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOGREL(wxCoord y) const
|
wxCoord YDEV2LOGREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wCoordRound((double)(y) / m_scaleY);
|
||||||
return (wxCoord)((double)(y) / m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) / m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEV(wxCoord x) const
|
wxCoord XLOG2DEV(wxCoord x) const
|
||||||
{
|
{
|
||||||
wxCoord new_x = x - m_logicalOriginX;
|
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEVREL(wxCoord x) const
|
wxCoord XLOG2DEVREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) * m_scaleX);
|
||||||
return (wxCoord)((double)(x) * m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) * m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEV(wxCoord y) const
|
wxCoord YLOG2DEV(wxCoord y) const
|
||||||
{
|
{
|
||||||
wxCoord new_y = y - m_logicalOriginY;
|
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEVREL(wxCoord y) const
|
wxCoord YLOG2DEVREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wxCoordRound((double)(y) * m_scaleY);
|
||||||
return (wxCoord)((double)(y) * m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) * m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MGLDevCtx *GetMGLDC() const { return m_MGLDC; }
|
MGLDevCtx *GetMGLDC() const { return m_MGLDC; }
|
||||||
|
@@ -65,63 +65,35 @@ public:
|
|||||||
|
|
||||||
wxCoord XDEV2LOG(wxCoord x) const
|
wxCoord XDEV2LOG(wxCoord x) const
|
||||||
{
|
{
|
||||||
wxCoord new_x = x - m_deviceOriginX;
|
return wxCoordRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord XDEV2LOGREL(wxCoord x) const
|
wxCoord XDEV2LOGREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) / m_scaleX);
|
||||||
return (wxCoord)((double)(x) / m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) / m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOG(wxCoord y) const
|
wxCoord YDEV2LOG(wxCoord y) const
|
||||||
{
|
{
|
||||||
wxCoord new_y = y - m_deviceOriginY;
|
return wxCoordRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord YDEV2LOGREL(wxCoord y) const
|
wxCoord YDEV2LOGREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wCoordRound((double)(y) / m_scaleY);
|
||||||
return (wxCoord)((double)(y) / m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) / m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEV(wxCoord x) const
|
wxCoord XLOG2DEV(wxCoord x) const
|
||||||
{
|
{
|
||||||
wxCoord new_x = x - m_logicalOriginX;
|
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord XLOG2DEVREL(wxCoord x) const
|
wxCoord XLOG2DEVREL(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) * m_scaleX);
|
||||||
return (wxCoord)((double)(x) * m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) * m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEV(wxCoord y) const
|
wxCoord YLOG2DEV(wxCoord y) const
|
||||||
{
|
{
|
||||||
wxCoord new_y = y - m_logicalOriginY;
|
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
wxCoord YLOG2DEVREL(wxCoord y) const
|
wxCoord YLOG2DEVREL(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wxCoordRound((double)(y) * m_scaleY);
|
||||||
return (wxCoord)((double)(y) * m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) * m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -617,10 +617,10 @@ void wxPrintout::FitThisSizeToPageMargins(const wxSize& imageSize, const wxPageS
|
|||||||
GetPageSizeMM(&mw, &mh);
|
GetPageSizeMM(&mw, &mh);
|
||||||
float mmToDeviceX = float(pw) / mw;
|
float mmToDeviceX = float(pw) / mw;
|
||||||
float mmToDeviceY = float(ph) / mh;
|
float mmToDeviceY = float(ph) / mh;
|
||||||
wxRect pageMarginsRect(paperRect.x + wxCoord(mmToDeviceX * topLeft.x),
|
wxRect pageMarginsRect(paperRect.x + wxCoordRound(mmToDeviceX * topLeft.x),
|
||||||
paperRect.y + wxCoord(mmToDeviceY * topLeft.y),
|
paperRect.y + wxCoordRound(mmToDeviceY * topLeft.y),
|
||||||
paperRect.width - wxCoord(mmToDeviceX * (topLeft.x + bottomRight.x)),
|
paperRect.width - wxCoordRound(mmToDeviceX * (topLeft.x + bottomRight.x)),
|
||||||
paperRect.height - wxCoord(mmToDeviceY * (topLeft.y + bottomRight.y)));
|
paperRect.height - wxCoordRound(mmToDeviceY * (topLeft.y + bottomRight.y)));
|
||||||
wxCoord w, h;
|
wxCoord w, h;
|
||||||
m_printoutDC->GetSize(&w, &h);
|
m_printoutDC->GetSize(&w, &h);
|
||||||
float scaleX = (float(pageMarginsRect.width) * w) / (float(pw) * imageSize.x);
|
float scaleX = (float(pageMarginsRect.width) * w) / (float(pw) * imageSize.x);
|
||||||
@@ -708,10 +708,10 @@ wxRect wxPrintout::GetLogicalPaperRect() const
|
|||||||
// This DC doesn't match the printed page, so we have to scale.
|
// This DC doesn't match the printed page, so we have to scale.
|
||||||
float scaleX = float(w) / pw;
|
float scaleX = float(w) / pw;
|
||||||
float scaleY = float(h) / ph;
|
float scaleY = float(h) / ph;
|
||||||
return wxRect(m_printoutDC->DeviceToLogicalX(wxCoord(paperRect.x * scaleX)),
|
return wxRect(m_printoutDC->DeviceToLogicalX(wxCoordRound(paperRect.x * scaleX)),
|
||||||
m_printoutDC->DeviceToLogicalY(wxCoord(paperRect.y * scaleY)),
|
m_printoutDC->DeviceToLogicalY(wxCoordRound(paperRect.y * scaleY)),
|
||||||
m_printoutDC->DeviceToLogicalXRel(wxCoord(paperRect.width * scaleX)),
|
m_printoutDC->DeviceToLogicalXRel(wxCoordRound(paperRect.width * scaleX)),
|
||||||
m_printoutDC->DeviceToLogicalYRel(wxCoord(paperRect.height * scaleY)));
|
m_printoutDC->DeviceToLogicalYRel(wxCoordRound(paperRect.height * scaleY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRect wxPrintout::GetLogicalPageRect() const
|
wxRect wxPrintout::GetLogicalPageRect() const
|
||||||
@@ -740,10 +740,10 @@ wxRect wxPrintout::GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSe
|
|||||||
GetPageSizeMM(&mw, &mh);
|
GetPageSizeMM(&mw, &mh);
|
||||||
float mmToDeviceX = float(pw) / mw;
|
float mmToDeviceX = float(pw) / mw;
|
||||||
float mmToDeviceY = float(ph) / mh;
|
float mmToDeviceY = float(ph) / mh;
|
||||||
wxRect pageMarginsRect(paperRect.x + wxCoord(mmToDeviceX * topLeft.x),
|
wxRect pageMarginsRect(paperRect.x + wxCoordRound(mmToDeviceX * topLeft.x),
|
||||||
paperRect.y + wxCoord(mmToDeviceY * topLeft.y),
|
paperRect.y + wxCoordRound(mmToDeviceY * topLeft.y),
|
||||||
paperRect.width - wxCoord(mmToDeviceX * (topLeft.x + bottomRight.x)),
|
paperRect.width - wxCoordRound(mmToDeviceX * (topLeft.x + bottomRight.x)),
|
||||||
paperRect.height - wxCoord(mmToDeviceY * (topLeft.y + bottomRight.y)));
|
paperRect.height - wxCoordRound(mmToDeviceY * (topLeft.y + bottomRight.y)));
|
||||||
wxCoord w, h;
|
wxCoord w, h;
|
||||||
m_printoutDC->GetSize(&w, &h);
|
m_printoutDC->GetSize(&w, &h);
|
||||||
if (w == pw && h == ph) {
|
if (w == pw && h == ph) {
|
||||||
@@ -756,10 +756,10 @@ wxRect wxPrintout::GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSe
|
|||||||
// This DC doesn't match the printed page, so we have to scale.
|
// This DC doesn't match the printed page, so we have to scale.
|
||||||
float scaleX = float(w) / pw;
|
float scaleX = float(w) / pw;
|
||||||
float scaleY = float(h) / ph;
|
float scaleY = float(h) / ph;
|
||||||
return wxRect(m_printoutDC->DeviceToLogicalX(wxCoord(pageMarginsRect.x * scaleX)),
|
return wxRect(m_printoutDC->DeviceToLogicalX(wxCoordRound(pageMarginsRect.x * scaleX)),
|
||||||
m_printoutDC->DeviceToLogicalY(wxCoord(pageMarginsRect.y * scaleY)),
|
m_printoutDC->DeviceToLogicalY(wxCoordRound(pageMarginsRect.y * scaleY)),
|
||||||
m_printoutDC->DeviceToLogicalXRel(wxCoord(pageMarginsRect.width * scaleX)),
|
m_printoutDC->DeviceToLogicalXRel(wxCoordRound(pageMarginsRect.width * scaleX)),
|
||||||
m_printoutDC->DeviceToLogicalYRel(wxCoord(pageMarginsRect.height * scaleY)));
|
m_printoutDC->DeviceToLogicalYRel(wxCoordRound(pageMarginsRect.height * scaleY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPrintout::SetLogicalOrigin(wxCoord x, wxCoord y)
|
void wxPrintout::SetLogicalOrigin(wxCoord x, wxCoord y)
|
||||||
|
@@ -2286,70 +2286,42 @@ void wxDC::Clear(void)
|
|||||||
*/ // TODO
|
*/ // TODO
|
||||||
wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
|
wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_deviceOriginX;
|
return wxCoordRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
|
wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_deviceOriginY;
|
return wxCoordRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
|
wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) / m_scaleX);
|
||||||
return (wxCoord)((double)x / m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)x / m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
|
wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wxCoordRound((double)(y) / m_scaleY);
|
||||||
return (wxCoord)((double)y / m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)y / m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
|
wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_logicalOriginX;
|
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
|
wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_logicalOriginY;
|
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
|
wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
return wxCoordRound((double)(x) * m_scaleX);
|
||||||
return (wxCoord)((double)x * m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)x * m_scaleX - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
|
wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
return wxCoordRound((double)(y) * m_scaleY);
|
||||||
return (wxCoord)((double)y * m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)y * m_scaleY - 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxMAC_USE_CORE_GRAPHICS
|
#endif // wxMAC_USE_CORE_GRAPHICS
|
||||||
|
Reference in New Issue
Block a user