本文整理汇总了C++中DisposeRgn函数的典型用法代码示例。如果您正苦于以下问题:C++ DisposeRgn函数的具体用法?C++ DisposeRgn怎么用?C++ DisposeRgn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DisposeRgn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderspu_SystemWindowVisibleRegion
void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, const GLint* pRects)
{
CRASSERT(window);
CRASSERT(window->window);
/* Remember any additional clipping stuff e.g. seamless regions */
if (window->hVisibleRegion)
{
DisposeRgn(window->hVisibleRegion);
window->hVisibleRegion = 0;
}
if (cRects>0)
{
int i;
/* Create some temporary regions */
RgnHandle rgn = NewRgn();
SetEmptyRgn (rgn);
RgnHandle tmpRgn = NewRgn();
for (i=0; i<cRects; ++i)
{
SetRectRgn (tmpRgn,
pRects[4*i] , pRects[4*i+1],
pRects[4*i+2], pRects[4*i+3]);
//DEBUG_MSG_POETZSCH (("visible rect %d %d %d %d\n", pRects[4*i] , pRects[4*i+1],
// pRects[4*i+2], pRects[4*i+3]));
UnionRgn (rgn, tmpRgn, rgn);
}
DisposeRgn (tmpRgn);
window->hVisibleRegion = rgn;
}
renderspu_SystemWindowApplyVisibleRegion(window);
}
示例2: setWindowTrackingRgn
void setWindowTrackingRgn(int windowIndex) {
Rect rgnRect;
RgnHandle rgn = NewRgn();
MouseTrackingRegionID id;
windowDescriptorBlock *windowBlock = windowBlockFromIndex(windowIndex);
if (!windowBlock)
return;
if (windowBlock->windowTrackingRef) {
GetWindowBounds(windowBlock->handle, kWindowContentRgn, &rgnRect);
SetRectRgn( rgn, rgnRect.left, rgnRect.top, rgnRect.right, rgnRect.bottom );
ChangeMouseTrackingRegion(windowBlock->windowTrackingRef,rgn, NULL);
DisposeRgn( rgn );
return;
}
GetWindowBounds(windowBlock->handle, kWindowContentRgn, &rgnRect);
SetRectRgn( rgn, rgnRect.left, rgnRect.top, rgnRect.right, rgnRect.bottom );
id.signature = 'FAST';
id.id = windowIndex;
OSStatus err = CreateMouseTrackingRegion(windowBlock->handle, rgn, NULL, kMouseTrackingOptionsGlobalClip,
id, NULL, NULL, &windowBlock->windowTrackingRef);
if ( noErr == err ) {
RetainMouseTrackingRegion( windowBlock->windowTrackingRef);
err = SetMouseTrackingRegionEnabled( windowBlock->windowTrackingRef, TRUE );
}
DisposeRgn( rgn );
}
示例3: TkRectInRegion
int
TkRectInRegion(
TkRegion region,
int x,
int y,
unsigned int width,
unsigned int height)
{
RgnHandle rgn = (RgnHandle) region;
RgnHandle rectRgn, destRgn;
int result;
rectRgn = NewRgn();
destRgn = NewRgn();
SetRectRgn(rectRgn, x, y, x + width, y + height);
SectRgn(rgn, rectRgn, destRgn);
if (EmptyRgn(destRgn)) {
result = RectangleOut;
} else if (EqualRgn(rgn, destRgn)) {
result = RectangleIn;
} else {
result = RectanglePart;
}
DisposeRgn(rectRgn);
DisposeRgn(destRgn);
return result;
}
示例4: renderspu_SystemSetRootVisibleRegion
static void renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *pRects)
{
/* Remember the visible region of the root window if there is one */
if (render_spu.hRootVisibleRegion)
{
DisposeRgn(render_spu.hRootVisibleRegion);
render_spu.hRootVisibleRegion = 0;
}
if (cRects>0)
{
int i;
render_spu.hRootVisibleRegion = NewRgn();
SetEmptyRgn (render_spu.hRootVisibleRegion);
RgnHandle tmpRgn = NewRgn();
for (i=0; i<cRects; ++i)
{
SetRectRgn (tmpRgn,
pRects[4*i] , pRects[4*i+1],
pRects[4*i+2], pRects[4*i+3]);
UnionRgn (render_spu.hRootVisibleRegion, tmpRgn, render_spu.hRootVisibleRegion);
}
DisposeRgn (tmpRgn);
}
}
示例5: wxASSERT
/* restores former dialog size and (on Mac) position */
bool CDlgItemProperties::RestoreState() {
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
int iWidth, iHeight;
wxASSERT(pConfig);
if (!pConfig) return false;
pConfig->SetPath(m_strBaseConfigLocation);
pConfig->Read(wxT("Width"), &iWidth, wxDefaultCoord);
pConfig->Read(wxT("Height"), &iHeight, wxDefaultCoord);
#ifndef __WXMAC__
// Set size to saved values or defaults if no saved values
SetSize(iWidth, iHeight);
#else
int iTop, iLeft;
pConfig->Read(wxT("YPos"), &iTop, wxDefaultCoord);
pConfig->Read(wxT("XPos"), &iLeft, wxDefaultCoord);
// If either co-ordinate is less then 0 then set it equal to 0 to ensure
// it displays on the screen.
if ((iLeft < 0) && (iLeft != wxDefaultCoord)) iLeft = 30;
if ((iTop < 0) && (iTop != wxDefaultCoord)) iTop = 30;
// Set size and position to saved values or defaults if no saved values
SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING);
// Now make sure window is on screen
GetScreenPosition(&iLeft, &iTop);
GetSize(&iWidth, &iHeight);
Rect titleRect = {iTop, iLeft, iTop+22, iLeft+iWidth };
InsetRect(&titleRect, 5, 5); // Make sure at least a 5X5 piece visible
RgnHandle displayRgn = NewRgn();
CopyRgn(GetGrayRgn(), displayRgn); // Region encompassing all displays
Rect menuRect = ((**GetMainDevice())).gdRect;
menuRect.bottom = GetMBarHeight() + menuRect.top;
RgnHandle menuRgn = NewRgn();
RectRgn(menuRgn, &menuRect); // Region hidden by menu bar
DiffRgn(displayRgn, menuRgn, displayRgn); // Subtract menu bar region
if (!RectInRgn(&titleRect, displayRgn)) {
iTop = iLeft = 30;
SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING);
}
DisposeRgn(menuRgn);
DisposeRgn(displayRgn);
#endif
return true;
}
示例6: wxString
void CDlgMessages::RestoreWindowDimensions() {
wxString strBaseConfigLocation = wxString(wxT("/Simple/Messages"));
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
bool bWindowIconized = false;
bool bWindowMaximized = false;
int iHeight = 0;
int iWidth = 0;
int iTop = 0;
int iLeft = 0;
wxASSERT(pConfig);
pConfig->SetPath(strBaseConfigLocation);
pConfig->Read(wxT("YPos"), &iTop, 30);
pConfig->Read(wxT("XPos"), &iLeft, 30);
pConfig->Read(wxT("Width"), &iWidth, 640);
pConfig->Read(wxT("Height"), &iHeight, 480);
pConfig->Read(wxT("WindowIconized"), &bWindowIconized, false);
pConfig->Read(wxT("WindowMaximized"), &bWindowMaximized, false);
#ifndef __WXMAC__
Iconize(bWindowIconized);
Maximize(bWindowMaximized);
if (!IsIconized() && !IsMaximized()) {
SetSize(-1, -1, iWidth, iHeight);
}
#else // ! __WXMAC__
// If the user has changed the arrangement of multiple
// displays, make sure the window title bar is still on-screen.
Rect titleRect = {iTop, iLeft, iTop+22, iLeft+iWidth };
InsetRect(&titleRect, 5, 5); // Make sure at least a 5X5 piece visible
RgnHandle displayRgn = NewRgn();
CopyRgn(GetGrayRgn(), displayRgn); // Region encompassing all displays
Rect menuRect = ((**GetMainDevice())).gdRect;
menuRect.bottom = GetMBarHeight() + menuRect.top;
RgnHandle menuRgn = NewRgn();
RectRgn(menuRgn, &menuRect); // Region hidden by menu bar
DiffRgn(displayRgn, menuRgn, displayRgn); // Subtract menu bar retion
if (!RectInRgn(&titleRect, displayRgn))
iTop = iLeft = 30;
DisposeRgn(menuRgn);
DisposeRgn(displayRgn);
SetSize(iLeft, iTop, iWidth, iHeight);
#endif // ! __WXMAC__
}
示例7: GetPort
void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackground )
{
GrafPtr formerPort ;
GetPort( &formerPort ) ;
SetPortWindowPort( (WindowRef)m_macWindow ) ;
m_macNeedsErasing |= eraseBackground ;
// if we already know that we will have to erase, there's no need to track the rest
if ( !m_macNeedsErasing)
{
// we end only here if eraseBackground is false
// if we already have a difference between m_macNoEraseUpdateRgn and UpdateRgn
// we will have to erase anyway
RgnHandle updateRgn = NewRgn();
RgnHandle diffRgn = NewRgn() ;
if ( updateRgn && diffRgn )
{
GetWindowUpdateRgn( (WindowRef)m_macWindow , updateRgn );
Point pt = {0,0} ;
LocalToGlobal( &pt ) ;
OffsetRgn( updateRgn , -pt.h , -pt.v ) ;
DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ;
if ( !EmptyRgn( diffRgn ) )
{
m_macNeedsErasing = true ;
}
}
if ( updateRgn )
DisposeRgn( updateRgn );
if ( diffRgn )
DisposeRgn( diffRgn );
if ( !m_macNeedsErasing )
{
RgnHandle rectRgn = NewRgn() ;
SetRectRgn( rectRgn , ((Rect*)rect)->left , ((Rect*)rect)->top , ((Rect*)rect)->right , ((Rect*)rect)->bottom ) ;
UnionRgn( (RgnHandle) m_macNoEraseUpdateRgn , rectRgn , (RgnHandle) m_macNoEraseUpdateRgn ) ;
DisposeRgn( rectRgn ) ;
}
}
InvalWindowRect( (WindowRef)m_macWindow , (Rect*)rect ) ;
// turn this on to debug the refreshing cycle
#if wxMAC_DEBUG_REDRAW
PaintRect( rect ) ;
#endif
SetPort( formerPort ) ;
}
示例8: HandleDrawContent
// --------------------------------------------------------------------------------------
void HandleDrawContent(WindowRef prefsWindow)
{
RgnHandle visibleRegion;
ListHandle iconList;
GetWindowProperty(prefsWindow, kAppSignature, kIconListTag, sizeof(ListHandle), NULL,
&iconList);
visibleRegion = NewRgn();
GetPortVisibleRegion(GetWindowPort(prefsWindow), visibleRegion);
if (visibleRegion != NULL)
{
Boolean active = IsWindowHilited(prefsWindow);
SInt16 pixelDepth;
Boolean isColorDevice;
if (active)
SetThemeWindowBackground(prefsWindow, kThemeBrushModelessDialogBackgroundActive,
false);
else
SetThemeWindowBackground(prefsWindow,
kThemeBrushModelessDialogBackgroundInactive, false);
EraseRgn(visibleRegion);
UpdateControls(prefsWindow, visibleRegion);
GetWindowDeviceDepthAndColor(prefsWindow, &pixelDepth, &isColorDevice);
SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice);
LUpdate(visibleRegion, iconList);
drawFrameAndFocus(iconList, active, prefsWindow);
DisposeRgn(visibleRegion);
}
}
示例9: handleMenuSelection
void handleMenuSelection(long result)
{
int menuID, menuItem;
RgnHandle rgnHandle = NewRgn();
menuID = HiWord(result);
menuItem = LoWord(result);
if (menuID == FILE_MENU) {
if (menuItem == FILE_SAVE)
saveToPICTFile();
else if (menuItem == FILE_QUIT)
gDone = true;
else if (menuItem == FILE_CLOSE) {
DisposeWindow(FrontWindow());
if (FrontWindow() == NULL)
gDone = true;
}
else if (menuItem == FILE_NEW) {
}
else if (menuItem == FILE_REFRESH) {
createImage();
drawImage(FrontWindow());
QDFlushPortBuffer(GetWindowPort(FrontWindow()), GetPortVisibleRegion(GetWindowPort(FrontWindow()), rgnHandle));
}
}
HiliteMenu(0);
DisposeRgn(rgnHandle);
}
示例10: shellupdatenow
boolean shellupdatenow (WindowPtr wupdate) {
/*
can be called from within one of the callbacks to force an update
to happen immediately, without waiting for the OS to generate an
update event.
dmb 8/14/90: can't we just call the normal update routine? this
should be fine from the toolbox's point of view, but will not limit
the update to contentrect.
*/
#ifdef MACVERSION
hdlregion rgn;
rgn = getupdateregion (wupdate);
if (!EmptyRgn (rgn))
shellupdatewindow (wupdate);
#if ACCESSOR_CALLS_ARE_FUNCTIONS == 1
//Code change by Timothy Paustian Thursday, May 18, 2000 10:24:57 PM
//Changed because calling getupdateregion returns a copy of the region
//we have to dispose of it to prevent a memory leak
DisposeRgn(rgn);
#endif
#endif
#ifdef WIN95VERSION
releasethreadglobals ();
UpdateWindow ((HWND) wupdate);
grabthreadglobals ();
#endif
return (true);
} /*shellupdatenow*/
示例11: TkDestroyRegion
void
TkDestroyRegion(
TkRegion r)
{
RgnHandle rgn = (RgnHandle) r;
DisposeRgn(rgn);
}
示例12: wxCHECK_MSG
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
{
wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE,
_T("Shaped windows must be created with the wxFRAME_SHAPED style."));
#if TARGET_CARBON
// The empty region signifies that the shape should be removed from the
// window.
if ( region.IsEmpty() )
{
wxSize sz = GetClientSize();
wxRegion rgn(0, 0, sz.x, sz.y);
return SetShape(rgn);
}
// Make a copy of the region
RgnHandle shapeRegion = NewRgn();
CopyRgn( (RgnHandle)region.GetWXHRGN(), shapeRegion );
// Dispose of any shape region we may already have
RgnHandle oldRgn = (RgnHandle)GetWRefCon( (WindowRef)MacGetWindowRef() );
if ( oldRgn )
DisposeRgn(oldRgn);
// Save the region so we can use it later
SetWRefCon((WindowRef)MacGetWindowRef(), (SInt32)shapeRegion);
// Tell the window manager that the window has changed shape
ReshapeCustomWindow((WindowRef)MacGetWindowRef());
return TRUE;
#else
return FALSE;
#endif
}
示例13: QTCode_ForceMovieRedraw
void QTCode_ForceMovieRedraw(Movie theMovie)
{
OSErr err = noErr;
Rect movieRect;
RgnHandle clipRegion = NULL;
if (theMovie == NULL) goto bail;
clipRegion = NewRgn();
if (clipRegion == NULL) goto bail;
GetClip(clipRegion);
GetMovieBox(theMovie, &movieRect);
ClipRect(&movieRect);
UpdateMovie(theMovie);
MoviesTask(theMovie, 0);
SetClip(clipRegion);
/* Closure. Clean up if we have handles. */
bail:
if (clipRegion != NULL)
{
DisposeRgn(clipRegion);
}
}
示例14: wxMacSetupControlBackground
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
{
OSStatus status = noErr ;
switch( iMessage )
{
case kControlMsgSetUpBackground :
{
wxControl* wx = (wxControl*) GetControlReference( iControl ) ;
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
{
wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
#if TARGET_CARBON
// under classic this would lead to partial redraws
RgnHandle clip = NewRgn() ;
int x = 0 , y = 0;
wx->MacWindowToRootWindow( &x,&y ) ;
CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
OffsetRgn( clip , x , y ) ;
SetClip( clip ) ;
DisposeRgn( clip ) ;
#endif
}
else
{
status = paramErr ;
}
}
break ;
default :
status = paramErr ;
break ;
}
return status ;
}
示例15: LCD_resize
void LCD_resize(Lcd *x)
{
Rect r;
short hor,ver;
#ifdef debug
post("LCD_Resize");
#endif
r = x->lcd_box.b_rect;
hor = x->cols = FixRound(FixRatio(((r.right-r.left-(2*BORDER_WIDTH))),x->f_width));
ver = x->rows = FixRound(FixRatio(((r.bottom-r.top-(2*BORDER_HEIGHT))),x->f_height));
#ifdef FORCEDResize
x->lcd_box.b_rect.right = r.left + (2*BORDER_WIDTH) + hor*x->f_width;
x->lcd_box.b_rect.bottom = r.top + (2*BORDER_HEIGHT) + ver*x->f_height;
#endif
if (x->lcd_region)
DisposeRgn(x->lcd_region);
x->lcd_oldRect = r = x->lcd_box.b_rect;
InsetRect(&r,1,1);
x->lcd_region = NewRgn();
RectRgn(x->lcd_region,&r); /* DDZ simpler way to make a rectangular region */
}