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

« back to all changes in this revision

Viewing changes to hw/xfree86/xf4bpp/emulOpStip.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/emulOpStip.c,v 1.2 1998/07/25 16:59:27 dawes Exp $ */
 
2
/*
 
3
 * Copyright IBM Corporation 1987,1988,1989
 
4
 *
 
5
 * All Rights Reserved
 
6
 *
 
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.
 
14
 *
 
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
 
21
 * SOFTWARE.
 
22
 *
 
23
*/
 
24
/* $XConsortium: emulOpStip.c /main/4 1996/02/21 17:56:12 kaleb $ */
 
25
 
 
26
/* ppc OpaqueStipple
 
27
 *
 
28
 * Based on the private stipple; does a foreground, and then an inverted
 
29
 * on the background 
 
30
 *
 
31
 */
 
32
 
 
33
#ifdef HAVE_XORG_CONFIG_H
 
34
#include <xorg-config.h>
 
35
#endif
 
36
 
 
37
#include "xf4bpp.h"
 
38
#include "OScompiler.h"
 
39
#include "mfbmap.h"
 
40
#include "mfb.h"
 
41
 
 
42
void 
 
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 ;
 
48
int alu ;
 
49
unsigned long int planes ;
 
50
register int x, y, w, h ;
 
51
int xSrc, ySrc ;
 
52
{
 
53
    /* DO BACKGROUND */
 
54
    switch ( alu ) {
 
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 */
 
61
            break ;
 
62
        case GXcopy:            /* 0x3 src */
 
63
        case GXcopyInverted:    /* 0xc NOT src */
 
64
            { /* Special Case Code */
 
65
                register int vtarget, htarget ;
 
66
 
 
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 ) ;
 
71
 
 
72
                /* First The Background */
 
73
                xf4bppFillSolid( pWin, bg, alu, planes, x, y,
 
74
                                        htarget, vtarget ) ;
 
75
                /* Then The Foreground */
 
76
                xf4bppFillStipple( pWin, pStipple, fg, alu, planes,
 
77
                                       x, y, htarget, vtarget,
 
78
                                       xSrc, ySrc ) ;
 
79
 
 
80
                /* Here We Double The Size Of The BLIT Each Iteration */
 
81
                xf4bppReplicateArea(pWin, x, y, planes, w, h, htarget, vtarget);
 
82
            }
 
83
            break ;
 
84
        default:
 
85
        /* Hard Cases -- i.e. Final Result DOES Depend On Initial Dest. */
 
86
            { /* Do The Background */
 
87
                register int i, j;
 
88
                register PixmapPtr pInvPixmap = xf4bppCopyPixmap( pStipple ) ;
 
89
                register unsigned char *data = pInvPixmap->devPrivate.ptr ;
 
90
 
 
91
                /* INVERT PIXMAP  OK, jeff, this is for you */
 
92
                for ( i = pInvPixmap->drawable.height ; i-- ; )
 
93
                        for ( j = pInvPixmap->devKind ; j-- ; data++ )
 
94
                                *data = ~ ( *data ) ;
 
95
 
 
96
                xf4bppFillStipple( pWin, pInvPixmap, bg, alu, planes, x, y, w, h, xSrc, ySrc );
 
97
                mfbDestroyPixmap( pInvPixmap ) ;
 
98
                /* DO FOREGROUND */
 
99
                xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc );
 
100
            }
 
101
        break ;
 
102
    }
 
103
    return;
 
104
}