summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/hp/ngle/nglecopy.c
blob: be8ddff37e211704f2dce04b2de8010a113de00f (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* $XConsortium$ */

/*
****************************************************************************
** DDX WINDOW ROUTINES
**
** (c) Copyright Hewlett-Packard Company, 1992.
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 copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Hewlett Packard not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.

HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  Hewlett-Packard shall not be liable for errors
contained herein or direct, indirect, special, incidental or
consequential damages in connection with the furnishing,
performance, or use of this material.
**
****************************************************************************
*/

#include "ngle.h"

/* Extern decalarations for CFB routines */
/* Depth 8 CFB functions */
extern int cfbDoBitbltGeneral();
extern int cfbDoBitbltCopy();
extern int cfbDoBitbltXor();
extern int cfbDoBitbltOr();
extern RegionPtr cfbBitBlt();

/* Depth 24 CFB functions */
extern int cfb32DoBitbltGeneral();
extern int cfb32DoBitbltCopy();
extern int cfb32DoBitbltXor();
extern int cfb32DoBitbltOr();
extern RegionPtr cfb32BitBlt();

/* Ngle routines */

extern int ngleBitBlt();

/***************************************************************************
 *
 *  ngleCopyArea8()
 *
 *  This routine is a replacement for cfbCopyArea(), to allow us to
 *  call our own block move routine when we are in the scrolling
 *  case.
 *
 ***************************************************************************
 */

RegionPtr ngleCopyArea8(pSrcDrawable, pDstDrawable,
            pGC, srcx, srcy, width, height, dstx, dsty)
    register DrawablePtr pSrcDrawable;
    register DrawablePtr pDstDrawable;
    GC *pGC;
    int srcx, srcy;
    int width, height;
    int dstx, dsty;
{
    int	(*doBitBlt) ();
    
    doBitBlt = cfbDoBitbltCopy;

    if (( pSrcDrawable == pDstDrawable) &&
	    (pSrcDrawable->type == DRAWABLE_WINDOW) &&
	    (pDstDrawable->type == DRAWABLE_WINDOW))
    {
	doBitBlt = ngleBitBlt;
    }

    if (pGC->alu != GXcopy || (pGC->planemask & 0xff) != 0xff)
    {
	doBitBlt = cfbDoBitbltGeneral;
	if ((pGC->planemask & 0xff) == 0xff)
	{
	    switch (pGC->alu) {
	    case GXxor:
		doBitBlt = cfbDoBitbltXor;
		break;
	    case GXor:
		doBitBlt = cfbDoBitbltOr;
		break;
	    }
	}
    }

    return cfbBitBlt (pSrcDrawable, pDstDrawable,
            pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, 0);
}


/***************************************************************************
 *
 *  ngleCopyArea24()
 *
 *  This routine is a replacement for cfb32CopyArea(), to allow us to
 *  call our own block move routine when we are in the scrolling
 *  case.
 *
 ***************************************************************************
 */

RegionPtr ngleCopyArea24(pSrcDrawable, pDstDrawable,
            pGC, srcx, srcy, width, height, dstx, dsty)
    register DrawablePtr pSrcDrawable;
    register DrawablePtr pDstDrawable;
    GC *pGC;
    int srcx, srcy;
    int width, height;
    int dstx, dsty;
{
    int	(*doBitBlt) ();
    
    doBitBlt = cfb32DoBitbltCopy;

    if (( pSrcDrawable == pDstDrawable) &&
	    (pSrcDrawable->type == DRAWABLE_WINDOW) &&
	    (pDstDrawable->type == DRAWABLE_WINDOW))
    {
	doBitBlt = ngleBitBlt;
    }

    if (pGC->alu != GXcopy || (pGC->planemask & 0xffffffff) != 0xffffffff)
    {
	doBitBlt = cfb32DoBitbltGeneral;
	if ((pGC->planemask & 0xffffffff) == 0xffffffff)
	{
	    switch (pGC->alu) {
	    case GXxor:
		doBitBlt = cfb32DoBitbltXor;
		break;
	    case GXor:
		doBitBlt = cfb32DoBitbltOr;
		break;
	    }
	}
    }

    return cfb32BitBlt (pSrcDrawable, pDstDrawable,
            pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, 0);
}