~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/xfree86/xf4bpp/mfbhrzvert.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbhrzvert.c,v 1.2 1998/07/25 16:59:29 dawes Exp $ */
 
2
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
 
3
/***********************************************************
 
4
 
 
5
Copyright (c) 1987  X Consortium
 
6
 
 
7
Permission is hereby granted, free of charge, to any person obtaining a copy
 
8
of this software and associated documentation files (the "Software"), to deal
 
9
in the Software without restriction, including without limitation the rights
 
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
11
copies of the Software, and to permit persons to whom the Software is
 
12
furnished to do so, subject to the following conditions:
 
13
 
 
14
The above copyright notice and this permission notice shall be included in
 
15
all copies or substantial portions of the Software.
 
16
 
 
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
20
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
21
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
22
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
23
 
 
24
Except as contained in this notice, the name of the X Consortium shall not be
 
25
used in advertising or otherwise to promote the sale, use or other dealings
 
26
in this Software without prior written authorization from the X Consortium.
 
27
 
 
28
 
 
29
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
 
30
 
 
31
                        All Rights Reserved
 
32
 
 
33
Permission to use, copy, modify, and distribute this software and its 
 
34
documentation for any purpose and without fee is hereby granted, 
 
35
provided that the above copyright notice appear in all copies and that
 
36
both that copyright notice and this permission notice appear in 
 
37
supporting documentation, and that the name of Digital not be
 
38
used in advertising or publicity pertaining to distribution of the
 
39
software without specific, written prior permission.  
 
40
 
 
41
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 
42
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 
43
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 
44
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 
45
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 
46
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 
47
SOFTWARE.
 
48
 
 
49
******************************************************************/
 
50
/* GJA -- modified this file for vga16 */
 
51
/* $XConsortium: mfbhrzvert.c /main/3 1996/02/21 17:56:41 kaleb $ */
 
52
 
 
53
#ifdef HAVE_XORG_CONFIG_H
 
54
#include <xorg-config.h>
 
55
#endif
 
56
 
 
57
#include "xf4bpp.h"
 
58
#include "OScompiler.h"
 
59
#include "mfbmap.h"
 
60
#include "mfb.h"
 
61
#include "maskbits.h"
 
62
#include "wm3.h"
 
63
 
 
64
/* horizontal solid line
 
65
   abs(len) > 1
 
66
*/
 
67
 
 
68
void
 
69
xf4bppHorzS(addrl, nlwidth, x1, y1, len)
 
70
register PixelType *addrl;      /* pointer to base of bitmap */
 
71
register int nlwidth;   /* width in longwords of bitmap */
 
72
int x1;                 /* initial point */ 
 
73
int y1;
 
74
int len;                /* length of line */
 
75
{
 
76
    register PixelType startmask;
 
77
    register PixelType endmask;
 
78
    register int nlmiddle;
 
79
 
 
80
 
 
81
    /* force the line to go left to right
 
82
       but don't draw the last point
 
83
    */
 
84
    if (len < 0)
 
85
    {
 
86
        x1 += len;
 
87
        x1 += 1;
 
88
        len = -len;
 
89
    }
 
90
 
 
91
    addrl = mfbScanline(addrl, x1, y1, nlwidth);
 
92
 
 
93
    /* all bits inside same longword */
 
94
    if ( ((x1 & PIM) + len) < PPW)
 
95
    {
 
96
        maskpartialbits(x1, len, startmask);
 
97
        UPDRW(addrl,startmask);
 
98
    }
 
99
    else
 
100
    {
 
101
        maskbits(x1, len, startmask, endmask, nlmiddle);
 
102
        if (startmask) {
 
103
            UPDRW(addrl,startmask); addrl++;
 
104
        }
 
105
        Duff (nlmiddle, UPDRW(addrl,~0); addrl++);
 
106
        if (endmask) {
 
107
            UPDRW(addrl,endmask);
 
108
        }
 
109
    }
 
110
}
 
111
 
 
112
/* vertical solid line
 
113
   this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates
 
114
   better code.  sigh.  we know that len will never be 0 or 1, so
 
115
   it's OK to use it.
 
116
*/
 
117
 
 
118
void
 
119
xf4bppVertS(addrl, nlwidth, x1, y1, len)
 
120
register PixelType *addrl;      /* pointer to base of bitmap */
 
121
register int nlwidth;   /* width in longwords of bitmap */
 
122
int x1, y1;             /* initial point */
 
123
register int len;       /* length of line */
 
124
{
 
125
    register PixelType bitmask;
 
126
 
 
127
    addrl = mfbScanline(addrl, x1, y1, nlwidth);
 
128
 
 
129
    if (len < 0)
 
130
    {
 
131
        nlwidth = -nlwidth;
 
132
        len = -len;
 
133
    }
 
134
 
 
135
    bitmask = mfbGetmask(x1 & PIM);
 
136
    Duff(len, UPDRW(addrl,bitmask); addrl += nlwidth);
 
137
}