2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
5 Desc: Graphics function MrgCop()
9 #include <aros/debug.h>
10 #include <exec/memory.h>
11 #include <graphics/gfxbase.h>
12 #include <graphics/view.h>
13 #include <graphics/rastport.h>
15 #include <proto/exec.h>
16 #include <proto/oop.h>
18 #include "graphics_intern.h"
19 #include "gfxfuncsupport.h"
21 /*****************************************************************************
24 #include <proto/graphics.h>
26 AROS_LH1(ULONG
, MrgCop
,
29 AROS_LHA(struct View
*, view
, A1
),
32 struct GfxBase
*, GfxBase
, 35, Graphics
)
35 Prepare the view for being displayed. Calculate necessary internal data.
36 For Amiga(tm) chipset this function also merges together the display, color, sprite and user
37 coprocessor instructions into a single coprocessor instruction stream.
40 view - a pointer to the view structure to prepare
43 error - ULONG error value indicating either lack of memory to build the system data,
44 or that MrgCop() has no work to do - ie there where no viewPorts in the list.
47 Pre-v39 AmigaOS returns void.
49 If the given view is already on display, changes appear immediately.
62 ******************************************************************************/
66 struct ViewPort
*first
, *vp
;
67 struct HIDD_ViewPortData
*vpd
;
68 struct HIDD_ViewPortData
*prev_vpd
;
69 struct monitor_driverdata
*mdd
;
70 struct monitor_driverdata
*prev_mdd
= NULL
;
73 /* Build lists of displayed bitmaps, one list per display.
74 Lists are embedded in ViewPortExtra.DriverData field. Start of
75 the list is the first ViewPort for this display. */
76 for (first
= view
->ViewPort
; first
; first
= first
->Next
) {
77 /* Ignore hidden ViewPorts */
78 if (!(first
->Modes
& VP_HIDE
)) {
80 mdd
= GET_VP_DRIVERDATA(first
);
81 /* Ignore next ViewPort if it belongs to the same display.
82 This makes us slightly faster */
87 /* We don't check GfxLookUp() result against NULL because MakeVPort() has
88 already took care about this. If MrgCop() was called with some mailformed
89 ViewPorts, it's not our problem */
90 prev_vpd
= VPE_DATA((struct ViewPortExtra
*)GfxLookUp(first
));
91 prev_vpd
->Next
= NULL
;
92 D(bug("[MrgCop] First ViewPort: 0x%p, data 0x%p\n", first
, prev_vpd
));
94 /* Now we look down the list for ViewPorts with the same display driver as
95 current ViewPort and add them to a list */
96 for (vp
= first
->Next
; vp
; vp
= vp
->Next
) {
97 if (!(vp
->Modes
& VP_HIDE
)) {
99 if (GET_VP_DRIVERDATA(vp
) == mdd
) {
100 vpd
= VPE_DATA((struct ViewPortExtra
*)GfxLookUp(vp
));
101 D(bug("[MrgCop] Attaching ViewPort 0x%p, data 0x%p\n", vp
, vpd
));
104 prev_vpd
->Next
= vpd
;
114 ret
= DoViewFunction(view
, driver_PrepareViewPorts
, GfxBase
);
118 ObtainSemaphore(GfxBase
->ActiViewCprSemaphore
);
120 /* If the given view is a currently displayed one, refresh immediately */
121 if (GfxBase
->ActiView
== view
)
122 DoViewFunction(view
, driver_LoadViewPorts
, GfxBase
);
124 ReleaseSemaphore(GfxBase
->ActiViewCprSemaphore
);