remove just added wxCoordRound() (see patch 1586499)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42763 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2006-10-30 20:34:25 +00:00
parent b4bdf722ab
commit 5a70d3f578
6 changed files with 74 additions and 100 deletions

View File

@ -58,7 +58,6 @@ the corresponding topic.
\helpref{wxCONCAT}{wxconcat}\\
\helpref{wxConcatFiles}{wxconcatfiles}\\
\helpref{wxConstCast}{wxconstcast}\\
\helpref{wxCoordRound}{wxcoordround}\\
\helpref{wxCopyFile}{wxcopyfile}\\
\helpref{wxCreateDynamicObject}{wxcreatedynamicobject}\\
\helpref{wxCreateFileTipProvider}{wxcreatefiletipprovider}\\
@ -2848,20 +2847,6 @@ 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}
\func{bool}{wxGetKeyState}{\param{wxKeyCode }{key}}

View File

@ -658,18 +658,6 @@ typedef int wxCoord;
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 */
/* ---------------------------------------------------------------------------- */

View File

@ -80,35 +80,35 @@ public:
wxCoord XDEV2LOG(wxCoord x) const
{
return wxCoordRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
}
wxCoord XDEV2LOGREL(wxCoord x) const
{
return wxCoordRound((double)(x) / m_scaleX);
return wxRound((double)(x) / m_scaleX);
}
wxCoord YDEV2LOG(wxCoord y) const
{
return wxCoordRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
}
wxCoord YDEV2LOGREL(wxCoord y) const
{
return wxCoordRound((double)(y) / m_scaleY);
return wxRound((double)(y) / m_scaleY);
}
wxCoord XLOG2DEV(wxCoord x) const
{
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
}
wxCoord XLOG2DEVREL(wxCoord x) const
{
return wxCoordRound((double)(x) * m_scaleX);
return wxRound((double)(x) * m_scaleX);
}
wxCoord YLOG2DEV(wxCoord y) const
{
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
}
wxCoord YLOG2DEVREL(wxCoord y) const
{
return wxCoordRound((double)(y) * m_scaleY);
return wxRound((double)(y) * m_scaleY);
}
// Returns the surface (and increases its ref count)

View File

@ -70,35 +70,35 @@ public:
wxCoord XDEV2LOG(wxCoord x) const
{
return wxCoordRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
}
wxCoord XDEV2LOGREL(wxCoord x) const
{
return wxCoordRound((double)(x) / m_scaleX);
return wxRound((double)(x) / m_scaleX);
}
wxCoord YDEV2LOG(wxCoord y) const
{
return wxCoordRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
}
wxCoord YDEV2LOGREL(wxCoord y) const
{
return wxCoordRound((double)(y) / m_scaleY);
return wxRound((double)(y) / m_scaleY);
}
wxCoord XLOG2DEV(wxCoord x) const
{
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
}
wxCoord XLOG2DEVREL(wxCoord x) const
{
return wxCoordRound((double)(x) * m_scaleX);
return wxRound((double)(x) * m_scaleX);
}
wxCoord YLOG2DEV(wxCoord y) const
{
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
}
wxCoord YLOG2DEVREL(wxCoord y) const
{
return wxCoordRound((double)(y) * m_scaleY);
return wxRound((double)(y) * m_scaleY);
}
protected:

View File

@ -27,6 +27,7 @@
#include "wx/utils.h"
#include "wx/dc.h"
#include "wx/app.h"
#include "wx/math.h"
#include "wx/msgdlg.h"
#include "wx/layout.h"
#include "wx/choice.h"
@ -617,10 +618,10 @@ void wxPrintout::FitThisSizeToPageMargins(const wxSize& imageSize, const wxPageS
GetPageSizeMM(&mw, &mh);
float mmToDeviceX = float(pw) / mw;
float mmToDeviceY = float(ph) / mh;
wxRect pageMarginsRect(paperRect.x + wxCoordRound(mmToDeviceX * topLeft.x),
paperRect.y + wxCoordRound(mmToDeviceY * topLeft.y),
paperRect.width - wxCoordRound(mmToDeviceX * (topLeft.x + bottomRight.x)),
paperRect.height - wxCoordRound(mmToDeviceY * (topLeft.y + bottomRight.y)));
wxRect pageMarginsRect(paperRect.x + wxRound(mmToDeviceX * topLeft.x),
paperRect.y + wxRound(mmToDeviceY * topLeft.y),
paperRect.width - wxRound(mmToDeviceX * (topLeft.x + bottomRight.x)),
paperRect.height - wxRound(mmToDeviceY * (topLeft.y + bottomRight.y)));
wxCoord w, h;
m_printoutDC->GetSize(&w, &h);
float scaleX = (float(pageMarginsRect.width) * w) / (float(pw) * imageSize.x);
@ -708,10 +709,10 @@ wxRect wxPrintout::GetLogicalPaperRect() const
// This DC doesn't match the printed page, so we have to scale.
float scaleX = float(w) / pw;
float scaleY = float(h) / ph;
return wxRect(m_printoutDC->DeviceToLogicalX(wxCoordRound(paperRect.x * scaleX)),
m_printoutDC->DeviceToLogicalY(wxCoordRound(paperRect.y * scaleY)),
m_printoutDC->DeviceToLogicalXRel(wxCoordRound(paperRect.width * scaleX)),
m_printoutDC->DeviceToLogicalYRel(wxCoordRound(paperRect.height * scaleY)));
return wxRect(m_printoutDC->DeviceToLogicalX(wxRound(paperRect.x * scaleX)),
m_printoutDC->DeviceToLogicalY(wxRound(paperRect.y * scaleY)),
m_printoutDC->DeviceToLogicalXRel(wxRound(paperRect.width * scaleX)),
m_printoutDC->DeviceToLogicalYRel(wxRound(paperRect.height * scaleY)));
}
wxRect wxPrintout::GetLogicalPageRect() const
@ -740,10 +741,10 @@ wxRect wxPrintout::GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSe
GetPageSizeMM(&mw, &mh);
float mmToDeviceX = float(pw) / mw;
float mmToDeviceY = float(ph) / mh;
wxRect pageMarginsRect(paperRect.x + wxCoordRound(mmToDeviceX * topLeft.x),
paperRect.y + wxCoordRound(mmToDeviceY * topLeft.y),
paperRect.width - wxCoordRound(mmToDeviceX * (topLeft.x + bottomRight.x)),
paperRect.height - wxCoordRound(mmToDeviceY * (topLeft.y + bottomRight.y)));
wxRect pageMarginsRect(paperRect.x + wxRound(mmToDeviceX * topLeft.x),
paperRect.y + wxRound(mmToDeviceY * topLeft.y),
paperRect.width - wxRound(mmToDeviceX * (topLeft.x + bottomRight.x)),
paperRect.height - wxRound(mmToDeviceY * (topLeft.y + bottomRight.y)));
wxCoord w, h;
m_printoutDC->GetSize(&w, &h);
if (w == pw && h == ph) {
@ -756,10 +757,10 @@ wxRect wxPrintout::GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSe
// This DC doesn't match the printed page, so we have to scale.
float scaleX = float(w) / pw;
float scaleY = float(h) / ph;
return wxRect(m_printoutDC->DeviceToLogicalX(wxCoordRound(pageMarginsRect.x * scaleX)),
m_printoutDC->DeviceToLogicalY(wxCoordRound(pageMarginsRect.y * scaleY)),
m_printoutDC->DeviceToLogicalXRel(wxCoordRound(pageMarginsRect.width * scaleX)),
m_printoutDC->DeviceToLogicalYRel(wxCoordRound(pageMarginsRect.height * scaleY)));
return wxRect(m_printoutDC->DeviceToLogicalX(wxRound(pageMarginsRect.x * scaleX)),
m_printoutDC->DeviceToLogicalY(wxRound(pageMarginsRect.y * scaleY)),
m_printoutDC->DeviceToLogicalXRel(wxRound(pageMarginsRect.width * scaleX)),
m_printoutDC->DeviceToLogicalYRel(wxRound(pageMarginsRect.height * scaleY)));
}
void wxPrintout::SetLogicalOrigin(wxCoord x, wxCoord y)

View File

@ -2286,42 +2286,42 @@ void wxDC::Clear(void)
*/ // TODO
wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
{
return wxCoordRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
}
wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
{
return wxCoordRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
}
wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
{
return wxCoordRound((double)(x) / m_scaleX);
return wxRound((double)(x) / m_scaleX);
}
wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
{
return wxCoordRound((double)(y) / m_scaleY);
return wxRound((double)(y) / m_scaleY);
}
wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
{
return wxCoordRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
}
wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
{
return wxCoordRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
}
wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
{
return wxCoordRound((double)(x) * m_scaleX);
return wxRound((double)(x) * m_scaleX);
}
wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
{
return wxCoordRound((double)(y) * m_scaleY);
return wxRound((double)(y) * m_scaleY);
}
#endif // wxMAC_USE_CORE_GRAPHICS