revert - libatomic is still needed for target code.
[AROS.git] / rom / graphics / freecolormap.c
blobe5e3d68c402045c68307d5d5cdeabed37b961edf
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function GetColorMap()
6 Lang: english
7 */
8 #include "exec/memory.h"
9 #include "exec/types.h"
10 #include "proto/exec.h"
11 #include "graphics/view.h"
12 #include "graphics_intern.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/graphics.h>
19 AROS_LH1(void, FreeColorMap,
21 /* SYNOPSIS */
22 AROS_LHA(struct ColorMap *, colormap, A0),
24 /* LOCATION */
25 struct GfxBase *, GfxBase, 96, Graphics)
27 /* FUNCTION
28 Correctly frees a ColorMap structure and associated structures
29 that have previously been allocated via GetColorMap().
31 INPUTS
32 colormap - pointer to the ColorMap structure previously
33 allocated via GetColorMap().
35 RESULT
36 Memory returned to pool of free memory.
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
45 GetColorMap(), SetRGB4(), graphics/view.h
47 INTERNALS
48 Also frees a possibly connected PaletteExtra and ViewPortExtra
49 structure. Possibly wrong, though.
51 HISTORY
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 /* if colormap != NULL return the memory */
58 if (NULL != colormap)
60 /* free the ColorTable */
61 FreeMem(colormap->ColorTable , (colormap->Count) * sizeof(UWORD));
63 /* free the LowColorBits */
64 FreeMem(colormap->LowColorBits, (colormap->Count) * sizeof(UWORD));
66 /* free a ViewPortExtra structure that might be connected to this one */
67 if (NULL != colormap->cm_vpe)
68 GfxFree((struct ExtendedNode *)colormap->cm_vpe);
70 /* free a PaletteExtra structure that might be connected to this */
71 if (NULL != colormap->PalExtra)
73 FreeMem(colormap->PalExtra->pe_RefCnt , colormap->Count * sizeof(PalExtra_RefCnt_Type));
74 FreeMem(colormap->PalExtra->pe_AllocList, colormap->Count * sizeof(PalExtra_AllocList_Type));
75 FreeMem(colormap->PalExtra, sizeof(struct PaletteExtra));
77 /* free the structure itself */
78 FreeMem(colormap, sizeof(struct ColorMap));
81 AROS_LIBFUNC_EXIT
83 } /* FreeColorMap */