added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / workbench / libs / muimaster / mui_addclipping.c
blob9cc9be7b38548d339fd9bd931a94c8553918428c
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/muimaster.h>
10 #include "support.h"
12 #include "mui.h"
13 #include "muimaster_intern.h"
15 /*****************************************************************************
17 NAME */
18 AROS_LH5(APTR, MUI_AddClipping,
20 /* SYNOPSIS */
21 AROS_LHA(struct MUI_RenderInfo *, mri, A0),
22 AROS_LHA(WORD, left, D0),
23 AROS_LHA(WORD, top, D1),
24 AROS_LHA(WORD, width, D2),
25 AROS_LHA(WORD, height, D3),
27 /* LOCATION */
28 struct Library *, MUIMasterBase, 24, MUIMaster)
30 /* FUNCTION
32 INPUTS
34 RESULT
36 NOTES
38 EXAMPLE
40 BUGS
41 The function itself is a bug ;-) Remove it!
43 SEE ALSO
45 INTERNALS
47 HISTORY
49 *****************************************************************************/
51 AROS_LIBFUNC_INIT
53 struct Region *r;
54 struct Rectangle rect;
55 APTR handle;
57 if ((width >= MUI_MAXMAX) || (height >= MUI_MAXMAX))
58 return (APTR)-1;
60 if (mri->mri_rCount > 0)
62 if (isRegionWithinBounds(mri->mri_rArray[mri->mri_rCount-1], left, top, width, height))
63 return (APTR)-1;
66 if ((r = NewRegion()) == NULL)
67 return (APTR)-1;
69 rect.MinX = left;
70 rect.MinY = top;
71 rect.MaxX = left + width - 1;
72 rect.MaxY = top + height - 1;
73 OrRectRegion(r, &rect);
75 handle = MUI_AddClipRegion(mri, r);
77 #if 0 /* MUI_AddClipRegion frees region itself upon failure */
78 if (handle == (APTR)-1)
80 DisposeRegion(r);
82 #endif
83 return handle;
85 AROS_LIBFUNC_EXIT
87 } /* MUIA_AddClipping */