delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/23/08:26:10

Message-ID: <3811084C.7874BA49@connect.ab.ca>
Date: Sat, 23 Oct 1999 00:58:52 +0000
From: Tom Fjellstrom <tomcf AT connect DOT ab DOT ca>
X-Mailer: Mozilla 4.61 [en] (Win95; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Plague of the slow 'blit' routine :)
References: <Pine DOT SUN DOT 3 DOT 91 DOT 991021170208 DOT 4001C-100000 AT is> <380EF520 DOT C2FAE759 AT connect DOT ab DOT ca> <HFWP3.1237$we DOT 1842 AT newsfeeds DOT bigpond DOT com>
NNTP-Posting-Host: ppp0069.connect.ab.ca
X-Trace: 23 Oct 1999 00:53:37 -0600, ppp0069.connect.ab.ca
Lines: 70
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019