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.
32 The ScreenBuffer's BitMap will be installed on the specifies screen,
34 After a signal from graphics.library, the previously installed
35 BitMap will be available for re-use.
36 Consult graphics.library/AllocDBufInfo() and
37 graphics.library/ChangeVPBitMap() for further information.
40 screen - The screen this screenbuffer belongs to
41 screenbuffer - The screenbuffer obtained by AllocScreenBuffer()
44 Non-zero if fuction succeeded, or zero if operation could not be
45 performed, eg. if user selects menus or gadgets.
48 You need not re-install the original ScreenBuffer before closing
49 a screen. Just FreeScreenBuffer() all buffers used for that screen.
56 AllocScreenBuffer(), FreeScreenBuffer(),
57 graphics.library/ChangeVPBitMap()
63 *****************************************************************************/
67 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
68 //struct IIHData *iihdata;
71 if (!screen
) return 0;
72 if (!screenbuffer
) return 0;
75 if (MENUS_ACTIVE
) return 0;
76 iihdata
= (struct IIHData
*)((struct IntIntuitionBase
*)(IntuitionBase
))->InputHandler
->is_Data
;
77 if (iihdata
->ActiveGadget
) return 0;
82 ChangeVPBitMap(&screen
->ViewPort
,screenbuffer
->sb_BitMap
,screenbuffer
->sb_DBufInfo
);
84 screen
->RastPort
.BitMap
= screenbuffer
->sb_BitMap
;
85 UpdateScreenBitMap(screen
, IntuitionBase
);
92 } /* ChangeScreenBuffer */
94 void UpdateScreenBitMap(struct Screen
*screen
, struct IntuitionBase
*IntuitionBase
)
97 struct BitMap
*bm
= screen
->RastPort
.BitMap
;
98 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
100 /* Patch up the obsolete screen bitmap as best we can for old programs
102 screen
->BitMap_OBSOLETE
.BytesPerRow
= GetBitMapAttr(bm
, BMA_WIDTH
) / 8;
103 screen
->BitMap_OBSOLETE
.Rows
= GetBitMapAttr(bm
, BMA_HEIGHT
);
104 screen
->BitMap_OBSOLETE
.Flags
= BMF_INVALID
| (GetBitMapAttr(bm
, BMA_FLAGS
) & BMF_STANDARD
);
105 screen
->BitMap_OBSOLETE
.pad
= 0;
106 screen
->BitMap_OBSOLETE
.Depth
= GetBitMapAttr(bm
, BMA_DEPTH
);
107 for (i
= 0; i
< 8; i
++) {
108 /* And for *really* old programs, copy the plane pointers,
111 if (screen
->BitMap_OBSOLETE
.Flags
& BMF_STANDARD
)
112 screen
->BitMap_OBSOLETE
.Planes
[i
] = bm
->Planes
[i
];
114 screen
->BitMap_OBSOLETE
.Planes
[i
] = NULL
;