]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/ogl/basic2.cpp
reSWIGged
[wxWidgets.git] / contrib / src / ogl / basic2.cpp
index b79a6c754570fd19ecaddeb3650c9f3fdc74becf..35c591720c79c9fa697945462ad1560d999fbc8b 100644 (file)
@@ -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;
 }