Applied patch [ 905577 ] Removed copystring from OGL library

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26314 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2004-03-23 22:07:56 +00:00
parent a0086878b0
commit 17401ab1cd
4 changed files with 9 additions and 13 deletions

View File

@@ -146,7 +146,7 @@ class WXDLLIMPEXP_OGL wxOpDraw: public wxDrawOp
{ {
public: public:
wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2, wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2,
double radius = 0.0, wxChar *s = NULL); double radius = 0.0, const wxString& s = wxEmptyString);
~wxOpDraw(); ~wxOpDraw();
void Do(wxDC& dc, double xoffset, double yoffset); void Do(wxDC& dc, double xoffset, double yoffset);
void Scale(double scaleX, double scaleY); void Scale(double scaleX, double scaleY);
@@ -166,7 +166,7 @@ public:
double m_x3; double m_x3;
double m_y3; double m_y3;
double m_radius; double m_radius;
wxChar* m_textString; wxString m_textString;
}; };

View File

@@ -700,9 +700,8 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int
wxShapeRegion *region = (wxShapeRegion *)node->GetData(); wxShapeRegion *region = (wxShapeRegion *)node->GetData();
if (region->GetText()) if (region->GetText())
{ {
wxChar *s = copystring(region->GetText()); wxString s(region->GetText());
dividedObject->FormatText(dc, s, i); dividedObject->FormatText(dc, s.c_str(), i);
delete[] s;
} }
node = node->GetNext(); node = node->GetNext();
i++; i++;

View File

@@ -676,7 +676,7 @@ void wxOpSetClipping::ReadExpr(wxPseudoMetaFile *WXUNUSED(image), wxExpr *expr)
*/ */
wxOpDraw::wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2, wxOpDraw::wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2,
double theRadius, wxChar *s) : wxDrawOp(theOp) double theRadius, const wxString& s) : wxDrawOp(theOp)
{ {
m_x1 = theX1; m_x1 = theX1;
m_y1 = theY1; m_y1 = theY1;
@@ -685,13 +685,11 @@ wxOpDraw::wxOpDraw(int theOp, double theX1, double theY1, double theX2, double t
m_x3 = 0.0; m_x3 = 0.0;
m_y3 = 0.0; m_y3 = 0.0;
m_radius = theRadius; m_radius = theRadius;
if (s) m_textString = copystring(s); m_textString = s;
else m_textString = NULL;
} }
wxOpDraw::~wxOpDraw() wxOpDraw::~wxOpDraw()
{ {
if (m_textString) delete[] m_textString;
} }
wxDrawOp *wxOpDraw::Copy(wxPseudoMetaFile *WXUNUSED(newImage)) wxDrawOp *wxOpDraw::Copy(wxPseudoMetaFile *WXUNUSED(newImage))
@@ -968,8 +966,7 @@ void wxOpDraw::ReadExpr(wxPseudoMetaFile *WXUNUSED(image), wxExpr *expr)
{ {
m_x1 = expr->Nth(1)->RealValue(); m_x1 = expr->Nth(1)->RealValue();
m_y1 = expr->Nth(2)->RealValue(); m_y1 = expr->Nth(2)->RealValue();
wxString str(expr->Nth(3)->StringValue()); m_textString = wxString(expr->Nth(3)->StringValue());
m_textString = copystring(str);
break; break;
} }
case DRAWOP_DRAW_ARC: case DRAWOP_DRAW_ARC:
@@ -2365,7 +2362,7 @@ void wxPseudoMetaFile::DrawText(const wxString& text, const wxPoint& pt)
wxOpDraw *theOp = new wxOpDraw(DRAWOP_DRAW_TEXT, wxOpDraw *theOp = new wxOpDraw(DRAWOP_DRAW_TEXT,
(double) pt.x, (double) pt.y, 0.0, 0.0); (double) pt.x, (double) pt.y, 0.0, 0.0);
theOp->m_textString = copystring(text); theOp->m_textString = text;
m_ops.Append(theOp); m_ops.Append(theOp);
} }

View File

@@ -505,7 +505,7 @@ void oglDrawFormattedText(wxDC& dc, wxList *text_list,
dc.SetClippingRegion( dc.SetClippingRegion(
(long)(m_xpos - width/2.0), (long)(m_ypos - height/2.0), (long)(m_xpos - width/2.0), (long)(m_ypos - height/2.0),
(long)width, (long)height); (long)width+1, (long)height+1); // +1 to allow for rounding errors
wxNode *current = text_list->GetFirst(); wxNode *current = text_list->GetFirst();
while (current) while (current)