Merge branch 'dc-cleanup'
Some cleanup in wxDC code: remove unnecessary casts, use RAII helpers instead of manual memory and other resources management. No real changes. See #22378.
This commit is contained in:
commit
d64ba81378
15 changed files with 260 additions and 363 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -257,6 +257,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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include "wx/dc.h"
|
||||
|
||||
#include "wx/scopedarray.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMirrorDC allows to write the same code for horz/vertical layout
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -224,25 +226,21 @@ protected:
|
|||
virtual void DoDrawLines(int n, const wxPoint points[],
|
||||
wxCoord xoffset, wxCoord yoffset) wxOVERRIDE
|
||||
{
|
||||
wxPoint* points_alloc = Mirror(n, points);
|
||||
wxScopedArray<wxPoint> points_alloc(Mirror(n, points));
|
||||
|
||||
m_dc.DoDrawLines(n, points,
|
||||
GetX(xoffset, yoffset), GetY(xoffset, yoffset));
|
||||
|
||||
delete[] points_alloc;
|
||||
}
|
||||
|
||||
virtual void DoDrawPolygon(int n, const wxPoint points[],
|
||||
wxCoord xoffset, wxCoord yoffset,
|
||||
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE
|
||||
{
|
||||
wxPoint* points_alloc = Mirror(n, points);
|
||||
wxScopedArray<wxPoint> points_alloc(Mirror(n, points));
|
||||
|
||||
m_dc.DoDrawPolygon(n, points,
|
||||
GetX(xoffset, yoffset), GetY(xoffset, yoffset),
|
||||
fillStyle);
|
||||
|
||||
delete[] points_alloc;
|
||||
}
|
||||
|
||||
virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region)) wxOVERRIDE
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "wx/dcscreen.h"
|
||||
#include "wx/dcprint.h"
|
||||
#include "wx/prntbase.h"
|
||||
#include "wx/scopedarray.h"
|
||||
#include "wx/scopeguard.h"
|
||||
#include "wx/stack.h"
|
||||
|
||||
|
|
@ -661,8 +662,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
|
||||
|
|
@ -719,7 +719,7 @@ wxDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
|
|||
void wxDCImpl::DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffset)
|
||||
{
|
||||
int n = list->GetCount();
|
||||
wxPoint *points = new wxPoint[n];
|
||||
wxScopedArray<wxPoint> points(n);
|
||||
|
||||
int i = 0;
|
||||
for ( wxPointList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
|
||||
|
|
@ -729,9 +729,7 @@ void wxDCImpl::DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffs
|
|||
points[i].y = point->y;
|
||||
}
|
||||
|
||||
DoDrawLines(n, points, xoffset, yoffset);
|
||||
|
||||
delete [] points;
|
||||
DoDrawLines(n, points.get(), xoffset, yoffset);
|
||||
}
|
||||
|
||||
void wxDCImpl::DrawPolygon(const wxPointList *list,
|
||||
|
|
@ -739,7 +737,7 @@ void wxDCImpl::DrawPolygon(const wxPointList *list,
|
|||
wxPolygonFillMode fillStyle)
|
||||
{
|
||||
int n = list->GetCount();
|
||||
wxPoint *points = new wxPoint[n];
|
||||
wxScopedArray<wxPoint> points(n);
|
||||
|
||||
int i = 0;
|
||||
for ( wxPointList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
|
||||
|
|
@ -749,9 +747,7 @@ void wxDCImpl::DrawPolygon(const wxPointList *list,
|
|||
points[i].y = point->y;
|
||||
}
|
||||
|
||||
DoDrawPolygon(n, points, xoffset, yoffset, fillStyle);
|
||||
|
||||
delete [] points;
|
||||
DoDrawPolygon(n, points.get(), xoffset, yoffset, fillStyle);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -768,14 +764,13 @@ wxDCImpl::DoDrawPolyPolygon(int n,
|
|||
}
|
||||
|
||||
int i, j, lastOfs;
|
||||
wxPoint* pts;
|
||||
|
||||
for (i = j = lastOfs = 0; i < n; i++)
|
||||
{
|
||||
lastOfs = j;
|
||||
j += count[i];
|
||||
}
|
||||
pts = new wxPoint[j+n-1];
|
||||
wxScopedArray<wxPoint> pts(j+n-1);
|
||||
for (i = 0; i < j; i++)
|
||||
pts[i] = points[i];
|
||||
for (i = 2; i <= n; i++)
|
||||
|
|
@ -786,15 +781,14 @@ wxDCImpl::DoDrawPolyPolygon(int n,
|
|||
|
||||
{
|
||||
wxDCPenChanger setTransp(*m_owner, *wxTRANSPARENT_PEN);
|
||||
DoDrawPolygon(j, pts, xoffset, yoffset, fillStyle);
|
||||
DoDrawPolygon(j, pts.get(), xoffset, yoffset, fillStyle);
|
||||
}
|
||||
|
||||
for (i = j = 0; i < n; i++)
|
||||
{
|
||||
DoDrawLines(count[i], pts+j, xoffset, yoffset);
|
||||
DoDrawLines(count[i], pts.get()+j, xoffset, yoffset);
|
||||
j += count[i];
|
||||
}
|
||||
delete[] pts;
|
||||
}
|
||||
|
||||
#if wxUSE_SPLINES
|
||||
|
|
@ -1359,8 +1353,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
|
||||
|
|
@ -1418,8 +1411,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
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#endif
|
||||
|
||||
#include "wx/display.h"
|
||||
#include "wx/scopedarray.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Local functions
|
||||
|
|
@ -282,8 +283,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 )
|
||||
|
|
@ -296,8 +296,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 +684,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 +701,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 +749,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 +799,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();
|
||||
}
|
||||
|
|
@ -842,7 +834,7 @@ void wxGCDCImpl::DoDrawLines(int n, const wxPoint points[],
|
|||
int maxX = minX;
|
||||
int maxY = minY;
|
||||
|
||||
wxPoint2DDouble* pointsD = new wxPoint2DDouble[n];
|
||||
wxScopedArray<wxPoint2DDouble> pointsD(n);
|
||||
for( int i = 0; i < n; ++i)
|
||||
{
|
||||
wxPoint p = points[i];
|
||||
|
|
@ -855,11 +847,10 @@ void wxGCDCImpl::DoDrawLines(int n, const wxPoint points[],
|
|||
else if (p.y > maxY) maxY = p.y;
|
||||
}
|
||||
|
||||
m_graphicContext->StrokeLines( n , pointsD);
|
||||
delete[] pointsD;
|
||||
m_graphicContext->StrokeLines( n , pointsD.get());
|
||||
|
||||
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
|
||||
|
||||
|
|
@ -927,7 +915,7 @@ void wxGCDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
int maxX = minX;
|
||||
int maxY = minY;
|
||||
|
||||
wxPoint2DDouble* pointsD = new wxPoint2DDouble[n+(closeIt?1:0)];
|
||||
wxScopedArray<wxPoint2DDouble> pointsD(n+(closeIt?1:0));
|
||||
for( int i = 0; i < n; ++i)
|
||||
{
|
||||
wxPoint p = points[i];
|
||||
|
|
@ -942,11 +930,10 @@ void wxGCDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
if ( closeIt )
|
||||
pointsD[n] = pointsD[0];
|
||||
|
||||
m_graphicContext->DrawLines( n+(closeIt?1:0) , pointsD, fillStyle);
|
||||
delete[] pointsD;
|
||||
m_graphicContext->DrawLines( n+(closeIt?1:0) , pointsD.get(), fillStyle);
|
||||
|
||||
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 +964,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 +978,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 +1005,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 +1023,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 +1129,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 +1182,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 +1223,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 +1385,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 +1416,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,
|
||||
|
|
|
|||
|
|
@ -626,8 +626,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)
|
||||
|
|
@ -857,8 +856,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[],
|
||||
|
|
@ -941,8 +939,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)
|
||||
|
|
@ -1140,8 +1137,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,
|
||||
|
|
@ -1180,8 +1176,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)
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#endif
|
||||
|
||||
#include "wx/fontutil.h"
|
||||
#include "wx/scopedarray.h"
|
||||
|
||||
#include "wx/gtk/private.h"
|
||||
#include "wx/gtk/private/object.h"
|
||||
|
|
@ -518,8 +519,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 +649,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 +696,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 )
|
||||
|
|
@ -726,12 +724,12 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset
|
|||
|
||||
// GdkPoint and wxPoint have the same memory layout, so we can cast one to the other
|
||||
const GdkPoint* gpts = reinterpret_cast<const GdkPoint*>(points);
|
||||
GdkPoint* gpts_alloc = NULL;
|
||||
wxScopedArray<GdkPoint> gpts_alloc;
|
||||
|
||||
if (doScale)
|
||||
{
|
||||
gpts_alloc = new GdkPoint[n];
|
||||
gpts = gpts_alloc;
|
||||
gpts_alloc.reset(new GdkPoint[n]);
|
||||
gpts = gpts_alloc.get();
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
|
|
@ -746,8 +744,6 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset
|
|||
|
||||
if (m_gdkwindow)
|
||||
gdk_draw_lines(m_gdkwindow, m_penGC, const_cast<GdkPoint*>(gpts), n);
|
||||
|
||||
delete[] gpts_alloc;
|
||||
}
|
||||
|
||||
void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
||||
|
|
@ -764,12 +760,12 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
|
||||
// GdkPoint and wxPoint have the same memory layout, so we can cast one to the other
|
||||
const GdkPoint* gdkpoints = reinterpret_cast<const GdkPoint*>(points);
|
||||
GdkPoint* gdkpoints_alloc = NULL;
|
||||
wxScopedArray<GdkPoint> gdkpoints_alloc;
|
||||
|
||||
if (doScale)
|
||||
{
|
||||
gdkpoints_alloc = new GdkPoint[n];
|
||||
gdkpoints = gdkpoints_alloc;
|
||||
gdkpoints_alloc.reset(new GdkPoint[n]);
|
||||
gdkpoints = gdkpoints_alloc.get();
|
||||
}
|
||||
|
||||
int i;
|
||||
|
|
@ -813,8 +809,6 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
delete[] gdkpoints_alloc;
|
||||
}
|
||||
|
||||
void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||
|
|
@ -853,8 +847,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 +925,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 +967,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 )
|
||||
|
|
@ -1016,11 +1007,11 @@ ScaleMask(GdkPixmap* mask, int x, int y, int w, int h, int dst_w, int dst_h, dou
|
|||
// convert black and white pixbuf back to a mono pixmap
|
||||
const unsigned out_rowstride = (dst_w + 7) / 8;
|
||||
const size_t data_size = out_rowstride * size_t(dst_h);
|
||||
char* data = new char[data_size];
|
||||
char* out = data;
|
||||
wxScopedArray<char> data(data_size);
|
||||
char* out = data.get();
|
||||
const guchar* row = gdk_pixbuf_get_pixels(pixbuf);
|
||||
const int rowstride = gdk_pixbuf_get_rowstride(pixbuf);
|
||||
memset(data, 0, data_size);
|
||||
memset(data.get(), 0, data_size);
|
||||
for (int j = 0; j < dst_h; j++, row += rowstride, out += out_rowstride)
|
||||
{
|
||||
const guchar* in = row;
|
||||
|
|
@ -1029,9 +1020,7 @@ ScaleMask(GdkPixmap* mask, int x, int y, int w, int h, int dst_w, int dst_h, dou
|
|||
out[i >> 3] |= 1 << (i & 7);
|
||||
}
|
||||
g_object_unref(pixbuf);
|
||||
GdkPixmap* pixmap = gdk_bitmap_create_from_data(mask, data, dst_w, dst_h);
|
||||
delete[] data;
|
||||
return pixmap;
|
||||
return gdk_bitmap_create_from_data(mask, data.get(), dst_w, dst_h);
|
||||
}
|
||||
|
||||
// Make a new mask from part of a mask and a clip region.
|
||||
|
|
@ -1087,8 +1076,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 +1225,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 +1411,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 +1434,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);
|
||||
|
|
@ -1641,13 +1627,12 @@ void wxWindowDCImpl::SetPen( const wxPen &pen )
|
|||
|
||||
if (req_dash && req_nb_dash)
|
||||
{
|
||||
wxDash* real_req_dash = new wxDash[req_nb_dash];
|
||||
wxScopedArray<wxDash> real_req_dash(req_nb_dash);
|
||||
if (real_req_dash)
|
||||
{
|
||||
for (int i = 0; i < req_nb_dash; i++)
|
||||
real_req_dash[i] = req_dash[i] * width;
|
||||
gdk_gc_set_dashes( m_penGC, 0, real_req_dash, req_nb_dash );
|
||||
delete[] real_req_dash;
|
||||
gdk_gc_set_dashes( m_penGC, 0, real_req_dash.get(), req_nb_dash );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1343,8 +1343,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)
|
||||
|
|
@ -1393,8 +1392,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),
|
||||
|
|
@ -1415,8 +1413,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)
|
||||
|
|
@ -1432,8 +1429,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)
|
||||
|
|
@ -1512,8 +1508,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)
|
||||
|
|
@ -1625,8 +1620,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)
|
||||
|
|
@ -1679,8 +1673,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)
|
||||
|
|
@ -1708,8 +1701,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);
|
||||
}
|
||||
|
|
@ -1743,8 +1735,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)
|
||||
|
|
@ -1766,8 +1757,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();
|
||||
}
|
||||
|
|
@ -1843,8 +1833,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);
|
||||
}
|
||||
|
|
@ -1932,9 +1921,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()
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#endif
|
||||
|
||||
#include "wx/fontutil.h"
|
||||
#include "wx/scopedarray.h"
|
||||
|
||||
#include "wx/gtk1/win_gtk.h"
|
||||
#include "wx/gtk1/dcclient.h"
|
||||
|
|
@ -458,8 +459,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 +570,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 +631,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 )
|
||||
|
|
@ -654,7 +652,7 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset
|
|||
if (n <= 0) return;
|
||||
|
||||
|
||||
GdkPoint * const gpts = new GdkPoint[n];
|
||||
wxScopedArray<GdkPoint> gpts(n);
|
||||
if ( !gpts )
|
||||
{
|
||||
wxFAIL_MSG( wxT("Cannot allocate PolyLine") );
|
||||
|
|
@ -672,9 +670,7 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset
|
|||
gpts[i].y = YLOG2DEV(y);
|
||||
}
|
||||
|
||||
gdk_draw_lines( m_window, m_penGC, gpts, n);
|
||||
|
||||
delete[] gpts;
|
||||
gdk_draw_lines( m_window, m_penGC, gpts.get(), n);
|
||||
}
|
||||
|
||||
void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode WXUNUSED(fillStyle) )
|
||||
|
|
@ -683,7 +679,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], wxCoord xoffs
|
|||
|
||||
if (n <= 0) return;
|
||||
|
||||
GdkPoint * const gpts = new GdkPoint[n];
|
||||
wxScopedArray<GdkPoint> gpts(n);
|
||||
|
||||
for (int i = 0 ; i < n ; i++)
|
||||
{
|
||||
|
|
@ -698,7 +694,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], wxCoord xoffs
|
|||
|
||||
if (m_brush.GetStyle() == wxBRUSHSTYLE_SOLID)
|
||||
{
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts, n );
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts.get(), n );
|
||||
}
|
||||
else if (m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
|
||||
{
|
||||
|
|
@ -707,19 +703,19 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], wxCoord xoffs
|
|||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_polygon( m_window, m_textGC, TRUE, gpts, n );
|
||||
gdk_draw_polygon( m_window, m_textGC, TRUE, gpts.get(), n );
|
||||
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
|
||||
} else
|
||||
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 15, m_deviceOriginY % 15 );
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts, n );
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts.get(), n );
|
||||
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 16, m_deviceOriginY % 16 );
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts, n );
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts.get(), n );
|
||||
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE)
|
||||
|
|
@ -727,22 +723,20 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], wxCoord xoffs
|
|||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts, n );
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts.get(), n );
|
||||
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts, n );
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts.get(), n );
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT)
|
||||
{
|
||||
gdk_draw_polygon( m_window, m_penGC, FALSE, gpts, n );
|
||||
gdk_draw_polygon( m_window, m_penGC, FALSE, gpts.get(), n );
|
||||
|
||||
}
|
||||
|
||||
delete[] gpts;
|
||||
}
|
||||
|
||||
void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||
|
|
@ -803,8 +797,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 +919,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 +977,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 +1003,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 +1187,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 +1419,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 +1529,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,
|
||||
|
|
@ -1738,13 +1725,12 @@ void wxWindowDCImpl::SetPen( const wxPen &pen )
|
|||
|
||||
if (req_dash && req_nb_dash)
|
||||
{
|
||||
wxGTKDash *real_req_dash = new wxGTKDash[req_nb_dash];
|
||||
wxScopedArray<wxGTKDash> real_req_dash(req_nb_dash);
|
||||
if (real_req_dash)
|
||||
{
|
||||
for (int i = 0; i < req_nb_dash; i++)
|
||||
real_req_dash[i] = req_dash[i] * width;
|
||||
gdk_gc_set_dashes( m_penGC, 0, real_req_dash, req_nb_dash );
|
||||
delete[] real_req_dash;
|
||||
gdk_gc_set_dashes( m_penGC, 0, real_req_dash.get(), req_nb_dash );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@
|
|||
#include "wx/dcclient.h"
|
||||
#endif
|
||||
|
||||
#include "wx/scopedarray.h"
|
||||
|
||||
#ifdef __VMS__
|
||||
#pragma message disable nosimpint
|
||||
#endif
|
||||
|
|
@ -259,8 +261,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 +370,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 +414,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 )
|
||||
|
|
@ -441,7 +440,7 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset
|
|||
if (m_autoSetting)
|
||||
SetPen (m_pen);
|
||||
|
||||
XPoint *xpoints = new XPoint[n];
|
||||
wxScopedArray<XPoint> xpoints(n);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
|
|
@ -449,7 +448,7 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset
|
|||
xpoints[i].x = (short)XLOG2DEV (points[i].x + xoffset);
|
||||
xpoints[i].y = (short)YLOG2DEV (points[i].y + yoffset);
|
||||
}
|
||||
XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints, n, 0);
|
||||
XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints.get(), n, 0);
|
||||
|
||||
if (m_window && m_window->GetBackingPixmap())
|
||||
{
|
||||
|
|
@ -458,9 +457,8 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset
|
|||
xpoints[i].x = (short)XLOG2DEV_2 (points[i].x + xoffset);
|
||||
xpoints[i].y = (short)YLOG2DEV_2 (points[i].y + yoffset);
|
||||
}
|
||||
XDrawLines ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints, n, 0);
|
||||
XDrawLines ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints.get(), n, 0);
|
||||
}
|
||||
delete[]xpoints;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -469,8 +467,8 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
{
|
||||
wxCHECK_RET( IsOk(), "invalid dc" );
|
||||
|
||||
XPoint *xpoints1 = new XPoint[n + 1];
|
||||
XPoint *xpoints2 = new XPoint[n + 1];
|
||||
wxScopedArray<XPoint> xpoints1(n + 1);
|
||||
wxScopedArray<XPoint> xpoints2(n + 1);
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
|
|
@ -491,13 +489,13 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
{
|
||||
SetBrush (m_brush);
|
||||
XSetFillRule ((Display*) m_display, (GC) m_gc, fillStyle == wxODDEVEN_RULE ? EvenOddRule : WindingRule);
|
||||
XFillPolygon ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1, n, Complex, 0);
|
||||
XFillPolygon ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1.get(), n, Complex, 0);
|
||||
XSetFillRule ((Display*) m_display, (GC) m_gc, EvenOddRule); // default mode
|
||||
if (m_window && m_window->GetBackingPixmap())
|
||||
{
|
||||
XSetFillRule ((Display*) m_display,(GC) m_gcBacking,
|
||||
fillStyle == wxODDEVEN_RULE ? EvenOddRule : WindingRule);
|
||||
XFillPolygon ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints2, n, Complex, 0);
|
||||
XFillPolygon ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints2.get(), n, Complex, 0);
|
||||
XSetFillRule ((Display*) m_display,(GC) m_gcBacking, EvenOddRule); // default mode
|
||||
}
|
||||
}
|
||||
|
|
@ -506,14 +504,11 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
{
|
||||
if (m_autoSetting)
|
||||
SetPen (m_pen);
|
||||
XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1, n + 1, 0);
|
||||
XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1.get(), n + 1, 0);
|
||||
|
||||
if (m_window && m_window->GetBackingPixmap())
|
||||
XDrawLines ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints2, n + 1, 0);
|
||||
XDrawLines ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints2.get(), n + 1, 0);
|
||||
}
|
||||
|
||||
delete[]xpoints1;
|
||||
delete[]xpoints2;
|
||||
}
|
||||
|
||||
void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||
|
|
@ -555,8 +550,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 +709,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 +760,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 +985,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 +1145,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 +1280,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
|
||||
|
|
|
|||
136
src/msw/dc.cpp
136
src/msw/dc.cpp
|
|
@ -37,6 +37,8 @@
|
|||
#endif
|
||||
|
||||
#include "wx/msw/dc.h"
|
||||
|
||||
#include "wx/scopedarray.h"
|
||||
#include "wx/sysopt.h"
|
||||
|
||||
#ifdef wxHAS_RAW_BITMAP
|
||||
|
|
@ -402,6 +404,9 @@ private:
|
|||
wxDECLARE_NO_COPY_CLASS(wxBrushAttrsSetter);
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// this class sets the stretch blit mode to COLORONCOLOR during its lifetime
|
||||
class StretchBltModeChanger
|
||||
{
|
||||
|
|
@ -432,6 +437,32 @@ private:
|
|||
wxDECLARE_NO_COPY_CLASS(StretchBltModeChanger);
|
||||
};
|
||||
|
||||
// This one changes polygon fill mode to the given one during its lifetime.
|
||||
class PolyFillModeSetter
|
||||
{
|
||||
public:
|
||||
PolyFillModeSetter(HDC hdc, wxPolygonFillMode mode)
|
||||
: m_hdc(hdc)
|
||||
{
|
||||
m_modeOld = ::SetPolyFillMode(m_hdc, mode == wxODDEVEN_RULE ? ALTERNATE
|
||||
: WINDING);
|
||||
}
|
||||
|
||||
~PolyFillModeSetter()
|
||||
{
|
||||
::SetPolyFillMode(m_hdc, m_modeOld);
|
||||
}
|
||||
|
||||
private:
|
||||
const HDC m_hdc;
|
||||
|
||||
int m_modeOld;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(PolyFillModeSetter);
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// ===========================================================================
|
||||
// implementation
|
||||
// ===========================================================================
|
||||
|
|
@ -621,11 +652,11 @@ void wxMSWDCImpl::SetClippingHrgn(WXHRGN hrgn, bool doRtlOffset)
|
|||
if ( GetLayoutDirection() == wxLayout_RightToLeft )
|
||||
{
|
||||
DWORD bufLen = ::GetRegionData(hrgn, 0, NULL); // Get the storage size
|
||||
char* pDataBuf = new char[bufLen]; // Buffer for the region data
|
||||
if ( ::GetRegionData(hrgn, bufLen, reinterpret_cast<RGNDATA*>(pDataBuf)) != bufLen )
|
||||
wxScopedArray<char> pDataBuf(bufLen);
|
||||
RGNDATA* const rgndata = reinterpret_cast<RGNDATA*>(pDataBuf.get());
|
||||
if ( ::GetRegionData(hrgn, bufLen, rgndata) != bufLen )
|
||||
{
|
||||
wxLogLastError("GetRegionData");
|
||||
delete[] pDataBuf;
|
||||
return;
|
||||
}
|
||||
int dcw, dch;
|
||||
|
|
@ -644,8 +675,7 @@ void wxMSWDCImpl::SetClippingHrgn(WXHRGN hrgn, bool doRtlOffset)
|
|||
// shoulde be adjusted.
|
||||
tr.eDx = doRtlOffset ? dcw : dcw-1; // max X
|
||||
tr.eDy = 0;
|
||||
hRgnRTL = ::ExtCreateRegion(&tr, bufLen, reinterpret_cast<RGNDATA*>(pDataBuf));
|
||||
delete[] pDataBuf;
|
||||
hRgnRTL = ::ExtCreateRegion(&tr, bufLen, rgndata);
|
||||
if ( !hRgnRTL )
|
||||
{
|
||||
wxLogLastError("ExtCreateRegion");
|
||||
|
|
@ -813,8 +843,6 @@ void wxMSWDCImpl::Clear()
|
|||
// of complex transformation (is e.g. rotated).
|
||||
::InflateRect(&rect, 1, 1);
|
||||
::FillRect(GetHdc(), &rect, hbr);
|
||||
|
||||
RealizeScaleAndOrigin();
|
||||
}
|
||||
|
||||
bool wxMSWDCImpl::DoFloodFill(wxCoord x,
|
||||
|
|
@ -913,8 +941,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)
|
||||
|
|
@ -946,8 +973,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)
|
||||
|
|
@ -999,8 +1025,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)
|
||||
|
|
@ -1024,22 +1049,21 @@ void wxMSWDCImpl::DoDrawPolygon(int n,
|
|||
{
|
||||
wxBrushAttrsSetter cc(*this); // needed for wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE handling
|
||||
|
||||
PolyFillModeSetter polyfillModeSetter(GetHdc(), fillStyle);
|
||||
|
||||
// Do things less efficiently if we have offsets
|
||||
if (xoffset != 0 || yoffset != 0)
|
||||
{
|
||||
POINT *cpoints = new POINT[n];
|
||||
wxScopedArray<POINT> cpoints(n);
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
cpoints[i].x = (int)(points[i].x + xoffset);
|
||||
cpoints[i].y = (int)(points[i].y + yoffset);
|
||||
cpoints[i].x = points[i].x + xoffset;
|
||||
cpoints[i].y = points[i].y + yoffset;
|
||||
|
||||
CalcBoundingBox(cpoints[i].x, cpoints[i].y);
|
||||
}
|
||||
int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
|
||||
(void)Polygon(GetHdc(), cpoints, n);
|
||||
SetPolyFillMode(GetHdc(),prev);
|
||||
delete[] cpoints;
|
||||
(void)Polygon(GetHdc(), cpoints.get(), n);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1047,9 +1071,7 @@ void wxMSWDCImpl::DoDrawPolygon(int n,
|
|||
for (i = 0; i < n; i++)
|
||||
CalcBoundingBox(points[i].x, points[i].y);
|
||||
|
||||
int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
|
||||
Polygon(GetHdc(), reinterpret_cast<const POINT*>(points), n);
|
||||
SetPolyFillMode(GetHdc(),prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1066,30 +1088,27 @@ wxMSWDCImpl::DoDrawPolyPolygon(int n,
|
|||
for (i = cnt = 0; i < n; i++)
|
||||
cnt += count[i];
|
||||
|
||||
PolyFillModeSetter polyfillModeSetter(GetHdc(), fillStyle);
|
||||
|
||||
// Do things less efficiently if we have offsets
|
||||
if (xoffset != 0 || yoffset != 0)
|
||||
{
|
||||
POINT *cpoints = new POINT[cnt];
|
||||
wxScopedArray<POINT> cpoints(cnt);
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
cpoints[i].x = (int)(points[i].x + xoffset);
|
||||
cpoints[i].y = (int)(points[i].y + yoffset);
|
||||
cpoints[i].x = points[i].x + xoffset;
|
||||
cpoints[i].y = points[i].y + yoffset;
|
||||
|
||||
CalcBoundingBox(cpoints[i].x, cpoints[i].y);
|
||||
}
|
||||
int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
|
||||
(void)PolyPolygon(GetHdc(), cpoints, count, n);
|
||||
SetPolyFillMode(GetHdc(),prev);
|
||||
delete[] cpoints;
|
||||
(void)PolyPolygon(GetHdc(), cpoints.get(), count, n);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < cnt; i++)
|
||||
CalcBoundingBox(points[i].x, points[i].y);
|
||||
|
||||
int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
|
||||
PolyPolygon(GetHdc(), reinterpret_cast<const POINT*>(points), count, n);
|
||||
SetPolyFillMode(GetHdc(),prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1098,7 +1117,7 @@ void wxMSWDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wx
|
|||
// Do things less efficiently if we have offsets
|
||||
if (xoffset != 0 || yoffset != 0)
|
||||
{
|
||||
POINT *cpoints = new POINT[n];
|
||||
wxScopedArray<POINT> cpoints(n);
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
|
|
@ -1107,8 +1126,7 @@ void wxMSWDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wx
|
|||
|
||||
CalcBoundingBox(cpoints[i].x, cpoints[i].y);
|
||||
}
|
||||
(void)Polyline(GetHdc(), cpoints, n);
|
||||
delete[] cpoints;
|
||||
(void)Polyline(GetHdc(), cpoints.get(), n);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1149,8 +1167,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)
|
||||
|
|
@ -1181,8 +1198,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)
|
||||
|
|
@ -1199,8 +1215,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
|
||||
|
|
@ -1226,7 +1241,7 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
|
|||
wxCHECK_RET( n_points >= 2 , "incomplete list of spline points?" );
|
||||
|
||||
const size_t n_bezier_points = n_points * 3 + 1;
|
||||
POINT *lppt = new POINT[n_bezier_points];
|
||||
wxScopedArray<POINT> lppt(n_bezier_points);
|
||||
size_t bezier_pos = 0;
|
||||
wxCoord x1, y1, x2, y2, cx1, cy1;
|
||||
|
||||
|
|
@ -1287,9 +1302,7 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
|
|||
lppt[ bezier_pos ] = lppt[ bezier_pos-1 ];
|
||||
bezier_pos++;
|
||||
|
||||
::PolyBezier( GetHdc(), lppt, bezier_pos );
|
||||
|
||||
delete []lppt;
|
||||
::PolyBezier( GetHdc(), lppt.get(), bezier_pos );
|
||||
}
|
||||
#endif // wxUSE_SPLINES
|
||||
|
||||
|
|
@ -1333,8 +1346,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)
|
||||
|
|
@ -1358,8 +1370,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 )
|
||||
|
|
@ -1403,8 +1414,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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1512,8 +1522,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)
|
||||
|
|
@ -1538,11 +1547,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)
|
||||
|
|
@ -1635,14 +1640,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)));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -2147,7 +2150,7 @@ void wxMSWDCImpl::SetDeviceOrigin(wxCoord x, wxCoord y)
|
|||
|
||||
wxDCImpl::SetDeviceOrigin( x, y );
|
||||
|
||||
::SetViewportOrgEx(GetHdc(), (int)m_deviceOriginX, (int)m_deviceOriginY, NULL);
|
||||
::SetViewportOrgEx(GetHdc(), m_deviceOriginX, m_deviceOriginY, NULL);
|
||||
|
||||
m_isClipBoxValid = false;
|
||||
}
|
||||
|
|
@ -2308,8 +2311,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;
|
||||
}
|
||||
}
|
||||
|
|
@ -2597,8 +2599,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;
|
||||
|
|
@ -2940,8 +2941,7 @@ void wxMSWDCImpl::DoGradientFillLinear (const wxRect& rect,
|
|||
: GRADIENT_FILL_RECT_V
|
||||
) )
|
||||
{
|
||||
CalcBoundingBox(rect.GetLeft(), rect.GetBottom());
|
||||
CalcBoundingBox(rect.GetRight(), rect.GetTop());
|
||||
CalcBoundingBox(rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#endif
|
||||
|
||||
#include "wx/fontutil.h"
|
||||
#include "wx/scopedarray.h"
|
||||
#include "wx/vector.h"
|
||||
|
||||
#include "wx/x11/private.h"
|
||||
|
|
@ -411,8 +412,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 +543,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 +622,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 )
|
||||
|
|
@ -645,7 +643,7 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset
|
|||
if (m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT) return;
|
||||
if (n <= 0) return;
|
||||
|
||||
XPoint *xpoints = new XPoint[n];
|
||||
wxScopedArray<XPoint> xpoints(n);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
xpoints[i].x = XLOG2DEV (points[i].x + xoffset);
|
||||
|
|
@ -653,9 +651,7 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset
|
|||
|
||||
CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset );
|
||||
}
|
||||
XDrawLines( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xpoints, n, 0 );
|
||||
|
||||
delete[] xpoints;
|
||||
XDrawLines( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xpoints.get(), n, 0 );
|
||||
}
|
||||
|
||||
void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
||||
|
|
@ -666,7 +662,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
|
||||
if (n <= 0) return;
|
||||
|
||||
XPoint *xpoints = new XPoint[n + 1];
|
||||
wxScopedArray<XPoint> xpoints(n + 1);
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
|
|
@ -688,7 +684,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
XFillPolygon( (Display*) m_display, (Window) m_x11window,
|
||||
(GC) m_textGC, xpoints, n, Complex, 0);
|
||||
(GC) m_textGC, xpoints.get(), n, Complex, 0);
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
|
||||
} else
|
||||
|
|
@ -698,7 +694,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
m_deviceOriginX % 15, m_deviceOriginY % 15 );
|
||||
|
||||
XFillPolygon( (Display*) m_display, (Window) m_x11window,
|
||||
(GC) m_brushGC, xpoints, n, Complex, 0);
|
||||
(GC) m_brushGC, xpoints.get(), n, Complex, 0);
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
|
|
@ -708,7 +704,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
m_deviceOriginX % 16, m_deviceOriginY % 16 );
|
||||
|
||||
XFillPolygon( (Display*) m_display, (Window) m_x11window,
|
||||
(GC) m_brushGC, xpoints, n, Complex, 0);
|
||||
(GC) m_brushGC, xpoints.get(), n, Complex, 0);
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
|
|
@ -719,14 +715,14 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
XFillPolygon( (Display*) m_display, (Window) m_x11window,
|
||||
(GC) m_brushGC, xpoints, n, Complex, 0);
|
||||
(GC) m_brushGC, xpoints.get(), n, Complex, 0);
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
XFillPolygon( (Display*) m_display, (Window) m_x11window,
|
||||
(GC) m_brushGC, xpoints, n, Complex, 0);
|
||||
(GC) m_brushGC, xpoints.get(), n, Complex, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -736,11 +732,9 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
|
|||
xpoints[i].x = xpoints[0].x;
|
||||
xpoints[i].y = xpoints[0].y;
|
||||
|
||||
XDrawLines( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xpoints, n + 1, 0);
|
||||
XDrawLines( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xpoints.get(), n + 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
delete[] xpoints;
|
||||
}
|
||||
|
||||
void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||
|
|
@ -819,8 +813,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 +935,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 +1011,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 +1037,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 +1155,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 +1373,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 +1589,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 +1645,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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue