Don't call InvertPixelArray with negative width and/or height.
[tangerine.git] / workbench / libs / muimaster / mui_addclipregion.c
blobfe780778e628d86023ceb23a88c272770d35b25b
1 /*
2 Copyright © 2002-2003, 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
50 AROS_LIBBASE_EXT_DECL(struct MUIMasterBase *,MUIMasterBase)
52 struct Window *w = mri->mri_Window;
53 struct Layer *l;
54 APTR result;
56 if (w != NULL)
57 l = w->WLayer;
58 else
59 l = mri->mri_RastPort->Layer;
61 // if (mri->mri_rCount == MRI_RARRAY_SIZE) kprintf(" --------- mui_addclipregion clip overflow ---------------------\n");
63 if ((l == NULL) || (r == NULL) || (mri->mri_rCount == MRI_RARRAY_SIZE))
65 if (r) DisposeRegion(r);
66 return (APTR)-1;
69 if (mri->mri_rCount != 0)
70 /* NOTE: ignoring the result here... */
71 AndRegionRegion(mri->mri_rArray[mri->mri_rCount-1], r);
73 if ((w != NULL) && (mri->mri_Flags & MUIMRI_REFRESHMODE))
75 LockLayerInfo(&w->WScreen->LayerInfo);
76 EndRefresh(w, FALSE);
79 #if 1 /* stegerg: what's this good for? */
80 if ((w != NULL) && !(w->Flags & WFLG_SIMPLE_REFRESH))
81 LockLayerInfo(&w->WScreen->LayerInfo);
82 #endif
84 result = InstallClipRegion(l, r);
86 #if 1 /* stegerg: what's this good for? */
87 if ((w != NULL) && !(w->Flags & WFLG_SIMPLE_REFRESH))
88 UnlockLayerInfo(&w->WScreen->LayerInfo);
89 #endif
91 if ((w != NULL) && (mri->mri_Flags & MUIMRI_REFRESHMODE))
93 BeginRefresh(w);
94 UnlockLayerInfo(&w->WScreen->LayerInfo);
97 mri->mri_rArray[mri->mri_rCount++] = r;
99 return result;
101 AROS_LIBFUNC_EXIT
103 } /* MUIA_AddClipRegion */