grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / graphics / initmasks.c
blobdd369d427e31a246b66aa23750a001d7d52b8bb6
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function InitMasks()
6 Lang: english
7 */
8 #include <graphics/gels.h>
9 #include <graphics/rastport.h>
10 #include "graphics_intern.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/graphics.h>
17 AROS_LH1(void, InitMasks,
19 /* SYNOPSIS */
20 AROS_LHA(struct VSprite *, vs, A0),
22 /* LOCATION */
23 struct GfxBase *, GfxBase, 21, Graphics)
25 /* FUNCTION
26 Creates the standard BorderLine and CollMask masks of the VSprite.
27 VSprites and Bobs are treated accordingly.
29 INPUTS
30 vs = pointer to VSprite structure
32 RESULT
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 InitGels(), InitGMasks(), graphics/gels.h
43 INTERNALS
45 HISTORY
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 LONG depth, WordsPerPlane, WordsPerLine, count;
52 /* is this a Bob or a VSprite? */
53 if (0 != (vs -> Flags & VSPRITE))
55 /* assumption: vs -> Widtht = 16 (or 32 on a better chipset??)*/
56 WordsPerLine = vs -> Width >> 4; /* Width:16 */
57 depth = 2; /* standard */
59 else
61 WordsPerLine = vs -> Width;
62 depth = vs -> Depth;
64 WordsPerPlane = (vs -> Height) * WordsPerLine;
67 /* create the standard collision mask by or'ing all bitplanes */
68 for (count = 0; count < WordsPerPlane; count++)
70 WORD * PlaneData = vs -> ImageData;
71 WORD Data = PlaneData[count];
72 LONG z;
73 for (z = 1; z < depth; z++)
74 Data |= PlaneData[count + z*WordsPerPlane];
75 (vs -> CollMask)[count] = Data;
78 /* create the standard BorderLine from the collision mask by or'ing all
79 lines */
80 for (count = 0 ; count < WordsPerLine; count++)
82 WORD * CollMask = vs -> CollMask;
83 WORD Data = CollMask[count];
84 LONG z;
85 for (z = 1; z < vs-> Height; z++)
86 Data |= CollMask[count + z*WordsPerLine];
87 (vs -> BorderLine)[count] = Data;
90 AROS_LIBFUNC_EXIT
91 } /* InitMasks */