2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <exec/types.h>
11 #include <graphics/gfxbase.h>
12 #include <graphics/gfxnodes.h>
13 #include <graphics/monitor.h>
14 #include <graphics/view.h>
15 #include <proto/exec.h>
16 #include <proto/graphics.h>
18 #include "graphics_intern.h"
19 #include "gfxfuncsupport.h"
21 /*****************************************************************************
25 AROS_LH1( void , GfxFree
,
28 AROS_LHA(struct ExtendedNode
*, node
, A0
),
32 struct GfxBase
*, GfxBase
, 111, Graphics
)
35 Free a special graphics extended data structure which was preciously
39 node = pointer to a graphics extended data structure obtained by
43 The node will be deallocated from memory. Graphics will disassociate
44 this special graphics extended node from any associated data
45 structure, if necessary, before freeing it (see GfxAssociate())
54 graphics/gfxnodes.h, GfxNew(), GfxAssociate(), GfxLookUp()
60 ******************************************************************************/
64 const ULONG GfxNew_memsizes
[] = { 0,
65 sizeof(struct ViewExtra
),
66 sizeof(struct ViewPortExtra
),
67 sizeof(struct SpecialMonitor
),
68 sizeof(struct MonitorSpec
)
71 D(bug("GfxFree(0x%p)\n", node
));
72 if ( SS_GRAPHICS
== node
->xln_Subsystem
&&
73 NT_GRAPHICS
== node
->xln_Type
)
75 /* take the element out of the hashlist, if it is in the
77 D(bug("[GfxFree] xln_Succ 0x%p, xln_Pred 0x%p\n", node
->xln_Succ
, node
->xln_Pred
));
79 ObtainSemaphore(GfxBase
->HashTableSemaphore
);
81 /* if the element has a Successor */
82 if (NULL
!= node
-> xln_Succ
)
83 ((struct ExtendedNode
*)(node
-> xln_Succ
)) -> xln_Pred
= (struct Node
*) (node
-> xln_Pred
);
85 /* if the previous Element is not the hashlist itself */
86 /* (the same code works also if the previous entry is the hashlist ) */
88 ((struct ExtendedNode
*)(node
-> xln_Pred
)) -> xln_Succ
= (struct Node
*) (node
-> xln_Succ
);
90 ReleaseSemaphore(GfxBase
->HashTableSemaphore
);
92 FreeMem((void *) node
, GfxNew_memsizes
[node
->xln_Subtype
]);