r4722@vps: verhaegs | 2007-05-06 13:11:19 -0400
[cake.git] / workbench / libs / muimaster / mui_addclipregion.c
blob8fd764262343b3e4b02013166e84ea4bb4d71768
1 /*
2 Copyright © 2002-2007, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/graphics.h>
7 #include <proto/layers.h>
8 #include <proto/intuition.h>
9 #include <proto/muimaster.h>
11 #include "mui.h"
12 #include "muimaster_intern.h"
14 #include "debug.h"
16 /*****************************************************************************
18 NAME */
19 AROS_LH2(APTR, MUI_AddClipRegion,
21 /* SYNOPSIS */
22 AROS_LHA(struct MUI_RenderInfo *, mri, A0),
23 AROS_LHA(struct Region *, r, A1),
25 /* LOCATION */
26 struct Library *, MUIMasterBase, 26, MUIMaster)
28 /* FUNCTION
30 INPUTS
32 RESULT
34 NOTES
36 EXAMPLE
38 BUGS
39 The function itself is a bug ;-) Remove it!
41 SEE ALSO
43 INTERNALS
45 HISTORY
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 struct Window *w = mri->mri_Window;
52 struct Layer *l;
53 APTR result;
55 if (w != NULL)
56 l = w->WLayer;
57 else
58 l = mri->mri_RastPort->Layer;
60 // if (mri->mri_rCount == MRI_RARRAY_SIZE) kprintf(" --------- mui_addclipregion clip overflow ---------------------\n");
62 if ((l == NULL) || (r == NULL) || (mri->mri_rCount == MRI_RARRAY_SIZE))
64 if (r) DisposeRegion(r);
65 return (APTR)-1;
68 if (mri->mri_rCount != 0)
69 /* NOTE: ignoring the result here... */
70 AndRegionRegion(mri->mri_rArray[mri->mri_rCount-1], r);
72 if ((w != NULL) && (mri->mri_Flags & MUIMRI_REFRESHMODE))
74 LockLayerInfo(&w->WScreen->LayerInfo);
75 EndRefresh(w, FALSE);
78 #if 1 /* stegerg: what's this good for? */
79 if ((w != NULL) && !(w->Flags & WFLG_SIMPLE_REFRESH))
80 LockLayerInfo(&w->WScreen->LayerInfo);
81 #endif
83 result = InstallClipRegion(l, r);
85 #if 1 /* stegerg: what's this good for? */
86 if ((w != NULL) && !(w->Flags & WFLG_SIMPLE_REFRESH))
87 UnlockLayerInfo(&w->WScreen->LayerInfo);
88 #endif
90 if ((w != NULL) && (mri->mri_Flags & MUIMRI_REFRESHMODE))
92 BeginRefresh(w);
93 UnlockLayerInfo(&w->WScreen->LayerInfo);
96 mri->mri_rArray[mri->mri_rCount++] = r;
98 return result;
100 AROS_LIBFUNC_EXIT
102 } /* MUIA_AddClipRegion */