X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8a16d7370e3cdc7d583a6f14ab11b3a1d27b73df..703e3c42d11a74be69cc1dee560e2c0f359ac13f:/src/generic/regiong.cpp diff --git a/src/generic/regiong.cpp b/src/generic/regiong.cpp index a60937a63c..24d24e2bba 100644 --- a/src/generic/regiong.cpp +++ b/src/generic/regiong.cpp @@ -176,12 +176,12 @@ protected: // wxRegionRefData // ======================================================================== -class wxRegionRefData : public wxObjectRefData, +class wxRegionRefData : public wxGDIRefData, public REGION { public: wxRegionRefData() - : wxObjectRefData(), + : wxGDIRefData(), REGION() { size = 1; @@ -194,7 +194,7 @@ public: } wxRegionRefData(const wxPoint& topLeft, const wxPoint& bottomRight) - : wxObjectRefData(), + : wxGDIRefData(), REGION() { rects = (BOX*)malloc(sizeof(BOX)); @@ -208,7 +208,7 @@ public: } wxRegionRefData(const wxRect& rect) - : wxObjectRefData(), + : wxGDIRefData(), REGION(rect) { rects = (BOX*)malloc(sizeof(BOX)); @@ -216,7 +216,7 @@ public: } wxRegionRefData(const wxRegionRefData& refData) - : wxObjectRefData(), + : wxGDIRefData(), REGION() { size = refData.size; @@ -271,17 +271,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); } @@ -322,19 +339,19 @@ bool wxRegionGeneric::DoUnionWithRect(const wxRect& rect) return REGION::XUnionRegion(®ion,M_REGIONDATA,M_REGIONDATA); } -bool wxRegionGeneric::DoUnionWithRegion(const wxRegionGeneric& region) +bool wxRegionGeneric::DoUnionWithRegion(const wxRegion& region) { AllocExclusive(); return REGION::XUnionRegion(M_REGIONDATA_OF(region),M_REGIONDATA,M_REGIONDATA); } -bool wxRegionGeneric::DoIntersect(const wxRegionGeneric& region) +bool wxRegionGeneric::DoIntersect(const wxRegion& region) { AllocExclusive(); return REGION::XIntersectRegion(M_REGIONDATA_OF(region),M_REGIONDATA,M_REGIONDATA); } -bool wxRegionGeneric::DoSubtract(const wxRegionGeneric& region) +bool wxRegionGeneric::DoSubtract(const wxRegion& region) { if ( region.IsEmpty() ) { @@ -345,7 +362,7 @@ bool wxRegionGeneric::DoSubtract(const wxRegionGeneric& region) return REGION::XSubtractRegion(M_REGIONDATA_OF(region),M_REGIONDATA,M_REGIONDATA); } -bool wxRegionGeneric::DoXor(const wxRegionGeneric& region) +bool wxRegionGeneric::DoXor(const wxRegion& region) { AllocExclusive(); return REGION::XXorRegion(M_REGIONDATA_OF(region),M_REGIONDATA,M_REGIONDATA); @@ -368,7 +385,7 @@ bool wxRegionGeneric::IsEmpty() const } // Does the region contain the point (x,y)? -wxRegionContain wxRegionGeneric::DoContainsPoint(long x, long y) const +wxRegionContain wxRegionGeneric::DoContainsPoint(wxCoord x, wxCoord y) const { wxASSERT(m_refData); return REGION::XPointInRegion(M_REGIONDATA,x,y) ? wxInRegion : wxOutRegion; @@ -600,7 +617,7 @@ Region REGION::XCreateRegion(void) if (!temp->rects) { - free((char *) temp); + delete temp; return (Region) NULL; } temp->numRects = 0; @@ -668,7 +685,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 +698,7 @@ miSetExtents (Region pReg) } pBox++; } - assert(pExtents->x1 < pExtents->x2); + wxASSERT_LEVEL_2(pExtents->x1 < pExtents->x2); } bool REGION:: @@ -772,7 +789,7 @@ miIntersectO ( */ if (x1 < x2) { - assert(y1rects); pNextRect->x1 = x1; @@ -781,7 +798,7 @@ miIntersectO ( pNextRect->y2 = y2; pReg->numRects += 1; pNextRect++; - assert(pReg->numRects <= pReg->size); + wxASSERT_LEVEL_2(pReg->numRects <= pReg->size); } /* @@ -1362,11 +1379,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 +1392,7 @@ miUnionNonO ( pReg->numRects += 1; pNextRect++; - assert(pReg->numRects<=pReg->size); + wxASSERT_LEVEL_2(pReg->numRects<=pReg->size); r++; } return 0; /* lint */ @@ -1422,7 +1439,7 @@ miUnionO ( if (pNextRect[-1].x2 < r->x2) \ { \ pNextRect[-1].x2 = r->x2; \ - assert(pNextRect[-1].x1numRects += 1; \ pNextRect += 1; \ } \ - assert(pReg->numRects<=pReg->size);\ + wxASSERT_LEVEL_2(pReg->numRects<=pReg->size);\ r++; - assert (y1x1 < r2->x1) @@ -1563,11 +1580,11 @@ miSubtractNonO1 ( pNextRect = &pReg->rects[pReg->numRects]; - assert(y1x1x2); + wxASSERT_LEVEL_2(r->x1x2); MEMCHECK(pReg, pNextRect, pReg->rects); pNextRect->x1 = r->x1; pNextRect->y1 = y1; @@ -1576,7 +1593,7 @@ miSubtractNonO1 ( pReg->numRects += 1; pNextRect++; - assert(pReg->numRects <= pReg->size); + wxASSERT_LEVEL_2(pReg->numRects <= pReg->size); r++; } @@ -1613,7 +1630,7 @@ miSubtractO ( x1 = r1->x1; - assert(y1rects[pReg->numRects]; while ((r1 != r1End) && (r2 != r2End)) @@ -1656,7 +1673,7 @@ miSubtractO ( * Left part of subtrahend covers part of minuend: add uncovered * part of minuend to region and skip to next subtrahend. */ - assert(x1x1); + wxASSERT_LEVEL_2(x1x1); MEMCHECK(pReg, pNextRect, pReg->rects); pNextRect->x1 = x1; pNextRect->y1 = y1; @@ -1665,7 +1682,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 +1716,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 +1729,7 @@ miSubtractO ( */ while (r1 != r1End) { - assert(x1x2); + wxASSERT_LEVEL_2(x1x2); MEMCHECK(pReg, pNextRect, pReg->rects); pNextRect->x1 = x1; pNextRect->y1 = y1; @@ -1721,7 +1738,7 @@ miSubtractO ( pReg->numRects += 1; pNextRect++; - assert(pReg->numRects<=pReg->size); + wxASSERT_LEVEL_2(pReg->numRects<=pReg->size); r1++; if (r1 != r1End)