2 * Copyright IBM Corporation 1987,1988,1989
6 * Permission to use, copy, modify, and distribute this software and its
7 * documentation for any purpose and without fee is hereby granted,
8 * provided that the above copyright notice appear in all copies and that
9 * both that copyright notice and this permission notice appear in
10 * supporting documentation, and that the name of IBM not be
11 * used in advertising or publicity pertaining to distribution of the
12 * software without specific, written prior permission.
14 * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
24 /***********************************************************
26 Copyright (c) 1987 X Consortium
28 Permission is hereby granted, free of charge, to any person obtaining a copy
29 of this software and associated documentation files (the "Software"), to deal
30 in the Software without restriction, including without limitation the rights
31 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32 copies of the Software, and to permit persons to whom the Software is
33 furnished to do so, subject to the following conditions:
35 The above copyright notice and this permission notice shall be included in
36 all copies or substantial portions of the Software.
38 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
42 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
43 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 Except as contained in this notice, the name of the X Consortium shall not be
46 used in advertising or otherwise to promote the sale, use or other dealings
47 in this Software without prior written authorization from the X Consortium.
50 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
54 Permission to use, copy, modify, and distribute this software and its
55 documentation for any purpose and without fee is hereby granted,
56 provided that the above copyright notice appear in all copies and that
57 both that copyright notice and this permission notice appear in
58 supporting documentation, and that the name of Digital not be
59 used in advertising or publicity pertaining to distribution of the
60 software without specific, written prior permission.
62 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
63 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
64 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
65 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
66 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
67 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
70 ******************************************************************/
72 #ifdef HAVE_XORG_CONFIG_H
73 #include <xorg-config.h>
80 #include "OScompiler.h"
82 #include "scrnintstr.h"
85 xf4bppCreatePixmap( pScreen
, width
, height
, depth
)
91 register PixmapPtr pPixmap
= (PixmapPtr
)NULL
;
94 TRACE(("xf4bppCreatePixmap(pScreen=0x%x, width=%d, height=%d, depth=%d)\n", pScreen
, width
, height
, depth
)) ;
97 return (PixmapPtr
) NULL
;
99 size
= PixmapBytePad(width
, depth
);
101 if (size
/ 4 > 32767 || height
> 32767)
102 return (PixmapPtr
) NULL
;
104 pPixmap
= AllocatePixmap (pScreen
, (height
* size
));
107 return (PixmapPtr
) NULL
;
108 pPixmap
->drawable
.type
= DRAWABLE_PIXMAP
;
109 pPixmap
->drawable
.class = 0 ;
110 pPixmap
->drawable
.pScreen
= pScreen
;
111 pPixmap
->drawable
.depth
= depth
;
112 pPixmap
->drawable
.id
= 0 ;
113 pPixmap
->drawable
.bitsPerPixel
= ( depth
== 1 ) ? 1 : 8 ;
114 pPixmap
->drawable
.serialNumber
= NEXT_SERIAL_NUMBER
;
115 pPixmap
->drawable
.x
= 0 ;
116 pPixmap
->drawable
.y
= 0 ;
117 pPixmap
->drawable
.width
= width
;
118 pPixmap
->drawable
.height
= height
;
119 pPixmap
->devKind
= size
;
120 pPixmap
->refcnt
= 1 ;
121 size
= height
* pPixmap
->devKind
;
122 pPixmap
->devPrivate
.ptr
= (pointer
) (((CARD8
*)pPixmap
)
123 + pScreen
->totalPixmapSize
);
124 bzero( (char *) pPixmap
->devPrivate
.ptr
, size
) ;
129 xf4bppCopyPixmap(pSrc
)
130 register PixmapPtr pSrc
;
132 register PixmapPtr pDst
;
135 TRACE(("xf4bppCopyPixmap(pSrc=0x%x)\n", pSrc
)) ;
136 size
= pSrc
->drawable
.height
* pSrc
->devKind
;
137 pDst
= xalloc(sizeof(PixmapRec
) + size
);
140 pDst
->drawable
= pSrc
->drawable
;
141 pDst
->drawable
.id
= 0;
142 pDst
->drawable
.serialNumber
= NEXT_SERIAL_NUMBER
;
143 pDst
->devKind
= pSrc
->devKind
;
145 pDst
->devPrivate
.ptr
= (pointer
)(pDst
+ 1);
146 MOVE( (char *)pSrc
->devPrivate
.ptr
, (char *)pDst
->devPrivate
.ptr
, size
) ;