delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/11/19:07:51

From: Chris Sequeira <nav2 AT flash DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Optimization help needed
Date: Sun, 08 Jun 1997 18:21:22 -0500
Organization: BlackHawk Software
Lines: 29
Message-ID: <339B3E72.4FE@flash.net>
Reply-To: nav2 AT flash DOT net
NNTP-Posting-Host: tc1-48.flash.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I got Justin Frankel's Plush 3D library to work with Allegro graphics
modes.  Now I can run it at high resolutions, such as 360 x 480 Mode-X
and the like.  Only one problem:  the Plush framebuffer and Allegro
memory bitmaps are created with incompatible data types.  The Plush
framebuffer is pure characters;  the Allegro bitmap is of type BITMAP. 
So, every frame, I have to call this function to copy the pixel values
to the Allegro bitmap:

// copies pure framebuffer values to allegro's bitmap
// DARN SLOW!!!!!!!!!!!!!!!!!!!!!!!
static void copy2bit(char *framebuffer, BITMAP *bitmap) {
  static int x, y, value;

  for (x = 0; x < W; x++) {
	for (y = 0; y < H; y++) {  
	  value = W*y+x;
	  bitmap->line[y][x] = framebuffer[value];
	}
  }

  return;
}

It has to copy W * H (in this case, 360*480) pixels every frame. 
Needless to say, it's not fast stuff.  I don't know how to get around
this, so I need to optimize it.  Unfortunately, I don't know any
assembly language.  Can anybody help with this?
-- 
From Chris Sequeira (nav2 AT flash DOT net)

- Raw text -


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