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

« back to all changes in this revision

Viewing changes to hw/xwin/winrop.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
/*
 
2
 *Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved.
 
3
 *
 
4
 *Permission is hereby granted, free of charge, to any person obtaining
 
5
 * a copy of this software and associated documentation files (the
 
6
 *"Software"), to deal in the Software without restriction, including
 
7
 *without limitation the rights to use, copy, modify, merge, publish,
 
8
 *distribute, sublicense, and/or sell copies of the Software, and to
 
9
 *permit persons to whom the Software is furnished to do so, subject to
 
10
 *the following conditions:
 
11
 *
 
12
 *The above copyright notice and this permission notice shall be
 
13
 *included in all copies or substantial portions of the Software.
 
14
 *
 
15
 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
16
 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
17
 *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
18
 *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
 
19
 *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 
20
 *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 
21
 *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
22
 *
 
23
 *Except as contained in this notice, the name of the XFree86 Project
 
24
 *shall not be used in advertising or otherwise to promote the sale, use
 
25
 *or other dealings in this Software without prior written authorization
 
26
 *from the XFree86 Project.
 
27
 *
 
28
 *      Authors:        Alan Hourihane <alanh@fairlite.demon.co.uk>
 
29
 */
 
30
/* $XFree86$ */
 
31
 
 
32
/*
 
33
 * Raster operations used by Windows translated to X's 16 rop codes...
 
34
 */
 
35
#ifdef HAVE_XWIN_CONFIG_H
 
36
#include <xwin-config.h>
 
37
#endif
 
38
#include "win.h"
 
39
 
 
40
void
 
41
ROP16 (HDC hdc, int rop);
 
42
 
 
43
int g_copyROP[16] = {   0xFF0062, /* GXclear            - 0 */
 
44
                        0x8800C6, /* GXand              - S & D */
 
45
                        0x440328, /* GXandReverse       - S & !D */
 
46
                        0xCC0020, /* GXcopy             - S */
 
47
                        0x220326, /* GXandInverted      - !S & D */
 
48
                        0xAA0029, /* GXnoop             - D */
 
49
                        0x660046, /* GXxor              - S ^ D */
 
50
                        0xEE0086, /* GXor               - S | D */
 
51
                        0x1100A6, /* GXnor              - !S & !D */
 
52
                        0x990126, /* GXequiv            - !S ^ D */
 
53
                        0x550009, /* GXinvert           - !D */
 
54
                        0xDD0228, /* GXorReverse        - S | !D */
 
55
                        0x330008, /* GXcopyInverted     - !S */
 
56
                        0xBB0226, /* GXorInverted       - !S | D */
 
57
                        0x7700C6, /* GXnand             - !S | !D */
 
58
                        0x000042  /* GXset              - 1 */
 
59
};
 
60
 
 
61
int g_patternROP[16] = {0xFF0062, /* GXclear            - 0 */
 
62
                        0xA000C9, /* GXand              - P & D */
 
63
                        0xF50225, /* GXandReverse       - P & !D */
 
64
                        0xF00021, /* GXcopy             - P */
 
65
                        0x5F00E9, /* GXandInverted      - !P & D */
 
66
                        0xAA0029, /* GXnoop             - D */
 
67
                        0xA50065, /* GXxor              - P ^ D */
 
68
                        0xA000C9, /* GXor               - P | D */
 
69
                        0x5F00E9, /* GXnor              - !P & !D */
 
70
                        0x5A0049, /* GXequiv            - !P ^ D */
 
71
                        0x550009, /* GXinvert           - !D */
 
72
                        0x500325, /* GXorReverse        - P | !D */
 
73
                        0x0F0001, /* GXcopyInverted     - !P */
 
74
                        0x0A0329, /* GXorInverted       - !P | D */
 
75
                        0x0500A9, /* GXnand             - !P | !D */
 
76
                        0x000042  /* GXset              - 1 */
 
77
};
 
78
 
 
79
 
 
80
void
 
81
ROP16 (HDC hdc, int rop)
 
82
{
 
83
  switch (rop)
 
84
    {
 
85
    case GXclear:
 
86
      SetROP2 (hdc, R2_BLACK);
 
87
      break;
 
88
 
 
89
    case GXand:
 
90
      SetROP2 (hdc, R2_MASKPEN);
 
91
      break;
 
92
 
 
93
    case GXandReverse:
 
94
      SetROP2 (hdc, R2_MASKPENNOT);
 
95
      break;
 
96
 
 
97
    case GXcopy:
 
98
      SetROP2 (hdc, R2_COPYPEN);
 
99
      break;
 
100
 
 
101
    case GXnoop:
 
102
      SetROP2 (hdc, R2_NOP);
 
103
      break;
 
104
 
 
105
    case GXxor:
 
106
      SetROP2 (hdc, R2_XORPEN);
 
107
      break;
 
108
 
 
109
    case GXor:
 
110
      SetROP2 (hdc, R2_MERGEPEN);
 
111
      break;
 
112
 
 
113
    case GXnor:
 
114
      SetROP2 (hdc, R2_NOTMERGEPEN);
 
115
      break;
 
116
 
 
117
    case GXequiv:
 
118
      SetROP2 (hdc, R2_NOTXORPEN);
 
119
      break;
 
120
 
 
121
    case GXinvert:
 
122
      SetROP2 (hdc, R2_NOT);
 
123
      break;
 
124
 
 
125
    case GXorReverse:
 
126
      SetROP2 (hdc, R2_MERGEPENNOT);
 
127
      break;
 
128
 
 
129
    case GXcopyInverted:
 
130
      SetROP2 (hdc, R2_NOTCOPYPEN);
 
131
      break;
 
132
 
 
133
    case GXorInverted:
 
134
      SetROP2 (hdc, R2_MERGENOTPEN);
 
135
      break;
 
136
 
 
137
    case GXnand:
 
138
      SetROP2 (hdc, R2_NOTMASKPEN);
 
139
      break;
 
140
 
 
141
    case GXset:
 
142
      SetROP2 (hdc, R2_WHITE);
 
143
      break;
 
144
    }
 
145
}