update the nightly configuration for x68_64 target to the newest toolchain. (NicJA)
[AROS.git] / rom / graphics / areamove.c
blobf2c7a899b4c77e863216b5b269c9c4fe8db56f30
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function AreaMove()
6 Lang: english
7 */
8 #include <exec/types.h>
9 #include <graphics/rastport.h>
10 #include "graphics_intern.h"
11 #include "gfxfuncsupport.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/graphics.h>
18 AROS_LH3(ULONG, AreaMove,
20 /* SYNOPSIS */
21 AROS_LHA(struct RastPort *, rp, A1),
22 AROS_LHA(WORD , x , D0),
23 AROS_LHA(WORD , y , D1),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 42, Graphics)
28 /* FUNCTION
29 Define a new starting point in the vector list for the following
30 polygon defined by calls to AreaDraw(). The last polygon is closed
31 if it wasn't closed by the user and the new starting points are
32 added to the vector collection matrix.
34 INPUTS
35 rp - pointer to a valid RastPort structure with a pointer to
36 the previously initialized AreaInfo structure.
37 x - x-coordinate of the starting-point in the raster
38 y - y-coordinate of the starting-point in the raster
40 RESULT
41 error - 0 for success
42 -1 if the vector collection matrix is full
44 NOTES
46 EXAMPLE
48 BUGS
50 SEE ALSO
51 InitArea(), AreaDraw(), AreaEllipse(), AreaCircle()
52 graphics/rastport.h
54 INTERNALS
56 HISTORY
58 *****************************************************************************/
60 AROS_LIBFUNC_INIT
62 struct AreaInfo * areainfo = rp->AreaInfo;
64 /* Is there still enough storage area in the areainfo-buffer?
65 * We just need room for one entry.
68 if (areainfo->Count + 1 <= areainfo->MaxCount)
70 FIX_GFXCOORD(x);
71 FIX_GFXCOORD(y);
73 /* is this the very first entry in the vector collection matrix */
74 if (0 == areainfo->Count)
76 areainfo->FirstX = x;
77 areainfo->FirstY = y;
79 /* Insert the new point into the matrix */
80 areainfo->VctrPtr[0] = x;
81 areainfo->VctrPtr[1] = y;
82 areainfo->VctrPtr = &areainfo->VctrPtr[2];
84 areainfo->FlagPtr[0] = AREAINFOFLAG_MOVE;
85 areainfo->FlagPtr++;
87 areainfo->Count++;
89 else
91 /* if the previous command was also an AreaMove() then we will replace
92 * that one ...
94 if ( AREAINFOFLAG_MOVE == areainfo->FlagPtr[-1])
96 areainfo->FirstX = x;
97 areainfo->FirstY = y;
99 /* replace the previous point */
100 areainfo->VctrPtr[-2] = x;
101 areainfo->VctrPtr[-1] = y;
103 else /* it's not the first command and the previous command wasn't AreaMove() */
105 /* ... otherwise close the polygon if necessary */
107 areaclosepolygon(areainfo);
109 /* Need to check again, if there is enough room, because
110 areaclosepolygon might have eaten one vector!! */
112 if (areainfo->Count + 1 > areainfo->MaxCount)
113 return -1;
115 areainfo->FirstX = x;
116 areainfo->FirstY = y;
118 /* Insert the new point into the matrix */
119 areainfo->VctrPtr[0] = x;
120 areainfo->VctrPtr[1] = y;
121 areainfo->VctrPtr = &areainfo->VctrPtr[2];
123 areainfo->FlagPtr[0] = AREAINFOFLAG_MOVE;
124 areainfo->FlagPtr++;
126 areainfo->Count++;
129 } /* if (0 == areainfo->Count) */
131 } /* if (areainfo->Count + 1 <= areainfo->MaxCount) */
132 else
133 return -1;
135 return 0;
137 AROS_LIBFUNC_EXIT
139 } /* AreaMove */