1994-02-11 10:00:37 +03:00
|
|
|
/*
|
1994-03-30 21:24:08 +04:00
|
|
|
* $Id: ite_cc.c,v 1.12 1994/03/30 17:24:34 chopps Exp $
|
1994-02-11 10:00:37 +03:00
|
|
|
*/
|
|
|
|
|
1993-07-05 23:19:43 +04:00
|
|
|
#include "ite.h"
|
1994-01-27 00:05:34 +03:00
|
|
|
#if ! defined (NITE)
|
|
|
|
#define NITE 1
|
|
|
|
#endif
|
1993-07-05 23:19:43 +04:00
|
|
|
#if NITE > 0
|
|
|
|
|
1994-02-14 00:10:20 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/tty.h>
|
|
|
|
#include <sys/systm.h>
|
1994-03-30 21:24:08 +04:00
|
|
|
#include <sys/queue.h>
|
1994-02-17 12:10:32 +03:00
|
|
|
#include <dev/cons.h>
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1993-09-02 22:05:24 +04:00
|
|
|
#include "ite.h"
|
1994-02-14 00:10:20 +03:00
|
|
|
#include <amiga/dev/itevar.h>
|
|
|
|
#include <amiga/dev/iteioctl.h>
|
|
|
|
#include <machine/cpu.h>
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-02-14 00:10:20 +03:00
|
|
|
#include <amiga/amiga/cc.h>
|
|
|
|
#include <amiga/dev/grfabs_reg.h>
|
|
|
|
#include <amiga/dev/viewioctl.h>
|
|
|
|
#include <amiga/dev/viewvar.h>
|
|
|
|
|
|
|
|
#include <sys/termios.h>
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
extern unsigned char kernel_font_width, kernel_font_height, kernel_font_baseline;
|
|
|
|
extern short kernel_font_boldsmear;
|
1993-07-05 23:19:43 +04:00
|
|
|
extern unsigned char kernel_font_lo, kernel_font_hi;
|
|
|
|
extern unsigned char kernel_font[], kernel_cursor[];
|
|
|
|
|
1993-09-02 22:05:24 +04:00
|
|
|
/*
|
|
|
|
* This is what ip->priv points to;
|
|
|
|
* it contains local variables for custom-chip ites.
|
|
|
|
*/
|
1994-01-27 00:05:34 +03:00
|
|
|
typedef struct ite_priv {
|
|
|
|
view_t *view; /* the view for this ite. */
|
|
|
|
u_char **row_ptr; /* array of pointers into the bitmap */
|
|
|
|
u_long row_bytes;
|
|
|
|
u_long cursor_opt;
|
|
|
|
|
|
|
|
/* these are precalc'ed for the putc routine so it can be faster. */
|
|
|
|
u_int *column_offset; /* array of offsets for columns */
|
|
|
|
u_int row_offset; /* the row offset */
|
1994-02-14 00:10:20 +03:00
|
|
|
u_short width; /* the bitmap width */
|
|
|
|
u_short underline; /* where the underline goes */
|
|
|
|
u_short ft_x; /* the font width */
|
|
|
|
u_short ft_y; /* the font height */
|
1994-01-27 00:05:34 +03:00
|
|
|
u_char *font_cell[256]; /* the font pointer */
|
|
|
|
} ipriv_t;
|
1993-09-02 22:05:24 +04:00
|
|
|
|
|
|
|
extern struct itesw itesw[];
|
|
|
|
|
|
|
|
/* (M<=8)-by-N routines */
|
1994-01-27 00:05:34 +03:00
|
|
|
static void view_le32n_cursor(struct ite_softc *ip, int flag);
|
|
|
|
static void view_le8n_putc(struct ite_softc *ip, int c, int dy, int dx, int mode);
|
|
|
|
static void view_le8n_clear(struct ite_softc *ip, int sy, int sx, int h, int w);
|
|
|
|
static void view_le8n_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir);
|
1994-02-14 00:10:20 +03:00
|
|
|
void scroll_bitmap (bmap_t *bm, u_short x, u_short y, u_short width, u_short height, short dx, short dy, u_char mask);
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
|
|
|
|
/* globals */
|
|
|
|
|
|
|
|
int ite_default_x;
|
|
|
|
int ite_default_y;
|
|
|
|
int ite_default_width = 640;
|
|
|
|
|
|
|
|
#if defined (GRF_NTSC)
|
|
|
|
int ite_default_height = 400;
|
|
|
|
int ite_default_depth = 2;
|
|
|
|
#elif defined (GRF_PAL)
|
|
|
|
int ite_default_height = 512;
|
|
|
|
int ite_default_depth = 2;
|
|
|
|
#else
|
|
|
|
int ite_default_height = 400;
|
|
|
|
int ite_default_depth = 2;
|
1993-09-02 22:05:24 +04:00
|
|
|
#endif
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
/* audio bell stuff */
|
|
|
|
static char *bell_data;
|
1994-02-17 12:10:32 +03:00
|
|
|
static struct ite_bell_values bell_vals = { 10, 200, 10 };
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
cc_unblank ()
|
|
|
|
{
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
init_bell ()
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
1994-01-27 00:05:34 +03:00
|
|
|
short i;
|
|
|
|
static char sample[20] = {
|
|
|
|
0,39,75,103,121,127,121,103,75,39,0,
|
|
|
|
-39,-75,-103,-121,-127,-121,-103,-75,-39 };
|
|
|
|
|
|
|
|
if (!bell_data) {
|
|
|
|
bell_data = alloc_chipmem(20);
|
|
|
|
if (!bell_data)
|
|
|
|
return (-1);
|
|
|
|
|
|
|
|
for (i=0; i<20; i++)
|
|
|
|
bell_data[i] = sample[i];
|
|
|
|
}
|
|
|
|
return (0);
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
cc_bell ()
|
1993-09-02 22:05:24 +04:00
|
|
|
{
|
1994-01-27 00:05:34 +03:00
|
|
|
if (bell_data) {
|
|
|
|
play_sample (10, PREP_DMA_MEM(bell_data),
|
|
|
|
bell_vals.period, bell_vals.volume, 0x3, bell_vals.time);
|
|
|
|
}
|
1993-09-02 22:05:24 +04:00
|
|
|
}
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
extern struct ite_softc ite_softc[];
|
|
|
|
#define IPUNIT(ip) (((u_long)ip-(u_long)ite_softc)/sizeof(struct ite_softc))
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
int
|
|
|
|
ite_new_size (struct ite_softc *ip, struct ite_window_size *vs)
|
|
|
|
{
|
|
|
|
extern struct view_softc views[];
|
|
|
|
ipriv_t *cci = ip->priv;
|
|
|
|
u_long fbp, i;
|
|
|
|
int error;
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
error = viewioctl (IPUNIT (ip), VIEW_SETSIZE, (struct view_size *)vs, 0, -1);
|
|
|
|
cci->view = views[IPUNIT(ip)].view;
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
ip->rows = (cci->view->display.height) / ip->ftheight;
|
|
|
|
ip->cols = (cci->view->display.width-1) / ip->ftwidth; /* -1 for bold. */
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-01-30 11:28:12 +03:00
|
|
|
/* save new values so that future opens use them */
|
|
|
|
/* this may not be correct when we implement Virtual Consoles */
|
|
|
|
ite_default_height = cci->view->display.height;
|
|
|
|
ite_default_width = cci->view->display.width;
|
|
|
|
ite_default_x = cci->view->display.x;
|
|
|
|
ite_default_y = cci->view->display.y;
|
|
|
|
ite_default_depth = cci->view->bitmap->depth;
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
if (cci->row_ptr)
|
|
|
|
free_chipmem (cci->row_ptr);
|
|
|
|
if (cci->column_offset)
|
|
|
|
free_chipmem (cci->column_offset);
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-02-14 00:10:20 +03:00
|
|
|
cci->row_ptr = alloc_chipmem (sizeof (u_char *)*ip->rows);
|
1994-01-27 00:05:34 +03:00
|
|
|
cci->column_offset = alloc_chipmem (sizeof (u_int)*ip->cols);
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
if (!cci->row_ptr || !cci->column_offset) {
|
|
|
|
panic ("no memory for console device.");
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
cci->width = cci->view->bitmap->bytes_per_row << 3;
|
|
|
|
cci->underline = ip->ftbaseline + 1;
|
|
|
|
cci->row_offset = (cci->view->bitmap->bytes_per_row + cci->view->bitmap->row_mod);
|
|
|
|
cci->ft_x = ip->ftwidth;
|
|
|
|
cci->ft_y = ip->ftheight;
|
|
|
|
|
|
|
|
cci->row_bytes = cci->row_offset * ip->ftheight;
|
|
|
|
|
|
|
|
/* initialize the row pointers */
|
|
|
|
cci->row_ptr[0] = VDISPLAY_LINE (cci->view, 0, 0);
|
|
|
|
for (i = 1; i < ip->rows; i++)
|
|
|
|
cci->row_ptr[i] = cci->row_ptr[i-1] + cci->row_bytes;
|
|
|
|
|
|
|
|
/* initialize the column offsets */
|
|
|
|
cci->column_offset[0] = 0;
|
|
|
|
for (i = 1; i < ip->cols; i++)
|
|
|
|
cci->column_offset[i] = cci->column_offset[i-1] + cci->ft_x;
|
|
|
|
|
|
|
|
/* initialize the font cell pointers */
|
|
|
|
cci->font_cell[ip->font_lo] = ip->font;
|
|
|
|
for (i=ip->font_lo+1; i<=ip->font_hi; i++)
|
|
|
|
cci->font_cell[i] = cci->font_cell[i-1] + ip->ftheight;
|
|
|
|
|
|
|
|
return (error);
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
|
|
|
|
1994-02-17 12:10:32 +03:00
|
|
|
/*
|
|
|
|
* view_cnprobe is called when the console is being initialized
|
|
|
|
* i.e. very early. grfconfig() has been called, so this implies
|
|
|
|
* that grfcc_probe() was called as well as view_config() (in view.c)
|
|
|
|
* if we are functioning view_inited will be true.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
|
|
|
view_cnprobe(min)
|
|
|
|
int min;
|
|
|
|
{
|
|
|
|
extern int view_inited; /* in view.c */
|
|
|
|
return (view_inited ? CN_INTERNAL : CN_DEAD);
|
|
|
|
}
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-02-17 12:10:32 +03:00
|
|
|
void
|
|
|
|
view_init(ip)
|
1993-07-05 23:19:43 +04:00
|
|
|
register struct ite_softc *ip;
|
|
|
|
{
|
1994-01-27 00:05:34 +03:00
|
|
|
struct itesw *sp = itesw;
|
|
|
|
ipriv_t *cci = ip->priv;
|
|
|
|
struct ite_window_size vs;
|
|
|
|
|
|
|
|
init_bell ();
|
|
|
|
|
|
|
|
if (!cci) {
|
|
|
|
ip->font = kernel_font;
|
|
|
|
ip->font_lo = kernel_font_lo;
|
|
|
|
ip->font_hi = kernel_font_hi;
|
|
|
|
ip->ftwidth = kernel_font_width;
|
|
|
|
ip->ftheight = kernel_font_height;
|
|
|
|
ip->ftbaseline = kernel_font_baseline;
|
|
|
|
ip->ftboldsmear = kernel_font_boldsmear;
|
|
|
|
|
|
|
|
/* Find the correct set of rendering routines for this font. */
|
|
|
|
if (ip->ftwidth <= 8) {
|
|
|
|
sp->ite_cursor = (void*)view_le32n_cursor;
|
|
|
|
sp->ite_putc = (void*)view_le8n_putc;
|
|
|
|
sp->ite_clear = (void*)view_le8n_clear;
|
|
|
|
sp->ite_scroll = (void*)view_le8n_scroll;
|
|
|
|
} else {
|
|
|
|
panic("kernel font size not supported");
|
|
|
|
}
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
cci = alloc_chipmem (sizeof (*cci));
|
|
|
|
if (!cci) {
|
|
|
|
panic ("no memory for console device.");
|
|
|
|
}
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
ip->priv = cci;
|
|
|
|
cci->cursor_opt = 0;
|
|
|
|
cci->view = NULL;
|
|
|
|
cci->row_ptr = NULL;
|
|
|
|
cci->column_offset = NULL;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* currently the view is permanently open due to grf driver */
|
|
|
|
if (viewopen (IPUNIT(ip), 0)) {
|
|
|
|
panic ("cannot get ahold of our view");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
vs.x = ite_default_x;
|
|
|
|
vs.y = ite_default_y;
|
|
|
|
vs.width = ite_default_width;
|
|
|
|
vs.height = ite_default_height;
|
|
|
|
vs.depth = ite_default_depth;
|
|
|
|
|
|
|
|
ite_new_size (ip, &vs);
|
|
|
|
XXX_grf_cc_on (IPUNIT (ip));
|
|
|
|
/* viewioctl (IPUNIT(ip), VIEW_DISPLAY, NULL, 0, -1); */
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
int
|
1994-02-11 08:02:36 +03:00
|
|
|
ite_grf_ioctl (ip, cmd, addr, flag, p)
|
|
|
|
struct ite_softc *ip;
|
|
|
|
caddr_t addr;
|
|
|
|
struct proc *p;
|
1994-01-27 00:05:34 +03:00
|
|
|
{
|
|
|
|
int error = 0;
|
|
|
|
struct ite_window_size *is;
|
|
|
|
struct ite_bell_values *ib;
|
|
|
|
ipriv_t *cci = ip->priv;
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case ITE_GET_WINDOW_SIZE:
|
|
|
|
is = (struct ite_window_size *)addr;
|
|
|
|
is->x = cci->view->display.x;
|
|
|
|
is->y = cci->view->display.y;
|
|
|
|
is->width = cci->view->display.width;
|
|
|
|
is->height = cci->view->display.height;
|
|
|
|
is->depth = cci->view->bitmap->depth;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ITE_SET_WINDOW_SIZE:
|
|
|
|
is = (struct ite_window_size *)addr;
|
|
|
|
|
|
|
|
if (ite_new_size (ip, is)) {
|
|
|
|
error = ENOMEM;
|
|
|
|
} else {
|
|
|
|
struct winsize ws;
|
|
|
|
ws.ws_row = ip->rows;
|
|
|
|
ws.ws_col = ip->cols;
|
|
|
|
ws.ws_xpixel = cci->view->display.width;
|
|
|
|
ws.ws_ypixel = cci->view->display.height;
|
|
|
|
ite_reset (ip);
|
|
|
|
/* XXX tell tty about the change *and* the process group should */
|
|
|
|
/* XXX be signalled---this is messy, but works nice :^) */
|
1994-02-17 12:10:32 +03:00
|
|
|
iteioctl (0, TIOCSWINSZ, (caddr_t)&ws, 0, p);
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ITE_DISPLAY_WINDOW:
|
|
|
|
XXX_grf_cc_on (IPUNIT (ip));
|
|
|
|
/* viewioctl (IPUNIT(ip), VIEW_DISPLAY, NULL, 0, -1); */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ITE_REMOVE_WINDOW:
|
|
|
|
XXX_grf_cc_off (IPUNIT (ip));
|
|
|
|
/* viewioctl (IPUNIT(ip), VIEW_REMOVE, NULL, 0, -1); */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ITE_GET_BELL_VALUES:
|
|
|
|
ib = (struct ite_bell_values *)addr;
|
|
|
|
bcopy (&bell_vals, ib, sizeof (struct ite_bell_values));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ITE_SET_BELL_VALUES:
|
|
|
|
ib = (struct ite_bell_values *)addr;
|
|
|
|
bcopy (ib, &bell_vals, sizeof (struct ite_bell_values));
|
|
|
|
break;
|
|
|
|
case VIEW_USECOLORMAP:
|
|
|
|
case VIEW_GETCOLORMAP:
|
|
|
|
/* XXX needs to be fixed when multiple console implemented. */
|
|
|
|
/* XXX watchout for that -1 its not really the kernel talking. */
|
|
|
|
/* XXX these two commands don't use the proc pointer though. */
|
|
|
|
error = viewioctl (0, cmd, addr, flag, -1);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error = -1;
|
|
|
|
break;
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1994-02-17 12:10:32 +03:00
|
|
|
void
|
|
|
|
view_deinit(ip)
|
1994-01-27 00:05:34 +03:00
|
|
|
struct ite_softc *ip;
|
|
|
|
{
|
|
|
|
ip->flags &= ~ITE_INITED;
|
|
|
|
/* FIX: free our stuff. */
|
|
|
|
if (ip->priv) {
|
|
|
|
ipriv_t *cci = ip->priv;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* view stays open permanently */
|
|
|
|
if (cci->view) {
|
|
|
|
viewclose (IPUNIT(ip));
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
1994-01-30 11:28:12 +03:00
|
|
|
#endif
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
/* well at least turn it off. */
|
|
|
|
XXX_grf_cc_off (IPUNIT (ip));
|
|
|
|
/* viewioctl (IPUNIT(ip), VIEW_REMOVE, NULL, 0, -1); */
|
|
|
|
|
|
|
|
if (cci->row_ptr)
|
|
|
|
free_chipmem (cci->row_ptr);
|
|
|
|
if (cci->column_offset)
|
|
|
|
free_chipmem (cci->column_offset);
|
|
|
|
|
|
|
|
free_chipmem (cci);
|
|
|
|
ip->priv = NULL;
|
|
|
|
}
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
/*** (M<8)-by-N routines ***/
|
|
|
|
|
1993-09-02 22:05:24 +04:00
|
|
|
static void
|
1994-01-27 00:05:34 +03:00
|
|
|
view_le32n_cursor(struct ite_softc *ip, int flag)
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
1994-01-27 00:05:34 +03:00
|
|
|
ipriv_t *cci = (ipriv_t *) ip->priv;
|
|
|
|
view_t *v = cci->view;
|
|
|
|
bmap_t *bm = v->bitmap;
|
|
|
|
int dr_plane = (bm->depth > 1 ? bm->depth-1 : 0);
|
|
|
|
int cend, ofs, h, cstart;
|
|
|
|
unsigned char opclr, opset;
|
|
|
|
u_char *pl;
|
|
|
|
|
|
|
|
if (flag == START_CURSOROPT) {
|
|
|
|
if (!cci->cursor_opt) {
|
|
|
|
view_le32n_cursor (ip, ERASE_CURSOR);
|
|
|
|
}
|
|
|
|
cci->cursor_opt++;
|
|
|
|
return; /* if we are already opted. */
|
|
|
|
} else if (flag == END_CURSOROPT) {
|
|
|
|
cci->cursor_opt--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cci->cursor_opt)
|
|
|
|
return; /* if we are still nested. */
|
|
|
|
/* else we draw the cursor. */
|
|
|
|
|
|
|
|
cstart = 0;
|
|
|
|
cend = ip->ftheight-1;
|
|
|
|
pl = VDISPLAY_LINE (v, dr_plane, (ip->cursory*ip->ftheight+cstart));
|
|
|
|
ofs = (ip->cursorx * ip->ftwidth);
|
|
|
|
|
|
|
|
/* erase cursor */
|
|
|
|
if (flag != DRAW_CURSOR && flag != END_CURSOROPT) {
|
|
|
|
/* erase the cursor */
|
|
|
|
int h;
|
|
|
|
if (dr_plane) {
|
|
|
|
for (h = cend; h >= 0; h--) {
|
|
|
|
asm("bfclr %0@{%1:%2}"
|
|
|
|
: : "a" (pl), "d" (ofs), "d" (ip->ftwidth));
|
|
|
|
pl += cci->row_offset;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (h = cend; h >= 0; h--) {
|
|
|
|
asm("bfchg %0@{%1:%2}"
|
|
|
|
: : "a" (pl), "d" (ofs), "d" (ip->ftwidth));
|
|
|
|
pl += cci->row_offset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((flag == DRAW_CURSOR || flag == MOVE_CURSOR || flag == END_CURSOROPT)) {
|
|
|
|
|
|
|
|
ip->cursorx = MIN(ip->curx, ip->cols-1);
|
|
|
|
ip->cursory = ip->cury;
|
|
|
|
cstart = 0;
|
|
|
|
cend = ip->ftheight-1;
|
|
|
|
pl = VDISPLAY_LINE (v, dr_plane, (ip->cursory*ip->ftheight+cstart));
|
|
|
|
ofs = (ip->cursorx * ip->ftwidth);
|
|
|
|
|
|
|
|
/* draw the cursor */
|
|
|
|
if (dr_plane) {
|
|
|
|
for (h = cend; h >= 0; h--) {
|
|
|
|
asm("bfset %0@{%1:%2}"
|
|
|
|
: : "a" (pl), "d" (ofs), "d" (ip->ftwidth));
|
|
|
|
pl += cci->row_offset;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (h = cend; h >= 0; h--) {
|
|
|
|
asm("bfchg %0@{%1:%2}"
|
|
|
|
: : "a" (pl), "d" (ofs), "d" (ip->ftwidth));
|
|
|
|
pl += cci->row_offset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
static inline
|
|
|
|
int expbits (int data)
|
|
|
|
{
|
|
|
|
int i, nd = 0;
|
|
|
|
if (data & 1) {
|
|
|
|
nd |= 0x02;
|
|
|
|
}
|
|
|
|
for (i=1; i < 32; i++) {
|
|
|
|
if (data & (1 << i)) {
|
|
|
|
nd |= 0x5 << (i-1);
|
|
|
|
}
|
1993-09-02 22:05:24 +04:00
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
nd &= ~data;
|
|
|
|
return (~nd);
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
/* Notes: optimizations given the kernel_font_(width|height) #define'd.
|
|
|
|
* the dbra loops could be elminated and unrolled using height,
|
|
|
|
* the :width in the bfxxx instruction could be made immediate instead
|
|
|
|
* of a data register as it now is.
|
|
|
|
* the underline could be added when the loop is unrolled
|
|
|
|
*
|
|
|
|
* It would look like hell but be very fast.*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
putc_nm (cci,p,f,co,ro,fw,fh)
|
|
|
|
register ipriv_t *cci;
|
|
|
|
register u_char *p;
|
|
|
|
register u_char *f;
|
|
|
|
register u_int co;
|
|
|
|
register u_int ro;
|
|
|
|
register u_int fw;
|
|
|
|
register u_int fh;
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
1994-01-27 00:05:34 +03:00
|
|
|
while (fh--) {
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (*f++), "a" (p), "d" (co), "d" (fw));
|
|
|
|
p += ro;
|
|
|
|
}
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
static void
|
|
|
|
putc_in (cci,p,f,co,ro,fw,fh)
|
|
|
|
register ipriv_t *cci;
|
|
|
|
register u_char *p;
|
|
|
|
register u_char *f;
|
|
|
|
register u_int co;
|
|
|
|
register u_int ro;
|
|
|
|
register u_int fw;
|
|
|
|
register u_int fh;
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
1994-01-27 00:05:34 +03:00
|
|
|
while (fh--) {
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (~(*f++)), "a" (p), "d" (co), "d" (fw));
|
|
|
|
p += ro;
|
|
|
|
}
|
|
|
|
}
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
static void
|
|
|
|
putc_ul (cci,p,f,co,ro,fw,fh)
|
|
|
|
register ipriv_t *cci;
|
|
|
|
register u_char *p;
|
|
|
|
register u_char *f;
|
|
|
|
register u_int co;
|
|
|
|
register u_int ro;
|
|
|
|
register u_int fw;
|
|
|
|
register u_int fh;
|
|
|
|
{
|
|
|
|
int underline = cci->underline;
|
|
|
|
while (underline--) {
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (*f++), "a" (p), "d" (co), "d" (fw));
|
|
|
|
p += ro;
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (expbits(*f++)), "a" (p), "d" (co), "d" (fw));
|
|
|
|
p += ro;
|
|
|
|
|
|
|
|
underline = fh - cci->underline - 1;
|
|
|
|
while (underline--) {
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (*f++), "a" (p), "d" (co), "d" (fw));
|
|
|
|
p += ro;
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
1993-09-02 22:05:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
static void
|
|
|
|
putc_ul_in (cci,p,f,co,ro,fw,fh)
|
|
|
|
register ipriv_t *cci;
|
|
|
|
register u_char *p;
|
|
|
|
register u_char *f;
|
|
|
|
register u_int co;
|
|
|
|
register u_int ro;
|
|
|
|
register u_int fw;
|
|
|
|
register u_int fh;
|
|
|
|
{
|
|
|
|
int underline = cci->underline;
|
|
|
|
while (underline--) {
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (~(*f++)), "a" (p), "d" (co), "d" (fw));
|
|
|
|
p += ro;
|
|
|
|
}
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (~expbits(*f++)), "a" (p), "d" (co), "d" (fw));
|
|
|
|
p += ro;
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
underline = fh - cci->underline - 1;
|
|
|
|
while (underline--) {
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (~(*f++)), "a" (p), "d" (co), "d" (fw));
|
|
|
|
p += ro;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bold */
|
|
|
|
static void
|
|
|
|
putc_bd (cci,p,f,co,ro,fw,fh)
|
|
|
|
register ipriv_t *cci;
|
|
|
|
register u_char *p;
|
|
|
|
register u_char *f;
|
|
|
|
register u_int co;
|
|
|
|
register u_int ro;
|
|
|
|
register u_int fw;
|
|
|
|
register u_int fh;
|
1993-09-02 22:05:24 +04:00
|
|
|
{
|
1994-02-14 00:10:20 +03:00
|
|
|
u_short ch;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
while (fh--) {
|
|
|
|
ch = *f++;
|
|
|
|
ch |= ch << 1;
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (ch), "a" (p), "d" (co), "d" (fw+1));
|
|
|
|
p += ro;
|
|
|
|
}
|
|
|
|
}
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
static void
|
|
|
|
putc_bd_in (cci,p,f,co,ro,fw,fh)
|
|
|
|
register ipriv_t *cci;
|
|
|
|
register u_char *p;
|
|
|
|
register u_char *f;
|
|
|
|
register u_int co;
|
|
|
|
register u_int ro;
|
|
|
|
register u_int fw;
|
|
|
|
register u_int fh;
|
|
|
|
{
|
1994-02-14 00:10:20 +03:00
|
|
|
u_short ch;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
while (fh--) {
|
|
|
|
ch = *f++;
|
|
|
|
ch |= ch << 1;
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (~(ch)), "a" (p), "d" (co), "d" (fw+1));
|
|
|
|
p += ro;
|
|
|
|
}
|
|
|
|
}
|
1993-09-02 22:05:24 +04:00
|
|
|
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
static void
|
|
|
|
putc_bd_ul (cci,p,f,co,ro,fw,fh)
|
|
|
|
register ipriv_t *cci;
|
|
|
|
register u_char *p;
|
|
|
|
register u_char *f;
|
|
|
|
register u_int co;
|
|
|
|
register u_int ro;
|
|
|
|
register u_int fw;
|
|
|
|
register u_int fh;
|
|
|
|
{
|
|
|
|
int underline = cci->underline;
|
1994-02-14 00:10:20 +03:00
|
|
|
u_short ch;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
while (underline--) {
|
|
|
|
ch = *f++;
|
|
|
|
ch |= ch << 1;
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (ch), "a" (p), "d" (co), "d" (fw+1));
|
|
|
|
p += ro;
|
1993-09-02 22:05:24 +04:00
|
|
|
}
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
ch = *f++;
|
|
|
|
ch |= ch << 1;
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (expbits(ch)), "a" (p), "d" (co), "d" (fw+1));
|
|
|
|
p += ro;
|
|
|
|
|
|
|
|
underline = fh - cci->underline - 1;
|
|
|
|
while (underline--) {
|
|
|
|
ch = *f++;
|
|
|
|
ch |= ch << 1;
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (ch), "a" (p), "d" (co), "d" (fw+1));
|
|
|
|
p += ro;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
static void
|
|
|
|
putc_bd_ul_in (cci,p,f,co,ro,fw,fh)
|
|
|
|
register ipriv_t *cci;
|
|
|
|
register u_char *p;
|
|
|
|
register u_char *f;
|
|
|
|
register u_int co;
|
|
|
|
register u_int ro;
|
|
|
|
register u_int fw;
|
|
|
|
register u_int fh;
|
|
|
|
{
|
|
|
|
int underline = cci->underline;
|
1994-02-14 00:10:20 +03:00
|
|
|
u_short ch;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
while (underline--) {
|
|
|
|
ch = *f++;
|
|
|
|
ch |= ch << 1;
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (~(ch)), "a" (p), "d" (co), "d" (fw+1));
|
|
|
|
p += ro;
|
|
|
|
}
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
ch = *f++;
|
|
|
|
ch |= ch << 1;
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (~expbits(ch)), "a" (p), "d" (co), "d" (fw+1));
|
|
|
|
p += ro;
|
|
|
|
|
|
|
|
underline = fh - cci->underline - 1;
|
|
|
|
while (underline--) {
|
|
|
|
ch = *f++;
|
|
|
|
ch |= ch << 1;
|
|
|
|
asm ("bfins %0,%1@{%2:%3}" : /* no output */ :
|
|
|
|
"d" (~(ch)), "a" (p), "d" (co), "d" (fw+1));
|
|
|
|
p += ro;
|
1993-09-02 22:05:24 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
typedef void cc_putc_func ();
|
|
|
|
|
|
|
|
cc_putc_func *put_func[ATTR_ALL+1] = {
|
|
|
|
putc_nm,
|
|
|
|
putc_in,
|
|
|
|
putc_ul,
|
|
|
|
putc_ul_in,
|
|
|
|
putc_bd,
|
|
|
|
putc_bd_in,
|
|
|
|
putc_bd_ul,
|
|
|
|
putc_bd_ul_in,
|
|
|
|
/* no support for blink */
|
|
|
|
putc_nm,
|
|
|
|
putc_in,
|
|
|
|
putc_ul,
|
|
|
|
putc_ul_in,
|
|
|
|
putc_bd,
|
|
|
|
putc_bd_in,
|
|
|
|
putc_bd_ul,
|
|
|
|
putc_bd_ul_in
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* FIX: shouldn't this advance the cursor even if the character to
|
|
|
|
be output is not available in the font? -ch */
|
|
|
|
|
1993-09-02 22:05:24 +04:00
|
|
|
static void
|
1994-01-27 00:05:34 +03:00
|
|
|
view_le8n_putc(struct ite_softc *ip, int c, int dy, int dx, int mode)
|
1993-09-02 22:05:24 +04:00
|
|
|
{
|
1994-01-27 00:05:34 +03:00
|
|
|
register ipriv_t *cci = (ipriv_t *) ip->priv;
|
|
|
|
if (c < ip->font_lo || c > ip->font_hi)
|
|
|
|
return;
|
|
|
|
|
|
|
|
put_func[mode](cci,
|
|
|
|
cci->row_ptr[dy],
|
|
|
|
cci->font_cell[c],
|
|
|
|
cci->column_offset[dx],
|
|
|
|
cci->row_offset,
|
|
|
|
cci->ft_x,
|
|
|
|
cci->ft_y);
|
1993-09-02 22:05:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1994-01-27 00:05:34 +03:00
|
|
|
view_le8n_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
|
1993-09-02 22:05:24 +04:00
|
|
|
{
|
1994-01-27 00:05:34 +03:00
|
|
|
ipriv_t *cci = (ipriv_t *) ip->priv;
|
|
|
|
view_t *v = cci->view;
|
|
|
|
bmap_t *bm = cci->view->bitmap;
|
1993-09-02 22:05:24 +04:00
|
|
|
|
|
|
|
if ((sx == 0) && (w == ip->cols))
|
|
|
|
{
|
|
|
|
/* common case: clearing whole lines */
|
|
|
|
while (h--)
|
|
|
|
{
|
1994-01-27 00:05:34 +03:00
|
|
|
int i;
|
|
|
|
u_char *ptr = cci->row_ptr[sy];
|
|
|
|
for (i=0; i < ip->ftheight; i++) {
|
|
|
|
bzero(ptr, bm->bytes_per_row);
|
|
|
|
ptr += bm->bytes_per_row + bm->row_mod; /* don't get any smart
|
|
|
|
ideas, becuase this is for
|
|
|
|
interleaved bitmaps */
|
|
|
|
}
|
1993-09-02 22:05:24 +04:00
|
|
|
sy++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* clearing only part of a line */
|
|
|
|
/* XXX could be optimized MUCH better, but is it worth the trouble? */
|
|
|
|
while (h--)
|
|
|
|
{
|
1994-01-27 00:05:34 +03:00
|
|
|
u_char *pl = cci->row_ptr[sy];
|
1993-09-02 22:05:24 +04:00
|
|
|
int ofs = sx * ip->ftwidth;
|
|
|
|
int i, j;
|
|
|
|
for (i = w-1; i >= 0; i--)
|
|
|
|
{
|
|
|
|
u_char *ppl = pl;
|
|
|
|
for (j = ip->ftheight-1; j >= 0; j--)
|
|
|
|
{
|
|
|
|
asm("bfclr %0@{%1:%2}"
|
|
|
|
: : "a" (ppl), "d" (ofs), "d" (ip->ftwidth));
|
1994-01-27 00:05:34 +03:00
|
|
|
ppl += bm->row_mod + bm->bytes_per_row;
|
1993-09-02 22:05:24 +04:00
|
|
|
}
|
|
|
|
ofs += ip->ftwidth;
|
|
|
|
}
|
|
|
|
sy++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Note: sx is only relevant for SCROLL_LEFT or SCROLL_RIGHT. */
|
|
|
|
static void
|
1994-01-27 00:05:34 +03:00
|
|
|
view_le8n_scroll(ip, sy, sx, count, dir)
|
1993-09-02 22:05:24 +04:00
|
|
|
register struct ite_softc *ip;
|
|
|
|
register int sy;
|
|
|
|
int dir, sx, count;
|
|
|
|
{
|
1994-01-27 00:05:34 +03:00
|
|
|
bmap_t *bm = ((ipriv_t *)ip->priv)->view->bitmap;
|
|
|
|
u_char *pl = ((ipriv_t *)ip->priv)->row_ptr[sy];
|
|
|
|
|
1993-09-02 22:05:24 +04:00
|
|
|
if (dir == SCROLL_UP)
|
|
|
|
{
|
|
|
|
int dy = sy - count;
|
1994-01-27 00:05:34 +03:00
|
|
|
int height = ip->bottom_margin - sy + 1;
|
1993-09-02 22:05:24 +04:00
|
|
|
int i;
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
/*FIX: add scroll bitmap call */
|
|
|
|
view_le32n_cursor(ip, ERASE_CURSOR);
|
|
|
|
scroll_bitmap (bm, 0, dy*ip->ftheight,
|
|
|
|
bm->bytes_per_row >> 3, (ip->bottom_margin-dy+1)*ip->ftheight,
|
|
|
|
0, -(count*ip->ftheight), 0x1);
|
|
|
|
/* if (ip->cursory <= bot || ip->cursory >= dy) {
|
|
|
|
ip->cursory -= count;
|
|
|
|
} */
|
1993-09-02 22:05:24 +04:00
|
|
|
}
|
|
|
|
else if (dir == SCROLL_DOWN)
|
|
|
|
{
|
|
|
|
int dy = sy + count;
|
1994-01-27 00:05:34 +03:00
|
|
|
int height = ip->bottom_margin - dy + 1;
|
1993-09-02 22:05:24 +04:00
|
|
|
int i;
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
/* FIX: add scroll bitmap call */
|
|
|
|
view_le32n_cursor(ip, ERASE_CURSOR);
|
|
|
|
scroll_bitmap (bm, 0, sy*ip->ftheight,
|
|
|
|
bm->bytes_per_row >> 3, (ip->bottom_margin-sy+1)*ip->ftheight,
|
|
|
|
0, count*ip->ftheight, 0x1);
|
|
|
|
/* if (ip->cursory <= bot || ip->cursory >= sy) {
|
|
|
|
ip->cursory += count;
|
|
|
|
} */
|
1993-09-02 22:05:24 +04:00
|
|
|
}
|
|
|
|
else if (dir == SCROLL_RIGHT)
|
|
|
|
{
|
|
|
|
int sofs = (ip->cols - count) * ip->ftwidth;
|
|
|
|
int dofs = (ip->cols) * ip->ftwidth;
|
|
|
|
int i, j;
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
view_le32n_cursor(ip, ERASE_CURSOR);
|
1993-09-02 22:05:24 +04:00
|
|
|
for (j = ip->ftheight-1; j >= 0; j--)
|
|
|
|
{
|
|
|
|
int sofs2 = sofs, dofs2 = dofs;
|
|
|
|
for (i = (ip->cols - (sx + count))-1; i >= 0; i--)
|
|
|
|
{
|
|
|
|
int t;
|
|
|
|
sofs2 -= ip->ftwidth;
|
|
|
|
dofs2 -= ip->ftwidth;
|
|
|
|
asm("bfextu %1@{%2:%3},%0"
|
|
|
|
: "=d" (t)
|
|
|
|
: "a" (pl), "d" (sofs2), "d" (ip->ftwidth));
|
|
|
|
asm("bfins %3,%0@{%1:%2}"
|
|
|
|
: : "a" (pl), "d" (dofs2), "d" (ip->ftwidth), "d" (t));
|
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
pl += bm->row_mod + bm->bytes_per_row;
|
1993-09-02 22:05:24 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* SCROLL_LEFT */
|
|
|
|
{
|
|
|
|
int sofs = (sx) * ip->ftwidth;
|
|
|
|
int dofs = (sx - count) * ip->ftwidth;
|
|
|
|
int i, j;
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
view_le32n_cursor(ip, ERASE_CURSOR);
|
1993-09-02 22:05:24 +04:00
|
|
|
for (j = ip->ftheight-1; j >= 0; j--)
|
|
|
|
{
|
|
|
|
int sofs2 = sofs, dofs2 = dofs;
|
|
|
|
for (i = (ip->cols - sx)-1; i >= 0; i--)
|
|
|
|
{
|
|
|
|
int t;
|
|
|
|
asm("bfextu %1@{%2:%3},%0"
|
|
|
|
: "=d" (t)
|
|
|
|
: "a" (pl), "d" (sofs2), "d" (ip->ftwidth));
|
|
|
|
asm("bfins %3,%0@{%1:%2}"
|
|
|
|
: : "a" (pl), "d" (dofs2), "d" (ip->ftwidth), "d" (t));
|
|
|
|
sofs2 += ip->ftwidth;
|
|
|
|
dofs2 += ip->ftwidth;
|
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
pl += bm->row_mod + bm->bytes_per_row;
|
1993-09-02 22:05:24 +04:00
|
|
|
}
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
void
|
1994-02-14 00:10:20 +03:00
|
|
|
scroll_bitmap (bmap_t *bm, u_short x, u_short y, u_short width, u_short height, short dx, short dy, u_char mask)
|
1994-01-27 00:05:34 +03:00
|
|
|
{
|
1994-02-14 00:10:20 +03:00
|
|
|
u_short depth = bm->depth;
|
|
|
|
u_short lwpr = bm->bytes_per_row >> 2;
|
1994-01-27 00:05:34 +03:00
|
|
|
if (dx) {
|
|
|
|
/* FIX: */ panic ("delta x not supported in scroll bitmap yet.");
|
|
|
|
}
|
|
|
|
if (bm->flags & BMF_INTERLEAVED) {
|
|
|
|
height *= depth;
|
|
|
|
depth = 1;
|
|
|
|
}
|
|
|
|
if (dy == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (dy > 0) {
|
|
|
|
int i;
|
|
|
|
for (i=0; i < depth && mask; i++, mask >>= 1) {
|
|
|
|
if (0x1 & mask) {
|
|
|
|
u_long *pl = (u_long *)bm->plane[i];
|
|
|
|
u_long *src_y = pl + (lwpr*y);
|
|
|
|
u_long *dest_y = pl + (lwpr*(y+dy));
|
|
|
|
u_long count = lwpr*(height-dy);
|
|
|
|
u_long *clr_y = src_y;
|
|
|
|
u_long clr_count = dest_y - src_y;
|
|
|
|
u_long bc, cbc;
|
|
|
|
|
|
|
|
src_y += count - 1;
|
|
|
|
dest_y += count - 1;
|
|
|
|
|
|
|
|
bc = count >> 4;
|
|
|
|
count &= 0xf;
|
|
|
|
|
|
|
|
while (bc--) {
|
|
|
|
*dest_y-- = *src_y--; *dest_y-- = *src_y--;
|
|
|
|
*dest_y-- = *src_y--; *dest_y-- = *src_y--;
|
|
|
|
*dest_y-- = *src_y--; *dest_y-- = *src_y--;
|
|
|
|
*dest_y-- = *src_y--; *dest_y-- = *src_y--;
|
|
|
|
*dest_y-- = *src_y--; *dest_y-- = *src_y--;
|
|
|
|
*dest_y-- = *src_y--; *dest_y-- = *src_y--;
|
|
|
|
*dest_y-- = *src_y--; *dest_y-- = *src_y--;
|
|
|
|
*dest_y-- = *src_y--; *dest_y-- = *src_y--;
|
|
|
|
}
|
|
|
|
while (count--) {
|
|
|
|
*dest_y-- = *src_y--;
|
|
|
|
}
|
|
|
|
|
|
|
|
cbc = clr_count >> 4;
|
|
|
|
clr_count &= 0xf;
|
|
|
|
|
|
|
|
while (cbc--) {
|
|
|
|
*clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
|
|
|
|
*clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
|
|
|
|
*clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
|
|
|
|
*clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
|
|
|
|
}
|
|
|
|
while (clr_count--) {
|
|
|
|
*clr_y++ = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (dy < 0) {
|
|
|
|
int i;
|
|
|
|
for (i=0; i < depth && mask; i++, mask >>= 1) {
|
|
|
|
if (0x1 & mask) {
|
|
|
|
u_long *pl = (u_long *)bm->plane[i];
|
|
|
|
u_long *src_y = pl + (lwpr*(y-dy));
|
|
|
|
u_long *dest_y = pl + (lwpr*y);
|
|
|
|
long count = lwpr*(height + dy);
|
|
|
|
u_long *clr_y = dest_y + count;
|
|
|
|
u_long clr_count = src_y - dest_y;
|
|
|
|
u_long bc, cbc;
|
|
|
|
|
|
|
|
bc = count >> 4;
|
|
|
|
count &= 0xf;
|
|
|
|
|
|
|
|
while (bc--) {
|
|
|
|
*dest_y++ = *src_y++; *dest_y++ = *src_y++;
|
|
|
|
*dest_y++ = *src_y++; *dest_y++ = *src_y++;
|
|
|
|
*dest_y++ = *src_y++; *dest_y++ = *src_y++;
|
|
|
|
*dest_y++ = *src_y++; *dest_y++ = *src_y++;
|
|
|
|
*dest_y++ = *src_y++; *dest_y++ = *src_y++;
|
|
|
|
*dest_y++ = *src_y++; *dest_y++ = *src_y++;
|
|
|
|
*dest_y++ = *src_y++; *dest_y++ = *src_y++;
|
|
|
|
*dest_y++ = *src_y++; *dest_y++ = *src_y++;
|
|
|
|
}
|
|
|
|
while (count--) {
|
|
|
|
*dest_y++ = *src_y++;
|
|
|
|
}
|
|
|
|
|
|
|
|
cbc = clr_count >> 4;
|
|
|
|
clr_count &= 0xf;
|
|
|
|
|
|
|
|
while (cbc--) {
|
|
|
|
*clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
|
|
|
|
*clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
|
|
|
|
*clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
|
|
|
|
*clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
|
|
|
|
}
|
|
|
|
while (clr_count--) {
|
|
|
|
*clr_y++ = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1993-07-05 23:19:43 +04:00
|
|
|
#endif
|