4 * Copyright 2011 Huw Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "gdi_private.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(dib
);
30 #define DST 0 /* Destination dib */
31 #define SRC 1 /* Source dib */
32 #define TMP 2 /* Temporary dib */
33 #define PAT 3 /* Pattern (brush) in destination DC */
35 #define OP(src,dst,rop) (OP_ARGS(src,dst) << 4 | ((rop) - 1))
36 #define OP_ARGS(src,dst) (((src) << 2) | (dst))
38 #define OP_SRC(opcode) ((opcode) >> 6)
39 #define OP_DST(opcode) (((opcode) >> 4) & 3)
40 #define OP_SRCDST(opcode) ((opcode) >> 4)
41 #define OP_ROP(opcode) (((opcode) & 0x0f) + 1)
43 #define MAX_OP_LEN 6 /* Longest opcode + 1 for the terminating 0 */
45 static const unsigned char BITBLT_Opcodes
[256][MAX_OP_LEN
] =
47 { OP(PAT
,DST
,R2_BLACK
) }, /* 0x00 0 */
48 { OP(PAT
,SRC
,R2_MERGEPEN
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x01 ~(D|(P|S)) */
49 { OP(PAT
,SRC
,R2_NOTMERGEPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x02 D&~(P|S) */
50 { OP(PAT
,SRC
,R2_NOTMERGEPEN
) }, /* 0x03 ~(P|S) */
51 { OP(PAT
,DST
,R2_NOTMERGEPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x04 S&~(D|P) */
52 { OP(PAT
,DST
,R2_NOTMERGEPEN
) }, /* 0x05 ~(D|P) */
53 { OP(SRC
,DST
,R2_NOTXORPEN
), OP(PAT
,DST
,R2_NOTMERGEPEN
), }, /* 0x06 ~(P|~(D^S)) */
54 { OP(SRC
,DST
,R2_MASKPEN
), OP(PAT
,DST
,R2_NOTMERGEPEN
) }, /* 0x07 ~(P|(D&S)) */
55 { OP(PAT
,DST
,R2_MASKNOTPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x08 S&D&~P */
56 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,DST
,R2_NOTMERGEPEN
) }, /* 0x09 ~(P|(D^S)) */
57 { OP(PAT
,DST
,R2_MASKNOTPEN
) }, /* 0x0a D&~P */
58 { OP(SRC
,DST
,R2_MASKPENNOT
), OP(PAT
,DST
,R2_NOTMERGEPEN
) }, /* 0x0b ~(P|(S&~D)) */
59 { OP(PAT
,SRC
,R2_MASKNOTPEN
) }, /* 0x0c S&~P */
60 { OP(SRC
,DST
,R2_MASKNOTPEN
), OP(PAT
,DST
,R2_NOTMERGEPEN
) }, /* 0x0d ~(P|(D&~S)) */
61 { OP(SRC
,DST
,R2_NOTMERGEPEN
), OP(PAT
,DST
,R2_NOTMERGEPEN
) }, /* 0x0e ~(P|~(D|S)) */
62 { OP(PAT
,DST
,R2_NOTCOPYPEN
) }, /* 0x0f ~P */
63 { OP(SRC
,DST
,R2_NOTMERGEPEN
), OP(PAT
,DST
,R2_MASKPEN
) }, /* 0x10 P&~(S|D) */
64 { OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x11 ~(D|S) */
65 { OP(PAT
,DST
,R2_NOTXORPEN
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x12 ~(S|~(D^P)) */
66 { OP(PAT
,DST
,R2_MASKPEN
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x13 ~(S|(D&P)) */
67 { OP(PAT
,SRC
,R2_NOTXORPEN
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x14 ~(D|~(P^S)) */
68 { OP(PAT
,SRC
,R2_MASKPEN
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x15 ~(D|(P&S)) */
69 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_NOTMASKPEN
),
70 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_XORPEN
),
71 OP(PAT
,DST
,R2_XORPEN
) }, /* 0x16 P^S^(D&~(P&S) */
72 { OP(SRC
,TMP
,R2_COPYPEN
), OP(SRC
,DST
,R2_XORPEN
),
73 OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_MASKPEN
),
74 OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x17 ~S^((S^P)&(S^D))*/
75 { OP(PAT
,SRC
,R2_XORPEN
), OP(PAT
,DST
,R2_XORPEN
),
76 OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x18 (S^P)&(D^P) */
77 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_NOTMASKPEN
),
78 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x19 ~S^(D&~(P&S)) */
79 { OP(PAT
,SRC
,R2_MASKPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
80 OP(PAT
,DST
,R2_XORPEN
) }, /* 0x1a P^(D|(S&P)) */
81 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_XORPEN
),
82 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x1b ~S^(D&(P^S)) */
83 { OP(PAT
,DST
,R2_MASKPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
84 OP(PAT
,DST
,R2_XORPEN
) }, /* 0x1c P^(S|(D&P)) */
85 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_XORPEN
),
86 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x1d ~D^(S&(D^P)) */
87 { OP(SRC
,DST
,R2_MERGEPEN
), OP(PAT
,DST
,R2_XORPEN
) }, /* 0x1e P^(D|S) */
88 { OP(SRC
,DST
,R2_MERGEPEN
), OP(PAT
,DST
,R2_NOTMASKPEN
) }, /* 0x1f ~(P&(D|S)) */
89 { OP(PAT
,SRC
,R2_MASKPENNOT
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x20 D&(P&~S) */
90 { OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x21 ~(S|(D^P)) */
91 { OP(SRC
,DST
,R2_MASKNOTPEN
) }, /* 0x22 ~S&D */
92 { OP(PAT
,DST
,R2_MASKPENNOT
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x23 ~(S|(P&~D)) */
93 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,SRC
,R2_XORPEN
),
94 OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x24 (S^P)&(S^D) */
95 { OP(PAT
,SRC
,R2_NOTMASKPEN
), OP(SRC
,DST
,R2_MASKPEN
),
96 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0x25 ~P^(D&~(S&P)) */
97 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MASKPEN
),
98 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0x26 S^(D|(S&P)) */
99 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_NOTXORPEN
),
100 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0x27 S^(D|~(P^S)) */
101 { OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x28 D&(P^S) */
102 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MASKPEN
),
103 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_XORPEN
),
104 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0x29 ~P^S^(D|(P&S)) */
105 { OP(PAT
,SRC
,R2_NOTMASKPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x2a D&~(P&S) */
106 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_XORPEN
),
107 OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_MASKPEN
),
108 OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x2b ~S^((P^S)&(P^D))*/
109 { OP(SRC
,DST
,R2_MERGEPEN
), OP(PAT
,DST
,R2_MASKPEN
),
110 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x2c S^(P&(S|D)) */
111 { OP(SRC
,DST
,R2_MERGEPENNOT
), OP(PAT
,DST
,R2_XORPEN
) }, /* 0x2d P^(S|~D) */
112 { OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
113 OP(PAT
,DST
,R2_XORPEN
) }, /* 0x2e P^(S|(D^P)) */
114 { OP(SRC
,DST
,R2_MERGEPENNOT
), OP(PAT
,DST
,R2_NOTMASKPEN
) }, /* 0x2f ~(P&(S|~D)) */
115 { OP(PAT
,SRC
,R2_MASKPENNOT
) }, /* 0x30 P&~S */
116 { OP(PAT
,DST
,R2_MASKNOTPEN
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x31 ~(S|(D&~P)) */
117 { OP(SRC
,DST
,R2_MERGEPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
118 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x32 S^(D|P|S) */
119 { OP(SRC
,DST
,R2_NOTCOPYPEN
) }, /* 0x33 ~S */
120 { OP(SRC
,DST
,R2_MASKPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
121 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x34 S^(P|(D&S)) */
122 { OP(SRC
,DST
,R2_NOTXORPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
123 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x35 S^(P|~(D^S)) */
124 { OP(PAT
,DST
,R2_MERGEPEN
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0x36 S^(D|P) */
125 { OP(PAT
,DST
,R2_MERGEPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0x37 ~(S&(D|P)) */
126 { OP(PAT
,DST
,R2_MERGEPEN
), OP(SRC
,DST
,R2_MASKPEN
),
127 OP(PAT
,DST
,R2_XORPEN
) }, /* 0x38 P^(S&(D|P)) */
128 { OP(PAT
,DST
,R2_MERGEPENNOT
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0x39 S^(P|~D) */
129 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
130 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x3a S^(P|(D^S)) */
131 { OP(PAT
,DST
,R2_MERGEPENNOT
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0x3b ~(S&(P|~D)) */
132 { OP(PAT
,SRC
,R2_XORPEN
) }, /* 0x3c P^S */
133 { OP(SRC
,DST
,R2_NOTMERGEPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
134 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x3d S^(P|~(D|S)) */
135 { OP(SRC
,DST
,R2_MASKNOTPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
136 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x3e S^(P|(D&~S)) */
137 { OP(PAT
,SRC
,R2_NOTMASKPEN
) }, /* 0x3f ~(P&S) */
138 { OP(SRC
,DST
,R2_MASKPENNOT
), OP(PAT
,DST
,R2_MASKPEN
) }, /* 0x40 P&S&~D */
139 { OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x41 ~(D|(P^S)) */
140 { OP(DST
,SRC
,R2_XORPEN
), OP(PAT
,DST
,R2_XORPEN
),
141 OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x42 (S^D)&(P^D) */
142 { OP(SRC
,DST
,R2_NOTMASKPEN
), OP(PAT
,DST
,R2_MASKPEN
),
143 OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0x43 ~S^(P&~(D&S)) */
144 { OP(SRC
,DST
,R2_MASKPENNOT
) }, /* 0x44 S&~D */
145 { OP(PAT
,SRC
,R2_MASKPENNOT
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x45 ~(D|(P&~S)) */
146 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_MASKPEN
),
147 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0x46 D^(S|(P&D)) */
148 { OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_MASKPEN
),
149 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0x47 ~P^(S&(D^P)) */
150 { OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x48 S&(P^D) */
151 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_MASKPEN
),
152 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_XORPEN
),
153 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0x49 ~P^D^(S|(P&D)) */
154 { OP(DST
,SRC
,R2_MERGEPEN
), OP(PAT
,SRC
,R2_MASKPEN
),
155 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x4a D^(P&(S|D)) */
156 { OP(SRC
,DST
,R2_MERGENOTPEN
), OP(PAT
,DST
,R2_XORPEN
) }, /* 0x4b P^(D|~S) */
157 { OP(PAT
,DST
,R2_NOTMASKPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x4c S&~(D&P) */
158 { OP(SRC
,TMP
,R2_COPYPEN
), OP(SRC
,DST
,R2_XORPEN
),
159 OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
160 OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x4d ~S^((S^P)|(S^D))*/
161 { OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
162 OP(PAT
,DST
,R2_XORPEN
) }, /* 0x4e P^(D|(S^P)) */
163 { OP(SRC
,DST
,R2_MERGENOTPEN
), OP(PAT
,DST
,R2_NOTMASKPEN
) }, /* 0x4f ~(P&(D|~S)) */
164 { OP(PAT
,DST
,R2_MASKPENNOT
) }, /* 0x50 P&~D */
165 { OP(PAT
,SRC
,R2_MASKNOTPEN
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x51 ~(D|(S&~P)) */
166 { OP(DST
,SRC
,R2_MASKPEN
), OP(PAT
,SRC
,R2_MERGEPEN
),
167 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x52 D^(P|(S&D)) */
168 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,DST
,R2_MASKPEN
),
169 OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0x53 ~S^(P&(D^S)) */
170 { OP(PAT
,SRC
,R2_NOTMERGEPEN
), OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x54 ~(D|~(P|S)) */
171 { OP(PAT
,DST
,R2_NOT
) }, /* 0x55 ~D */
172 { OP(PAT
,SRC
,R2_MERGEPEN
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0x56 D^(P|S) */
173 { OP(PAT
,SRC
,R2_MERGEPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0x57 ~(D&(P|S)) */
174 { OP(PAT
,SRC
,R2_MERGEPEN
), OP(SRC
,DST
,R2_MASKPEN
),
175 OP(PAT
,DST
,R2_XORPEN
) }, /* 0x58 P^(D&(P|S)) */
176 { OP(PAT
,SRC
,R2_MERGEPENNOT
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0x59 D^(P|~S) */
177 { OP(PAT
,DST
,R2_XORPEN
) }, /* 0x5a D^P */
178 { OP(DST
,SRC
,R2_NOTMERGEPEN
), OP(PAT
,SRC
,R2_MERGEPEN
),
179 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x5b D^(P|~(S|D)) */
180 { OP(DST
,SRC
,R2_XORPEN
), OP(PAT
,SRC
,R2_MERGEPEN
),
181 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x5c D^(P|(S^D)) */
182 { OP(PAT
,SRC
,R2_MERGEPENNOT
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0x5d ~(D&(P|~S)) */
183 { OP(DST
,SRC
,R2_MASKNOTPEN
), OP(PAT
,SRC
,R2_MERGEPEN
),
184 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x5e D^(P|(S&~D)) */
185 { OP(PAT
,DST
,R2_NOTMASKPEN
) }, /* 0x5f ~(D&P) */
186 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,DST
,R2_MASKPEN
) }, /* 0x60 P&(D^S) */
187 { OP(DST
,TMP
,R2_COPYPEN
), OP(SRC
,DST
,R2_MASKPEN
),
188 OP(PAT
,DST
,R2_MERGEPEN
), OP(SRC
,DST
,R2_XORPEN
),
189 OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x61 ~D^S^(P|(D&S)) */
190 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
191 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0x62 D^(S&(P|D)) */
192 { OP(PAT
,DST
,R2_MERGENOTPEN
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0x63 S^(D|~P) */
193 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MERGEPEN
),
194 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0x64 S^(D&(P|S)) */
195 { OP(PAT
,SRC
,R2_MERGENOTPEN
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0x65 D^(S|~P) */
196 { OP(SRC
,DST
,R2_XORPEN
) }, /* 0x66 S^D */
197 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_NOTMERGEPEN
),
198 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0x67 S^(D|~(S|P) */
199 { OP(DST
,TMP
,R2_COPYPEN
), OP(SRC
,DST
,R2_NOTMERGEPEN
),
200 OP(PAT
,DST
,R2_MERGEPEN
), OP(SRC
,DST
,R2_XORPEN
),
201 OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x68 ~D^S^(P|~(D|S))*/
202 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0x69 ~P^(D^S) */
203 { OP(PAT
,SRC
,R2_MASKPEN
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0x6a D^(P&S) */
204 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MERGEPEN
),
205 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_XORPEN
),
206 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0x6b ~P^S^(D&(P|S)) */
207 { OP(PAT
,DST
,R2_MASKPEN
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0x6c S^(D&P) */
208 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
209 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_XORPEN
),
210 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0x6d ~P^D^(S&(P|D)) */
211 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MERGEPENNOT
),
212 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0x6e S^(D&(P|~S)) */
213 { OP(SRC
,DST
,R2_NOTXORPEN
), OP(PAT
,DST
,R2_NOTMASKPEN
) }, /* 0x6f ~(P&~(S^D)) */
214 { OP(SRC
,DST
,R2_NOTMASKPEN
), OP(PAT
,DST
,R2_MASKPEN
) }, /* 0x70 P&~(D&S) */
215 { OP(SRC
,TMP
,R2_COPYPEN
), OP(DST
,SRC
,R2_XORPEN
),
216 OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_MASKPEN
),
217 OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x71 ~S^((S^D)&(P^D))*/
218 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_XORPEN
),
219 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0x72 S^(D|(P^S)) */
220 { OP(PAT
,DST
,R2_MERGENOTPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0x73 ~(S&(D|~P)) */
221 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_XORPEN
),
222 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0x74 D^(S|(P^D)) */
223 { OP(PAT
,SRC
,R2_MERGENOTPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0x75 ~(D&(S|~P)) */
224 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MASKPENNOT
),
225 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0x76 S^(D|(P&~S)) */
226 { OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0x77 ~(S&D) */
227 { OP(SRC
,DST
,R2_MASKPEN
), OP(PAT
,DST
,R2_XORPEN
) }, /* 0x78 P^(D&S) */
228 { OP(DST
,TMP
,R2_COPYPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
229 OP(PAT
,DST
,R2_MASKPEN
), OP(SRC
,DST
,R2_XORPEN
),
230 OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x79 ~D^S^(P&(D|S)) */
231 { OP(DST
,SRC
,R2_MERGENOTPEN
), OP(PAT
,SRC
,R2_MASKPEN
),
232 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x7a D^(P&(S|~D)) */
233 { OP(PAT
,DST
,R2_NOTXORPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0x7b ~(S&~(D^P)) */
234 { OP(SRC
,DST
,R2_MERGENOTPEN
), OP(PAT
,DST
,R2_MASKPEN
),
235 OP(SRC
,DST
,R2_XORPEN
) }, /* 0x7c S^(P&(D|~S)) */
236 { OP(PAT
,SRC
,R2_NOTXORPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0x7d ~(D&~(P^S)) */
237 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,SRC
,R2_XORPEN
),
238 OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0x7e (S^P)|(S^D) */
239 { OP(PAT
,SRC
,R2_MASKPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0x7f ~(D&P&S) */
240 { OP(PAT
,SRC
,R2_MASKPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x80 D&P&S */
241 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,SRC
,R2_XORPEN
),
242 OP(SRC
,DST
,R2_NOTMERGEPEN
) }, /* 0x81 ~((S^P)|(S^D)) */
243 { OP(PAT
,SRC
,R2_NOTXORPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x82 D&~(P^S) */
244 { OP(SRC
,DST
,R2_MERGENOTPEN
), OP(PAT
,DST
,R2_MASKPEN
),
245 OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0x83 ~S^(P&(D|~S)) */
246 { OP(PAT
,DST
,R2_NOTXORPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x84 S&~(D^P) */
247 { OP(PAT
,SRC
,R2_MERGENOTPEN
), OP(SRC
,DST
,R2_MASKPEN
),
248 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0x85 ~P^(D&(S|~P)) */
249 { OP(DST
,TMP
,R2_COPYPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
250 OP(PAT
,DST
,R2_MASKPEN
), OP(SRC
,DST
,R2_XORPEN
),
251 OP(TMP
,DST
,R2_XORPEN
) }, /* 0x86 D^S^(P&(D|S)) */
252 { OP(SRC
,DST
,R2_MASKPEN
), OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0x87 ~P^(D&S) */
253 { OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x88 S&D */
254 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MASKPENNOT
),
255 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x89 ~S^(D|(P&~S)) */
256 { OP(PAT
,SRC
,R2_MERGENOTPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x8a D&(S|~P) */
257 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_XORPEN
),
258 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x8b ~D^(S|(P^D)) */
259 { OP(PAT
,DST
,R2_MERGENOTPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0x8c S&(D|~P) */
260 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_XORPEN
),
261 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x8d ~S^(D|(P^S)) */
262 { OP(SRC
,TMP
,R2_COPYPEN
), OP(DST
,SRC
,R2_XORPEN
),
263 OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_MASKPEN
),
264 OP(TMP
,DST
,R2_XORPEN
) }, /* 0x8e S^((S^D)&(P^D))*/
265 { OP(SRC
,DST
,R2_NOTMASKPEN
), OP(PAT
,DST
,R2_NOTMASKPEN
) }, /* 0x8f ~(P&~(D&S)) */
266 { OP(SRC
,DST
,R2_NOTXORPEN
), OP(PAT
,DST
,R2_MASKPEN
) }, /* 0x90 P&~(D^S) */
267 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MERGEPENNOT
),
268 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x91 ~S^(D&(P|~S)) */
269 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
270 OP(SRC
,DST
,R2_MASKPEN
), OP(PAT
,DST
,R2_XORPEN
),
271 OP(TMP
,DST
,R2_XORPEN
) }, /* 0x92 D^P^(S&(D|P)) */
272 { OP(PAT
,DST
,R2_MASKPEN
), OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0x93 ~S^(P&D) */
273 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MERGEPEN
),
274 OP(SRC
,DST
,R2_MASKPEN
), OP(PAT
,DST
,R2_XORPEN
),
275 OP(TMP
,DST
,R2_XORPEN
) }, /* 0x94 S^P^(D&(P|S)) */
276 { OP(PAT
,SRC
,R2_MASKPEN
), OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0x95 ~D^(P&S) */
277 { OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0x96 D^P^S */
278 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_NOTMERGEPEN
),
279 OP(SRC
,DST
,R2_MERGEPEN
), OP(PAT
,DST
,R2_XORPEN
),
280 OP(TMP
,DST
,R2_XORPEN
) }, /* 0x97 S^P^(D|~(P|S)) */
281 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_NOTMERGEPEN
),
282 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x98 ~S^(D|~(P|S)) */
283 { OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0x99 ~S^D */
284 { OP(PAT
,SRC
,R2_MASKPENNOT
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0x9a D^(P&~S) */
285 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MERGEPEN
),
286 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x9b ~S^(D&(P|S)) */
287 { OP(PAT
,DST
,R2_MASKPENNOT
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0x9c S^(P&~D) */
288 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
289 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0x9d ~D^(S&(P|D)) */
290 { OP(DST
,TMP
,R2_COPYPEN
), OP(SRC
,DST
,R2_MASKPEN
),
291 OP(PAT
,DST
,R2_MERGEPEN
), OP(SRC
,DST
,R2_XORPEN
),
292 OP(TMP
,DST
,R2_XORPEN
) }, /* 0x9e D^S^(P|(D&S)) */
293 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,DST
,R2_NOTMASKPEN
) }, /* 0x9f ~(P&(D^S)) */
294 { OP(PAT
,DST
,R2_MASKPEN
) }, /* 0xa0 D&P */
295 { OP(PAT
,SRC
,R2_MASKNOTPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
296 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0xa1 ~P^(D|(S&~P)) */
297 { OP(PAT
,SRC
,R2_MERGEPENNOT
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0xa2 D&(P|~S) */
298 { OP(DST
,SRC
,R2_XORPEN
), OP(PAT
,SRC
,R2_MERGEPEN
),
299 OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0xa3 ~D^(P|(S^D)) */
300 { OP(PAT
,SRC
,R2_NOTMERGEPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
301 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0xa4 ~P^(D|~(S|P)) */
302 { OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0xa5 ~P^D */
303 { OP(PAT
,SRC
,R2_MASKNOTPEN
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0xa6 D^(S&~P) */
304 { OP(PAT
,SRC
,R2_MERGEPEN
), OP(SRC
,DST
,R2_MASKPEN
),
305 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0xa7 ~P^(D&(S|P)) */
306 { OP(PAT
,SRC
,R2_MERGEPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0xa8 D&(P|S) */
307 { OP(PAT
,SRC
,R2_MERGEPEN
), OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0xa9 ~D^(P|S) */
308 { OP(PAT
,DST
,R2_NOP
) }, /* 0xaa D */
309 { OP(PAT
,SRC
,R2_NOTMERGEPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xab D|~(P|S) */
310 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,DST
,R2_MASKPEN
),
311 OP(SRC
,DST
,R2_XORPEN
) }, /* 0xac S^(P&(D^S)) */
312 { OP(DST
,SRC
,R2_MASKPEN
), OP(PAT
,SRC
,R2_MERGEPEN
),
313 OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0xad ~D^(P|(S&D)) */
314 { OP(PAT
,SRC
,R2_MASKNOTPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xae D|(S&~P) */
315 { OP(PAT
,DST
,R2_MERGENOTPEN
) }, /* 0xaf D|~P */
316 { OP(SRC
,DST
,R2_MERGENOTPEN
), OP(PAT
,DST
,R2_MASKPEN
) }, /* 0xb0 P&(D|~S) */
317 { OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
318 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0xb1 ~P^(D|(S^P)) */
319 { OP(SRC
,TMP
,R2_COPYPEN
), OP(SRC
,DST
,R2_XORPEN
),
320 OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
321 OP(TMP
,DST
,R2_XORPEN
) }, /* 0xb2 S^((S^P)|(S^D))*/
322 { OP(PAT
,DST
,R2_NOTMASKPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0xb3 ~(S&~(D&P)) */
323 { OP(SRC
,DST
,R2_MASKPENNOT
), OP(PAT
,DST
,R2_XORPEN
) }, /* 0xb4 P^(S&~D) */
324 { OP(DST
,SRC
,R2_MERGEPEN
), OP(PAT
,SRC
,R2_MASKPEN
),
325 OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0xb5 ~D^(P&(S|D)) */
326 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_MASKPEN
),
327 OP(SRC
,DST
,R2_MERGEPEN
), OP(PAT
,DST
,R2_XORPEN
),
328 OP(TMP
,DST
,R2_XORPEN
) }, /* 0xb6 D^P^(S|(D&P)) */
329 { OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0xb7 ~(S&(D^P)) */
330 { OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_MASKPEN
),
331 OP(PAT
,DST
,R2_XORPEN
) }, /* 0xb8 P^(S&(D^P)) */
332 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_MASKPEN
),
333 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0xb9 ~D^(S|(P&D)) */
334 { OP(PAT
,SRC
,R2_MASKPENNOT
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xba D|(P&~S) */
335 { OP(SRC
,DST
,R2_MERGENOTPEN
) }, /* 0xbb ~S|D */
336 { OP(SRC
,DST
,R2_NOTMASKPEN
), OP(PAT
,DST
,R2_MASKPEN
),
337 OP(SRC
,DST
,R2_XORPEN
) }, /* 0xbc S^(P&~(D&S)) */
338 { OP(DST
,SRC
,R2_XORPEN
), OP(PAT
,DST
,R2_XORPEN
),
339 OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0xbd ~((S^D)&(P^D)) */
340 { OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xbe D|(P^S) */
341 { OP(PAT
,SRC
,R2_NOTMASKPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xbf D|~(P&S) */
342 { OP(PAT
,SRC
,R2_MASKPEN
) }, /* 0xc0 P&S */
343 { OP(SRC
,DST
,R2_MASKNOTPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
344 OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0xc1 ~S^(P|(D&~S)) */
345 { OP(SRC
,DST
,R2_NOTMERGEPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
346 OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0xc2 ~S^(P|~(D|S)) */
347 { OP(PAT
,SRC
,R2_NOTXORPEN
) }, /* 0xc3 ~P^S */
348 { OP(PAT
,DST
,R2_MERGEPENNOT
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0xc4 S&(P|~D) */
349 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
350 OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0xc5 ~S^(P|(D^S)) */
351 { OP(PAT
,DST
,R2_MASKNOTPEN
), OP(SRC
,DST
,R2_XORPEN
) }, /* 0xc6 S^(D&~P) */
352 { OP(PAT
,DST
,R2_MERGEPEN
), OP(SRC
,DST
,R2_MASKPEN
),
353 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0xc7 ~P^(S&(D|P)) */
354 { OP(PAT
,DST
,R2_MERGEPEN
), OP(SRC
,DST
,R2_MASKPEN
) }, /* 0xc8 S&(D|P) */
355 { OP(PAT
,DST
,R2_MERGEPEN
), OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0xc9 ~S^(P|D) */
356 { OP(DST
,SRC
,R2_XORPEN
), OP(PAT
,SRC
,R2_MASKPEN
),
357 OP(SRC
,DST
,R2_XORPEN
) }, /* 0xca D^(P&(S^D)) */
358 { OP(SRC
,DST
,R2_MASKPEN
), OP(PAT
,DST
,R2_MERGEPEN
),
359 OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0xcb ~S^(P|(D&S)) */
360 { OP(SRC
,DST
,R2_COPYPEN
) }, /* 0xcc S */
361 { OP(PAT
,DST
,R2_NOTMERGEPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xcd S|~(D|P) */
362 { OP(PAT
,DST
,R2_MASKNOTPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xce S|(D&~P) */
363 { OP(PAT
,SRC
,R2_MERGENOTPEN
) }, /* 0xcf S|~P */
364 { OP(SRC
,DST
,R2_MERGEPENNOT
), OP(PAT
,DST
,R2_MASKPEN
) }, /* 0xd0 P&(S|~D) */
365 { OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
366 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0xd1 ~P^(S|(D^P)) */
367 { OP(SRC
,DST
,R2_MASKNOTPEN
), OP(PAT
,DST
,R2_XORPEN
) }, /* 0xd2 P^(D&~S) */
368 { OP(SRC
,DST
,R2_MERGEPEN
), OP(PAT
,DST
,R2_MASKPEN
),
369 OP(SRC
,DST
,R2_NOTXORPEN
) }, /* 0xd3 ~S^(P&(D|S)) */
370 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_XORPEN
),
371 OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_MASKPEN
),
372 OP(TMP
,DST
,R2_XORPEN
) }, /* 0xd4 S^((S^P)&(D^P))*/
373 { OP(PAT
,SRC
,R2_NOTMASKPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0xd5 ~(D&~(P&S)) */
374 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MASKPEN
),
375 OP(SRC
,DST
,R2_MERGEPEN
), OP(PAT
,DST
,R2_XORPEN
),
376 OP(TMP
,DST
,R2_XORPEN
) }, /* 0xd6 S^P^(D|(P&S)) */
377 { OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0xd7 ~(D&(P^S)) */
378 { OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_MASKPEN
),
379 OP(PAT
,DST
,R2_XORPEN
) }, /* 0xd8 P^(D&(S^P)) */
380 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_MASKPEN
),
381 OP(SRC
,DST
,R2_MERGEPEN
), OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0xd9 ~S^(D|(P&S)) */
382 { OP(DST
,SRC
,R2_NOTMASKPEN
), OP(PAT
,SRC
,R2_MASKPEN
),
383 OP(SRC
,DST
,R2_XORPEN
) }, /* 0xda D^(P&~(S&D)) */
384 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,SRC
,R2_XORPEN
),
385 OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0xdb ~((S^P)&(S^D)) */
386 { OP(PAT
,DST
,R2_MASKPENNOT
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xdc S|(P&~D) */
387 { OP(SRC
,DST
,R2_MERGEPENNOT
) }, /* 0xdd S|~D */
388 { OP(PAT
,DST
,R2_XORPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xde S|(D^P) */
389 { OP(PAT
,DST
,R2_NOTMASKPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xdf S|~(D&P) */
390 { OP(SRC
,DST
,R2_MERGEPEN
), OP(PAT
,DST
,R2_MASKPEN
) }, /* 0xe0 P&(D|S) */
391 { OP(SRC
,DST
,R2_MERGEPEN
), OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0xe1 ~P^(D|S) */
392 { OP(DST
,TMP
,R2_COPYPEN
), OP(PAT
,DST
,R2_XORPEN
),
393 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0xe2 D^(S&(P^D)) */
394 { OP(PAT
,DST
,R2_MASKPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
395 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0xe3 ~P^(S|(D&P)) */
396 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_XORPEN
),
397 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0xe4 S^(D&(P^S)) */
398 { OP(PAT
,SRC
,R2_MASKPEN
), OP(SRC
,DST
,R2_MERGEPEN
),
399 OP(PAT
,DST
,R2_NOTXORPEN
) }, /* 0xe5 ~P^(D|(S&P)) */
400 { OP(SRC
,TMP
,R2_COPYPEN
), OP(PAT
,SRC
,R2_NOTMASKPEN
),
401 OP(SRC
,DST
,R2_MASKPEN
), OP(TMP
,DST
,R2_XORPEN
) }, /* 0xe6 S^(D&~(P&S)) */
402 { OP(PAT
,SRC
,R2_XORPEN
), OP(PAT
,DST
,R2_XORPEN
),
403 OP(SRC
,DST
,R2_NOTMASKPEN
) }, /* 0xe7 ~((S^P)&(D^P)) */
404 { OP(SRC
,TMP
,R2_COPYPEN
), OP(SRC
,DST
,R2_XORPEN
),
405 OP(PAT
,SRC
,R2_XORPEN
), OP(SRC
,DST
,R2_MASKPEN
),
406 OP(TMP
,DST
,R2_XORPEN
) }, /* 0xe8 S^((S^P)&(S^D))*/
407 { OP(DST
,TMP
,R2_COPYPEN
), OP(SRC
,DST
,R2_NOTMASKPEN
),
408 OP(PAT
,DST
,R2_MASKPEN
), OP(SRC
,DST
,R2_XORPEN
),
409 OP(TMP
,DST
,R2_NOTXORPEN
) }, /* 0xe9 ~D^S^(P&~(S&D))*/
410 { OP(PAT
,SRC
,R2_MASKPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xea D|(P&S) */
411 { OP(PAT
,SRC
,R2_NOTXORPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xeb D|~(P^S) */
412 { OP(PAT
,DST
,R2_MASKPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xec S|(D&P) */
413 { OP(PAT
,DST
,R2_NOTXORPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xed S|~(D^P) */
414 { OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xee S|D */
415 { OP(PAT
,DST
,R2_MERGENOTPEN
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xef S|D|~P */
416 { OP(PAT
,DST
,R2_COPYPEN
) }, /* 0xf0 P */
417 { OP(SRC
,DST
,R2_NOTMERGEPEN
), OP(PAT
,DST
,R2_MERGEPEN
) }, /* 0xf1 P|~(D|S) */
418 { OP(SRC
,DST
,R2_MASKNOTPEN
), OP(PAT
,DST
,R2_MERGEPEN
) }, /* 0xf2 P|(D&~S) */
419 { OP(PAT
,SRC
,R2_MERGEPENNOT
) }, /* 0xf3 P|~S */
420 { OP(SRC
,DST
,R2_MASKPENNOT
), OP(PAT
,DST
,R2_MERGEPEN
) }, /* 0xf4 P|(S&~D) */
421 { OP(PAT
,DST
,R2_MERGEPENNOT
) }, /* 0xf5 P|~D */
422 { OP(SRC
,DST
,R2_XORPEN
), OP(PAT
,DST
,R2_MERGEPEN
) }, /* 0xf6 P|(D^S) */
423 { OP(SRC
,DST
,R2_NOTMASKPEN
), OP(PAT
,DST
,R2_MERGEPEN
) }, /* 0xf7 P|~(S&D) */
424 { OP(SRC
,DST
,R2_MASKPEN
), OP(PAT
,DST
,R2_MERGEPEN
) }, /* 0xf8 P|(D&S) */
425 { OP(SRC
,DST
,R2_NOTXORPEN
), OP(PAT
,DST
,R2_MERGEPEN
) }, /* 0xf9 P|~(D^S) */
426 { OP(PAT
,DST
,R2_MERGEPEN
) }, /* 0xfa D|P */
427 { OP(PAT
,SRC
,R2_MERGEPENNOT
), OP(SRC
,DST
,R2_MERGEPEN
) }, /* 0xfb D|P|~S */
428 { OP(PAT
,SRC
,R2_MERGEPEN
) }, /* 0xfc P|S */
429 { OP(SRC
,DST
,R2_MERGEPENNOT
), OP(PAT
,DST
,R2_MERGEPEN
) }, /* 0xfd P|S|~D */
430 { OP(SRC
,DST
,R2_MERGEPEN
), OP(PAT
,DST
,R2_MERGEPEN
) }, /* 0xfe P|D|S */
431 { OP(PAT
,DST
,R2_WHITE
) } /* 0xff 1 */
434 static int get_overlap( const dib_info
*dst
, const RECT
*dst_rect
,
435 const dib_info
*src
, const RECT
*src_rect
)
437 const char *src_top
, *dst_top
;
440 if (dst
->stride
!= src
->stride
) return 0; /* can't be the same dib */
441 if (dst
->rect
.left
+ dst_rect
->right
<= src
->rect
.left
+ src_rect
->left
) return 0;
442 if (dst
->rect
.left
+ dst_rect
->left
>= src
->rect
.left
+ src_rect
->right
) return 0;
444 src_top
= (const char *)src
->bits
.ptr
+ (src
->rect
.top
+ src_rect
->top
) * src
->stride
;
445 dst_top
= (const char *)dst
->bits
.ptr
+ (dst
->rect
.top
+ dst_rect
->top
) * dst
->stride
;
446 height
= (dst_rect
->bottom
- dst_rect
->top
) * dst
->stride
;
450 if (src_top
>= dst_top
+ height
) return 0;
451 if (src_top
+ height
<= dst_top
) return 0;
452 if (dst_top
< src_top
) ret
|= OVERLAP_ABOVE
;
453 else if (dst_top
> src_top
) ret
|= OVERLAP_BELOW
;
457 if (src_top
<= dst_top
+ height
) return 0;
458 if (src_top
+ height
>= dst_top
) return 0;
459 if (dst_top
> src_top
) ret
|= OVERLAP_ABOVE
;
460 else if (dst_top
< src_top
) ret
|= OVERLAP_BELOW
;
463 if (dst
->rect
.left
+ dst_rect
->left
< src
->rect
.left
+ src_rect
->left
) ret
|= OVERLAP_LEFT
;
464 else if (dst
->rect
.left
+ dst_rect
->left
> src
->rect
.left
+ src_rect
->left
) ret
|= OVERLAP_RIGHT
;
469 static void copy_rect( dib_info
*dst
, const RECT
*dst_rect
, const dib_info
*src
, const RECT
*src_rect
,
470 const struct clipped_rects
*clipped_rects
, INT rop2
)
474 int i
, count
, start
, end
, overlap
;
475 DWORD
and = 0, xor = 0;
479 rects
= clipped_rects
->rects
;
480 count
= clipped_rects
->count
;
490 case R2_NOT
: and = ~0u;
492 case R2_WHITE
: xor = ~0u;
495 dst
->funcs
->solid_rects( dst
, count
, rects
, and, xor );
501 overlap
= get_overlap( dst
, dst_rect
, src
, src_rect
);
502 if (overlap
& OVERLAP_BELOW
)
504 if (overlap
& OVERLAP_RIGHT
) /* right to left, bottom to top */
506 for (i
= count
- 1; i
>= 0; i
--)
508 origin
.x
= src_rect
->left
+ rects
[i
].left
- dst_rect
->left
;
509 origin
.y
= src_rect
->top
+ rects
[i
].top
- dst_rect
->top
;
510 dst
->funcs
->copy_rect( dst
, &rects
[i
], src
, &origin
, rop2
, overlap
);
513 else /* left to right, bottom to top */
515 for (start
= count
- 1; start
>= 0; start
= end
)
517 for (end
= start
- 1; end
>= 0; end
--)
518 if (rects
[start
].top
!= rects
[end
].top
) break;
520 for (i
= end
+ 1; i
<= start
; i
++)
522 origin
.x
= src_rect
->left
+ rects
[i
].left
- dst_rect
->left
;
523 origin
.y
= src_rect
->top
+ rects
[i
].top
- dst_rect
->top
;
524 dst
->funcs
->copy_rect( dst
, &rects
[i
], src
, &origin
, rop2
, overlap
);
529 else if (overlap
& OVERLAP_RIGHT
) /* right to left, top to bottom */
531 for (start
= 0; start
< count
; start
= end
)
533 for (end
= start
+ 1; end
< count
; end
++)
534 if (rects
[start
].top
!= rects
[end
].top
) break;
536 for (i
= end
- 1; i
>= start
; i
--)
538 origin
.x
= src_rect
->left
+ rects
[i
].left
- dst_rect
->left
;
539 origin
.y
= src_rect
->top
+ rects
[i
].top
- dst_rect
->top
;
540 dst
->funcs
->copy_rect( dst
, &rects
[i
], src
, &origin
, rop2
, overlap
);
544 else /* left to right, top to bottom */
546 for (i
= 0; i
< count
; i
++)
548 origin
.x
= src_rect
->left
+ rects
[i
].left
- dst_rect
->left
;
549 origin
.y
= src_rect
->top
+ rects
[i
].top
- dst_rect
->top
;
550 dst
->funcs
->copy_rect( dst
, &rects
[i
], src
, &origin
, rop2
, overlap
);
555 static void mask_rect( dib_info
*dst
, const RECT
*dst_rect
, const dib_info
*src
, const RECT
*src_rect
,
556 const struct clipped_rects
*clipped_rects
, INT rop2
)
562 if (rop2
== R2_BLACK
|| rop2
== R2_NOT
|| rop2
== R2_NOP
|| rop2
== R2_WHITE
)
563 return copy_rect( dst
, dst_rect
, src
, src_rect
, clipped_rects
, rop2
);
567 rects
= clipped_rects
->rects
;
568 count
= clipped_rects
->count
;
576 for (i
= 0; i
< count
; i
++)
578 origin
.x
= src_rect
->left
+ rects
[i
].left
- dst_rect
->left
;
579 origin
.y
= src_rect
->top
+ rects
[i
].top
- dst_rect
->top
;
580 dst
->funcs
->mask_rect( dst
, &rects
[i
], src
, &origin
, rop2
);
584 static DWORD
blend_rect( dib_info
*dst
, const RECT
*dst_rect
, const dib_info
*src
, const RECT
*src_rect
,
585 HRGN clip
, BLENDFUNCTION blend
)
588 struct clipped_rects clipped_rects
;
591 if (!get_clipped_rects( dst
, dst_rect
, clip
, &clipped_rects
)) return ERROR_SUCCESS
;
592 for (i
= 0; i
< clipped_rects
.count
; i
++)
594 origin
.x
= src_rect
->left
+ clipped_rects
.rects
[i
].left
- dst_rect
->left
;
595 origin
.y
= src_rect
->top
+ clipped_rects
.rects
[i
].top
- dst_rect
->top
;
596 dst
->funcs
->blend_rect( dst
, &clipped_rects
.rects
[i
], src
, &origin
, blend
);
598 free_clipped_rects( &clipped_rects
);
599 return ERROR_SUCCESS
;
602 /* compute y-ordered, device coords vertices for a horizontal rectangle gradient */
603 static void get_gradient_hrect_vertices( const GRADIENT_RECT
*rect
, const TRIVERTEX
*vert
,
604 const POINT
*dev_pts
, TRIVERTEX v
[2], RECT
*bounds
)
606 int v0
= rect
->UpperLeft
;
607 int v1
= rect
->LowerRight
;
609 if (dev_pts
[v1
].x
< dev_pts
[v0
].x
) /* swap the colors */
611 v0
= rect
->LowerRight
;
612 v1
= rect
->UpperLeft
;
616 bounds
->left
= v
[0].x
= dev_pts
[v0
].x
;
617 bounds
->right
= v
[1].x
= dev_pts
[v1
].x
;
618 bounds
->top
= v
[0].y
= min( dev_pts
[v0
].y
, dev_pts
[v1
].y
);
619 bounds
->bottom
= v
[1].y
= max( dev_pts
[v0
].y
, dev_pts
[v1
].y
);
622 /* compute y-ordered, device coords vertices for a vertical rectangle gradient */
623 static void get_gradient_vrect_vertices( const GRADIENT_RECT
*rect
, const TRIVERTEX
*vert
,
624 const POINT
*dev_pts
, TRIVERTEX v
[2], RECT
*bounds
)
626 int v0
= rect
->UpperLeft
;
627 int v1
= rect
->LowerRight
;
629 if (dev_pts
[v1
].y
< dev_pts
[v0
].y
) /* swap the colors */
631 v0
= rect
->LowerRight
;
632 v1
= rect
->UpperLeft
;
636 bounds
->left
= v
[0].x
= min( dev_pts
[v0
].x
, dev_pts
[v1
].x
);
637 bounds
->right
= v
[1].x
= max( dev_pts
[v0
].x
, dev_pts
[v1
].x
);
638 bounds
->top
= v
[0].y
= dev_pts
[v0
].y
;
639 bounds
->bottom
= v
[1].y
= dev_pts
[v1
].y
;
642 /* compute y-ordered, device coords vertices for a triangle gradient */
643 static void get_gradient_triangle_vertices( const GRADIENT_TRIANGLE
*tri
, const TRIVERTEX
*vert
,
644 const POINT
*dev_pts
, TRIVERTEX v
[3], RECT
*bounds
)
648 if (dev_pts
[tri
->Vertex1
].y
> dev_pts
[tri
->Vertex2
].y
)
650 if (dev_pts
[tri
->Vertex3
].y
< dev_pts
[tri
->Vertex2
].y
)
651 { v0
= tri
->Vertex3
; v1
= tri
->Vertex2
; v2
= tri
->Vertex1
; }
652 else if (dev_pts
[tri
->Vertex3
].y
< dev_pts
[tri
->Vertex1
].y
)
653 { v0
= tri
->Vertex2
; v1
= tri
->Vertex3
; v2
= tri
->Vertex1
; }
655 { v0
= tri
->Vertex2
; v1
= tri
->Vertex1
; v2
= tri
->Vertex3
; }
659 if (dev_pts
[tri
->Vertex3
].y
< dev_pts
[tri
->Vertex1
].y
)
660 { v0
= tri
->Vertex3
; v1
= tri
->Vertex1
; v2
= tri
->Vertex2
; }
661 else if (dev_pts
[tri
->Vertex3
].y
< dev_pts
[tri
->Vertex2
].y
)
662 { v0
= tri
->Vertex1
; v1
= tri
->Vertex3
; v2
= tri
->Vertex2
; }
664 { v0
= tri
->Vertex1
; v1
= tri
->Vertex2
; v2
= tri
->Vertex3
; }
669 v
[0].x
= dev_pts
[v0
].x
;
670 v
[0].y
= dev_pts
[v0
].y
;
671 v
[1].y
= dev_pts
[v1
].y
;
672 v
[1].x
= dev_pts
[v1
].x
;
673 v
[2].x
= dev_pts
[v2
].x
;
674 v
[2].y
= dev_pts
[v2
].y
;
675 bounds
->left
= min( v
[0].x
, min( v
[1].x
, v
[2].x
));
676 bounds
->top
= v
[0].y
;
677 bounds
->right
= max( v
[0].x
, max( v
[1].x
, v
[2].x
));
678 bounds
->bottom
= v
[2].y
;
681 static BOOL
gradient_rect( dib_info
*dib
, TRIVERTEX
*v
, int mode
, HRGN clip
, const RECT
*bounds
)
684 struct clipped_rects clipped_rects
;
687 if (!get_clipped_rects( dib
, bounds
, clip
, &clipped_rects
)) return TRUE
;
688 for (i
= 0; i
< clipped_rects
.count
; i
++)
690 if (!(ret
= dib
->funcs
->gradient_rect( dib
, &clipped_rects
.rects
[i
], v
, mode
))) break;
692 free_clipped_rects( &clipped_rects
);
696 static DWORD
copy_src_bits( dib_info
*src
, RECT
*src_rect
)
698 int y
, stride
= get_dib_stride( src
->width
, src
->bit_count
);
699 int height
= src_rect
->bottom
- src_rect
->top
;
700 void *ptr
= HeapAlloc( GetProcessHeap(), 0, stride
* height
);
702 if (!ptr
) return ERROR_OUTOFMEMORY
;
704 for (y
= 0; y
< height
; y
++)
705 memcpy( (char *)ptr
+ y
* stride
,
706 (char *)src
->bits
.ptr
+ (src
->rect
.top
+ src_rect
->top
+ y
) * src
->stride
, stride
);
707 src
->stride
= stride
;
708 src
->height
= height
;
710 src
->rect
.bottom
= height
;
711 if (src
->bits
.free
) src
->bits
.free( &src
->bits
);
712 src
->bits
.is_copy
= TRUE
;
714 src
->bits
.free
= free_heap_bits
;
715 src
->bits
.param
= NULL
;
717 offset_rect( src_rect
, 0, -src_rect
->top
);
718 return ERROR_SUCCESS
;
721 static DWORD
create_tmp_dib( const dib_info
*copy
, int width
, int height
, dib_info
*ret
)
723 copy_dib_color_info( ret
, copy
);
725 ret
->height
= height
;
726 ret
->stride
= get_dib_stride( width
, ret
->bit_count
);
729 ret
->rect
.right
= width
;
730 ret
->rect
.bottom
= height
;
731 ret
->bits
.ptr
= HeapAlloc( GetProcessHeap(), 0, ret
->height
* ret
->stride
);
732 ret
->bits
.is_copy
= TRUE
;
733 ret
->bits
.free
= free_heap_bits
;
734 ret
->bits
.param
= NULL
;
736 return ret
->bits
.ptr
? ERROR_SUCCESS
: ERROR_OUTOFMEMORY
;
739 static DWORD
execute_rop( dibdrv_physdev
*pdev
, const RECT
*dst_rect
, dib_info
*src
,
740 const RECT
*src_rect
, const struct clipped_rects
*clipped_rects
, DWORD rop
)
742 dib_info
*dibs
[3], *result
= src
, tmp
;
744 int width
= dst_rect
->right
- dst_rect
->left
;
745 int height
= dst_rect
->bottom
- dst_rect
->top
;
746 const BYTE
*opcode
= BITBLT_Opcodes
[(rop
>> 16) & 0xff];
750 dibs
[DST
] = &pdev
->dib
;
753 rects
[SRC
] = *src_rect
;
754 rects
[DST
] = *dst_rect
;
755 rects
[TMP
] = *dst_rect
;
756 offset_rect( &rects
[TMP
], -rects
[TMP
].left
, -rects
[TMP
].top
);
758 for ( ; *opcode
; opcode
++)
760 if (OP_DST(*opcode
) == DST
) result
= dibs
[DST
];
761 if (OP_DST(*opcode
) == SRC
&& src
->bits
.is_copy
== FALSE
)
763 err
= copy_src_bits( src
, &rects
[SRC
] );
766 if (OP_DST(*opcode
) == TMP
&& !dibs
[TMP
])
768 err
= create_tmp_dib( &pdev
->dib
, width
, height
, &tmp
);
773 switch(OP_SRCDST(*opcode
))
775 case OP_ARGS(DST
,TMP
):
776 case OP_ARGS(SRC
,TMP
):
777 case OP_ARGS(DST
,SRC
):
778 case OP_ARGS(SRC
,DST
):
779 case OP_ARGS(TMP
,SRC
):
780 case OP_ARGS(TMP
,DST
):
781 copy_rect( dibs
[OP_DST(*opcode
)], &rects
[OP_DST(*opcode
)],
782 dibs
[OP_SRC(*opcode
)], &rects
[OP_SRC(*opcode
)],
783 OP_DST(*opcode
) == DST
? clipped_rects
: NULL
, OP_ROP(*opcode
) );
785 case OP_ARGS(PAT
,DST
):
786 pdev
->brush
.rects( pdev
, &pdev
->brush
, dibs
[DST
], clipped_rects
->count
, clipped_rects
->rects
,
789 case OP_ARGS(PAT
,SRC
):
790 pdev
->brush
.rects( pdev
, &pdev
->brush
, dibs
[SRC
], 1, &rects
[SRC
], OP_ROP(*opcode
) );
795 if (dibs
[TMP
]) free_dib_info( dibs
[TMP
] );
798 copy_rect( dibs
[DST
], &rects
[DST
], dibs
[SRC
], &rects
[SRC
], clipped_rects
, R2_COPYPEN
);
800 return ERROR_SUCCESS
;
803 static void set_color_info( const dib_info
*dib
, BITMAPINFO
*info
)
805 DWORD
*masks
= (DWORD
*)info
->bmiColors
;
807 info
->bmiHeader
.biCompression
= BI_RGB
;
808 info
->bmiHeader
.biClrUsed
= 0;
810 switch (info
->bmiHeader
.biBitCount
)
815 if (dib
->color_table
)
817 info
->bmiHeader
.biClrUsed
= 1 << dib
->bit_count
;
818 memcpy( info
->bmiColors
, dib
->color_table
, info
->bmiHeader
.biClrUsed
* sizeof(RGBQUAD
) );
822 masks
[0] = dib
->red_mask
;
823 masks
[1] = dib
->green_mask
;
824 masks
[2] = dib
->blue_mask
;
825 info
->bmiHeader
.biCompression
= BI_BITFIELDS
;
828 if (dib
->funcs
!= &funcs_8888
)
830 masks
[0] = dib
->red_mask
;
831 masks
[1] = dib
->green_mask
;
832 masks
[2] = dib
->blue_mask
;
833 info
->bmiHeader
.biCompression
= BI_BITFIELDS
;
839 static DWORD
get_image_dib_info( dib_info
*dib
, BITMAPINFO
*info
,
840 struct gdi_image_bits
*bits
, struct bitblt_coords
*src
)
842 info
->bmiHeader
.biSize
= sizeof(info
->bmiHeader
);
843 info
->bmiHeader
.biPlanes
= 1;
844 info
->bmiHeader
.biXPelsPerMeter
= 0;
845 info
->bmiHeader
.biYPelsPerMeter
= 0;
846 info
->bmiHeader
.biClrImportant
= 0;
847 info
->bmiHeader
.biWidth
= dib
->width
;
848 info
->bmiHeader
.biHeight
= dib
->height
;
849 info
->bmiHeader
.biBitCount
= dib
->bit_count
;
850 info
->bmiHeader
.biSizeImage
= info
->bmiHeader
.biHeight
* abs( dib
->stride
);
851 if (dib
->stride
> 0) info
->bmiHeader
.biHeight
= -info
->bmiHeader
.biHeight
;
853 set_color_info( dib
, info
);
857 bits
->ptr
= dib
->bits
.ptr
;
858 bits
->is_copy
= FALSE
;
861 if (dib
->stride
< 0) bits
->ptr
= (char *)bits
->ptr
+ (dib
->height
- 1) * dib
->stride
;
862 src
->x
+= dib
->rect
.left
;
863 src
->y
+= dib
->rect
.top
;
864 offset_rect( &src
->visrect
, dib
->rect
.left
, dib
->rect
.top
);
866 return ERROR_SUCCESS
;
869 DWORD
get_image_from_bitmap( BITMAPOBJ
*bmp
, BITMAPINFO
*info
,
870 struct gdi_image_bits
*bits
, struct bitblt_coords
*src
)
874 if (!init_dib_info_from_bitmapobj( &dib
, bmp
)) return ERROR_OUTOFMEMORY
;
875 return get_image_dib_info( &dib
, info
, bits
, src
);
878 /***********************************************************************
881 DWORD
dibdrv_GetImage( PHYSDEV dev
, BITMAPINFO
*info
, struct gdi_image_bits
*bits
,
882 struct bitblt_coords
*src
)
884 dibdrv_physdev
*pdev
= get_dibdrv_pdev(dev
);
886 TRACE( "%p %p\n", dev
, info
);
888 return get_image_dib_info( &pdev
->dib
, info
, bits
, src
);
891 static BOOL
matching_color_info( const dib_info
*dib
, const BITMAPINFO
*info
, BOOL allow_mask_rect
)
893 const RGBQUAD
*color_table
= info
->bmiColors
;
895 if (info
->bmiHeader
.biPlanes
!= 1) return FALSE
;
897 if (allow_mask_rect
&& info
->bmiHeader
.biBitCount
== 1 && dib
->bit_count
!= 1)
900 if (info
->bmiHeader
.biBitCount
!= dib
->bit_count
) return FALSE
;
902 switch (info
->bmiHeader
.biBitCount
)
905 if (dib
->color_table_size
!= info
->bmiHeader
.biClrUsed
) return FALSE
;
906 return !memcmp( color_table
, dib
->color_table
, dib
->color_table_size
* sizeof(RGBQUAD
) );
910 if (!info
->bmiHeader
.biClrUsed
)
912 if (!dib
->color_table_size
) return TRUE
;
913 if (dib
->color_table_size
!= 1 << info
->bmiHeader
.biBitCount
) return FALSE
;
914 color_table
= get_default_color_table( info
->bmiHeader
.biBitCount
);
916 else if (dib
->color_table_size
!= info
->bmiHeader
.biClrUsed
) return FALSE
;
918 return !memcmp( color_table
, dib
->color_table
, dib
->color_table_size
* sizeof(RGBQUAD
) );
922 DWORD
*masks
= (DWORD
*)info
->bmiColors
;
923 if (info
->bmiHeader
.biCompression
== BI_RGB
) return dib
->funcs
== &funcs_555
;
924 if (info
->bmiHeader
.biCompression
== BI_BITFIELDS
)
925 return masks
[0] == dib
->red_mask
&& masks
[1] == dib
->green_mask
&& masks
[2] == dib
->blue_mask
;
934 DWORD
*masks
= (DWORD
*)info
->bmiColors
;
935 if (info
->bmiHeader
.biCompression
== BI_RGB
) return dib
->funcs
== &funcs_8888
;
936 if (info
->bmiHeader
.biCompression
== BI_BITFIELDS
)
937 return masks
[0] == dib
->red_mask
&& masks
[1] == dib
->green_mask
&& masks
[2] == dib
->blue_mask
;
946 DWORD
put_image_into_bitmap( BITMAPOBJ
*bmp
, HRGN clip
, BITMAPINFO
*info
,
947 const struct gdi_image_bits
*bits
, struct bitblt_coords
*src
,
948 struct bitblt_coords
*dst
)
950 struct clipped_rects clipped_rects
;
951 dib_info dib
, src_dib
;
953 if (!init_dib_info_from_bitmapobj( &dib
, bmp
)) return ERROR_OUTOFMEMORY
;
954 if (!matching_color_info( &dib
, info
, FALSE
)) goto update_format
;
955 if (!bits
) return ERROR_SUCCESS
;
956 if ((src
->width
!= dst
->width
) || (src
->height
!= dst
->height
)) return ERROR_TRANSFORM_NOT_SUPPORTED
;
958 init_dib_info_from_bitmapinfo( &src_dib
, info
, bits
->ptr
);
959 src_dib
.bits
.is_copy
= bits
->is_copy
;
961 if (get_clipped_rects( &dib
, &dst
->visrect
, clip
, &clipped_rects
))
963 copy_rect( &dib
, &dst
->visrect
, &src_dib
, &src
->visrect
, &clipped_rects
, R2_COPYPEN
);
964 free_clipped_rects( &clipped_rects
);
967 return ERROR_SUCCESS
;
970 info
->bmiHeader
.biPlanes
= 1;
971 info
->bmiHeader
.biBitCount
= dib
.bit_count
;
972 set_color_info( &dib
, info
);
973 return ERROR_BAD_FORMAT
;
976 static inline BOOL
rop_uses_pat(DWORD rop
)
978 return ((rop
>> 4) & 0x0f0000) != (rop
& 0x0f0000);
981 /***********************************************************************
984 DWORD
dibdrv_PutImage( PHYSDEV dev
, HRGN clip
, BITMAPINFO
*info
,
985 const struct gdi_image_bits
*bits
, struct bitblt_coords
*src
,
986 struct bitblt_coords
*dst
, DWORD rop
)
988 DC
*dc
= get_physdev_dc( dev
);
989 struct clipped_rects clipped_rects
;
990 DWORD ret
= ERROR_SUCCESS
;
993 dibdrv_physdev
*pdev
= get_dibdrv_pdev( dev
);
994 BOOL stretch
= (src
->width
!= dst
->width
) || (src
->height
!= dst
->height
);
996 TRACE( "%p %p\n", dev
, info
);
998 if (!matching_color_info( &pdev
->dib
, info
, !stretch
&& !rop_uses_pat( rop
) )) goto update_format
;
999 if (!bits
) return ERROR_SUCCESS
;
1000 if (stretch
) return ERROR_TRANSFORM_NOT_SUPPORTED
;
1002 /* For mask_rect, 1-bpp source without a color table uses the destination DC colors */
1003 if (info
->bmiHeader
.biBitCount
== 1 && pdev
->dib
.bit_count
!= 1 && !info
->bmiHeader
.biClrUsed
)
1004 get_mono_dc_colors( dc
, info
, 2 );
1006 init_dib_info_from_bitmapinfo( &src_dib
, info
, bits
->ptr
);
1007 src_dib
.bits
.is_copy
= bits
->is_copy
;
1009 if (clip
&& pdev
->clip
)
1011 tmp_rgn
= CreateRectRgn( 0, 0, 0, 0 );
1012 CombineRgn( tmp_rgn
, clip
, pdev
->clip
, RGN_AND
);
1015 else if (!clip
) clip
= pdev
->clip
;
1016 add_clipped_bounds( pdev
, &dst
->visrect
, clip
);
1018 if (get_clipped_rects( &pdev
->dib
, &dst
->visrect
, clip
, &clipped_rects
))
1020 if (!rop_uses_pat( rop
))
1022 int rop2
= ((rop
>> 16) & 0xf) + 1;
1023 if (pdev
->dib
.bit_count
== info
->bmiHeader
.biBitCount
)
1024 copy_rect( &pdev
->dib
, &dst
->visrect
, &src_dib
, &src
->visrect
, &clipped_rects
, rop2
);
1026 mask_rect( &pdev
->dib
, &dst
->visrect
, &src_dib
, &src
->visrect
, &clipped_rects
, rop2
);
1029 ret
= execute_rop( pdev
, &dst
->visrect
, &src_dib
, &src
->visrect
, &clipped_rects
, rop
);
1030 free_clipped_rects( &clipped_rects
);
1032 if (tmp_rgn
) DeleteObject( tmp_rgn
);
1036 info
->bmiHeader
.biPlanes
= 1;
1037 info
->bmiHeader
.biBitCount
= pdev
->dib
.bit_count
;
1038 set_color_info( &pdev
->dib
, info
);
1039 return ERROR_BAD_FORMAT
;
1042 /***********************************************************************
1045 DWORD
dibdrv_BlendImage( PHYSDEV dev
, BITMAPINFO
*info
, const struct gdi_image_bits
*bits
,
1046 struct bitblt_coords
*src
, struct bitblt_coords
*dst
, BLENDFUNCTION blend
)
1048 dibdrv_physdev
*pdev
= get_dibdrv_pdev( dev
);
1050 DWORD
*masks
= (DWORD
*)info
->bmiColors
;
1052 TRACE( "%p %p\n", dev
, info
);
1054 if (info
->bmiHeader
.biPlanes
!= 1) goto update_format
;
1055 if (info
->bmiHeader
.biBitCount
!= 32) goto update_format
;
1056 if (info
->bmiHeader
.biCompression
== BI_BITFIELDS
)
1058 if (blend
.AlphaFormat
& AC_SRC_ALPHA
) return ERROR_INVALID_PARAMETER
;
1059 if (masks
[0] != 0xff0000 || masks
[1] != 0x00ff00 || masks
[2] != 0x0000ff)
1063 if (!bits
) return ERROR_SUCCESS
;
1064 if ((src
->width
!= dst
->width
) || (src
->height
!= dst
->height
)) return ERROR_TRANSFORM_NOT_SUPPORTED
;
1066 init_dib_info_from_bitmapinfo( &src_dib
, info
, bits
->ptr
);
1067 src_dib
.bits
.is_copy
= bits
->is_copy
;
1068 add_clipped_bounds( pdev
, &dst
->visrect
, pdev
->clip
);
1069 return blend_rect( &pdev
->dib
, &dst
->visrect
, &src_dib
, &src
->visrect
, pdev
->clip
, blend
);
1072 if (blend
.AlphaFormat
& AC_SRC_ALPHA
) /* source alpha requires A8R8G8B8 format */
1073 return ERROR_INVALID_PARAMETER
;
1075 info
->bmiHeader
.biPlanes
= 1;
1076 info
->bmiHeader
.biBitCount
= 32;
1077 info
->bmiHeader
.biCompression
= BI_BITFIELDS
;
1078 info
->bmiHeader
.biClrUsed
= 0;
1079 masks
[0] = 0xff0000;
1080 masks
[1] = 0x00ff00;
1081 masks
[2] = 0x0000ff;
1082 return ERROR_BAD_FORMAT
;
1085 /****************************************************************************
1086 * calc_1d_stretch_params (helper for stretch_bitmapinfo)
1088 * If one plots the dst axis vertically, the src axis horizontally, then a
1089 * 1-d stretch/shrink is rather like finding the pixels to draw a straight
1090 * line. Following a Bresenham type argument from point (s_i, d_i) we must
1091 * pick either (s_i + 1, d_i) or (s_i + 1, d_i + 1), however the choice
1092 * depends on where the centre of the next pixel is, ie whether the
1093 * point (s_i + 3/2, d_i + 1) (the mid-point between the two centres)
1094 * lies above or below the idea line. The differences in error between
1095 * both choices and the current pixel is the same as per Bresenham,
1096 * the only difference is the error between the zeroth and first pixel.
1097 * This is now 3 dy - 2 dx (cf 2 dy - dx for the line case).
1099 * Here we use the Bresenham line clipper to provide the start and end points
1100 * and add the additional dy - dx error term by passing this as the bias.
1103 static DWORD
calc_1d_stretch_params( INT dst_start
, INT dst_length
, INT dst_vis_start
, INT dst_vis_end
,
1104 INT src_start
, INT src_length
, INT src_vis_start
, INT src_vis_end
,
1105 INT
*dst_clipped_start
, INT
*src_clipped_start
,
1106 INT
*dst_clipped_end
, INT
*src_clipped_end
,
1107 struct stretch_params
*stretch_params
, BOOL
*stretch
)
1109 bres_params bres_params
;
1110 POINT start
, end
, clipped_start
, clipped_end
;
1112 int clip_status
, m
, n
;
1114 stretch_params
->src_inc
= stretch_params
->dst_inc
= 1;
1116 bres_params
.dy
= abs( dst_length
);
1117 bres_params
.dx
= abs( src_length
);
1119 if (bres_params
.dx
> bres_params
.dy
) bres_params
.octant
= 1;
1120 else bres_params
.octant
= 2;
1123 bres_params
.octant
= 5 - bres_params
.octant
;
1124 stretch_params
->src_inc
= -1;
1128 bres_params
.octant
= 9 - bres_params
.octant
;
1129 stretch_params
->dst_inc
= -1;
1131 bres_params
.octant
= 1 << (bres_params
.octant
- 1);
1133 if (bres_params
.dx
> bres_params
.dy
)
1134 bres_params
.bias
= bres_params
.dy
- bres_params
.dx
;
1136 bres_params
.bias
= bres_params
.dx
- bres_params
.dy
;
1138 start
.x
= src_start
;
1139 start
.y
= dst_start
;
1140 end
.x
= src_start
+ src_length
;
1141 end
.y
= dst_start
+ dst_length
;
1143 clip
.left
= src_vis_start
;
1144 clip
.right
= src_vis_end
;
1145 clip
.top
= dst_vis_start
;
1146 clip
.bottom
= dst_vis_end
;
1148 clip_status
= clip_line( &start
, &end
, &clip
, &bres_params
, &clipped_start
, &clipped_end
);
1150 if (!clip_status
) return ERROR_NO_DATA
;
1152 m
= abs( clipped_start
.x
- start
.x
);
1153 n
= abs( clipped_start
.y
- start
.y
);
1155 if (bres_params
.dx
> bres_params
.dy
)
1157 stretch_params
->err_start
= 3 * bres_params
.dy
- 2 * bres_params
.dx
+
1158 m
* 2 * bres_params
.dy
- n
* 2 * bres_params
.dx
;
1159 stretch_params
->err_add_1
= 2 * bres_params
.dy
- 2 * bres_params
.dx
;
1160 stretch_params
->err_add_2
= 2 * bres_params
.dy
;
1161 stretch_params
->length
= abs( clipped_end
.x
- clipped_start
.x
);
1166 stretch_params
->err_start
= 3 * bres_params
.dx
- 2 * bres_params
.dy
+
1167 n
* 2 * bres_params
.dx
- m
* 2 * bres_params
.dy
;
1168 stretch_params
->err_add_1
= 2 * bres_params
.dx
- 2 * bres_params
.dy
;
1169 stretch_params
->err_add_2
= 2 * bres_params
.dx
;
1170 stretch_params
->length
= abs( clipped_end
.y
- clipped_start
.y
);
1174 /* The endpoint will usually have been clipped out as we don't want to touch
1175 that pixel, if it is we'll increment the length. */
1176 if (end
.x
!= clipped_end
.x
|| end
.y
!= clipped_end
.y
)
1178 clipped_end
.x
+= stretch_params
->src_inc
;
1179 clipped_end
.y
+= stretch_params
->dst_inc
;
1180 stretch_params
->length
++;
1183 *src_clipped_start
= clipped_start
.x
;
1184 *dst_clipped_start
= clipped_start
.y
;
1185 *src_clipped_end
= clipped_end
.x
;
1186 *dst_clipped_end
= clipped_end
.y
;
1188 return ERROR_SUCCESS
;
1192 DWORD
stretch_bitmapinfo( const BITMAPINFO
*src_info
, void *src_bits
, struct bitblt_coords
*src
,
1193 const BITMAPINFO
*dst_info
, void *dst_bits
, struct bitblt_coords
*dst
,
1196 dib_info src_dib
, dst_dib
;
1197 POINT dst_start
, src_start
, dst_end
, src_end
;
1199 BOOL hstretch
, vstretch
;
1200 struct stretch_params v_params
, h_params
;
1203 void (* row_fn
)(const dib_info
*dst_dib
, const POINT
*dst_start
,
1204 const dib_info
*src_dib
, const POINT
*src_start
,
1205 const struct stretch_params
*params
, int mode
, BOOL keep_dst
);
1207 TRACE("dst %d, %d - %d x %d visrect %s src %d, %d - %d x %d visrect %s\n",
1208 dst
->x
, dst
->y
, dst
->width
, dst
->height
, wine_dbgstr_rect(&dst
->visrect
),
1209 src
->x
, src
->y
, src
->width
, src
->height
, wine_dbgstr_rect(&src
->visrect
));
1211 init_dib_info_from_bitmapinfo( &src_dib
, src_info
, src_bits
);
1212 init_dib_info_from_bitmapinfo( &dst_dib
, dst_info
, dst_bits
);
1215 ret
= calc_1d_stretch_params( dst
->y
, dst
->height
, dst
->visrect
.top
, dst
->visrect
.bottom
,
1216 src
->y
, src
->height
, src
->visrect
.top
, src
->visrect
.bottom
,
1217 &dst_start
.y
, &src_start
.y
, &dst_end
.y
, &src_end
.y
,
1218 &v_params
, &vstretch
);
1219 if (ret
) return ret
;
1222 ret
= calc_1d_stretch_params( dst
->x
, dst
->width
, dst
->visrect
.left
, dst
->visrect
.right
,
1223 src
->x
, src
->width
, src
->visrect
.left
, src
->visrect
.right
,
1224 &dst_start
.x
, &src_start
.x
, &dst_end
.x
, &src_end
.x
,
1225 &h_params
, &hstretch
);
1226 if (ret
) return ret
;
1228 TRACE("got dst start %d, %d inc %d, %d. src start %d, %d inc %d, %d len %d x %d\n",
1229 dst_start
.x
, dst_start
.y
, h_params
.dst_inc
, v_params
.dst_inc
,
1230 src_start
.x
, src_start
.y
, h_params
.src_inc
, v_params
.src_inc
,
1231 h_params
.length
, v_params
.length
);
1233 get_bounding_rect( &rect
, dst_start
.x
, dst_start
.y
, dst_end
.x
- dst_start
.x
, dst_end
.y
- dst_start
.y
);
1234 intersect_rect( &dst
->visrect
, &dst
->visrect
, &rect
);
1236 dst_start
.x
-= dst
->visrect
.left
;
1237 dst_start
.y
-= dst
->visrect
.top
;
1239 err
= v_params
.err_start
;
1241 row_fn
= hstretch
? dst_dib
.funcs
->stretch_row
: dst_dib
.funcs
->shrink_row
;
1245 BOOL need_row
= TRUE
;
1246 RECT last_row
, this_row
;
1247 if (hstretch
) mode
= STRETCH_DELETESCANS
;
1249 last_row
.right
= dst
->visrect
.right
- dst
->visrect
.left
;
1251 while (v_params
.length
--)
1255 row_fn( &dst_dib
, &dst_start
, &src_dib
, &src_start
, &h_params
, mode
, FALSE
);
1260 last_row
.top
= dst_start
.y
- v_params
.dst_inc
;
1261 last_row
.bottom
= last_row
.top
+ 1;
1262 this_row
= last_row
;
1263 offset_rect( &this_row
, 0, v_params
.dst_inc
);
1264 copy_rect( &dst_dib
, &this_row
, &dst_dib
, &last_row
, NULL
, R2_COPYPEN
);
1269 src_start
.y
+= v_params
.src_inc
;
1271 err
+= v_params
.err_add_1
;
1273 else err
+= v_params
.err_add_2
;
1274 dst_start
.y
+= v_params
.dst_inc
;
1279 int merged_rows
= 0;
1281 while (v_params
.length
--)
1283 if (mode
!= STRETCH_DELETESCANS
|| !merged_rows
)
1284 row_fn( &dst_dib
, &dst_start
, &src_dib
, &src_start
, &h_params
, mode
, merged_rows
!= 0 );
1289 dst_start
.y
+= v_params
.dst_inc
;
1291 err
+= v_params
.err_add_1
;
1293 else err
+= v_params
.err_add_2
;
1294 src_start
.y
+= v_params
.src_inc
;
1298 /* update coordinates, the destination rectangle is always stored at 0,0 */
1300 src
->x
-= src
->visrect
.left
;
1301 src
->y
-= src
->visrect
.top
;
1302 offset_rect( &src
->visrect
, -src
->visrect
.left
, -src
->visrect
.top
);
1303 return ERROR_SUCCESS
;
1306 DWORD
blend_bitmapinfo( const BITMAPINFO
*src_info
, void *src_bits
, struct bitblt_coords
*src
,
1307 const BITMAPINFO
*dst_info
, void *dst_bits
, struct bitblt_coords
*dst
,
1308 BLENDFUNCTION blend
)
1310 dib_info src_dib
, dst_dib
;
1312 init_dib_info_from_bitmapinfo( &src_dib
, src_info
, src_bits
);
1313 init_dib_info_from_bitmapinfo( &dst_dib
, dst_info
, dst_bits
);
1315 return blend_rect( &dst_dib
, &dst
->visrect
, &src_dib
, &src
->visrect
, NULL
, blend
);
1318 DWORD
gradient_bitmapinfo( const BITMAPINFO
*info
, void *bits
, TRIVERTEX
*vert_array
, ULONG nvert
,
1319 void *grad_array
, ULONG ngrad
, ULONG mode
, const POINT
*dev_pts
, HRGN rgn
)
1322 const GRADIENT_TRIANGLE
*tri
= grad_array
;
1323 const GRADIENT_RECT
*rect
= grad_array
;
1328 DWORD ret
= ERROR_SUCCESS
;
1330 init_dib_info_from_bitmapinfo( &dib
, info
, bits
);
1334 case GRADIENT_FILL_RECT_H
:
1335 for (i
= 0; i
< ngrad
; i
++, rect
++)
1337 get_gradient_hrect_vertices( rect
, vert_array
, dev_pts
, vert
, &rc
);
1338 gradient_rect( &dib
, vert
, mode
, 0, &rc
);
1339 add_rect_to_region( rgn
, &rc
);
1343 case GRADIENT_FILL_RECT_V
:
1344 for (i
= 0; i
< ngrad
; i
++, rect
++)
1346 get_gradient_vrect_vertices( rect
, vert_array
, dev_pts
, vert
, &rc
);
1347 gradient_rect( &dib
, vert
, mode
, 0, &rc
);
1348 add_rect_to_region( rgn
, &rc
);
1352 case GRADIENT_FILL_TRIANGLE
:
1353 for (i
= 0; i
< ngrad
; i
++, tri
++)
1355 get_gradient_triangle_vertices( tri
, vert_array
, dev_pts
, vert
, &rc
);
1356 if (gradient_rect( &dib
, vert
, mode
, 0, &rc
))
1358 for (y
= vert
[0].y
; y
< vert
[2].y
; y
++)
1360 int x1
, x2
= edge_coord( y
, vert
[0].x
, vert
[0].y
, vert
[2].x
, vert
[2].y
);
1361 if (y
< vert
[1].y
) x1
= edge_coord( y
, vert
[0].x
, vert
[0].y
, vert
[1].x
, vert
[1].y
);
1362 else x1
= edge_coord( y
, vert
[1].x
, vert
[1].y
, vert
[2].x
, vert
[2].y
);
1364 rc
.left
= min( x1
, x2
);
1366 rc
.right
= max( x1
, x2
);
1368 add_rect_to_region( rgn
, &rc
);
1371 else ret
= ERROR_INVALID_PARAMETER
;
1378 COLORREF
get_pixel_bitmapinfo( const BITMAPINFO
*info
, void *bits
, struct bitblt_coords
*src
)
1383 init_dib_info_from_bitmapinfo( &dib
, info
, bits
);
1384 pixel
= dib
.funcs
->get_pixel( &dib
, src
->x
, src
->y
);
1385 return dib
.funcs
->pixel_to_colorref( &dib
, pixel
);
1388 /***********************************************************************
1391 BOOL
dibdrv_StretchBlt( PHYSDEV dst_dev
, struct bitblt_coords
*dst
,
1392 PHYSDEV src_dev
, struct bitblt_coords
*src
, DWORD rop
)
1394 DC
*dc_dst
= get_physdev_dc( dst_dev
);
1396 if (dst
->width
== 1 && src
->width
> 1) src
->width
--;
1397 if (dst
->height
== 1 && src
->height
> 1) src
->height
--;
1399 return dc_dst
->nulldrv
.funcs
->pStretchBlt( &dc_dst
->nulldrv
, dst
, src_dev
, src
, rop
);
1402 /***********************************************************************
1405 BOOL
dibdrv_AlphaBlend( PHYSDEV dst_dev
, struct bitblt_coords
*dst
,
1406 PHYSDEV src_dev
, struct bitblt_coords
*src
, BLENDFUNCTION blend
)
1408 DC
*dc_dst
= get_physdev_dc( dst_dev
);
1410 return dc_dst
->nulldrv
.funcs
->pAlphaBlend( &dc_dst
->nulldrv
, dst
, src_dev
, src
, blend
);
1413 /***********************************************************************
1414 * dibdrv_GradientFill
1416 BOOL
dibdrv_GradientFill( PHYSDEV dev
, TRIVERTEX
*vert_array
, ULONG nvert
,
1417 void *grad_array
, ULONG ngrad
, ULONG mode
)
1419 dibdrv_physdev
*pdev
= get_dibdrv_pdev( dev
);
1420 DC
*dc
= get_physdev_dc( dev
);
1421 const GRADIENT_TRIANGLE
*tri
= grad_array
;
1422 const GRADIENT_RECT
*rect
= grad_array
;
1429 if (!(pts
= HeapAlloc( GetProcessHeap(), 0, nvert
* sizeof(*pts
) ))) return FALSE
;
1430 for (i
= 0; i
< nvert
; i
++)
1432 pts
[i
].x
= vert_array
[i
].x
;
1433 pts
[i
].y
= vert_array
[i
].y
;
1435 lp_to_dp( dc
, pts
, nvert
);
1439 case GRADIENT_FILL_RECT_H
:
1440 for (i
= 0; i
< ngrad
; i
++, rect
++)
1442 get_gradient_hrect_vertices( rect
, vert_array
, pts
, vert
, &bounds
);
1443 /* Windows bug: no alpha on a8r8g8b8 created with bitfields */
1444 if (pdev
->dib
.funcs
== &funcs_8888
&& pdev
->dib
.compression
== BI_BITFIELDS
)
1445 vert
[0].Alpha
= vert
[1].Alpha
= 0;
1446 add_clipped_bounds( pdev
, &bounds
, pdev
->clip
);
1447 gradient_rect( &pdev
->dib
, vert
, mode
, pdev
->clip
, &bounds
);
1451 case GRADIENT_FILL_RECT_V
:
1452 for (i
= 0; i
< ngrad
; i
++, rect
++)
1454 get_gradient_vrect_vertices( rect
, vert_array
, pts
, vert
, &bounds
);
1455 /* Windows bug: no alpha on a8r8g8b8 created with bitfields */
1456 if (pdev
->dib
.funcs
== &funcs_8888
&& pdev
->dib
.compression
== BI_BITFIELDS
)
1457 vert
[0].Alpha
= vert
[1].Alpha
= 0;
1458 add_clipped_bounds( pdev
, &bounds
, pdev
->clip
);
1459 gradient_rect( &pdev
->dib
, vert
, mode
, pdev
->clip
, &bounds
);
1463 case GRADIENT_FILL_TRIANGLE
:
1464 for (i
= 0; i
< ngrad
; i
++, tri
++)
1466 get_gradient_triangle_vertices( tri
, vert_array
, pts
, vert
, &bounds
);
1467 /* Windows bug: no alpha on a8r8g8b8 created with bitfields */
1468 if (pdev
->dib
.funcs
== &funcs_8888
&& pdev
->dib
.compression
== BI_BITFIELDS
)
1469 vert
[0].Alpha
= vert
[1].Alpha
= vert
[2].Alpha
= 0;
1470 add_clipped_bounds( pdev
, &bounds
, pdev
->clip
);
1471 if (!gradient_rect( &pdev
->dib
, vert
, mode
, pdev
->clip
, &bounds
)) ret
= FALSE
;
1476 HeapFree( GetProcessHeap(), 0, pts
);