Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!snorkelwacker.mit.edu!ira.uka.de!fauern!faui43.informatik.uni-erlangen.de!csbrod From: csbrod@immd4.informatik.uni-erlangen.de (Claus Brod) Newsgroups: comp.sys.atari.st Subject: Re: vro_cpyfmt() blues Keywords: ATARI ST, GEM, VDI, C Message-ID: <1991May21.122304.2302@informatik.uni-erlangen.de> Date: 21 May 91 12:23:04 GMT References: <1991May21.104617.26475@informatik.uni-erlangen.de> Organization: CSD., University of Erlangen, Germany Lines: 59 lsmichae@immd4.informatik.uni-erlangen.de (Lars Michael) writes: >VOID copy_block(dest_adr, src_adr, x, y, w, h) > BYTE *dest_adr; > BYTE *src_adr; > WORD x, y, w, h; > >{ WORD line; > MFDB dest_mfdb; > MFDB src_mfdb; > WORD pxyarray[8]; > > line = (Getrez()==2)?80:160; /* get number of Words in scanline */ Using Getrez() here is a major sin. You can calculate them from work_out[0], and you can even forget about these parameters if you use the method suggested below. > src_mfdb.fd_addr = src_adr; > src_mfdb.fd_w = work_out[0]+1; > src_mfdb.fd_h = work_out[1]+1; > src_mfdb.fd_wdwidth = line; > src_mfdb.fd_stand = 0; /* use device specific format */ > src_mfdb.fd_nplanes = 4>>Getrez(); Again, this is a SIN. > pxyarray[0] = x; > pxyarray[1] = y; > pxyarray[2] = x+w+3; > pxyarray[3] = y+h+3; > dest_mfdb = src_mfdb; /* dest_mfdb is identical .. */ > dest_mfdb.fd_addr = dest_adr; /* except the address */ > pxyarray[4] = x; > pxyarray[5] = y; > pxyarray[6] = x+w+3; > pxyarray[7] = y+h+3; > (VOID) v_hide_c(VdiHandle); > vro_cpyfm(VdiHandle, 3, pxyarray, &src_mfdb, &dest_mfdb); > (VOID) v_show_c(VdiHandle, 0); >} >The routine will be entered by a call like >copy_block(Logbase(), temp, xdial, ydial, wdial, hdial); Don't use Logbase() in a VDI context. Just use 0L as a pointer to the current screen. VDI will automatically convert this to the actual address needed and will even fill in the word width and plane count parameters in the MFDB automatically! ---------------------------------------------------------------------- Claus Brod, Am Felsenkeller 2, Things. Take. Time. D-8772 Marktheidenfeld, Germany (Piet Hein) csbrod@medusa.informatik.uni-erlangen.de Claus Brod@wue.maus.de ----------------------------------------------------------------------