2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 /****************************************************************************************/
11 #include <proto/oop.h>
12 #include <proto/utility.h>
13 #include <exec/memory.h>
15 #include <utility/tagitem.h>
16 #include <hidd/graphics.h>
19 #include <aros/debug.h>
21 #include "graphics_intern.h"
23 /****************************************************************************************/
25 OOP_Object
*Sync__Root__New(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_New
*msg
)
27 struct sync_data
*data
;
30 DECLARE_ATTRCHECK(sync
);
32 EnterFunc(bug("Sync::New()\n"));
34 /* Get object from superclass */
35 o
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
39 /* If we got a NULL attrlist we just allocate an empty object an exit */
40 if (NULL
== msg
->attrList
)
43 data
= OOP_INST_DATA(cl
, o
);
45 if (!parse_sync_tags(msg
->attrList
, data
, ATTRCHECK(sync
), CSD(cl
) ))
47 D(bug("!!! ERROR PARSING SYNC ATTRS IN Sync::New() !!!\n"));
56 OOP_MethodID dispose_mid
;
58 dispose_mid
= OOP_GetMethodID(IID_Root
, moRoot_Dispose
);
59 OOP_CoerceMethod(cl
, o
, (OOP_Msg
)&dispose_mid
);
66 /****************************************************************************************/
68 VOID
Sync__Root__Get(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_Get
*msg
)
70 struct sync_data
*data
;
73 data
= OOP_INST_DATA(cl
, o
);
75 if (IS_SYNC_ATTR(msg
->attrID
, idx
))
79 case aoHidd_Sync_PixelTime
:
80 *msg
->storage
= (IPTR
)data
->pixtime
;
83 case aoHidd_Sync_PixelClock
:
86 #warning Find code for non-FPU!
87 *msg
->storage
= (ULONG
)0x12345678;
89 DOUBLE pixtime
, pixclock
;
91 pixtime
= (DOUBLE
)data
->pixtime
;
93 pixtime
/= 1000000000000; /* pixtime is in 10E-12 secs */
94 pixclock
= 1 / pixtime
; /* convert to Hz */
95 *msg
->storage
= (ULONG
)pixclock
;
100 case aoHidd_Sync_LeftMargin
:
101 *msg
->storage
= (IPTR
)data
->left_margin
;
104 case aoHidd_Sync_RightMargin
:
105 *msg
->storage
= (IPTR
)data
->right_margin
;
108 case aoHidd_Sync_HSyncLength
:
109 *msg
->storage
= (IPTR
)data
->hsync_length
;
112 case aoHidd_Sync_UpperMargin
:
113 *msg
->storage
= (IPTR
)data
->upper_margin
;
116 case aoHidd_Sync_LowerMargin
:
117 *msg
->storage
= (IPTR
)data
->lower_margin
;
120 case aoHidd_Sync_VSyncLength
:
121 *msg
->storage
= (IPTR
)data
->vsync_length
;
124 case aoHidd_Sync_HDisp
:
125 *msg
->storage
= (IPTR
)data
->hdisp
;
128 case aoHidd_Sync_VDisp
:
129 *msg
->storage
= (IPTR
)data
->vdisp
;
132 case aoHidd_Sync_HSyncStart
:
133 *msg
->storage
= (IPTR
)(data
->hdisp
+ data
->right_margin
);
136 case aoHidd_Sync_HSyncEnd
:
137 *msg
->storage
= (IPTR
)(data
->hdisp
+ data
->right_margin
+ data
->hsync_length
);
140 case aoHidd_Sync_HTotal
:
141 *msg
->storage
= (IPTR
)(data
->hdisp
+ data
->right_margin
+ data
->hsync_length
+ data
->left_margin
);
144 case aoHidd_Sync_VSyncStart
:
145 *msg
->storage
= (IPTR
)(data
->vdisp
+ data
->lower_margin
);
148 case aoHidd_Sync_VSyncEnd
:
149 *msg
->storage
= (IPTR
)(data
->vdisp
+ data
->lower_margin
+ data
->vsync_length
);
152 case aoHidd_Sync_VTotal
:
153 *msg
->storage
= (IPTR
)(data
->vdisp
+ data
->lower_margin
+ data
->vsync_length
+ data
->upper_margin
);
156 case aoHidd_Sync_Description
:
157 *msg
->storage
= (IPTR
)data
->description
;
161 D(bug("!!! TRYING TO GET UNKNOWN ATTR FROM SYNC OBJECT !!!\n"));
162 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
170 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
177 /****************************************************************************************/