compiler/pthread: port latest version
[AROS.git] / rom / graphics / bltclear.c
blob4b67e778d7d3ad45e63611a8d19f1b58fd72a0f5
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function BltClear()
6 Lang: english
7 */
8 #include "graphics_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/graphics.h>
15 AROS_LH3(void, BltClear,
17 /* SYNOPSIS */
18 AROS_LHA(void *, memBlock, A1),
19 AROS_LHA(ULONG , bytecount, D0),
20 AROS_LHA(ULONG , flags, D1),
22 /* LOCATION */
23 struct GfxBase *, GfxBase, 50, Graphics)
25 /* FUNCTION
26 Use the blitter for clearing a block of Chip-Ram.
28 INPUTS
29 memBlock - pointer to beginning of memory to be cleared
30 flags - set bit 0 to force function to wait until
31 the blitter - if used - is done
32 set bit 1 for row/bytesperrow - mode
33 bytecount - if bit 1 is set to 1: bytecount contains an even number
34 of bytes to clear
35 if bit 1 is set to 0: low 16 bits are taken as number of
36 bytes per row and upper 16 bits
37 are taken as number of rows.
39 RESULT
40 A cleared block of Chip-Ram.
42 NOTES
43 THIS FUNCTION IS DEPRECATED except if you want to simply clear
44 some memory.
46 EXAMPLE
48 BUGS
50 SEE ALSO
51 InitGels(), Animate(), graphics/rastport.h, graphics/gels.h
53 INTERNALS
55 HISTORY
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 ULONG count, end;
63 if (0 != (flags & 2) )
64 /* use row/bytesperrow */
65 bytecount = (bytecount & 0xFFFF) * (bytecount >> 16);
67 /* we have an even number of BYTES to clear here */
68 /* but use LONGS for clearing the block */
69 count = 0;
70 end = bytecount >> 2;
71 while(count < end)
72 ((ULONG *)memBlock)[count++] = 0;
73 /* see whether we had an odd number of WORDS */
74 if (0 != (bytecount & 2))
75 ((UWORD *)memBlock)[(count * 2)] = 0;
77 AROS_LIBFUNC_EXIT
78 } /* BltClear */