From 728ddc45e0377352434e752ede07311e00252399 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Mon, 24 Sep 2007 21:07:20 +0000 Subject: [PATCH] Reduce width and height of drawing ops by one in all vector printing backends git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/dcpsg.cpp | 9 +++++++++ src/gtk/gnome/gprint.cpp | 11 ++++++++++- src/gtk/print.cpp | 9 +++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index e978a7dba0..f8e57a0836 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -737,6 +737,9 @@ void wxPostScriptDC::DoDrawLines (int n, wxPoint points[], wxCoord xoffset, wxCo void wxPostScriptDC::DoDrawRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); + + width--; + height--; if (m_brush.GetStyle () != wxTRANSPARENT) { @@ -789,6 +792,9 @@ void wxPostScriptDC::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); + width--; + height--; + if (radius < 0.0) { // Now, a negative radius is interpreted to mean @@ -868,6 +874,9 @@ void wxPostScriptDC::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); + width--; + height--; + if (m_brush.GetStyle () != wxTRANSPARENT) { SetBrush (m_brush); diff --git a/src/gtk/gnome/gprint.cpp b/src/gtk/gnome/gprint.cpp index a676664ff1..344569826a 100644 --- a/src/gtk/gnome/gprint.cpp +++ b/src/gtk/gnome/gprint.cpp @@ -1198,6 +1198,9 @@ void wxGnomePrintDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxC void wxGnomePrintDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { + width--; + height--; + if (m_brush.GetStyle () != wxTRANSPARENT) { SetBrush( m_brush ); @@ -1233,7 +1236,10 @@ void wxGnomePrintDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoor void wxGnomePrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) { - wxCoord rad = (wxCoord) radius; + width--; + height--; + + wxCoord rad = wxRound( radius ); if (m_brush.GetStyle() != wxTRANSPARENT) { @@ -1348,6 +1354,9 @@ void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y, void wxGnomePrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { + width--; + height--; + if (m_brush.GetStyle () != wxTRANSPARENT) { SetBrush( m_brush ); diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index d1f3080828..24b50d68ef 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -1415,6 +1415,9 @@ void wxGtkPrintDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoo void wxGtkPrintDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { + width--; + height--; + gs_cairo->cairo_new_path(m_cairo); gs_cairo->cairo_rectangle ( m_cairo, XLOG2DEV(x), YLOG2DEV(y), XLOG2DEVREL(width), YLOG2DEVREL(height)); @@ -1430,6 +1433,9 @@ void wxGtkPrintDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord void wxGtkPrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) { + width--; + height--; + if (radius < 0.0) radius = - radius * ((width < height) ? width : height); wxCoord dd = 2 * (wxCoord) radius; @@ -1475,6 +1481,9 @@ void wxGtkPrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, w void wxGtkPrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { + width--; + height--; + gs_cairo->cairo_save (m_cairo); gs_cairo->cairo_new_path(m_cairo); -- 2.45.2