2 * Copyright © 2005 Novell, Inc.
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Novell, Inc. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Novell, Inc. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
15 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Author: David Reveman <davidr@novell.com>
32 xglShmPutImage (DrawablePtr pDrawable
,
46 ScreenPtr pScreen
= pDrawable
->pScreen
;
47 PixmapPtr pPixmapHeader
= NULL
;
51 XGL_DRAWABLE_PIXMAP_PRIV (pDrawable
);
53 if ((format
== ZPixmap
) || (depth
== 1))
55 pPixmap
= pPixmapHeader
=
56 GetScratchPixmapHeader (pScreen
, w
, h
, depth
,
58 PixmapBytePad (w
, depth
),
61 /* disable any possible acceleration of this pixmap */
63 xglSetPixmapVisual (pPixmap
, 0);
67 pPixmap
= (*pScreen
->CreatePixmap
) (pScreen
, sw
, sh
, depth
);
72 if (!xglAllocatePixmapBits (pPixmap
,
73 XGL_PIXMAP_USAGE_HINT_DEFAULT
))
75 (*pScreen
->DestroyPixmap
) (pPixmap
);
79 xglSetPixmapVisual (pPixmap
, 0);
81 pScratchGC
= GetScratchGC (depth
, pScreen
);
84 (*pScreen
->DestroyPixmap
) (pPixmap
);
88 ValidateGC ((DrawablePtr
) pPixmap
, pScratchGC
);
89 (*pGC
->ops
->PutImage
) ((DrawablePtr
) pPixmap
, pScratchGC
, depth
,
91 (format
== XYPixmap
) ? XYPixmap
: ZPixmap
,
94 FreeScratchGC (pScratchGC
);
103 /* CopyArea should always be done in software */
104 saveTarget
= pPixmapPriv
->target
;
105 pPixmapPriv
->target
= xglPixmapTargetNo
;
107 if (format
== XYBitmap
)
108 (*pGC
->ops
->CopyPlane
) ((DrawablePtr
) pPixmap
, pDrawable
, pGC
,
109 sx
, sy
, sw
, sh
, dx
, dy
, 1L);
111 (*pGC
->ops
->CopyArea
) ((DrawablePtr
) pPixmap
, pDrawable
, pGC
,
112 sx
, sy
, sw
, sh
, dx
, dy
);
114 pPixmapPriv
->target
= saveTarget
;
117 FreeScratchPixmapHeader (pPixmapHeader
);
119 (*pScreen
->DestroyPixmap
) (pPixmap
);