]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/regiong.cpp
Add wxAnyScrollHelperBase to reduce code duplication in wxVarScrollHelperBase.
[wxWidgets.git] / src / generic / regiong.cpp
index 845df56ce07041a924712cbe9f8a97a8a38fba28..7580c44432d49b29450042da5c5c8f62eb2bd7c9 100644 (file)
@@ -1,10 +1,9 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/generic/region.cpp
+// Name:        src/generic/regiong.cpp
 // Purpose:     generic wxRegion class
 // Author:      David Elliott
 // Modified by:
 // Created:     2004/04/12
-// RCS-ID:      $Id$
 // Copyright:   (c) 2004 David Elliott
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -176,12 +175,12 @@ protected:
 // wxRegionRefData
 // ========================================================================
 
-class wxRegionRefData : public wxObjectRefData,
+class wxRegionRefData : public wxGDIRefData,
                         public REGION
 {
 public:
     wxRegionRefData()
-        : wxObjectRefData(),
+        : wxGDIRefData(),
           REGION()
     {
         size = 1;
@@ -194,7 +193,7 @@ public:
     }
 
     wxRegionRefData(const wxPoint& topLeft, const wxPoint& bottomRight)
-        : wxObjectRefData(),
+        : wxGDIRefData(),
           REGION()
     {
         rects = (BOX*)malloc(sizeof(BOX));
@@ -208,7 +207,7 @@ public:
     }
 
     wxRegionRefData(const wxRect& rect)
-        : wxObjectRefData(),
+        : wxGDIRefData(),
           REGION(rect)
     {
         rects = (BOX*)malloc(sizeof(BOX));
@@ -216,7 +215,7 @@ public:
     }
 
     wxRegionRefData(const wxRegionRefData& refData)
-        : wxObjectRefData(),
+        : wxGDIRefData(),
           REGION()
     {
         size = refData.size;
@@ -271,17 +270,34 @@ wxRegionGeneric::wxRegionGeneric(const wxPoint& topLeft, const wxPoint& bottomRi
     m_refData = new wxRegionRefData(topLeft, bottomRight);
 }
 
+wxRegionGeneric::wxRegionGeneric(const wxBitmap& bmp)
+{
+    wxFAIL_MSG("NOT IMPLEMENTED: wxRegionGeneric::wxRegionGeneric(const wxBitmap& bmp)");
+}
+
+wxRegionGeneric::wxRegionGeneric(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle)
+{
+    wxFAIL_MSG("NOT IMPLEMENTED: wxRegionGeneric::wxRegionGeneric(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle)");
+}
+
+wxRegionGeneric::wxRegionGeneric(const wxBitmap& bmp, const wxColour& transp, int tolerance)
+{
+    wxFAIL_MSG("NOT IMPLEMENTED: wxRegionGeneric::wxRegionGeneric(const wxBitmap& bmp, const wxColour& transp, int tolerance)");
+}
+
 void wxRegionGeneric::Clear()
 {
     UnRef();
+    if (!m_refData)
+        m_refData = new wxRegionRefData(wxRect(0,0,0,0));
 }
 
-wxObjectRefData *wxRegionGeneric::CreateRefData() const
+wxGDIRefData *wxRegionGeneric::CreateGDIRefData() const
 {
     return new wxRegionRefData;
 }
 
-wxObjectRefData *wxRegionGeneric::CloneRefData(const wxObjectRefData *data) const
+wxGDIRefData *wxRegionGeneric::CloneGDIRefData(const wxGDIRefData *data) const
 {
     return new wxRegionRefData(*(wxRegionRefData *)data);
 }
@@ -600,7 +616,7 @@ Region REGION::XCreateRegion(void)
 
     if (!temp->rects)
     {
-        free((char *) temp);
+        delete temp;
         return (Region) NULL;
     }
     temp->numRects = 0;
@@ -668,7 +684,7 @@ miSetExtents (Region pReg)
     pExtents->x2 = pBoxEnd->x2;
     pExtents->y2 = pBoxEnd->y2;
 
-    assert(pExtents->y1 < pExtents->y2);
+    wxASSERT_LEVEL_2(pExtents->y1 < pExtents->y2);
     while (pBox <= pBoxEnd)
     {
         if (pBox->x1 < pExtents->x1)
@@ -681,7 +697,7 @@ miSetExtents (Region pReg)
         }
         pBox++;
     }
-    assert(pExtents->x1 < pExtents->x2);
+    wxASSERT_LEVEL_2(pExtents->x1 < pExtents->x2);
 }
 
 bool REGION::
@@ -772,7 +788,7 @@ miIntersectO (
          */
         if (x1 < x2)
         {
-            assert(y1<y2);
+            wxASSERT_LEVEL_2(y1<y2);
 
             MEMCHECK(pReg, pNextRect, pReg->rects);
             pNextRect->x1 = x1;
@@ -781,7 +797,7 @@ miIntersectO (
             pNextRect->y2 = y2;
             pReg->numRects += 1;
             pNextRect++;
-            assert(pReg->numRects <= pReg->size);
+            wxASSERT_LEVEL_2(pReg->numRects <= pReg->size);
         }
 
         /*
@@ -1362,11 +1378,11 @@ miUnionNonO (
 
     pNextRect = &pReg->rects[pReg->numRects];
 
-    assert(y1 < y2);
+    wxASSERT_LEVEL_2(y1 < y2);
 
     while (r != rEnd)
     {
-        assert(r->x1 < r->x2);
+        wxASSERT_LEVEL_2(r->x1 < r->x2);
         MEMCHECK(pReg, pNextRect, pReg->rects);
         pNextRect->x1 = r->x1;
         pNextRect->y1 = y1;
@@ -1375,7 +1391,7 @@ miUnionNonO (
         pReg->numRects += 1;
         pNextRect++;
 
-        assert(pReg->numRects<=pReg->size);
+        wxASSERT_LEVEL_2(pReg->numRects<=pReg->size);
         r++;
     }
     return 0;        /* lint */
@@ -1422,7 +1438,7 @@ miUnionO (
         if (pNextRect[-1].x2 < r->x2)  \
         {  \
             pNextRect[-1].x2 = r->x2;  \
-            assert(pNextRect[-1].x1<pNextRect[-1].x2); \
+            wxASSERT_LEVEL_2(pNextRect[-1].x1<pNextRect[-1].x2); \
         }  \
     }  \
     else  \
@@ -1435,10 +1451,10 @@ miUnionO (
         pReg->numRects += 1;  \
         pNextRect += 1;  \
     }  \
-    assert(pReg->numRects<=pReg->size);\
+    wxASSERT_LEVEL_2(pReg->numRects<=pReg->size);\
     r++;
 
-    assert (y1<y2);
+    wxASSERT_LEVEL_2 (y1<y2);
     while ((r1 != r1End) && (r2 != r2End))
     {
         if (r1->x1 < r2->x1)
@@ -1563,11 +1579,11 @@ miSubtractNonO1 (
 
     pNextRect = &pReg->rects[pReg->numRects];
 
-    assert(y1<y2);
+    wxASSERT_LEVEL_2(y1<y2);
 
     while (r != rEnd)
     {
-        assert(r->x1<r->x2);
+        wxASSERT_LEVEL_2(r->x1<r->x2);
         MEMCHECK(pReg, pNextRect, pReg->rects);
         pNextRect->x1 = r->x1;
         pNextRect->y1 = y1;
@@ -1576,7 +1592,7 @@ miSubtractNonO1 (
         pReg->numRects += 1;
         pNextRect++;
 
-        assert(pReg->numRects <= pReg->size);
+        wxASSERT_LEVEL_2(pReg->numRects <= pReg->size);
 
         r++;
     }
@@ -1613,7 +1629,7 @@ miSubtractO (
 
     x1 = r1->x1;
 
-    assert(y1<y2);
+    wxASSERT_LEVEL_2(y1<y2);
     pNextRect = &pReg->rects[pReg->numRects];
 
     while ((r1 != r1End) && (r2 != r2End))
@@ -1628,7 +1644,7 @@ miSubtractO (
         else if (r2->x1 <= x1)
         {
             /*
-             * Subtrahend preceeds minuend: nuke left edge of minuend.
+             * Subtrahend precedes minuend: nuke left edge of minuend.
              */
             x1 = r2->x2;
             if (x1 >= r1->x2)
@@ -1656,7 +1672,7 @@ miSubtractO (
              * Left part of subtrahend covers part of minuend: add uncovered
              * part of minuend to region and skip to next subtrahend.
              */
-            assert(x1<r2->x1);
+            wxASSERT_LEVEL_2(x1<r2->x1);
             MEMCHECK(pReg, pNextRect, pReg->rects);
             pNextRect->x1 = x1;
             pNextRect->y1 = y1;
@@ -1665,7 +1681,7 @@ miSubtractO (
             pReg->numRects += 1;
             pNextRect++;
 
-            assert(pReg->numRects<=pReg->size);
+            wxASSERT_LEVEL_2(pReg->numRects<=pReg->size);
 
             x1 = r2->x2;
             if (x1 >= r1->x2)
@@ -1699,7 +1715,7 @@ miSubtractO (
                 pNextRect->y2 = y2;
                 pReg->numRects += 1;
                 pNextRect++;
-                assert(pReg->numRects<=pReg->size);
+                wxASSERT_LEVEL_2(pReg->numRects<=pReg->size);
             }
             r1++;
             if (r1 != r1End)
@@ -1712,7 +1728,7 @@ miSubtractO (
      */
     while (r1 != r1End)
     {
-        assert(x1<r1->x2);
+        wxASSERT_LEVEL_2(x1<r1->x2);
         MEMCHECK(pReg, pNextRect, pReg->rects);
         pNextRect->x1 = x1;
         pNextRect->y1 = y1;
@@ -1721,7 +1737,7 @@ miSubtractO (
         pReg->numRects += 1;
         pNextRect++;
 
-        assert(pReg->numRects<=pReg->size);
+        wxASSERT_LEVEL_2(pReg->numRects<=pReg->size);
 
         r1++;
         if (r1 != r1End)