delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/22/08:51:48

From: "Johan Venter" <jventer AT writeme DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <Pine DOT SUN DOT 3 DOT 91 DOT 991021170208 DOT 4001C-100000 AT is> <380EF520 DOT C2FAE759 AT connect DOT ab DOT ca>
Subject: Re: Plague of the slow 'blit' routine :)
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <HFWP3.1237$we.1842@newsfeeds.bigpond.com>
Date: Fri, 22 Oct 1999 11:18:24 +1000
NNTP-Posting-Host: 139.134.163.34
X-Trace: newsfeeds.bigpond.com 940586727 139.134.163.34 (Fri, 22 Oct 1999 20:05:27 EST)
NNTP-Posting-Date: Fri, 22 Oct 1999 20:05:27 EST
Organization: Telstra BigPond Internet Services (http://www.bigpond.com)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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


- Raw text -


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