Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / libs / muimaster / mui_removeclipregion.c
blobb7d397d5215c457aacbcf126b3cc5153847a7221
1 /*
2 Copyright © 2002-2007, The AROS Development Team.
3 All rights reserved.
5 $Id$
6 */
8 #include <proto/layers.h>
9 #include <proto/intuition.h>
10 #include <proto/graphics.h>
11 #include <proto/muimaster.h>
13 #include "mui.h"
14 #include "muimaster_intern.h"
16 /*****************************************************************************
18 NAME */
19 AROS_LH2(VOID, MUI_RemoveClipRegion,
21 /* SYNOPSIS */
22 AROS_LHA(struct MUI_RenderInfo *, mri, A0),
23 AROS_LHA(APTR, handle, A1),
25 /* LOCATION */
26 struct Library *, MUIMasterBase, 27, MUIMaster)
28 /* FUNCTION
30 INPUTS
32 RESULT
34 NOTES
36 sba: This function frees the region given in MUI_AddClipRegion, but this seems wrong to me.
37 MUI_AddClipRegion should better duplicate the region.
39 EXAMPLE
41 BUGS
43 SEE ALSO
45 INTERNALS
47 HISTORY
49 *****************************************************************************/
51 AROS_LIBFUNC_INIT
53 struct Window *w = mri->mri_Window;
54 struct Layer *l;
56 if (handle == (APTR)-1)
57 return;
59 if (w != NULL)
60 l = w->WLayer;
61 else
62 l = mri->mri_RastPort->Layer;
64 if (l == NULL)
65 return;
67 mri->mri_rCount--;
69 if ((w != NULL) && (mri->mri_Flags & MUIMRI_REFRESHMODE))
71 LockLayerInfo(&w->WScreen->LayerInfo);
72 EndRefresh(w, FALSE);
75 #if 1 /* stegerg: what's this good for */
76 if ((w != NULL) && !(w->Flags & WFLG_SIMPLE_REFRESH))
77 LockLayerInfo(&w->WScreen->LayerInfo);
78 #endif
80 InstallClipRegion(l, (mri->mri_rCount > 0)
81 ? mri->mri_rArray[mri->mri_rCount-1] : NULL);
83 #if 1 /* stegerg: what's this good for */
84 if ((w != NULL) && !(w->Flags & WFLG_SIMPLE_REFRESH))
85 UnlockLayerInfo(&w->WScreen->LayerInfo);
86 #endif
88 if ((w != NULL) && (mri->mri_Flags & MUIMRI_REFRESHMODE))
90 BeginRefresh(w);
91 UnlockLayerInfo(&w->WScreen->LayerInfo);
94 DisposeRegion(mri->mri_rArray[mri->mri_rCount]);
95 mri->mri_rArray[mri->mri_rCount] = NULL;
97 AROS_LIBFUNC_EXIT
99 } /* MUIA_RemoveClipRegion */