2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
5 Desc: Graphics function VideoControl()
8 #include <aros/debug.h>
9 #include <graphics/videocontrol.h>
10 #include <graphics/view.h>
11 #include <utility/tagitem.h>
12 #include <proto/utility.h>
14 #include "graphics_intern.h"
16 /*****************************************************************************
19 #include <proto/graphics.h>
21 AROS_LH2(ULONG
, VideoControl
,
24 AROS_LHA(struct ColorMap
*, cm
, A0
),
25 AROS_LHA(struct TagItem
*, tags
, A1
),
28 struct GfxBase
*, GfxBase
, 118, Graphics
)
33 cm - pointer to struct ColorMap obtained via GetColorMap()
34 tags - pointer to a table of videocontrol tagitems
37 error - 0 if no error ocurred in the control operation
38 non-0 if bad colormap pointer, no tagitems or bad tag
53 ******************************************************************************/
57 struct TagItem
*tag
, *tstate
= tags
;
58 LONG
*immediate
= NULL
;
61 while ((tag
= NextTagItem(&tstate
))) {
64 case VTAG_ATTACH_CM_SET
:
65 cm
->cm_vp
= (struct ViewPort
*)tag
->ti_Data
;
68 case VTAG_ATTACH_CM_GET
:
69 tag
->ti_Tag
= VTAG_ATTACH_CM_SET
;
70 tag
->ti_Data
= (STACKIPTR
)cm
->cm_vp
;
73 case VTAG_VIEWPORTEXTRA_SET
:
74 cm
->cm_vpe
= (struct ViewPortExtra
*)tag
->ti_Data
;
75 GfxAssociate(cm
->cm_vp
, &cm
->cm_vpe
->n
);
78 case VTAG_VIEWPORTEXTRA_GET
:
79 tag
->ti_Tag
= VTAG_VIEWPORTEXTRA_SET
;
80 tag
->ti_Data
= (STACKIPTR
)cm
->cm_vpe
;
83 case VTAG_NORMAL_DISP_SET
:
84 cm
->NormalDisplayInfo
= (APTR
)tag
->ti_Data
;
87 case VTAG_NORMAL_DISP_GET
:
88 tag
->ti_Tag
= VTAG_NORMAL_DISP_SET
;
89 tag
->ti_Data
= (STACKIPTR
)cm
->NormalDisplayInfo
;
92 case VTAG_COERCE_DISP_SET
:
93 cm
->CoerceDisplayInfo
= (APTR
)tag
->ti_Data
;
96 case VTAG_COERCE_DISP_GET
:
97 tag
->ti_Tag
= VTAG_COERCE_DISP_SET
;
98 tag
->ti_Data
= (STACKIPTR
)cm
->CoerceDisplayInfo
;
101 case VTAG_PF1_BASE_SET
:
102 cm
->Bp_0_base
= tag
->ti_Data
;
105 case VTAG_PF1_BASE_GET
:
106 tag
->ti_Tag
= VTAG_PF1_BASE_SET
;
107 tag
->ti_Data
= cm
->Bp_0_base
;
110 case VTAG_PF2_BASE_SET
:
111 cm
->Bp_1_base
= tag
->ti_Data
;
114 case VTAG_PF2_BASE_GET
:
115 tag
->ti_Tag
= VTAG_PF2_BASE_SET
;
116 tag
->ti_Data
= cm
->Bp_1_base
;
119 case VTAG_SPODD_BASE_SET
:
120 cm
->SpriteBase_Odd
= tag
->ti_Data
;
123 case VTAG_SPODD_BASE_GET
:
124 tag
->ti_Tag
= VTAG_SPODD_BASE_SET
;
125 tag
->ti_Data
= cm
->SpriteBase_Odd
;
128 case VTAG_SPEVEN_BASE_SET
:
129 cm
->SpriteBase_Even
= tag
->ti_Data
;
130 /* TODO: propagate this value to the display driver */
133 case VTAG_SPEVEN_BASE_GET
:
134 tag
->ti_Tag
= VTAG_SPEVEN_BASE_SET
;
135 tag
->ti_Data
= cm
->SpriteBase_Even
;
138 case VTAG_BORDERSPRITE_SET
:
139 cm
->Flags
|= BORDERSPRITES
;
142 case VTAG_BORDERSPRITE_CLR
:
143 cm
->Flags
&= ~BORDERSPRITES
;
146 case VTAG_BORDERSPRITE_GET
:
147 /* FIXME: Does AmigaOS do the same? */
148 if (cm
->Flags
& BORDERSPRITES
) {
149 tag
->ti_Tag
= VTAG_BORDERSPRITE_SET
;
152 tag
->ti_Tag
= VTAG_BORDERSPRITE_CLR
;
153 tag
->ti_Data
= FALSE
;
157 case VTAG_SPRITERESN_SET
:
158 cm
->SpriteResolution
= tag
->ti_Data
;
161 case VTAG_SPRITERESN_GET
:
162 tag
->ti_Tag
= VTAG_SPRITERESN_SET
;
163 tag
->ti_Data
= cm
->SpriteResolution
;
166 /* TODO: Implement these */
167 case VTAG_PF1_TO_SPRITEPRI_SET
:
170 case VTAG_PF1_TO_SPRITEPRI_GET
:
171 tag
->ti_Tag
= VTAG_PF1_TO_SPRITEPRI_SET
;
175 case VTAG_PF2_TO_SPRITEPRI_SET
:
178 case VTAG_PF2_TO_SPRITEPRI_GET
:
179 tag
->ti_Tag
= VTAG_PF2_TO_SPRITEPRI_SET
;
183 case VTAG_BORDERBLANK_SET
:
184 cm
->Flags
|= BORDER_BLANKING
;
187 case VTAG_BORDERBLANK_CLR
:
188 cm
->Flags
&= ~BORDER_BLANKING
;
191 case VTAG_BORDERBLANK_GET
:
192 if (cm
->Flags
& BORDER_BLANKING
) {
193 tag
->ti_Tag
= VTAG_BORDERBLANK_SET
;
196 tag
->ti_Tag
= VTAG_BORDERBLANK_CLR
;
197 tag
->ti_Data
= FALSE
;
201 case VTAG_BORDERNOTRANS_SET
:
202 cm
->Flags
|= BORDER_NOTRANSPARENCY
;
205 case VTAG_BORDERNOTRANS_CLR
:
206 cm
->Flags
&= ~BORDER_NOTRANSPARENCY
;
209 case VTAG_BORDERNOTRANS_GET
:
210 if (cm
->Flags
& BORDER_NOTRANSPARENCY
) {
211 tag
->ti_Tag
= VTAG_BORDERNOTRANS_SET
;
214 tag
->ti_Tag
= VTAG_BORDERNOTRANS_CLR
;
215 tag
->ti_Data
= FALSE
;
219 /* TODO: implement these */
220 case VTAG_CHROMAKEY_SET
:
223 case VTAG_CHROMAKEY_CLR
:
226 case VTAG_CHROMAKEY_GET
:
227 tag
->ti_Tag
= VTAG_CHROMAKEY_CLR
;
231 case VTAG_BITPLANEKEY_SET
:
234 case VTAG_BITPLANEKEY_CLR
:
237 case VTAG_BITPLANEKEY_GET
:
238 tag
->ti_Tag
= VTAG_BITPLANEKEY_CLR
;
242 case VTAG_CHROMA_PEN_SET
:
245 case VTAG_CHROMA_PEN_CLR
:
248 case VTAG_CHROMA_PEN_GET
:
249 tag
->ti_Tag
= VTAG_CHROMA_PEN_CLR
;
253 case VTAG_CHROMA_PLANE_SET
:
256 case VTAG_CHROMA_PLANE_GET
:
257 tag
->ti_Tag
= VTAG_CHROMA_PLANE_SET
;
262 immediate
= (LONG
*)tag
->ti_Data
;
265 case VTAG_FULLPALETTE_SET
:
266 cm
->AuxFlags
|= CMAF_FULLPALETTE
;
269 case VTAG_FULLPALETTE_CLR
:
270 cm
->AuxFlags
&= ~CMAF_FULLPALETTE
;
273 case VTAG_FULLPALETTE_GET
:
274 if (cm
->AuxFlags
& CMAF_FULLPALETTE
) {
275 tag
->ti_Tag
= VTAG_FULLPALETTE_SET
;
278 tag
->ti_Tag
= VTAG_FULLPALETTE_CLR
;
279 tag
->ti_Data
= FALSE
;
283 case VC_IntermediateCLUpdate
:
285 cm
->AuxFlags
&= ~CMAF_NO_INTERMED_UPDATE
;
287 cm
->AuxFlags
|= CMAF_NO_INTERMED_UPDATE
;
290 case VC_IntermediateCLUpdate_Query
:
291 *(ULONG
*)tag
->ti_Data
= (cm
->AuxFlags
& CMAF_NO_INTERMED_UPDATE
) ? FALSE
: TRUE
;
294 case VC_NoColorPaletteLoad
:
296 cm
->AuxFlags
|= CMAF_NO_COLOR_LOAD
;
298 cm
->AuxFlags
&= ~CMAF_NO_COLOR_LOAD
;
301 case VC_NoColorPaletteLoad_Query
:
302 *(ULONG
*)tag
->ti_Data
= (cm
->AuxFlags
& CMAF_NO_COLOR_LOAD
) ? TRUE
: FALSE
;
305 case VC_DUALPF_Disable
:
307 cm
->AuxFlags
|= CMAF_DUALPF_DISABLE
;
309 cm
->AuxFlags
&= ~CMAF_DUALPF_DISABLE
;
312 case VC_DUALPF_Disable_Query
:
313 *(ULONG
*)tag
->ti_Data
= (cm
->AuxFlags
& CMAF_DUALPF_DISABLE
) ? TRUE
: FALSE
;
316 case VTAG_USERCLIP_SET
:
317 cm
->Flags
|= USER_COPPER_CLIP
;
320 case VTAG_USERCLIP_CLR
:
321 cm
->Flags
&= ~USER_COPPER_CLIP
;
324 case VTAG_USERCLIP_GET
:
325 if (cm
->Flags
& USER_COPPER_CLIP
) {
326 tag
->ti_Tag
= VTAG_USERCLIP_SET
;
329 tag
->ti_Tag
= VTAG_USERCLIP_CLR
;
330 tag
->ti_Data
= FALSE
;
334 case VTAG_NEXTBUF_CM
:
335 tstate
= (struct TagItem
*)tag
->ti_Data
;
338 case VTAG_BATCH_CM_SET
:
339 cm
->Flags
|= VIDEOCONTROL_BATCH
;
342 case VTAG_BATCH_CM_CLR
:
343 cm
->Flags
&= ~VIDEOCONTROL_BATCH
;
346 case VTAG_BATCH_CM_GET
:
347 if (cm
->Flags
& VIDEOCONTROL_BATCH
) {
348 tag
->ti_Tag
= VTAG_BATCH_CM_SET
;
351 tag
->ti_Tag
= VTAG_BATCH_CM_CLR
;
352 tag
->ti_Data
= FALSE
;
356 case VTAG_BATCH_ITEMS_SET
:
357 cm
->cm_batch_items
= (struct TagItem
*)tag
->ti_Data
;
360 /* TODO: implement this */
361 case VTAG_BATCH_ITEMS_ADD
:
364 case VTAG_BATCH_ITEMS_GET
:
365 tag
->ti_Tag
= VTAG_BATCH_ITEMS_SET
;
366 tag
->ti_Data
= (STACKIPTR
)cm
->cm_batch_items
;
369 case VTAG_VPMODEID_SET
:
370 cm
->VPModeID
= tag
->ti_Data
;
373 case VTAG_VPMODEID_CLR
:
374 cm
->VPModeID
= INVALID_ID
;
377 case VTAG_VPMODEID_GET
:
378 tag
->ti_Tag
= (cm
->VPModeID
== INVALID_ID
) ? VTAG_VPMODEID_CLR
: VTAG_VPMODEID_SET
;
379 tag
->ti_Data
= cm
->VPModeID
;
389 /* TODO: update SpriteBase in the graphics driver here */