grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / graphics / freevportcoplists.c
blob15d3f4592eb93e2d954633d6da94adcdefc9757b
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function FreeVPortCopLists()
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <graphics/copper.h>
11 #include <graphics/view.h>
12 #include <hidd/graphics.h>
13 #include <proto/exec.h>
14 #include <proto/oop.h>
16 #include "graphics_intern.h"
17 #include "gfxfuncsupport.h"
19 /*****************************************************************************
21 NAME */
22 #include <proto/graphics.h>
24 AROS_LH1(void, FreeVPortCopLists,
26 /* SYNOPSIS */
27 AROS_LHA(struct ViewPort *, vp, A0),
29 /* LOCATION */
30 struct GfxBase *, GfxBase, 90, Graphics)
32 /* FUNCTION
33 Deallocate all memory associated with the CopList structures
34 for display, color, sprite and the user copper list. The
35 corresponding fields in this structure will be set to NULL.
37 INPUTS
38 vp - pointer to a ViewPort structure
40 RESULT
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
49 graphics/view.h
51 INTERNALS
53 HISTORY
55 *****************************************************************************/
57 AROS_LIBFUNC_INIT
59 struct ViewPortExtra *vpe;
61 vpe = (struct ViewPortExtra *)GfxLookUp(vp);
62 D(bug("[FreeVPortCopLists] ViewPort 0x%p, ViewPortExtra 0x%p\n", vp, vpe));
63 if (vpe)
65 /* Free the associated DriverData */
66 struct HIDD_ViewPortData *vpd = VPE_DATA(vpe);
68 if (vpd)
70 /* Do driver-specific cleanup */
71 HIDD_Gfx_CleanViewPort(VPE_DRIVER(vpe)->gfxhidd, vpd);
73 FreeMem(vpd, sizeof(struct HIDD_ViewPortData));
75 vpe->DriverData[0] = NULL;
78 if (vpe->Flags & VPXF_FREE_ME)
80 D(bug("[FreeVPortCopLists] Freeing temporary ViewPortExtra\n"));
81 GfxFree(&vpe->n);
85 AROS_LIBFUNC_EXIT
86 } /* FreeVPortCopLists */