Fixed (?) problem in region handling which caused major redraw problems.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40497 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -170,10 +170,9 @@ public:
|
||||
// Tests
|
||||
// Does the region contain the point (x,y)?
|
||||
//
|
||||
wxRegionContain Contains( wxCoord lX
|
||||
,wxCoord lY
|
||||
) const;
|
||||
|
||||
inline wxRegionContain Contains( wxCoord lX, wxCoord lY ) const{
|
||||
return Contains( wxPoint( lX, lY ) );
|
||||
}
|
||||
//
|
||||
// Convert the region to a B&W bitmap with the black pixels being inside
|
||||
// the region.
|
||||
@@ -206,7 +205,10 @@ public:
|
||||
//
|
||||
// Does the region contain the rectangle rect?
|
||||
//
|
||||
wxRegionContain Contains(const wxRect& rRect) const;
|
||||
inline wxRegionContain Contains(const wxRect& rRect) const{
|
||||
return Contains( rRect.x, rRect.y,
|
||||
rRect.GetWidth(), rRect.GetHeight());
|
||||
}
|
||||
|
||||
//
|
||||
// Internal
|
||||
|
@@ -5,7 +5,7 @@
|
||||
// Modified by:
|
||||
// Created: 10/15/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Davdi Webster
|
||||
// Copyright: (c) David Webster
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -86,6 +86,13 @@ public:
|
||||
// wxRegion
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// General remark:
|
||||
// wxRegion is always basically stored in wx coordinates. However, since
|
||||
// OS/2's internal functions rely on "top > bottom", the values of top and
|
||||
// bottom values of a region need to be interchanged, as compared to wx.
|
||||
// This needs to be taken into account when feeding any rectangle to wx _or_
|
||||
// when accessing the region data via GetBox, wxRegionIterator or otherwise.
|
||||
|
||||
/*!
|
||||
* Create an empty region.
|
||||
*/
|
||||
@@ -162,8 +169,8 @@ wxRegion::wxRegion(
|
||||
|
||||
vRect.xLeft = rTopLeft.x;
|
||||
vRect.xRight = rBottomRight.x;
|
||||
vRect.yBottom = rBottomRight.y;
|
||||
vRect.yTop = rTopLeft.y;
|
||||
vRect.yBottom = rTopLeft.y;
|
||||
vRect.yTop = rBottomRight.y;
|
||||
|
||||
m_refData = new wxRegionRefData;
|
||||
|
||||
@@ -428,47 +435,20 @@ bool wxRegion::Empty() const
|
||||
//-----------------------------------------------------------------------------
|
||||
// Tests
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Does the region contain the point (x,y)?
|
||||
wxRegionContain wxRegion::Contains(
|
||||
wxCoord x
|
||||
, wxCoord y
|
||||
) const
|
||||
{
|
||||
POINTL vPoint;
|
||||
|
||||
vPoint.x = x;
|
||||
vPoint.y = y;
|
||||
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
LONG lInside = ::GpiPtInRegion( ((wxRegionRefData*)m_refData)->m_hPS
|
||||
,M_REGION
|
||||
,&vPoint
|
||||
);
|
||||
if (lInside == PRGN_INSIDE)
|
||||
return wxInRegion;
|
||||
return wxOutRegion;
|
||||
} // end of wxRegion::Contains
|
||||
|
||||
//
|
||||
// Does the region contain the point pt?
|
||||
//
|
||||
wxRegionContain wxRegion::Contains(
|
||||
const wxPoint& rPoint
|
||||
) const
|
||||
wxRegionContain wxRegion::Contains( const wxPoint& rPoint ) const
|
||||
{
|
||||
POINTL vPoint = { rPoint.x, rPoint.y };
|
||||
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
LONG lInside = ::GpiPtInRegion( ((wxRegionRefData*)m_refData)->m_hPS
|
||||
,M_REGION
|
||||
,&vPoint
|
||||
);
|
||||
LONG lInside = ::GpiPtInRegion( ((wxRegionRefData*)m_refData)->m_hPS,
|
||||
M_REGION,
|
||||
&vPoint
|
||||
);
|
||||
if (lInside == PRGN_INSIDE)
|
||||
return wxInRegion;
|
||||
else
|
||||
@@ -478,56 +458,31 @@ wxRegionContain wxRegion::Contains(
|
||||
//
|
||||
// Does the region contain the rectangle (x, y, w, h)?
|
||||
//
|
||||
wxRegionContain wxRegion::Contains(
|
||||
wxCoord x
|
||||
, wxCoord y
|
||||
, wxCoord vWidth
|
||||
, wxCoord vHeight
|
||||
) const
|
||||
wxRegionContain wxRegion::Contains( wxCoord x,
|
||||
wxCoord y,
|
||||
wxCoord vWidth,
|
||||
wxCoord vHeight ) const
|
||||
{
|
||||
RECTL vRect;
|
||||
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
RECTL vRect;
|
||||
vRect.xLeft = x;
|
||||
vRect.yTop = y;
|
||||
vRect.xRight = x + vWidth;
|
||||
vRect.yBottom = y + vHeight;
|
||||
vRect.yTop = y + vHeight;
|
||||
vRect.yBottom = y;
|
||||
|
||||
if (PRGN_INSIDE == ::GpiRectInRegion( ((wxRegionRefData*)m_refData)->m_hPS
|
||||
,M_REGION
|
||||
,&vRect
|
||||
))
|
||||
return wxInRegion;
|
||||
else
|
||||
return wxOutRegion;
|
||||
} // end of wxRegion::Contains
|
||||
|
||||
//
|
||||
// Does the region contain the rectangle rect
|
||||
//
|
||||
wxRegionContain wxRegion::Contains(
|
||||
const wxRect& rRect
|
||||
) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
wxCoord x;
|
||||
wxCoord y;
|
||||
wxCoord vWidth;
|
||||
wxCoord vHeight;
|
||||
|
||||
x = rRect.x;
|
||||
y = rRect.y;
|
||||
vWidth = rRect.GetWidth();
|
||||
vHeight = rRect.GetHeight();
|
||||
return Contains( x
|
||||
,y
|
||||
,vWidth
|
||||
,vHeight
|
||||
);
|
||||
LONG lInside = ::GpiRectInRegion( ((wxRegionRefData*)m_refData)->m_hPS,
|
||||
M_REGION,
|
||||
&vRect
|
||||
);
|
||||
switch (lInside)
|
||||
{
|
||||
case RRGN_INSIDE : return wxInRegion;
|
||||
case RRGN_PARTIAL : return wxPartRegion;
|
||||
case RRGN_ERROR :
|
||||
default : return wxOutRegion;
|
||||
}
|
||||
} // end of wxRegion::Contains
|
||||
|
||||
//
|
||||
|
@@ -2641,6 +2641,7 @@ MRESULT wxWindowOS2::OS2WindowProc( WXUINT uMsg,
|
||||
}
|
||||
break;
|
||||
|
||||
case CBN_LBSELECT:
|
||||
case BN_CLICKED: // Dups as LN_SELECT and CBN_LBSELECT
|
||||
{
|
||||
HWND hWnd = ::WinWindowFromID((HWND)GetHwnd(), SHORT1FROMMP(wParam));
|
||||
@@ -2697,11 +2698,19 @@ MRESULT wxWindowOS2::OS2WindowProc( WXUINT uMsg,
|
||||
,(WXWORD)SHORT1FROMMP(wParam)
|
||||
);
|
||||
}
|
||||
if (pWin->IsKindOf(CLASSINFO(wxChoice)))
|
||||
{
|
||||
wxChoice* pChoice = wxDynamicCast(pWin, wxChoice);
|
||||
|
||||
pChoice->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
|
||||
,(WXWORD)SHORT1FROMMP(wParam)
|
||||
);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
// break;
|
||||
|
||||
case LN_ENTER: /* dups as CBN_EFCHANGE */
|
||||
case LN_ENTER:
|
||||
{
|
||||
HWND hWnd = HWNDFROMMP(lParam);
|
||||
wxWindowOS2* pWin = wxFindWinFromHandle(hWnd);
|
||||
@@ -3568,15 +3577,10 @@ bool wxWindowOS2::HandlePaint()
|
||||
wxLogLastError(wxT("CreateRectRgn"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get all the rectangles from the region, convert the individual
|
||||
// rectangles to "the other" coordinate system and reassemble a
|
||||
// region from the rectangles, to be feed into m_updateRegion.
|
||||
//
|
||||
// FIXME: This is a bad hack since OS/2 API specifies that rectangles
|
||||
// passed into GpiSetRegion must not have Bottom > Top,
|
||||
// however, at first sight, it _seems_ to work nonetheless.
|
||||
//
|
||||
RGNRECT vRgnData;
|
||||
PRECTL pUpdateRects = NULL;
|
||||
vRgnData.ulDirection = RECTDIR_LFRT_TOPBOT;
|
||||
@@ -3606,14 +3610,13 @@ bool wxWindowOS2::HandlePaint()
|
||||
{
|
||||
int rectHeight;
|
||||
rectHeight = pUpdateRects[i].yTop - pUpdateRects[i].yBottom;
|
||||
pUpdateRects[i].yTop = height - pUpdateRects[i].yTop;
|
||||
pUpdateRects[i].yBottom = pUpdateRects[i].yTop + rectHeight;
|
||||
pUpdateRects[i].yBottom = height - pUpdateRects[i].yTop;
|
||||
pUpdateRects[i].yTop = pUpdateRects[i].yBottom + rectHeight;
|
||||
}
|
||||
::GpiSetRegion(hPS, hRgn, vRgnData.crc, pUpdateRects);
|
||||
delete [] pUpdateRects;
|
||||
}
|
||||
}
|
||||
|
||||
m_updateRegion = wxRegion(hRgn, hPS);
|
||||
|
||||
vEvent.SetEventObject(this);
|
||||
|
Reference in New Issue
Block a user