Indentation fix, cleanup.
[AROS.git] / rom / graphics / changevpbitmap.c
bloba86b4e182b77cc803adf031f2a6d62b1c3d34fb5
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function ChangeVPBitMap()
6 Lang: english
7 */
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 /*****************************************************************************
20 NAME */
21 #include <proto/graphics.h>
23 AROS_LH3(void, ChangeVPBitMap,
25 /* SYNOPSIS */
26 AROS_LHA(struct ViewPort *, vp, A0),
27 AROS_LHA(struct BitMap *, bm, A1),
28 AROS_LHA(struct DBufInfo *, db, A2),
30 /* LOCATION */
31 struct GfxBase *, GfxBase, 157, Graphics)
33 /* FUNCTION
35 INPUTS
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
42 RESULT
44 NOTES
46 EXAMPLE
48 BUGS
50 SEE ALSO
52 INTERNALS
54 HISTORY
57 ******************************************************************************/
59 AROS_LIBFUNC_INIT
61 struct ViewPort *vp2;
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 */
77 if (vp2 == vp)
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);
94 break;
99 ReleaseSemaphore(GfxBase->ActiViewCprSemaphore);
101 /* Reply both messages - the displayed bitmap has been swapped */
102 ReplyMsg(&db->dbi_SafeMessage);
103 ReplyMsg(&db->dbi_DispMessage);
105 AROS_LIBFUNC_EXIT
106 } /* ChangeVPBitMap */