2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Graphics function ChangeVPBitMap()
9 #include <aros/debug.h>
10 #include <graphics/gfx.h>
11 #include <graphics/gfxbase.h>
12 #include <graphics/view.h>
13 #include <hidd/graphics.h>
15 #include "graphics_intern.h"
16 #include "gfxfuncsupport.h"
18 /*****************************************************************************
21 #include <proto/graphics.h>
23 AROS_LH3(void, ChangeVPBitMap
,
26 AROS_LHA(struct ViewPort
*, vp
, A0
),
27 AROS_LHA(struct BitMap
*, bm
, A1
),
28 AROS_LHA(struct DBufInfo
*, db
, A2
),
31 struct GfxBase
*, GfxBase
, 157, Graphics
)
36 vp - pointer to a viewport
37 bm - pointer to a BitMap structure. This BitMap structure must be of
38 the same layout as the one attached to the viewport
39 (same depth, alignment and BytesPerRow)
40 db - pointer to a DBufInfo
57 ******************************************************************************/
63 /* This is a very basic implementation. Screen refresh is completely not in sync with VBlank.
64 The main problem here is that AROS completely misses VBlank interrupt. */
66 /* Insert a new bitmap and rebuild the viewport */
67 vp
->RasInfo
->BitMap
= bm
;
68 MakeVPort(GfxBase
->ActiView
, vp
);
70 ObtainSemaphore(GfxBase
->ActiViewCprSemaphore
);
72 if (GfxBase
->ActiView
)
74 for (vp2
= GfxBase
->ActiView
->ViewPort
; vp2
; vp2
= vp2
->Next
)
76 /* First check if the updated ViewPort is currently on display */
79 if (!(vp2
->Modes
& VP_HIDE
))
82 * If yes, we need to rebuild driver's display. Look up the driver
83 * and its ViewPorts chain and redisplay it.
84 * We don't check against vpd == NULL because we already know
85 * there's at least one ViewPort (our one) in the chain.
87 struct monitor_driverdata
*mdd
= GET_VP_DRIVERDATA(vp
);
88 struct HIDD_ViewPortData
*vpd
= driver_FindViewPorts(GfxBase
->ActiView
, mdd
, GfxBase
);
90 HIDD_Gfx_PrepareViewPorts(mdd
->gfxhidd
, vpd
, GfxBase
->ActiView
);
91 driver_LoadViewPorts(vpd
, GfxBase
->ActiView
, mdd
, GfxBase
);
99 ReleaseSemaphore(GfxBase
->ActiViewCprSemaphore
);
101 /* Reply both messages - the displayed bitmap has been swapped */
102 ReplyMsg(&db
->dbi_SafeMessage
);
103 ReplyMsg(&db
->dbi_DispMessage
);
106 } /* ChangeVPBitMap */