add NOWARN_SIZEOF_POINTER_MEMACCESS
[AROS.git] / rom / graphics / gfxnew.c
blobfc82bc06c1545376116aaab31dc0ee959db3c8b6
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <exec/types.h>
11 #include <exec/memory.h>
12 #include <graphics/gfxbase.h>
13 #include <graphics/monitor.h>
14 #include <graphics/view.h>
15 #include <graphics/gfxnodes.h>
16 #include <proto/exec.h>
17 #include <proto/graphics.h>
18 #include "graphics_intern.h"
20 static LONG dummy_init(void);
22 /*****************************************************************************
24 NAME */
26 AROS_LH1(struct ExtendedNode *, GfxNew,
28 /* SYNOPSIS */
30 AROS_LHA( ULONG, node_type, D0),
32 /* LOCATION */
34 struct GfxBase *, GfxBase, 110, Graphics)
36 /* FUNCTION
37 Allocate a special graphics extended data structure. The type of
38 structure to be allocated is passed in the node_type identifier.
40 INPUTS
41 node_type = the type of graphics extended data structure to allocate.
42 (see gfxnodes.h for identifier definitions.)
44 RESULT
45 A pointer to the allocated graphics node or NULL if the allocation
46 failed
48 NOTES
50 EXAMPLE
52 BUGS
54 SEE ALSO
55 graphics/gfxnodes.h, GfxFree(), GfxAssociate(), GfxLookUp()
57 INTERNALS
59 HISTORY
61 ******************************************************************************/
63 AROS_LIBFUNC_INIT
65 struct ExtendedNode * Result;
66 const ULONG GfxNew_memsizes[] = { 0,
67 sizeof(struct ViewExtra),
68 sizeof(struct ViewPortExtra),
69 sizeof(struct SpecialMonitor),
70 sizeof(struct MonitorSpec)
74 if (node_type >= VIEW_EXTRA_TYPE && node_type <= MONITOR_SPEC_TYPE)
76 Result = (struct ExtendedNode *) AllocMem(GfxNew_memsizes[node_type],
77 MEMF_CLEAR | MEMF_PUBLIC);
78 if (Result)
80 /* do some initialisation they all have in common */
81 Result->xln_Type = NT_GRAPHICS;
82 Result->xln_Subsystem = SS_GRAPHICS;
83 Result->xln_Subtype = (BYTE)node_type;
84 Result->xln_Library = GfxBase;
86 /* the following pointer has to point to some unknown routine */
87 /* WB2.x+ native monitor drivers call it, added dummy function to prevent crash */
88 Result->xln_Init = dummy_init;
91 /* lets get more specific now !*/
92 switch(node_type)
94 case VIEW_EXTRA_TYPE:
95 ((struct ViewExtra *)Result)->Monitor = GfxBase->natural_monitor;
96 /* FindName() can't work here until ABI v1 release
97 FindName((struct List *)(&(GfxBase -> MonitorList)), DEFAULT_MONITOR_NAME);*/
98 break;
99 case VIEWPORT_EXTRA_TYPE:
100 break;
101 case SPECIAL_MONITOR_TYPE:
102 /* ((struct SpecialMonitor *)Result).do_monitor = */
103 break;
104 case MONITOR_SPEC_TYPE:
105 /* ((struct MonitorSpec *)Result)->ms_transform = */
106 /* ((struct MonitorSpec *)Result)->ms_translate = */
107 /* ((struct MonitorSpec *)Result)->ms_scale = */
108 /* ((struct MonitorSpec *)Result)->ms_xoffset = */
109 /* ((struct MonitorSpec *)Result)->ms_yoffset = */
110 /* ((struct MonitorSpec *)Result)->ms_maxoscan = */
111 /* ((struct MonitorSpec *)Result)->ms_videoscan = */
112 /* ((struct MonitorSpec *)Result)->ms_reserved00 = */
113 /* ((struct MonitorSpec *)Result)->ms_reserved01 = */
114 break;
116 return Result;
117 } /* could allocate requested memory */
118 } /* node_type is valid */
119 return NULL;
121 AROS_LIBFUNC_EXIT
122 } /* GfxNew */
124 static LONG dummy_init(void)
126 D(bug("xln_Init called\n"));
127 return 0;