delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/01/01:40:06

From: "Chia" <chia AT top DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: stretch_blit crash
Date: Sat, 31 Jan 1998 21:28:42 -0600
Organization: Home
Lines: 47
Message-ID: <6b0q66$3la@nnrp3.farm.idt.net>
NNTP-Posting-Host: pm1-1.top.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

This is a little weird...  allegro 3.0 problem.

I've got a bitmap which is 800 pixels wide and 16 high.  It was intended to
be kind of like if you're in windows and you look at the top of a window and
there's like a bar with the minimize, close, icon, and title on it or
whatever.  Anyway, so I've got this bitmap and I've got my window.display()
function for the GUI I'm developing.

Anyways, I create "mBmp", a memory bitmap where the fade bar is drawn and
then the title and whatever else is on the menu bar.  Then, I go to
stretch_blit() the fade bar bitmap across onto that mBmp.  This gives me the
correct size so my fade bar will look consistent on all windows.

The program compiles fine, but when it gets to the window.display()
function, allegro crashed with a SIGSEV error or something.

I traced the problem back to the stretch_blit() function.  When I
comment-out the stretch_blit, it works just fine (except of course I don't
get the fade bar), and when I replaced the stretch_blit() with a normal blit
it also worked fine.

So, does anyone have any ideas on why this would happen?  Here's the
function:
class window {
 [...]
  void display(BITMAP *dest) {
    BITMAP *wBmp, *mBmp, *fade;
    wBmp = create_bitmap(w, h);
    mBmp = create_bitmap(w, 16);
    fade = (BITMAP *)jGuiDat[windowbar].dat;
 //    stretch_blit(fade, mBmp, 0, 0, fade->w, fade->h, 0, 0, mBmp->w,
mBmp->h);
      textout(mBmp, font, title, TITLE_X, TITLE_Y, C_WHITE);
     if (icon != NULL) draw_sprite(mBmp, icon, (TITLE_X - 20), (TITLE_Y -
2));
     panel->display(wBmp, 0, 16);
     menu->display(mBmp, (text_length(font, title) + 50), 0);
     blit(mBmp, wBmp, 0, 0, 0, 0, mBmp->w, mBmp->h);
     vsync();
     blit(wBmp, dest, 0, 0, x, y, wBmp->w, wBmp->h);
   }
 [...]
};

And the stretch_blit is the only thing that crashes it.  Any ideas?  Thanks!


- Raw text -


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