1
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/emulOpStip.c,v 1.2 1998/07/25 16:59:27 dawes Exp $ */
3
* Copyright IBM Corporation 1987,1988,1989
7
* Permission to use, copy, modify, and distribute this software and its
8
* documentation for any purpose and without fee is hereby granted,
9
* provided that the above copyright notice appear in all copies and that
10
* both that copyright notice and this permission notice appear in
11
* supporting documentation, and that the name of IBM not be
12
* used in advertising or publicity pertaining to distribution of the
13
* software without specific, written prior permission.
15
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
16
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
17
* IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
18
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
20
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
24
/* $XConsortium: emulOpStip.c /main/4 1996/02/21 17:56:12 kaleb $ */
28
* Based on the private stipple; does a foreground, and then an inverted
33
#ifdef HAVE_XORG_CONFIG_H
34
#include <xorg-config.h>
38
#include "OScompiler.h"
43
xf4bppOpaqueStipple( pWin, pStipple, fg, bg, alu, planes, x, y, w, h, xSrc, ySrc )
44
WindowPtr pWin; /* GJA */
45
register PixmapPtr pStipple ;
46
unsigned long int fg ;
47
unsigned long int bg ;
49
unsigned long int planes ;
50
register int x, y, w, h ;
55
/* Easy Cases -- i.e. Final Result Doesn't Depend On Initial Dest. */
56
case GXclear: /* 0x0 Zero 0 */
57
case GXset: /* 0xf 1 */
58
/* Foreground And Background Are Both The Same !! */
59
xf4bppFillSolid( pWin, bg, alu, planes, x, y, w, h ) ;
60
case GXnoop: /* 0x5 dst */
62
case GXcopy: /* 0x3 src */
63
case GXcopyInverted: /* 0xc NOT src */
64
{ /* Special Case Code */
65
register int vtarget, htarget ;
67
/* We Can Draw Just One Copy Then Blit The Rest !! */
68
/* Draw The One Copy */
69
htarget = MIN( w, pStipple->drawable.width ) ;
70
vtarget = MIN( h, pStipple->drawable.height ) ;
72
/* First The Background */
73
xf4bppFillSolid( pWin, bg, alu, planes, x, y,
75
/* Then The Foreground */
76
xf4bppFillStipple( pWin, pStipple, fg, alu, planes,
77
x, y, htarget, vtarget,
80
/* Here We Double The Size Of The BLIT Each Iteration */
81
xf4bppReplicateArea(pWin, x, y, planes, w, h, htarget, vtarget);
85
/* Hard Cases -- i.e. Final Result DOES Depend On Initial Dest. */
86
{ /* Do The Background */
88
register PixmapPtr pInvPixmap = xf4bppCopyPixmap( pStipple ) ;
89
register unsigned char *data = pInvPixmap->devPrivate.ptr ;
91
/* INVERT PIXMAP OK, jeff, this is for you */
92
for ( i = pInvPixmap->drawable.height ; i-- ; )
93
for ( j = pInvPixmap->devKind ; j-- ; data++ )
96
xf4bppFillStipple( pWin, pInvPixmap, bg, alu, planes, x, y, w, h, xSrc, ySrc );
97
mfbDestroyPixmap( pInvPixmap ) ;
99
xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc );