X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8552e6f031ded8ae61b4a5b489fbf06962365da7..31d7fc0f9cb3f5913ecd4a039a816487a6753a93:/contrib/src/ogl/basic2.cpp?ds=inline diff --git a/contrib/src/ogl/basic2.cpp b/contrib/src/ogl/basic2.cpp index b79a6c7545..35c591720c 100644 --- a/contrib/src/ogl/basic2.cpp +++ b/contrib/src/ogl/basic2.cpp @@ -63,23 +63,31 @@ void wxPolygonShape::Create(wxList *the_points) { ClearPoints(); - m_originalPoints = the_points; - - // Duplicate the list of points - m_points = new wxList; - - wxNode *node = the_points->GetFirst(); - while (node) + if (!the_points) { - wxRealPoint *point = (wxRealPoint *)node->GetData(); - wxRealPoint *new_point = new wxRealPoint(point->x, point->y); - m_points->Append((wxObject*) new_point); - node = node->GetNext(); + m_originalPoints = new wxList; + m_points = new wxList; + } + else + { + m_originalPoints = the_points; + + // Duplicate the list of points + m_points = new wxList; + + wxNode *node = the_points->GetFirst(); + while (node) + { + wxRealPoint *point = (wxRealPoint *)node->GetData(); + wxRealPoint *new_point = new wxRealPoint(point->x, point->y); + m_points->Append((wxObject*) new_point); + node = node->GetNext(); + } + CalculateBoundingBox(); + m_originalWidth = m_boundWidth; + m_originalHeight = m_boundHeight; + SetDefaultRegionSize(); } - CalculateBoundingBox(); - m_originalWidth = m_boundWidth; - m_originalHeight = m_boundHeight; - SetDefaultRegionSize(); } wxPolygonShape::~wxPolygonShape() @@ -1761,7 +1769,7 @@ wxShapeRegion::wxShapeRegion() m_textColour = wxT("BLACK"); m_penColour = wxT("BLACK"); m_penStyle = wxSOLID; - m_actualColourObject = NULL; + m_actualColourObject = wxTheColourDatabase->Find(wxT("BLACK")); m_actualPenObject = NULL; } @@ -1782,7 +1790,7 @@ wxShapeRegion::wxShapeRegion(wxShapeRegion& region) m_regionProportionX = region.m_regionProportionX; m_regionProportionY = region.m_regionProportionY; m_formatMode = region.m_formatMode; - m_actualColourObject = NULL; + m_actualColourObject = region.m_actualColourObject; m_actualPenObject = NULL; m_penStyle = region.m_penStyle; m_penColour = region.m_penColour; @@ -1854,15 +1862,12 @@ void wxShapeRegion::SetFormatMode(int mode) void wxShapeRegion::SetColour(const wxString& col) { m_textColour = col; - m_actualColourObject = NULL; + m_actualColourObject = col; } -wxColour *wxShapeRegion::GetActualColourObject() +wxColour wxShapeRegion::GetActualColourObject() { - if (!m_actualColourObject) - m_actualColourObject = wxTheColourDatabase->FindColour(GetColour()); - if (!m_actualColourObject) - m_actualColourObject = wxBLACK; + m_actualColourObject = wxTheColourDatabase->Find(GetColour()); return m_actualColourObject; }