2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function GetColorMap()
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 /*****************************************************************************
17 #include <proto/graphics.h>
19 AROS_LH1(void, FreeColorMap
,
22 AROS_LHA(struct ColorMap
*, colormap
, A0
),
25 struct GfxBase
*, GfxBase
, 96, Graphics
)
28 Correctly frees a ColorMap structure and associated structures
29 that have previously been allocated via GetColorMap().
32 colormap - pointer to the ColorMap structure previously
33 allocated via GetColorMap().
36 Memory returned to pool of free memory.
45 GetColorMap(), SetRGB4(), graphics/view.h
48 Also frees a possibly connected PaletteExtra and ViewPortExtra
49 structure. Possibly wrong, though.
53 *****************************************************************************/
57 /* if colormap != NULL return the memory */
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
));