![]() |
![]() |
#1 |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,927
|
interleaved bitmap / doublebuffering
What I'm trying to do is this:
I want to use V39's double buffering functions. I AllocBitMap() twice for two bitmaps, open a screen using one of the bitmaps as custom bitmap. Then I allocate two ScreenBuffers passing the bitmaps I allocated before and use them for the double buffering logic. However, there is on property of the allocated bitmaps that my code requires, that is, the eight bitplanes need to be contiguous so that my chunky2planar code works right. Now graphics.doc tells me this: BMF_INTERLEAVED tells graphics that you would like your bitmap to be allocated with one large chunk of display memory for all bitplanes. This minimizes color flashing on deep displays. If there is not enough contiguous RAM for an interleaved bitmap, graphics.library will fall back to a non-interleaved one. This sounds like what I need but it turns out that I get a garbled display when I set this flag (and I get a good one if I leave it away). Question #1: It looks like the system will give me eight contiguous planes even without this flag but I think I cannot rely on this as chipmem could be fragmented, right? But when chipmem is so fragmented that I don't get my interleaved bitmap, I guess I would have to check whether I got the interleaved bitmap and if not, quit. Question #2: When I pass this BMF_INTERLEAVED flag, I get bad screen output. Am I right in thinking that this is because of the interleaved format (I only have very faint memories of this). Does this mean that there is one line of bpl0 data followed by one line of bpl1 a.s.o. and then again the same for the next line? In this case I think I could adapt my c2p code to this format and use BMF_INTERLEAVED to ensure that I always get contiguous bitplane memory but I wouldn't want to do this without need (my c2p processes 128 pixels per iteration and with 320 pixel screens = 2.5*128 this could be a pain to adapt to the interleaved format). Question #3: As already stated, I pass one of my custom bitmaps to OpenScreenTagList() and then I AllocScreenBuffer() to get a ScreenBuffer for it. Should I pass my bitmap and no flags or no bitmap and the SB_SCREEN_BITMAP flag to get a ScreenBuffer for this bitmap? From the documentation I would expect both to work: For non-CUSTOMBITMAP screens, set SB_SCREEN_BITMAP in order to get a ScreenBuffer referring to the screen's actual BitMap. (For CUSTOMBITMAP screens, just set the BitMap parameter to the BitMap you passed to OpenScreen()). |
![]() |
![]() |
#2 |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,927
|
I have solved this now by checking the returned bitmap structure by looking at the bm_BytesPerRow and bm_Rows entries of the struct and checking that the pointers to the bitplanes are in fact set off by width*height/8. If one of the tests fails, the program aborts. I assume this can happen if there is no large enough chunk of chipmem available to hold all bitplanes at the same time but still enough smaller chunks for each individual plane. If it cannot happen, the checking doesn't hurt either...
If my c2p could be converted easily to work with interleaved bitmaps, I would have chosen that way but it couldn't be done. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Raw Interleaved Graphics | Hungry Horace | Coders. General | 12 | 28 January 2023 23:30 |
BLITZ2 : interleaved bitmap | Raislin77it | Coders. General | 0 | 22 April 2014 21:28 |
interleaved bitmaps and blitting | h0ffman | Coders. Asm / Hardware | 6 | 07 December 2013 20:58 |
BPLxMOD for interleaved bitmaps | phx | Coders. Asm / Hardware | 12 | 02 June 2012 22:47 |
the bitmap bros are from the uk | petza | Nostalgia & memories | 53 | 12 May 2006 16:08 |
|
|