summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86/vgafb/enhanced/SpeedUpBlt.c
blob: 001d7358d4127ffead0a7613fb3d6c5b5a7621bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/SpeedUpBlt.c,v 1.1.2.1 1997/07/16 10:37:02 hohndel Exp $ */
/*******************************************************************************
                        Copyr 1992 by Glenn G. Lai

                        All Rs Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyr notice appear in all copies and that
both that copyr notice and this permission notice appear in
supporting documentation, and that the name of Glenn G. Lai not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.

Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

Glenn G. Lai
P.O. Box 4314
Austin, Tx 78765
glenn@cs.utexas.edu)
8/17/92
*******************************************************************************/
/* $XConsortium: SpeedUpBlt.c /main/4 1996/02/21 18:08:35 kaleb $ */

#include "vgafb.h"

static char copyright[] = "Copyright 8/17/1992 by Glenn G. Lai";

void
SpeedUpBitBlt(sBase, dBase, widthS, widthD, x, y, x1, y1, w, h, xdir, ydir)
    unsigned char *sBase, *dBase;
    int	widthS, widthD;
    int	x, y, x1, y1, w, h;
    int	xdir, ydir;
{
    if (sBase >= (unsigned char*)VGABASE)
	if (dBase >= (unsigned char*)VGABASE) {
	    unsigned char *src, *dst;

	    if (y == y1 && xdir == -1) {
		src = sBase + (y+h-1) * widthS + x + w - 1 - VGABASE;
		dst = dBase + (y1+h-1) * widthD + x1 + w - 1-VGABASE;
		WinWin(src, dst, h, w, -1, -1, widthS, 1);
	    } else if (ydir == -1) {
		src = sBase - (y + h - 1) * widthS + x - VGABASE;
		dst = dBase - (y1 + h - 1) * widthD + x1 - VGABASE;
		WinWin(src, dst, h, w, xdir, -1, widthS, 0);
	    } else { /* ydir == 1 */
		src = sBase + y * widthS + x - VGABASE;
		dst = dBase + y1 * widthD + x1 - VGABASE;
		WinWin(src, dst, h, w, xdir, 1, widthS, 0);
	    }
	} else {
	    if (widthS <0)
		widthS = -widthS;
	    if (widthD <0)
		widthD = -widthD;
	    WinPix(sBase+(y*widthS)+x,dBase+(y1*widthD)+x1,
		   h, w, widthS, widthD);
	}
    else if (dBase >= (unsigned char*)VGABASE) {
	if (widthS <0)
	    widthS = -widthS;
	if (widthD <0)
	    widthD = -widthD;
	PixWin(sBase+(y*widthS)+x,dBase+(y1*widthD)+x1, h, w, widthS, widthD);
    } else {
	if (ydir == 1)
	    if ((y == y1) && (xdir == -1))
		PixPix(sBase+((y+h-1)*widthS)+x+w-1,
		       dBase+((y1+h-1)*widthD)+x1+w-1,
		       h, w, -widthS + w, -widthD + w, -1);
	    else
		PixPix(sBase+(y*widthS)+x,dBase+(y1*widthD)+x1,
		       h, w, widthS - w, widthD - w, 1);
	else
	    if (w > 4)
		PixPix(sBase-((y+h-1)*widthS)+x+w-1,
		       dBase-((y1+h-1)*widthD)+x1+w-1,
		       h, w, widthS + w, widthD + w, -1);
	    else
		PixPix(sBase-((y+h-1)*widthS)+x,
		       dBase-((y1+h-1)*widthD)+x1,
		       h, w, widthS - w, widthD - w, -1);
    }
}