diff --git a/include/wx/dc.h b/include/wx/dc.h index d6c2881ef2..96c4da6647 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -353,6 +353,23 @@ public: m_maxY = y; } } + + void CalcBoundingBox(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) + { + CalcBoundingBox(x1, y1); + CalcBoundingBox(x2, y2); + } + + void CalcBoundingBox(const wxPoint& pt, const wxSize& sz) + { + CalcBoundingBox(pt.x, pt.y, pt.x + sz.x, pt.y + sz.y); + } + + void CalcBoundingBox(const wxRect& rect) + { + CalcBoundingBox(rect.GetPosition(), rect.GetSize()); + } + void ResetBoundingBox() { m_isBBoxValid = false; diff --git a/include/wx/dcgraph.h b/include/wx/dcgraph.h index a57e8168e1..35d6245bef 100644 --- a/include/wx/dcgraph.h +++ b/include/wx/dcgraph.h @@ -258,6 +258,15 @@ private: // fields, returns true if the context was valid. bool DoInitContext(wxGraphicsContext* ctx); + // Another convenient wrapper for CalcBoundingBox(). + // This is not an overload in order to avoid hiding the base class ones. + void CalcBoundingBoxForBox(const wxRect2DDouble& box) + { + CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y)); + CalcBoundingBox(wxRound(box.m_x + box.m_width), + wxRound(box.m_y + box.m_height)); + } + wxDECLARE_CLASS(wxGCDCImpl); wxDECLARE_NO_COPY_CLASS(wxGCDCImpl); }; diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 82be5c669d..4e656015e8 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -637,8 +637,7 @@ void wxDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1, DoDrawLine(x1, y3, x3, y2); DoDrawLine(x3, y2, x2, y1); - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } bool @@ -1335,8 +1334,7 @@ void wxDC::DrawLabel(const wxString& text, *rectBounding = wxRect(x, y - heightText, widthText, heightText); } - CalcBoundingBox(x0, y0); - CalcBoundingBox(x0 + width0, y0 + height); + m_pimpl->CalcBoundingBox(wxPoint(x0, y0), wxSize(width0, height)); } #if WXWIN_COMPATIBILITY_2_8 @@ -1394,8 +1392,8 @@ void wxDC::GetClippingBox(long *x, long *y, long *w, long *h) const void wxDC::DrawObject(wxDrawObject* drawobject) { drawobject->Draw(*this); - CalcBoundingBox(drawobject->MinX(),drawobject->MinY()); - CalcBoundingBox(drawobject->MaxX(),drawobject->MaxY()); + CalcBoundingBox(drawobject->MinX(),drawobject->MinY(), + drawobject->MaxX(),drawobject->MaxY()); } #endif // WXWIN_COMPATIBILITY_2_8 diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 368ddfed83..8c77b37d19 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -277,8 +277,7 @@ void wxGCDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, m_graphicContext->DrawBitmap( bmpCopy, x, y, w, h ); } - CalcBoundingBox(x, y); - CalcBoundingBox(x + w, y + h); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); } void wxGCDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) @@ -291,8 +290,7 @@ void wxGCDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) m_graphicContext->DrawIcon( icon , x, y, w, h ); - CalcBoundingBox(x, y); - CalcBoundingBox(x + w, y + h); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); } bool wxGCDCImpl::StartDoc( const wxString& message ) @@ -685,8 +683,7 @@ void wxGCDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) m_graphicContext->StrokeLine(x1,y1,x2,y2); - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } void wxGCDCImpl::DoCrossHair( wxCoord x, wxCoord y ) @@ -703,8 +700,7 @@ void wxGCDCImpl::DoCrossHair( wxCoord x, wxCoord y ) m_graphicContext->StrokeLine(0,y,w,y); m_graphicContext->StrokeLine(x,0,x,h); - CalcBoundingBox(0, 0); - CalcBoundingBox(w, h); + CalcBoundingBox(0, 0, w, h); } void wxGCDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, @@ -752,10 +748,7 @@ void wxGCDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, path.AddLineToPoint( xc, yc ); m_graphicContext->DrawPath(path); - wxRect2DDouble box = path.GetBox(); - CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y)); - CalcBoundingBox(wxRound(box.m_x + box.m_width), - wxRound(box.m_y + box.m_height)); + CalcBoundingBoxForBox(path.GetBox()); } void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h, @@ -805,9 +798,7 @@ void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h, box.m_x += dx; box.m_y += dy; - CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y)); - CalcBoundingBox(wxRound(box.m_x + box.m_width), - wxRound(box.m_y + box.m_height)); + CalcBoundingBoxForBox(box); m_graphicContext->PopState(); } @@ -858,8 +849,8 @@ void wxGCDCImpl::DoDrawLines(int n, const wxPoint points[], m_graphicContext->StrokeLines( n , pointsD); delete[] pointsD; - CalcBoundingBox(minX + xoffset, minY + yoffset); - CalcBoundingBox(maxX + xoffset, maxY + yoffset); + CalcBoundingBox(minX + xoffset, minY + yoffset, + maxX + xoffset, maxY + yoffset); } #if wxUSE_SPLINES @@ -898,10 +889,7 @@ void wxGCDCImpl::DoDrawSpline(const wxPointList *points) m_graphicContext->StrokePath( path ); - wxRect2DDouble box = path.GetBox(); - CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y)); - CalcBoundingBox(wxRound(box.m_x + box.m_width), - wxRound(box.m_y + box.m_height)); + CalcBoundingBoxForBox(path.GetBox()); } #endif // wxUSE_SPLINES @@ -945,8 +933,8 @@ void wxGCDCImpl::DoDrawPolygon( int n, const wxPoint points[], m_graphicContext->DrawLines( n+(closeIt?1:0) , pointsD, fillStyle); delete[] pointsD; - CalcBoundingBox(minX + xoffset, minY + yoffset); - CalcBoundingBox(maxX + xoffset, maxY + yoffset); + CalcBoundingBox(minX + xoffset, minY + yoffset, + maxX + xoffset, maxY + yoffset); } void wxGCDCImpl::DoDrawPolyPolygon(int n, @@ -977,10 +965,7 @@ void wxGCDCImpl::DoDrawPolyPolygon(int n, } m_graphicContext->DrawPath( path , fillStyle); - wxRect2DDouble box = path.GetBox(); - CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y)); - CalcBoundingBox(wxRound(box.m_x + box.m_width), - wxRound(box.m_y + box.m_height)); + CalcBoundingBoxForBox(path.GetBox()); } void wxGCDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) @@ -994,8 +979,7 @@ void wxGCDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) if (w == 0 || h == 0) return; - CalcBoundingBox(x, y); - CalcBoundingBox(x + w, y + h); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); if (m_pen.IsOk() && m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT && m_pen.GetWidth() > 0) { @@ -1022,8 +1006,7 @@ void wxGCDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, if (w == 0 || h == 0) return; - CalcBoundingBox(x, y); - CalcBoundingBox(x + w, y + h); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); if (m_pen.IsOk() && m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT && m_pen.GetWidth() > 0) { @@ -1041,8 +1024,7 @@ void wxGCDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) if ( !m_logicalFunctionSupported ) return; - CalcBoundingBox(x, y); - CalcBoundingBox(x + w, y + h); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); m_graphicContext->DrawEllipse(x,y,w,h); } @@ -1148,8 +1130,7 @@ bool wxGCDCImpl::DoStretchBlit( // reset composition m_graphicContext->SetCompositionMode(formerMode); - CalcBoundingBox(xdest, ydest); - CalcBoundingBox(xdest + dstWidth, ydest + dstHeight); + CalcBoundingBox(wxPoint(xdest, ydest), wxSize(dstWidth, dstHeight)); return retval; } @@ -1202,14 +1183,12 @@ void wxGCDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, // determining which of them is really topmost/leftmost/...) // "upper left" and "upper right" - CalcBoundingBox(x, y); - CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); + CalcBoundingBox(x, y, x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); // "bottom left" and "bottom right" x += (wxCoord)(h*sin(rad)); y += (wxCoord)(h*cos(rad)); - CalcBoundingBox(x, y); - CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); + CalcBoundingBox(x, y, x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); } void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y) @@ -1245,10 +1224,7 @@ void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y) m_graphicContext->SetCompositionMode(curMode); - wxCoord w, h; - GetOwner()->GetTextExtent(str, &w, &h); - CalcBoundingBox(x, y); - CalcBoundingBox(x + w, y + h); + CalcBoundingBox(wxPoint(x, y), GetOwner()->GetTextExtent(str)); } bool wxGCDCImpl::CanGetTextExtent() const @@ -1410,8 +1386,7 @@ void wxGCDCImpl::DoGradientFillLinear(const wxRect& rect, m_graphicContext->SetPen(m_pen); m_graphicContext->SetBrush(m_brush); - CalcBoundingBox(rect.x, rect.y); - CalcBoundingBox(rect.x + rect.width, rect.y + rect.height); + CalcBoundingBox(rect); } void wxGCDCImpl::DoGradientFillConcentric(const wxRect& rect, @@ -1442,8 +1417,7 @@ void wxGCDCImpl::DoGradientFillConcentric(const wxRect& rect, m_graphicContext->SetPen(m_pen); m_graphicContext->SetBrush(m_brush); - CalcBoundingBox(rect.x, rect.y); - CalcBoundingBox(rect.x + rect.width, rect.y + rect.height); + CalcBoundingBox(rect); } void wxGCDCImpl::DoDrawCheckMark(wxCoord x, wxCoord y, diff --git a/src/common/dcsvg.cpp b/src/common/dcsvg.cpp index 6104c349d3..dc3e18e9ac 100644 --- a/src/common/dcsvg.cpp +++ b/src/common/dcsvg.cpp @@ -601,8 +601,7 @@ void wxSVGFileDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) write(s); - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } void wxSVGFileDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset) @@ -832,8 +831,7 @@ void wxSVGFileDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width write(s); - CalcBoundingBox(x, y); - CalcBoundingBox(x + width, y + height); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxSVGFileDCImpl::DoDrawPolygon(int n, const wxPoint points[], @@ -916,8 +914,7 @@ void wxSVGFileDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord write(s); - CalcBoundingBox(x, y); - CalcBoundingBox(x + width, y + height); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxSVGFileDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc) @@ -1115,8 +1112,7 @@ void wxSVGFileDCImpl::DoGradientFillLinear(const wxRect& rect, write(s); - CalcBoundingBox(rect.x, rect.y); - CalcBoundingBox(rect.x + rect.width, rect.y + rect.height); + CalcBoundingBox(rect); } void wxSVGFileDCImpl::DoGradientFillConcentric(const wxRect& rect, @@ -1155,8 +1151,7 @@ void wxSVGFileDCImpl::DoGradientFillConcentric(const wxRect& rect, write(s); - CalcBoundingBox(rect.x, rect.y); - CalcBoundingBox(rect.x + rect.width, rect.y + rect.height); + CalcBoundingBox(rect); } void wxSVGFileDCImpl::DoSetDeviceClippingRegion(const wxRegion& region) diff --git a/src/dfb/dc.cpp b/src/dfb/dc.cpp index 13956da7d3..c0a1c2c0e5 100644 --- a/src/dfb/dc.cpp +++ b/src/dfb/dc.cpp @@ -134,8 +134,7 @@ void wxDFBDCImpl::Clear() m_surface->Clear(clr.Red(), clr.Green(), clr.Blue(), clr.Alpha()); wxSize size(GetSize()); - CalcBoundingBox(XDEV2LOG(0), YDEV2LOG(0)); - CalcBoundingBox(XDEV2LOG(size.x), YDEV2LOG(size.y)); + CalcBoundingBox(XDEV2LOG(0), YDEV2LOG(0), XDEV2LOG(size.x), YDEV2LOG(size.y)); } extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y, @@ -203,8 +202,7 @@ void wxDFBDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) m_surface->DrawLine(xx1, yy1, xx2, yy2); - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } // Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1) @@ -284,8 +282,7 @@ void wxDFBDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h m_surface->DrawRectangle(xx, yy, ww, hh); } - CalcBoundingBox(x, y); - CalcBoundingBox(x + width, y + height); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxDFBDCImpl::DoDrawRoundedRectangle(wxCoord WXUNUSED(x), @@ -330,9 +327,8 @@ void wxDFBDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y) // update the bounding box wxCoord w, h; - CalcBoundingBox(x, y); DoGetTextExtent(text, &w, &h); - CalcBoundingBox(x + w, y + h); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); // if background mode is solid, DrawText must paint text's background: if ( m_backgroundMode == wxBRUSHSTYLE_SOLID ) @@ -693,8 +689,7 @@ bool wxDFBDCImpl::DoBlitFromSurface(const wxIDirectFBSurfacePtr& src, return false; } - CalcBoundingBox(dstx, dsty); - CalcBoundingBox(dstx + w, dsty + h); + CalcBoundingBox(wxPoint(dstx, dsty), wxSize(w, h)); DFBRectangle srcRect = { srcx, srcy, w, h }; DFBRectangle dstRect = { XLOG2DEV(dstx), YLOG2DEV(dsty), diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index a089c8a8d1..7c12378567 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -420,8 +420,7 @@ void wxPostScriptDCImpl::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord buffer.Replace( ",", "." ); PsPrint( buffer ); - CalcBoundingBox( x1, y1 ); - CalcBoundingBox( x2, y2 ); + CalcBoundingBox( x1, y1, x2, y2 ); } void wxPostScriptDCImpl::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc) @@ -500,8 +499,7 @@ void wxPostScriptDCImpl::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord PsPrint( "stroke\n" ); } - CalcBoundingBox( xc-i_radius, yc-i_radius ); - CalcBoundingBox( xc+i_radius, yc+i_radius ); + CalcBoundingBox( xc-i_radius, yc-i_radius, xc+i_radius, yc+i_radius ); } void wxPostScriptDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) @@ -536,8 +534,7 @@ void wxPostScriptDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord buffer.Replace( ",", "." ); PsPrint( buffer ); - CalcBoundingBox( x ,y ); - CalcBoundingBox( x+w, y+h ); + CalcBoundingBox( wxPoint(x, y), wxSize(w, h) ); } if ( m_pen.IsNonTransparent() ) @@ -553,8 +550,7 @@ void wxPostScriptDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord buffer.Replace( ",", "." ); PsPrint( buffer ); - CalcBoundingBox( x ,y ); - CalcBoundingBox( x+w, y+h ); + CalcBoundingBox( wxPoint(x, y), wxSize(w, h) ); } } @@ -787,8 +783,7 @@ void wxPostScriptDCImpl::DoDrawRectangle (wxCoord x, wxCoord y, wxCoord width, w buffer.Replace( ",", "." ); PsPrint( buffer ); - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox( wxPoint(x, y), wxSize(width, height) ); } if ( m_pen.IsNonTransparent() ) @@ -810,8 +805,7 @@ void wxPostScriptDCImpl::DoDrawRectangle (wxCoord x, wxCoord y, wxCoord width, w buffer.Replace( ",", "." ); PsPrint( buffer ); - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox( wxPoint(x, y), wxSize(width, height) ); } } @@ -860,8 +854,7 @@ void wxPostScriptDCImpl::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord w buffer.Replace( ",", "." ); PsPrint( buffer ); - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox( wxPoint(x, y), wxSize(width, height) ); } if ( m_pen.IsNonTransparent() ) @@ -892,8 +885,7 @@ void wxPostScriptDCImpl::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord w buffer.Replace( ",", "." ); PsPrint( buffer ); - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox( wxPoint(x, y), wxSize(width, height) ); } } @@ -917,8 +909,7 @@ void wxPostScriptDCImpl::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxC buffer.Replace( ",", "." ); PsPrint( buffer ); - CalcBoundingBox( x - width, y - height ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox( x - width, y - height, x + width, y + height ); } if ( m_pen.IsNonTransparent() ) @@ -934,8 +925,7 @@ void wxPostScriptDCImpl::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxC buffer.Replace( ",", "." ); PsPrint( buffer ); - CalcBoundingBox( x - width, y - height ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox( x - width, y - height, x + width, y + height ); } } @@ -1375,10 +1365,7 @@ void wxPostScriptDCImpl::DoDrawText( const wxString& text, wxCoord x, wxCoord y DrawAnyText(textbuf, text_descent, size); - wxCoord w, h; - GetOwner()->GetMultiLineTextExtent(text, &w, &h); - CalcBoundingBox(x, y); - CalcBoundingBox(x + w , y + h); + CalcBoundingBox(wxPoint(x, y), GetOwner()->GetMultiLineTextExtent(text)); } void wxPostScriptDCImpl::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord y, double angle ) @@ -1423,13 +1410,11 @@ void wxPostScriptDCImpl::DoDrawRotatedText( const wxString& text, wxCoord x, wxC wxCoord w, h; GetOwner()->GetMultiLineTextExtent(text, &w, &h); // "upper left" and "upper right" - CalcBoundingBox(x, y); - CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); + CalcBoundingBox(x, y, x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); // "bottom left" and "bottom right" x += (wxCoord)(h*sin(rad)); y += (wxCoord)(h*cos(rad)); - CalcBoundingBox(x, y); - CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); + CalcBoundingBox(x, y, x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); } void wxPostScriptDCImpl::SetBackground (const wxBrush& brush) diff --git a/src/gtk/dc.cpp b/src/gtk/dc.cpp index 08cda73695..574497437d 100644 --- a/src/gtk/dc.cpp +++ b/src/gtk/dc.cpp @@ -103,8 +103,7 @@ void wxGTKCairoDCImpl::DoDrawText(const wxString& text, int x, int y) int w, h; DoGetTextExtent(text, &w, &h); - CalcBoundingBox(x, y); - CalcBoundingBox(x + w, y + h); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); const bool yInverted = m_signY < 0; if (xInverted || yInverted) diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index fed357b468..b8a9869d47 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -518,8 +518,7 @@ void wxWindowDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 if (m_gdkwindow) gdk_draw_line( m_gdkwindow, m_penGC, XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) ); - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } } @@ -649,8 +648,7 @@ void wxWindowDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, } } - CalcBoundingBox (x1, y1); - CalcBoundingBox (x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double sa, double ea ) @@ -697,8 +695,7 @@ void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxC gdk_draw_arc( m_gdkwindow, m_penGC, FALSE, xx, yy, ww, hh, start, end ); } - CalcBoundingBox (x, y); - CalcBoundingBox (x + width, y + height); + CalcBoundingBox( wxPoint(x, y), wxSize(width, height) ); } void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y ) @@ -853,8 +850,7 @@ void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoo } } - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox( wxPoint(x, y), wxSize(width, height) ); } void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius ) @@ -932,8 +928,7 @@ void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width } // this ignores the radius - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox( wxPoint(x, y), wxSize(width, height) ); } void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) @@ -975,8 +970,7 @@ void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord gdk_draw_arc( m_gdkwindow, m_penGC, false, xx, yy, ww, hh, 0, 360*64 ); } - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox( wxPoint(x, y), wxSize(width, height) ); } void wxWindowDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) @@ -1087,8 +1081,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, // notice that as the bitmap is not drawn upside down (or right to left) // even if the corresponding axis direction is inversed, we need to take it // into account when calculating its bounding box - CalcBoundingBox(x, y); - CalcBoundingBox(x + m_signX*w, y + m_signY*h); + CalcBoundingBox(wxPoint(x, y), wxSize(m_signX*w, m_signY*h)); // device coords int xx = LogicalToDeviceX(x); @@ -1237,8 +1230,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, return false; } - CalcBoundingBox(xdest, ydest); - CalcBoundingBox(xdest + width, ydest + height); + CalcBoundingBox(wxPoint(xdest, ydest), wxSize(width, height) ); // source device coords int src_x = source->LogicalToDeviceX(xsrc); @@ -1424,8 +1416,7 @@ void wxWindowDCImpl::DoDrawRotatedText(const wxString& text, int xLogical, int y if (wxIsNullDouble(angle)) { - CalcBoundingBox(xLogical, yLogical); - CalcBoundingBox(xLogical + w, yLogical + h); + CalcBoundingBox(wxPoint(xLogical, yLogical), wxSize(w, h)); } else { @@ -1448,8 +1439,8 @@ void wxWindowDCImpl::DoDrawRotatedText(const wxString& text, int xLogical, int y minY = (wxCoord)(dmin(dmin(0, y2), dmin(y3, y4)) - 0.5); x += minX; y += minY; - CalcBoundingBox(DeviceToLogicalX(x), DeviceToLogicalY(y)); - CalcBoundingBox(DeviceToLogicalX(x + maxX - minX), DeviceToLogicalY(y + maxY - minY)); + CalcBoundingBox(DeviceToLogicalX(x), DeviceToLogicalY(y), + DeviceToLogicalX(x + maxX - minX), DeviceToLogicalY(y + maxY - minY)); } gdk_draw_layout_with_colors(m_gdkwindow, m_textGC, x, y, m_layout, NULL, bg_col); diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index e263b23561..e4f087aabc 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -1342,8 +1342,7 @@ void wxGtkPrinterDCImpl::DoGradientFillConcentric(const wxRect& rect, const wxCo cairo_pattern_destroy(gradient); - CalcBoundingBox(xR, yR); - CalcBoundingBox(xR+w, yR+h); + CalcBoundingBox(wxPoint(xR, yR), wxSize(w, h)); } void wxGtkPrinterDCImpl::DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection) @@ -1392,8 +1391,7 @@ void wxGtkPrinterDCImpl::DoGradientFillLinear(const wxRect& rect, const wxColour cairo_pattern_destroy(gradient); - CalcBoundingBox(x, y); - CalcBoundingBox(x+w, y+h); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); } bool wxGtkPrinterDCImpl::DoGetPixel(wxCoord WXUNUSED(x1), @@ -1414,8 +1412,7 @@ void wxGtkPrinterDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord cairo_line_to ( m_cairo, XLOG2DEV(x2), YLOG2DEV(y2) ); cairo_stroke ( m_cairo ); - CalcBoundingBox( x1, y1 ); - CalcBoundingBox( x2, y2 ); + CalcBoundingBox( x1, y1, x2, y2 ); } void wxGtkPrinterDCImpl::DoCrossHair(wxCoord x, wxCoord y) @@ -1431,8 +1428,7 @@ void wxGtkPrinterDCImpl::DoCrossHair(wxCoord x, wxCoord y) cairo_line_to (m_cairo, XLOG2DEVREL(w), YLOG2DEV(y)); cairo_stroke (m_cairo); - CalcBoundingBox( 0, 0 ); - CalcBoundingBox( w, h ); + CalcBoundingBox( 0, 0, w, h ); } void wxGtkPrinterDCImpl::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc) @@ -1511,8 +1507,7 @@ void wxGtkPrinterDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord cairo_restore( m_cairo ); - CalcBoundingBox( x, y); - CalcBoundingBox( x+w, y+h ); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); } void wxGtkPrinterDCImpl::DoDrawPoint(wxCoord x, wxCoord y) @@ -1624,8 +1619,7 @@ void wxGtkPrinterDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wx cairo_stroke(m_cairo); } - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxGtkPrinterDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) @@ -1678,8 +1672,7 @@ void wxGtkPrinterDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord wi cairo_stroke(m_cairo); } - CalcBoundingBox(x,y); - CalcBoundingBox(x+width,y+height); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxGtkPrinterDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) @@ -1707,8 +1700,7 @@ void wxGtkPrinterDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCo cairo_stroke(m_cairo); } - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); cairo_restore (m_cairo); } @@ -1742,8 +1734,7 @@ void wxGtkPrinterDCImpl::DoDrawSpline(const wxPointList *points) cairo_move_to( m_cairo, XLOG2DEV((wxCoord)x1), YLOG2DEV((wxCoord)y1) ); cairo_line_to( m_cairo, XLOG2DEV((wxCoord)x3), YLOG2DEV((wxCoord)y3) ); - CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 ); - CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 ); + CalcBoundingBox( (wxCoord)x1, (wxCoord)y1, (wxCoord)x3, (wxCoord)y3 ); node = node->GetNext(); while (node) @@ -1765,8 +1756,7 @@ void wxGtkPrinterDCImpl::DoDrawSpline(const wxPointList *points) XLOG2DEV((wxCoord)x2), YLOG2DEV((wxCoord)y2), XLOG2DEV((wxCoord)x3), YLOG2DEV((wxCoord)y3) ); - CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 ); - CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 ); + CalcBoundingBox( (wxCoord)x1, (wxCoord)y1, (wxCoord)x3, (wxCoord)y3 ); node = node->GetNext(); } @@ -1842,8 +1832,7 @@ void wxGtkPrinterDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoor cairo_fill(m_cairo); #endif - CalcBoundingBox(0,0); - CalcBoundingBox(bw,bh); + CalcBoundingBox(0, 0, bw, bh); cairo_restore(m_cairo); } @@ -1931,9 +1920,7 @@ void wxGtkPrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCo pango_layout_set_attributes(m_layout, NULL); } - // Back to device units: - CalcBoundingBox (x, y); - CalcBoundingBox (x + w, y + h); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); } void wxGtkPrinterDCImpl::Clear() diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 668d79e3de..c949ae93ba 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -458,8 +458,7 @@ void wxWindowDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 if (m_window) gdk_draw_line( m_window, m_penGC, XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) ); - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } } @@ -570,8 +569,7 @@ void wxWindowDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, } } - CalcBoundingBox (x1, y1); - CalcBoundingBox (x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double sa, double ea ) @@ -632,8 +630,7 @@ void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxC gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, start, end ); } - CalcBoundingBox (x, y); - CalcBoundingBox (x + width, y + height); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y ) @@ -803,8 +800,7 @@ void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoo gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 ); } - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius ) @@ -926,8 +922,7 @@ void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width } // this ignores the radius - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) @@ -985,8 +980,7 @@ void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 ); } - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxWindowDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) @@ -1012,8 +1006,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, int w = bitmap.GetWidth(); int h = bitmap.GetHeight(); - CalcBoundingBox( x, y ); - CalcBoundingBox( x + w, y + h ); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); if (!m_window) return; @@ -1197,8 +1190,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, } } - CalcBoundingBox( xdest, ydest ); - CalcBoundingBox( xdest + width, ydest + height ); + CalcBoundingBox(wxPoint(xdest, ydest), wxSize(width, height)); // scale/translate size and position wxCoord xx = XLOG2DEV(xdest); @@ -1430,8 +1422,7 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) width = wxCoord(width / m_scaleX); height = wxCoord(height / m_scaleY); - CalcBoundingBox (x + width, y + height); - CalcBoundingBox (x, y); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } @@ -1541,8 +1532,7 @@ void wxWindowDCImpl::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord #endif // 0 // update the bounding box - CalcBoundingBox(x + minX, y + minY); - CalcBoundingBox(x + maxX, y + maxY); + CalcBoundingBox(x + minX, y + minY, x + maxX, y + maxY); } void wxWindowDCImpl::DoGetTextExtent(const wxString &string, diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp index 16e026dc20..1cee3077fb 100644 --- a/src/motif/dcclient.cpp +++ b/src/motif/dcclient.cpp @@ -259,8 +259,7 @@ void wxWindowDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 XLOG2DEV_2(x1), YLOG2DEV_2(y1), XLOG2DEV_2(x2), YLOG2DEV_2(y2)); - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } void wxWindowDCImpl::DoCrossHair( wxCoord x, wxCoord y ) @@ -369,8 +368,7 @@ void wxWindowDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, xxc_2 - r, yyc_2 - r, 2 * r, 2 * r, alpha1, alpha2); } - CalcBoundingBox (x1, y1); - CalcBoundingBox (x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double sa, double ea ) @@ -414,8 +412,7 @@ void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxC XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, XLOG2DEV_2 (x), YLOG2DEV_2 (y),wd,hd,start,end); } - CalcBoundingBox (x, y); - CalcBoundingBox (x + width, y + height); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y ) @@ -555,8 +552,7 @@ void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoo XLOG2DEV_2 (x), YLOG2DEV_2 (y), wd, hd); } - CalcBoundingBox (x, y); - CalcBoundingBox (x + width, y + height); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius ) @@ -715,8 +711,7 @@ void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width rw_d2, rh_d2, 180 * 64, 90 * 64); } } - CalcBoundingBox (x, y); - CalcBoundingBox (x + width, y + height); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) @@ -767,8 +762,7 @@ void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord XLOG2DEVREL (width) - WX_GC_CF, YLOG2DEVREL (height) - WX_GC_CF, 0, angle); } - CalcBoundingBox (x, y); - CalcBoundingBox (x + width, y + height); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } @@ -993,8 +987,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, } } /* Remote/local (Display*) m_display */ - CalcBoundingBox (xdest, ydest); - CalcBoundingBox (xdest + width, ydest + height); + CalcBoundingBox(wxPoint(xdest, ydest), wxSize(width, height)); SetLogicalFunction(orig); @@ -1154,8 +1147,7 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) wxCoord w, h; DoGetTextExtent (text, &w, &h); - CalcBoundingBox (x + w, y + h); - CalcBoundingBox (x, y); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); } void wxWindowDCImpl::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, @@ -1290,8 +1282,7 @@ void wxWindowDCImpl::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord oldForegroundPixel); } - CalcBoundingBox (minx, miny); - CalcBoundingBox (maxx, maxy); + CalcBoundingBox(minx, miny, maxx, maxy); } bool wxWindowDCImpl::CanGetTextExtent() const diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index c757728573..1c54f14a0e 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -911,8 +911,7 @@ void wxMSWDCImpl::DoCrossHair(wxCoord x, wxCoord y) wxDrawLine(GetHdc(), XLOG2DEV(x), YLOG2DEV(rect.top), XLOG2DEV(x), YLOG2DEV(rect.bottom)); } - CalcBoundingBox(rect.left, rect.top); - CalcBoundingBox(rect.right, rect.bottom); + CalcBoundingBox(rect.left, rect.top, rect.right, rect.bottom); } void wxMSWDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) @@ -944,8 +943,7 @@ void wxMSWDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxDrawLine(GetHdc(), XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2)); } - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } // Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1) @@ -997,8 +995,7 @@ void wxMSWDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, Arc(GetHdc(),xxx1,yyy1,xxx2,yyy2, xx1,yy1,xx2,yy2); } - CalcBoundingBox(xc - r, yc - r); - CalcBoundingBox(xc + r, yc + r); + CalcBoundingBox(xc - r, yc - r, xc + r, yc + r); } void wxMSWDCImpl::DoDrawPoint(wxCoord x, wxCoord y) @@ -1147,8 +1144,7 @@ void wxMSWDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h (void)Rectangle(GetHdc(), x1dev, y1dev, x2dev, y2dev); - CalcBoundingBox(x, y); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x, y, x2, y2); } void wxMSWDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) @@ -1179,8 +1175,7 @@ void wxMSWDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wx (void)RoundRect(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2), (int) (2*XLOG2DEV(radius)), (int)( 2*YLOG2DEV(radius))); - CalcBoundingBox(x, y); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x, y, x2, y2); } void wxMSWDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) @@ -1197,8 +1192,7 @@ void wxMSWDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord hei ::Ellipse(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2)); - CalcBoundingBox(x, y); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x, y, x2, y2); } #if wxUSE_SPLINES @@ -1331,8 +1325,7 @@ void wxMSWDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,doub (void)Arc(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2), rx1, ry1, rx2, ry2); - CalcBoundingBox(x, y); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x, y, x2, y2); } void wxMSWDCImpl::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) @@ -1356,8 +1349,7 @@ void wxMSWDCImpl::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) ::DrawIconEx(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon), icon.GetWidth(), icon.GetHeight(), 0, NULL, DI_NORMAL); } - CalcBoundingBox(x, y); - CalcBoundingBox(x + icon.GetWidth(), y + icon.GetHeight()); + CalcBoundingBox(wxPoint(x, y), icon.GetSize()); } void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask ) @@ -1401,8 +1393,7 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool if ( AlphaBlt(this, x, y, width, height, 0, 0, width, height, hdcMem, curBmp) ) { - CalcBoundingBox(x, y); - CalcBoundingBox(x + bmp.GetWidth(), y + bmp.GetHeight()); + CalcBoundingBox(wxPoint(x, y), bmp.GetSize()); return; } } @@ -1510,8 +1501,7 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool ::DeleteDC( memdc ); } - CalcBoundingBox(x, y); - CalcBoundingBox(x + bmp.GetWidth(), y + bmp.GetHeight()); + CalcBoundingBox(wxPoint(x, y), bmp.GetSize()); } void wxMSWDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y) @@ -1536,11 +1526,7 @@ void wxMSWDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y) DrawAnyText(text, x, y); // update the bounding box - CalcBoundingBox(x, y); - - wxCoord w, h; - GetOwner()->GetTextExtent(text, &w, &h); - CalcBoundingBox(x + w, y + h); + CalcBoundingBox(wxPoint(x, y), GetOwner()->GetTextExtent(text)); } void wxMSWDCImpl::DrawAnyText(const wxString& text, wxCoord x, wxCoord y) @@ -1633,14 +1619,12 @@ void wxMSWDCImpl::DoDrawRotatedText(const wxString& text, // determining which of them is really topmost/leftmost/...) // "upper left" and "upper right" - CalcBoundingBox(x, y); - CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); + CalcBoundingBox(x, y, x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); // "bottom left" and "bottom right" x += (wxCoord)(h*sin(rad)); y += (wxCoord)(h*cos(rad)); - CalcBoundingBox(x, y); - CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); + CalcBoundingBox(x, y, x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); } // --------------------------------------------------------------------------- @@ -2306,8 +2290,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, if ( AlphaBlt(this, xdest, ydest, dstWidth, dstHeight, xsrc, ysrc, srcWidth, srcHeight, hdcSrc, bmpSrc) ) { - CalcBoundingBox(xdest, ydest); - CalcBoundingBox(xdest + dstWidth, ydest + dstHeight); + CalcBoundingBox(wxPoint(xdest, ydest), wxSize(dstWidth, dstHeight)); return true; } } @@ -2595,8 +2578,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, if ( success ) { - CalcBoundingBox(xdest, ydest); - CalcBoundingBox(xdest + dstWidth, ydest + dstHeight); + CalcBoundingBox(wxPoint(xdest, ydest), wxSize(dstWidth, dstHeight)); } return success; @@ -2943,8 +2925,7 @@ void wxMSWDCImpl::DoGradientFillLinear (const wxRect& rect, : GRADIENT_FILL_RECT_V ) ) { - CalcBoundingBox(rect.GetLeft(), rect.GetBottom()); - CalcBoundingBox(rect.GetRight(), rect.GetTop()); + CalcBoundingBox(rect); } else { diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index 58f3bc2e24..5464eb16db 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -411,8 +411,7 @@ void wxWindowDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 // (GC) m_penGC, XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) ); } - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } } @@ -543,8 +542,7 @@ void wxWindowDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, } } - CalcBoundingBox (x1, y1); - CalcBoundingBox (x2, y2); + CalcBoundingBox(x1, y1, x2, y2); } void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double sa, double ea ) @@ -623,8 +621,7 @@ void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxC } } - CalcBoundingBox (x, y); - CalcBoundingBox (x + width, y + height); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y ) @@ -819,8 +816,7 @@ void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoo } } - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius ) @@ -942,8 +938,7 @@ void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width } // this ignores the radius - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) @@ -1019,8 +1014,7 @@ void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord } } - CalcBoundingBox( x, y ); - CalcBoundingBox( x + width, y + height ); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); } void wxWindowDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y) @@ -1046,8 +1040,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, int w = bitmap.GetWidth(); int h = bitmap.GetHeight(); - CalcBoundingBox( x, y ); - CalcBoundingBox( x + w, y + h ); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); if (!m_x11window) return; @@ -1165,8 +1158,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, int w = bitmap.GetWidth(); int h = bitmap.GetHeight(); - CalcBoundingBox( x, y ); - CalcBoundingBox( x + w, y + h ); + CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); if (!m_x11window) return; @@ -1384,8 +1376,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoor } } - CalcBoundingBox( xdest, ydest ); - CalcBoundingBox( xdest + width, ydest + height ); + CalcBoundingBox(wxPoint(xdest, ydest), wxSize(width, height)); // scale/translate size and position wxCoord xx = XLOG2DEV(xdest); @@ -1601,8 +1592,7 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) g_object_unref( G_OBJECT( layout ) ); - CalcBoundingBox (x + width, y + height); - CalcBoundingBox (x, y); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); #else XFontStruct *xfont = (XFontStruct*) m_font.GetFontStruct( m_scaleY, m_display ); @@ -1658,8 +1648,7 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) width = wxCoord(width / m_scaleX); height = wxCoord(height / m_scaleY); - CalcBoundingBox (x + width, y + height); - CalcBoundingBox (x, y); + CalcBoundingBox(wxPoint(x, y), wxSize(width, height)); #endif #endif }