Mail Archives: djgpp/1999/10/23/08:26:10
Johan Venter wrote:
> Tom Fjellstrom <tomcf AT connect DOT ab DOT ca> wrote in message
> news:380EF520 DOT C2FAE759 AT connect DOT ab DOT ca...
> > The only way I have thought of determining that a bitmap is in video memory
> > is too add a variable to the bitmap struct when creating it to indicate
> > whether
> > or not it is in video memory. If that is the only safe way of doing it I
> > guess i'll have to.
>
> A suggestion if I may:
>
> Do you have a global 'screen' bitmap which always contains a pointer to the
> video memory? If so, try something like this:
>
> void blit(BITMAP *src, BITMAP *dest, int from_x, int from_y, int to_x, int to_y)
> {
>
> int source_address = src->dat + (from_y*src->w+from_x);
> int dest_address = dest->dat + (to_y*dest->w+to_x);
>
> /* maybe add some clipping here */
>
> if (dest->dat == screen->dat) {
> /* DO A FAR POINTER BLIT TO SCREEN */
> }
> else {
> /* DO A memcpy */
> }
> }
>
> Note:
>
> 1. Code written very fast.
> 2. Code untested.
> 3. Not even sure code will compile.
>
> Hopefully you get the point though,
>
> --
> Johan Venter
> ICQ 3643877 - jventer AT writeme DOT com
> The TPU DJGPP Interest Group - http://surf.to/djgppig
> The RSXNTDJ 1.5 HOWTO - http://surf.to/rsxntdj
Thanks Johan,
I thought of this too, But my problem is a bitmap might
be a sub bitmap of the screen, that does not necessarily
start at the beginning of video memory. although sense my
last message I thought checking for a bitmap that is any where
in video memory can be done some what like this:
if ((dest->dat >= screen->dat) && (dest->dat <= endofvideomem)) {
/* DO A FAR POINTER BLIT TO SCREEN */
} else { /* memcpy */ }
If I'm wrong then let me know, and if I'm not then I should have thought of this
sooner.
--
"An Optimist will say the glass is half full,
A Pessimist will say the glass is half empty,
A Canadian will say Waiter!"
Tom Fjellstrom
tomcf AT connect DOT ab DOT ca
- Raw text -