2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
6 Desc: Intuition function ChangeScreenBuffer()
9 #include <proto/graphics.h>
10 #include "intuition_intern.h"
11 #include "inputhandler.h"
14 /*****************************************************************************
17 #include <intuition/screens.h>
18 #include <proto/intuition.h>
20 AROS_LH2(ULONG
, ChangeScreenBuffer
,
23 AROS_LHA(struct Screen
* , screen
, A0
),
24 AROS_LHA(struct ScreenBuffer
*, screenbuffer
, A1
),
27 struct IntuitionBase
*, IntuitionBase
, 130, Intuition
)
30 Do double or multiple buffering on an intuition screen in an
31 intuition-cooperative way. The ScreenBuffer's BitMap will be
32 installed on the specified screen, if possible. After a signal from
33 graphics.library, the previously installed BitMap will be available
34 for re-use. Consult graphics.library/AllocDBufInfo() and
35 graphics.library/ChangeVPBitMap() for further information.
38 screen - The screen this screenbuffer belongs to
39 screenbuffer - The screenbuffer obtained by AllocScreenBuffer()
42 Non-zero if fuction succeeded, or zero if operation could not be
43 performed, e.g. if user selects menus or gadgets.
46 You need not re-install the original ScreenBuffer before closing
47 a screen. Just FreeScreenBuffer() all buffers used for that screen.
54 AllocScreenBuffer(), FreeScreenBuffer(),
55 graphics.library/ChangeVPBitMap()
59 *****************************************************************************/
63 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
64 //struct IIHData *iihdata;
67 if (!screen
) return 0;
68 if (!screenbuffer
) return 0;
71 if (MENUS_ACTIVE
) return 0;
72 iihdata
= (struct IIHData
*)((struct IntIntuitionBase
*)(IntuitionBase
))->InputHandler
->is_Data
;
73 if (iihdata
->ActiveGadget
) return 0;
78 ChangeVPBitMap(&screen
->ViewPort
,screenbuffer
->sb_BitMap
,screenbuffer
->sb_DBufInfo
);
80 screen
->RastPort
.BitMap
= screenbuffer
->sb_BitMap
;
81 UpdateScreenBitMap(screen
, IntuitionBase
);
88 } /* ChangeScreenBuffer */
90 void UpdateScreenBitMap(struct Screen
*screen
, struct IntuitionBase
*IntuitionBase
)
93 struct BitMap
*bm
= screen
->RastPort
.BitMap
;
94 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
96 /* Patch up the obsolete screen bitmap as best we can for old programs
98 screen
->BitMap_OBSOLETE
.BytesPerRow
= GetBitMapAttr(bm
, BMA_WIDTH
) / 8;
99 screen
->BitMap_OBSOLETE
.Rows
= GetBitMapAttr(bm
, BMA_HEIGHT
);
100 screen
->BitMap_OBSOLETE
.Flags
= BMF_INVALID
| (GetBitMapAttr(bm
, BMA_FLAGS
) & BMF_STANDARD
);
101 screen
->BitMap_OBSOLETE
.pad
= 0;
102 screen
->BitMap_OBSOLETE
.Depth
= GetBitMapAttr(bm
, BMA_DEPTH
);
103 for (i
= 0; i
< 8; i
++) {
104 /* And for *really* old programs, copy the plane pointers,
107 if (screen
->BitMap_OBSOLETE
.Flags
& BMF_STANDARD
)
108 screen
->BitMap_OBSOLETE
.Planes
[i
] = bm
->Planes
[i
];
110 screen
->BitMap_OBSOLETE
.Planes
[i
] = NULL
;