1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-15 07:54:13 +00:00
Interlisp.maiko/src/bitblt.c
Nick Briggs 0ad69fc6fe Create a new inc/xxxdefs.h for each src/xxx.c containing appropriate function prototypes.
This also involves removing unnecessary forward declarations, inserting
       includes for all cross-file function references, making some definitions
       static if they are not otherwise used, correcting errors that were exposed
       by having correct prototypes.

	new file:   inc/allocmdsdefs.h
	new file:   inc/arith2defs.h
	new file:   inc/arith3defs.h
	new file:   inc/arith4defs.h
	new file:   inc/array2defs.h
	new file:   inc/array3defs.h
	new file:   inc/array4defs.h
	new file:   inc/array5defs.h
	new file:   inc/array6defs.h
	new file:   inc/arraydefs.h
	new file:   inc/bbtsubdefs.h
	new file:   inc/bindefs.h
	new file:   inc/bindsdefs.h
	new file:   inc/bitbltdefs.h
	new file:   inc/bltdefs.h
	new file:   inc/byteswapdefs.h
	new file:   inc/car-cdrdefs.h
	new file:   inc/chardevdefs.h
	new file:   inc/commondefs.h
	new file:   inc/conspagedefs.h
	new file:   inc/dbgtooldefs.h
	new file:   inc/dirdefs.h
	new file:   inc/drawdefs.h
	new file:   inc/dskdefs.h
	new file:   inc/dspifdefs.h
	new file:   inc/dspsubrsdefs.h
	new file:   inc/eqfdefs.h
	new file:   inc/etherdefs.h
	new file:   inc/findkeydefs.h
	new file:   inc/fpdefs.h
	new file:   inc/fvardefs.h
	new file:   inc/gc2defs.h
	new file:   inc/gcarraydefs.h
	new file:   inc/gccodedefs.h
	new file:   inc/gcdefs.h
	new file:   inc/gcfinaldefs.h
	new file:   inc/gchtfinddefs.h
	new file:   inc/gcmain3defs.h
	new file:   inc/gcoflowdefs.h
	new file:   inc/gcrcelldefs.h
	new file:   inc/gcrdefs.h
	new file:   inc/gcscandefs.h
	new file:   inc/gvar2defs.h
	new file:   inc/hacksdefs.h
	new file:   inc/hardrtndefs.h
	new file:   inc/inetdefs.h
	new file:   inc/initdspdefs.h
	new file:   inc/initkbddefs.h
	new file:   inc/initsoutdefs.h
	modified:   inc/inlineC.h
	new file:   inc/intcalldefs.h
	new file:   inc/kbdsubrsdefs.h
	new file:   inc/keyeventdefs.h
	new file:   inc/keylibdefs.h
	new file:   inc/kprintdefs.h
	new file:   inc/ldsoutdefs.h
	new file:   inc/lineblt8defs.h
	new file:   inc/lisp2cdefs.h
	modified:   inc/lispemul.h
	new file:   inc/llcolordefs.h
	new file:   inc/llstkdefs.h
	modified:   inc/lnk-inlineC.h
	new file:   inc/loopsopsdefs.h
	new file:   inc/lowlev1defs.h
	new file:   inc/lowlev2defs.h
	new file:   inc/lsthandldefs.h
	new file:   inc/maindefs.h
	new file:   inc/misc7defs.h
	new file:   inc/miscndefs.h
	new file:   inc/mkatomdefs.h
	new file:   inc/mkcelldefs.h
	new file:   inc/mvsdefs.h
	new file:   inc/osmsgdefs.h
	new file:   inc/perrnodefs.h
	new file:   inc/returndefs.h
	new file:   inc/rpcdefs.h
	new file:   inc/rplconsdefs.h
	new file:   inc/shiftdefs.h
	new file:   inc/storagedefs.h
	new file:   inc/subr0374defs.h
	new file:   inc/subrdefs.h
	new file:   inc/sxhashdefs.h
	new file:   inc/testtooldefs.h
	new file:   inc/timerdefs.h
	new file:   inc/typeofdefs.h
	new file:   inc/ubf1defs.h
	new file:   inc/ubf2defs.h
	new file:   inc/ubf3defs.h
	new file:   inc/ufsdefs.h
	new file:   inc/unixcommdefs.h
	new file:   inc/unwinddefs.h
	new file:   inc/uraiddefs.h
	new file:   inc/usrsubrdefs.h
	new file:   inc/uutilsdefs.h
	new file:   inc/vars3defs.h
	new file:   inc/vmemsavedefs.h
	new file:   inc/xbbtdefs.h
	new file:   inc/xcdefs.h
	new file:   inc/xcursordefs.h
	new file:   inc/xinitdefs.h
	new file:   inc/xlspwindefs.h
	new file:   inc/xmkicondefs.h
	new file:   inc/xrdoptdefs.h
	new file:   inc/xscrolldefs.h
	new file:   inc/xwinmandefs.h
	new file:   inc/z2defs.h
	modified:   src/allocmds.c
	modified:   src/arith2.c
	modified:   src/arith3.c
	modified:   src/arith4.c
	modified:   src/array.c
	modified:   src/array2.c
	modified:   src/array3.c
	modified:   src/array4.c
	modified:   src/array5.c
	modified:   src/array6.c
	modified:   src/bbtsub.c
	modified:   src/bin.c
	modified:   src/binds.c
	modified:   src/bitblt.c
	modified:   src/blt.c
	modified:   src/byteswap.c
	modified:   src/car-cdr.c
	modified:   src/chardev.c
	modified:   src/common.c
	modified:   src/conspage.c
	modified:   src/dbgtool.c
	modified:   src/dir.c
	modified:   src/draw.c
	modified:   src/dsk.c
	modified:   src/dspif.c
	modified:   src/dspsubrs.c
	modified:   src/eqf.c
	modified:   src/ether.c
	modified:   src/findkey.c
	modified:   src/foreign.c
	modified:   src/fp.c
	modified:   src/fvar.c
	modified:   src/gc.c
	modified:   src/gc2.c
	modified:   src/gcarray.c
	modified:   src/gccode.c
	modified:   src/gcfinal.c
	modified:   src/gchtfind.c
	modified:   src/gcmain3.c
	modified:   src/gcoflow.c
	modified:   src/gcr.c
	modified:   src/gcrcell.c
	modified:   src/gcscan.c
	modified:   src/gvar2.c
	modified:   src/hacks.c
	modified:   src/hardrtn.c
	modified:   src/inet.c
	modified:   src/initdsp.c
	modified:   src/initkbd.c
	modified:   src/initsout.c
	modified:   src/intcall.c
	modified:   src/kbdsubrs.c
	modified:   src/keyevent.c
	modified:   src/keylib.c
	modified:   src/kprint.c
	modified:   src/ldsout.c
	modified:   src/lineblt8.c
	modified:   src/lisp2c.c
	modified:   src/llcolor.c
	modified:   src/llstk.c
	modified:   src/loopsops.c
	modified:   src/lowlev1.c
	modified:   src/lowlev2.c
	modified:   src/lsthandl.c
	modified:   src/main.c
	modified:   src/misc7.c
	modified:   src/miscn.c
	modified:   src/mkatom.c
	modified:   src/mkcell.c
	modified:   src/mvs.c
	modified:   src/osmsg.c
	modified:   src/perrno.c
	modified:   src/return.c
	modified:   src/rpc.c
	modified:   src/rplcons.c
	modified:   src/setsout.c
	modified:   src/shift.c
	modified:   src/storage.c
	modified:   src/subr.c
	modified:   src/subr0374.c
	modified:   src/sxhash.c
	modified:   src/testtool.c
	modified:   src/timer.c
	modified:   src/truecolor.c
	modified:   src/tstsout.c
	modified:   src/typeof.c
	modified:   src/ubf1.c
	modified:   src/ubf2.c
	modified:   src/ubf3.c
	modified:   src/ufn.c
	modified:   src/ufs.c
	modified:   src/unixcomm.c
	modified:   src/unwind.c
	modified:   src/uraid.c
	modified:   src/usrsubr.c
	modified:   src/uutils.c
	modified:   src/vars3.c
	modified:   src/vmemsave.c
	modified:   src/xbbt.c
	modified:   src/xc.c
	modified:   src/xcursor.c
	modified:   src/xinit.c
	modified:   src/xlspwin.c
	modified:   src/xmkicon.c
	modified:   src/xrdopt.c
	modified:   src/xscroll.c
	modified:   src/xwinman.c
	modified:   src/z2.c
2020-09-04 18:21:44 -07:00

241 lines
6.9 KiB
C

/* $Id: bitblt.c,v 1.2 1999/01/03 02:06:47 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
static char *id = "$Id: bitblt.c,v 1.2 1999/01/03 02:06:47 sybalsky Exp $ Copyright (C) Venue";
/************************************************************************/
/* */
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
#include "version.h"
#include <stdio.h>
#ifndef NOPIXRECT
#ifndef DOS
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#include <suntool/sunview.h>
#include <sunwindow/cms_mono.h>
#include <suntool/canvas.h>
#include <sys/ioctl.h>
#endif /* DOS */
#include <signal.h>
#endif
#ifdef XWINDOW
#define DISPLAYBUFFER
#endif /* XWINDOW */
#include "lispemul.h"
#include "lspglob.h"
#include "lispmap.h"
#include "adr68k.h"
#include "address.h"
#include "pilotbbt.h"
#include "display.h"
#include "bitblt.h"
#include "bb.h"
#include "bitbltdefs.h"
#include "initdspdefs.h"
#ifdef DOS
#include "devif.h"
#include "iopage.h"
extern DspInterface currentdsp;
extern IOPAGE *IOPage68K;
#endif
extern int LispWindowFd;
extern int ScreenLocked;
extern int kbd_for_makeinit;
#ifdef COLOR
extern int MonoOrColor;
#endif /* COLOR */
/*****************************************************************************/
/** **/
/** N_OP_pilotbitblt **/
/** **/
/** The Native-code compatible version of the opcode for bitblt. **/
/** **/
/** **/
/*****************************************************************************/
LispPTR N_OP_pilotbitblt(LispPTR pilot_bt_tbl,int tos)
{
PILOTBBT *pbt;
DLword *srcbase, *dstbase;
int displayflg;
int sx, dx, w, h, srcbpl, dstbpl, backwardflg;
int src_comp, op, gray, num_gray, curr_gray_line;
#ifdef INIT
/* for init, we have to initialize the pointers at the
first call to pilotbitblt or we die. If we do it
earlier we die also. We set a new flag so we don't
do it more than once which is a lose also.
I put this in an ifdef so there won't be any extra
code when making a regular LDE. */
if (!kbd_for_makeinit) {
init_keyboard(0);
kbd_for_makeinit = 1;
};
#endif
pbt = (PILOTBBT *)Addr68k_from_LADDR(pilot_bt_tbl);
w = pbt->pbtwidth;
h = pbt->pbtheight;
if ((h <= 0) || (w <= 0)) return (pilot_bt_tbl);
dx = pbt->pbtdestbit;
sx = pbt->pbtsourcebit;
backwardflg = pbt->pbtbackward;
/* if displayflg != 0 then source or destination is DisplayBitMap */
#ifdef DOS
currentdsp->device.locked++;
#else
ScreenLocked = T;
#endif /* DOS */
#if SUNDISPLAY || DOS
displayflg = cursorin(pbt->pbtdesthi, (pbt->pbtdestlo + (dx >> 4)), w, h, backwardflg) ||
cursorin(pbt->pbtsourcehi, (pbt->pbtsourcelo + (sx >> 4)), w, h, backwardflg);
#endif /* SUNDISPLAY */
srcbase = (DLword *)Addr68k_from_LADDR(VAG2(pbt->pbtsourcehi, pbt->pbtsourcelo));
dstbase = (DLword *)Addr68k_from_LADDR(VAG2(pbt->pbtdesthi, pbt->pbtdestlo));
srcbpl = pbt->pbtsourcebpl;
dstbpl = pbt->pbtdestbpl;
src_comp = pbt->pbtsourcetype;
op = pbt->pbtoperation;
gray = pbt->pbtusegray;
num_gray = ((TEXTUREBBT *)pbt)->pbtgrayheightlessone + 1;
curr_gray_line = ((TEXTUREBBT *)pbt)->pbtgrayoffset;
#ifdef SUNDISPLAY
if (displayflg) HideCursor;
#elif DOS
if (displayflg) (currentdsp->mouse_invisible)(currentdsp, IOPage68K);
;
#endif /* SUNDISPLAY / DOS */
new_bitblt_code
#ifdef SUNDISPLAY
#ifdef DISPLAYBUFFER
#ifdef COLOR
if (MonoOrColor == MONO_SCREEN)
#endif /* COLOR */
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
#endif
if (displayflg) ShowCursor;
#elif DOS
flush_display_lineregion(dx, dstbase, w, h);
if (displayflg) (currentdsp->mouse_visible)(IOPage68K->dlmousex, IOPage68K->dlmousey);
#endif /* SUNDISPLAY / DOS */
#ifdef XWINDOW
flush_display_lineregion(dx, dstbase, w, h);
#endif /* XWINDOW */
#ifdef DOS
currentdsp->device.locked--;
#else
ScreenLocked = NIL;
#endif /* DOS */
return (pilot_bt_tbl);
} /* end of N_OP_pilotbitblt */
/************************************************************************/
/* */
/* c u r s o r i n */
/* */
/* */
/* */
/************************************************************************/
#ifndef COLOR
/* for MONO only */
int cursorin(DLword addrhi, DLword addrlo, int w, int h, int backward)
{
register int x, y;
if (addrhi == DISPLAY_HI) {
y = addrlo / DisplayRasterWidth;
x = (addrlo - y * DisplayRasterWidth) << 4;
} else if (addrhi == DISPLAY_HI + 1) {
y = (addrlo + DLWORDSPER_SEGMENT) / DisplayRasterWidth;
x = ((addrlo + DLWORDSPER_SEGMENT) - y * DisplayRasterWidth) << 4;
} else
return (NIL);
if (backward) y -= h;
if ((x < MOUSEXR) && (x + w > MOUSEXL) && (y < MOUSEYH) && (y + h > MOUSEYL))
return (T);
else
return (NIL);
}
#else
/* for COLOR & MONO */
int cursorin(DLword addrhi, DLword addrlo, int w, int h, int backward)
{
register int x, y;
register DLword *base68k;
extern int MonoOrColor;
extern int displaywidth;
extern DLword *ColorDisplayRegion68k;
if (MonoOrColor == MONO_SCREEN) { /* On MONO screen */
if (addrhi == DISPLAY_HI) {
y = addrlo / DisplayRasterWidth;
x = (addrlo - y * DisplayRasterWidth) << 4;
} else if (addrhi == DISPLAY_HI + 1) {
y = (addrlo + DLWORDSPER_SEGMENT) / DisplayRasterWidth;
x = ((addrlo + DLWORDSPER_SEGMENT) - y * DisplayRasterWidth) << 4;
} else
return (NIL);
if (backward) y -= h;
if ((x < MOUSEXR) && (x + w > MOUSEXL) && (y < MOUSEYH) && (y + h > MOUSEYL))
return (T);
else
return (NIL);
} else {
base68k = (DLword *)Addr68k_from_LADDR(addrhi << 16 | addrlo);
if ((ColorDisplayRegion68k <= base68k) && (base68k <= COLOR_MAX_Address)) {
y = (base68k - ColorDisplayRegion68k) / displaywidth;
x = (UNSIGNED)(base68k - ColorDisplayRegion68k) - (y * displaywidth);
/* printf("cursorin: IN COLOR mx=%d my=%d x=%d y%d w=%d h=%d\n"
,*EmMouseX68K,*EmMouseY68K,x,y,w,h); */
} else
return (NIL);
if (backward) y -= h;
if ((x < MOUSEXR) && ((x + (w >> 3)) > MOUSEXL) && (y < MOUSEYH) &&
(y + h > MOUSEYL)) { /* printf("cursorin T\n"); */
return (T);
} else
return (NIL);
} /* on COLOR screen */
}
#endif /* COLOR */