Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * GDI bit-blit operations |
| 3 | * |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 4 | * Copyright 1993, 1994 Alexandre Julliard |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 5 | * |
| 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. |
| 10 | * |
| 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. |
| 15 | * |
| 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
Patrik Stridvall | ab121e7 | 1999-02-04 11:11:01 +0000 | [diff] [blame] | 21 | #include "config.h" |
| 22 | |
Patrik Stridvall | 151170c | 1998-12-26 12:00:43 +0000 | [diff] [blame] | 23 | #include <X11/Intrinsic.h> |
Patrik Stridvall | 3d51161 | 2000-04-25 19:55:35 +0000 | [diff] [blame] | 24 | |
Patrik Stridvall | ab121e7 | 1999-02-04 11:11:01 +0000 | [diff] [blame] | 25 | #include "ts_xlib.h" |
Patrik Stridvall | 151170c | 1998-12-26 12:00:43 +0000 | [diff] [blame] | 26 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 27 | #include <assert.h> |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 28 | #include <stdio.h> |
| 29 | #include <stdlib.h> |
Alexandre Julliard | 8efd454 | 2001-01-15 22:30:50 +0000 | [diff] [blame] | 30 | #include "winbase.h" |
| 31 | #include "wingdi.h" |
Dmitry Timoshkov | de70d2b | 2001-06-19 03:32:44 +0000 | [diff] [blame] | 32 | #include "winreg.h" |
Alexandre Julliard | 8efd454 | 2001-01-15 22:30:50 +0000 | [diff] [blame] | 33 | #include "winuser.h" |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 34 | #include "bitmap.h" |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 35 | #include "gdi.h" |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 36 | #include "x11drv.h" |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 37 | #include "wine/debug.h" |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 38 | |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 39 | WINE_DEFAULT_DEBUG_CHANNEL(bitblt); |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 40 | |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 41 | |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 42 | #define DST 0 /* Destination drawable */ |
| 43 | #define SRC 1 /* Source drawable */ |
| 44 | #define TMP 2 /* Temporary drawable */ |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 45 | #define PAT 3 /* Pattern (brush) in destination DC */ |
| 46 | |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 47 | #define OP(src,dst,rop) (OP_ARGS(src,dst) << 4 | (rop)) |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 48 | #define OP_ARGS(src,dst) (((src) << 2) | (dst)) |
| 49 | |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 50 | #define OP_SRC(opcode) ((opcode) >> 6) |
| 51 | #define OP_DST(opcode) (((opcode) >> 4) & 3) |
| 52 | #define OP_SRCDST(opcode) ((opcode) >> 4) |
| 53 | #define OP_ROP(opcode) ((opcode) & 0x0f) |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 54 | |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 55 | #define MAX_OP_LEN 6 /* Longest opcode + 1 for the terminating 0 */ |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 56 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 57 | #define SWAP_INT32(i1,i2) \ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 58 | do { INT __t = *(i1); *(i1) = *(i2); *(i2) = __t; } while(0) |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 59 | |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 60 | static const unsigned char BITBLT_Opcodes[256][MAX_OP_LEN] = |
| 61 | { |
| 62 | { OP(PAT,DST,GXclear) }, /* 0x00 0 */ |
| 63 | { OP(PAT,SRC,GXor), OP(SRC,DST,GXnor) }, /* 0x01 ~(D|(P|S)) */ |
| 64 | { OP(PAT,SRC,GXnor), OP(SRC,DST,GXand) }, /* 0x02 D&~(P|S) */ |
| 65 | { OP(PAT,SRC,GXnor) }, /* 0x03 ~(P|S) */ |
| 66 | { OP(PAT,DST,GXnor), OP(SRC,DST,GXand) }, /* 0x04 S&~(D|P) */ |
| 67 | { OP(PAT,DST,GXnor) }, /* 0x05 ~(D|P) */ |
| 68 | { OP(SRC,DST,GXequiv), OP(PAT,DST,GXnor), }, /* 0x06 ~(P|~(D^S)) */ |
| 69 | { OP(SRC,DST,GXand), OP(PAT,DST,GXnor) }, /* 0x07 ~(P|(D&S)) */ |
| 70 | { OP(PAT,DST,GXandInverted), OP(SRC,DST,GXand) },/* 0x08 S&D&~P */ |
| 71 | { OP(SRC,DST,GXxor), OP(PAT,DST,GXnor) }, /* 0x09 ~(P|(D^S)) */ |
| 72 | { OP(PAT,DST,GXandInverted) }, /* 0x0a D&~P */ |
| 73 | { OP(SRC,DST,GXandReverse), OP(PAT,DST,GXnor) }, /* 0x0b ~(P|(S&~D)) */ |
| 74 | { OP(PAT,SRC,GXandInverted) }, /* 0x0c S&~P */ |
| 75 | { OP(SRC,DST,GXandInverted), OP(PAT,DST,GXnor) },/* 0x0d ~(P|(D&~S)) */ |
| 76 | { OP(SRC,DST,GXnor), OP(PAT,DST,GXnor) }, /* 0x0e ~(P|~(D|S)) */ |
| 77 | { OP(PAT,DST,GXcopyInverted) }, /* 0x0f ~P */ |
| 78 | { OP(SRC,DST,GXnor), OP(PAT,DST,GXand) }, /* 0x10 P&~(S|D) */ |
| 79 | { OP(SRC,DST,GXnor) }, /* 0x11 ~(D|S) */ |
| 80 | { OP(PAT,DST,GXequiv), OP(SRC,DST,GXnor) }, /* 0x12 ~(S|~(D^P)) */ |
| 81 | { OP(PAT,DST,GXand), OP(SRC,DST,GXnor) }, /* 0x13 ~(S|(D&P)) */ |
| 82 | { OP(PAT,SRC,GXequiv), OP(SRC,DST,GXnor) }, /* 0x14 ~(D|~(P^S)) */ |
| 83 | { OP(PAT,SRC,GXand), OP(SRC,DST,GXnor) }, /* 0x15 ~(D|(P&S)) */ |
| 84 | { OP(SRC,TMP,GXcopy), OP(PAT,TMP,GXnand), |
| 85 | OP(TMP,DST,GXand), OP(SRC,DST,GXxor), |
| 86 | OP(PAT,DST,GXxor) }, /* 0x16 P^S^(D&~(P&S) */ |
| 87 | { OP(SRC,TMP,GXcopy), OP(SRC,DST,GXxor), |
| 88 | OP(PAT,SRC,GXxor), OP(SRC,DST,GXand), |
| 89 | OP(TMP,DST,GXequiv) }, /* 0x17 ~S^((S^P)&(S^D))*/ |
| 90 | { OP(PAT,SRC,GXxor), OP(PAT,DST,GXxor), |
| 91 | OP(SRC,DST,GXand) }, /* 0x18 (S^P)&(D^P) */ |
| 92 | { OP(SRC,TMP,GXcopy), OP(PAT,TMP,GXnand), |
| 93 | OP(TMP,DST,GXand), OP(SRC,DST,GXequiv) }, /* 0x19 ~S^(D&~(P&S)) */ |
| 94 | { OP(PAT,SRC,GXand), OP(SRC,DST,GXor), |
| 95 | OP(PAT,DST,GXxor) }, /* 0x1a P^(D|(S&P)) */ |
| 96 | { OP(SRC,TMP,GXcopy), OP(PAT,TMP,GXxor), |
| 97 | OP(TMP,DST,GXand), OP(SRC,DST,GXequiv) }, /* 0x1b ~S^(D&(P^S)) */ |
| 98 | { OP(PAT,DST,GXand), OP(SRC,DST,GXor), |
| 99 | OP(PAT,DST,GXxor) }, /* 0x1c P^(S|(D&P)) */ |
| 100 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXxor), |
| 101 | OP(SRC,DST,GXand), OP(TMP,DST,GXequiv) }, /* 0x1d ~D^(S&(D^P)) */ |
| 102 | { OP(SRC,DST,GXor), OP(PAT,DST,GXxor) }, /* 0x1e P^(D|S) */ |
| 103 | { OP(SRC,DST,GXor), OP(PAT,DST,GXnand) }, /* 0x1f ~(P&(D|S)) */ |
| 104 | { OP(PAT,SRC,GXandReverse), OP(SRC,DST,GXand) }, /* 0x20 D&(P&~S) */ |
| 105 | { OP(PAT,DST,GXxor), OP(SRC,DST,GXnor) }, /* 0x21 ~(S|(D^P)) */ |
| 106 | { OP(SRC,DST,GXandInverted) }, /* 0x22 ~S&D */ |
| 107 | { OP(PAT,DST,GXandReverse), OP(SRC,DST,GXnor) }, /* 0x23 ~(S|(P&~D)) */ |
| 108 | { OP(SRC,DST,GXxor), OP(PAT,SRC,GXxor), |
| 109 | OP(SRC,DST,GXand) }, /* 0x24 (S^P)&(S^D) */ |
| 110 | { OP(PAT,SRC,GXnand), OP(SRC,DST,GXand), |
| 111 | OP(PAT,DST,GXequiv) }, /* 0x25 ~P^(D&~(S&P)) */ |
| 112 | { OP(SRC,TMP,GXcopy), OP(PAT,TMP,GXand), |
| 113 | OP(TMP,DST,GXor), OP(SRC,DST,GXxor) }, /* 0x26 S^(D|(S&P)) */ |
| 114 | { OP(SRC,TMP,GXcopy), OP(PAT,TMP,GXequiv), |
| 115 | OP(TMP,DST,GXor), OP(SRC,DST,GXxor) }, /* 0x27 S^(D|~(P^S)) */ |
| 116 | { OP(PAT,SRC,GXxor), OP(SRC,DST,GXand) }, /* 0x28 D&(P^S) */ |
| 117 | { OP(SRC,TMP,GXcopy), OP(PAT,TMP,GXand), |
| 118 | OP(TMP,DST,GXor), OP(SRC,DST,GXxor), |
| 119 | OP(PAT,DST,GXequiv) }, /* 0x29 ~P^S^(D|(P&S)) */ |
| 120 | { OP(PAT,SRC,GXnand), OP(SRC,DST,GXand) }, /* 0x2a D&~(P&S) */ |
| 121 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXxor), |
| 122 | OP(PAT,DST,GXxor), OP(SRC,DST,GXand), |
| 123 | OP(TMP,DST,GXequiv) }, /* 0x2b ~S^((P^S)&(P^D))*/ |
| 124 | { OP(SRC,DST,GXor), OP(PAT,DST,GXand), |
| 125 | OP(SRC,DST,GXxor) }, /* 0x2c S^(P&(S|D)) */ |
| 126 | { OP(SRC,DST,GXorReverse), OP(PAT,DST,GXxor) }, /* 0x2d P^(S|~D) */ |
| 127 | { OP(PAT,DST,GXxor), OP(SRC,DST,GXor), |
| 128 | OP(PAT,DST,GXxor) }, /* 0x2e P^(S|(D^P)) */ |
| 129 | { OP(SRC,DST,GXorReverse), OP(PAT,DST,GXnand) }, /* 0x2f ~(P&(S|~D)) */ |
| 130 | { OP(PAT,SRC,GXandReverse) }, /* 0x30 P&~S */ |
| 131 | { OP(PAT,DST,GXandInverted), OP(SRC,DST,GXnor) },/* 0x31 ~(S|(D&~P)) */ |
| 132 | { OP(SRC,DST,GXor), OP(PAT,DST,GXor), |
| 133 | OP(SRC,DST,GXxor) }, /* 0x32 S^(D|P|S) */ |
| 134 | { OP(SRC,DST,GXcopyInverted) }, /* 0x33 ~S */ |
| 135 | { OP(SRC,DST,GXand), OP(PAT,DST,GXor), |
| 136 | OP(SRC,DST,GXxor) }, /* 0x34 S^(P|(D&S)) */ |
| 137 | { OP(SRC,DST,GXequiv), OP(PAT,DST,GXor), |
| 138 | OP(SRC,DST,GXxor) }, /* 0x35 S^(P|~(D^S)) */ |
| 139 | { OP(PAT,DST,GXor), OP(SRC,DST,GXxor) }, /* 0x36 S^(D|P) */ |
| 140 | { OP(PAT,DST,GXor), OP(SRC,DST,GXnand) }, /* 0x37 ~(S&(D|P)) */ |
| 141 | { OP(PAT,DST,GXor), OP(SRC,DST,GXand), |
| 142 | OP(PAT,DST,GXxor) }, /* 0x38 P^(S&(D|P)) */ |
| 143 | { OP(PAT,DST,GXorReverse), OP(SRC,DST,GXxor) }, /* 0x39 S^(P|~D) */ |
| 144 | { OP(SRC,DST,GXxor), OP(PAT,DST,GXor), |
| 145 | OP(SRC,DST,GXxor) }, /* 0x3a S^(P|(D^S)) */ |
| 146 | { OP(PAT,DST,GXorReverse), OP(SRC,DST,GXnand) }, /* 0x3b ~(S&(P|~D)) */ |
| 147 | { OP(PAT,SRC,GXxor) }, /* 0x3c P^S */ |
| 148 | { OP(SRC,DST,GXnor), OP(PAT,DST,GXor), |
| 149 | OP(SRC,DST,GXxor) }, /* 0x3d S^(P|~(D|S)) */ |
| 150 | { OP(SRC,DST,GXandInverted), OP(PAT,DST,GXor), |
| 151 | OP(SRC,DST,GXxor) }, /* 0x3e S^(P|(D&~S)) */ |
| 152 | { OP(PAT,SRC,GXnand) }, /* 0x3f ~(P&S) */ |
| 153 | { OP(SRC,DST,GXandReverse), OP(PAT,DST,GXand) }, /* 0x40 P&S&~D */ |
| 154 | { OP(PAT,SRC,GXxor), OP(SRC,DST,GXnor) }, /* 0x41 ~(D|(P^S)) */ |
| 155 | { OP(DST,SRC,GXxor), OP(PAT,DST,GXxor), |
| 156 | OP(SRC,DST,GXand) }, /* 0x42 (S^D)&(P^D) */ |
| 157 | { OP(SRC,DST,GXnand), OP(PAT,DST,GXand), |
| 158 | OP(SRC,DST,GXequiv) }, /* 0x43 ~S^(P&~(D&S)) */ |
| 159 | { OP(SRC,DST,GXandReverse) }, /* 0x44 S&~D */ |
| 160 | { OP(PAT,SRC,GXandReverse), OP(SRC,DST,GXnor) }, /* 0x45 ~(D|(P&~S)) */ |
| 161 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXand), |
| 162 | OP(SRC,DST,GXor), OP(TMP,DST,GXxor) }, /* 0x46 D^(S|(P&D)) */ |
| 163 | { OP(PAT,DST,GXxor), OP(SRC,DST,GXand), |
| 164 | OP(PAT,DST,GXequiv) }, /* 0x47 ~P^(S&(D^P)) */ |
| 165 | { OP(PAT,DST,GXxor), OP(SRC,DST,GXand) }, /* 0x48 S&(P^D) */ |
| 166 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXand), |
| 167 | OP(SRC,DST,GXor), OP(TMP,DST,GXxor), |
| 168 | OP(PAT,DST,GXequiv) }, /* 0x49 ~P^D^(S|(P&D)) */ |
| 169 | { OP(DST,SRC,GXor), OP(PAT,SRC,GXand), |
| 170 | OP(SRC,DST,GXxor) }, /* 0x4a D^(P&(S|D)) */ |
| 171 | { OP(SRC,DST,GXorInverted), OP(PAT,DST,GXxor) }, /* 0x4b P^(D|~S) */ |
| 172 | { OP(PAT,DST,GXnand), OP(SRC,DST,GXand) }, /* 0x4c S&~(D&P) */ |
| 173 | { OP(SRC,TMP,GXcopy), OP(SRC,DST,GXxor), |
| 174 | OP(PAT,SRC,GXxor), OP(SRC,DST,GXor), |
| 175 | OP(TMP,DST,GXequiv) }, /* 0x4d ~S^((S^P)|(S^D))*/ |
| 176 | { OP(PAT,SRC,GXxor), OP(SRC,DST,GXor), |
| 177 | OP(PAT,DST,GXxor) }, /* 0x4e P^(D|(S^P)) */ |
| 178 | { OP(SRC,DST,GXorInverted), OP(PAT,DST,GXnand) },/* 0x4f ~(P&(D|~S)) */ |
| 179 | { OP(PAT,DST,GXandReverse) }, /* 0x50 P&~D */ |
| 180 | { OP(PAT,SRC,GXandInverted), OP(SRC,DST,GXnor) },/* 0x51 ~(D|(S&~P)) */ |
| 181 | { OP(DST,SRC,GXand), OP(PAT,SRC,GXor), |
| 182 | OP(SRC,DST,GXxor) }, /* 0x52 D^(P|(S&D)) */ |
| 183 | { OP(SRC,DST,GXxor), OP(PAT,DST,GXand), |
| 184 | OP(SRC,DST,GXequiv) }, /* 0x53 ~S^(P&(D^S)) */ |
| 185 | { OP(PAT,SRC,GXnor), OP(SRC,DST,GXnor) }, /* 0x54 ~(D|~(P|S)) */ |
| 186 | { OP(PAT,DST,GXinvert) }, /* 0x55 ~D */ |
| 187 | { OP(PAT,SRC,GXor), OP(SRC,DST,GXxor) }, /* 0x56 D^(P|S) */ |
| 188 | { OP(PAT,SRC,GXor), OP(SRC,DST,GXnand) }, /* 0x57 ~(D&(P|S)) */ |
| 189 | { OP(PAT,SRC,GXor), OP(SRC,DST,GXand), |
| 190 | OP(PAT,DST,GXxor) }, /* 0x58 P^(D&(P|S)) */ |
| 191 | { OP(PAT,SRC,GXorReverse), OP(SRC,DST,GXxor) }, /* 0x59 D^(P|~S) */ |
| 192 | { OP(PAT,DST,GXxor) }, /* 0x5a D^P */ |
| 193 | { OP(DST,SRC,GXnor), OP(PAT,SRC,GXor), |
| 194 | OP(SRC,DST,GXxor) }, /* 0x5b D^(P|~(S|D)) */ |
| 195 | { OP(DST,SRC,GXxor), OP(PAT,SRC,GXor), |
| 196 | OP(SRC,DST,GXxor) }, /* 0x5c D^(P|(S^D)) */ |
| 197 | { OP(PAT,SRC,GXorReverse), OP(SRC,DST,GXnand) }, /* 0x5d ~(D&(P|~S)) */ |
| 198 | { OP(DST,SRC,GXandInverted), OP(PAT,SRC,GXor), |
| 199 | OP(SRC,DST,GXxor) }, /* 0x5e D^(P|(S&~D)) */ |
| 200 | { OP(PAT,DST,GXnand) }, /* 0x5f ~(D&P) */ |
| 201 | { OP(SRC,DST,GXxor), OP(PAT,DST,GXand) }, /* 0x60 P&(D^S) */ |
| 202 | { OP(DST,TMP,GXcopy), OP(SRC,DST,GXand), |
| 203 | OP(PAT,DST,GXor), OP(SRC,DST,GXxor), |
| 204 | OP(TMP,DST,GXequiv) }, /* 0x61 ~D^S^(P|(D&S)) */ |
| 205 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXor), |
| 206 | OP(SRC,DST,GXand), OP(TMP,DST,GXxor) }, /* 0x62 D^(S&(P|D)) */ |
| 207 | { OP(PAT,DST,GXorInverted), OP(SRC,DST,GXxor) }, /* 0x63 S^(D|~P) */ |
| 208 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXor), |
| 209 | OP(SRC,DST,GXand), OP(TMP,DST,GXxor) }, /* 0x64 S^(D&(P|S)) */ |
| 210 | { OP(PAT,SRC,GXorInverted), OP(SRC,DST,GXxor) }, /* 0x65 D^(S|~P) */ |
| 211 | { OP(SRC,DST,GXxor) }, /* 0x66 S^D */ |
| 212 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXnor), |
| 213 | OP(SRC,DST,GXor), OP(TMP,DST,GXxor) }, /* 0x67 S^(D|~(S|P) */ |
| 214 | { OP(DST,TMP,GXcopy), OP(SRC,DST,GXnor), |
| 215 | OP(PAT,DST,GXor), OP(SRC,DST,GXxor), |
| 216 | OP(TMP,DST,GXequiv) }, /* 0x68 ~D^S^(P|~(D|S))*/ |
| 217 | { OP(SRC,DST,GXxor), OP(PAT,DST,GXequiv) }, /* 0x69 ~P^(D^S) */ |
| 218 | { OP(PAT,SRC,GXand), OP(SRC,DST,GXxor) }, /* 0x6a D^(P&S) */ |
| 219 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXor), |
| 220 | OP(SRC,DST,GXand), OP(TMP,DST,GXxor), |
| 221 | OP(PAT,DST,GXequiv) }, /* 0x6b ~P^S^(D&(P|S)) */ |
| 222 | { OP(PAT,DST,GXand), OP(SRC,DST,GXxor) }, /* 0x6c S^(D&P) */ |
| 223 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXor), |
| 224 | OP(SRC,DST,GXand), OP(TMP,DST,GXxor), |
| 225 | OP(PAT,DST,GXequiv) }, /* 0x6d ~P^D^(S&(P|D)) */ |
| 226 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXorReverse), |
| 227 | OP(SRC,DST,GXand), OP(TMP,DST,GXxor) }, /* 0x6e S^(D&(P|~S)) */ |
| 228 | { OP(SRC,DST,GXequiv), OP(PAT,DST,GXnand) }, /* 0x6f ~(P&~(S^D)) */ |
| 229 | { OP(SRC,DST,GXnand), OP(PAT,DST,GXand) }, /* 0x70 P&~(D&S) */ |
| 230 | { OP(SRC,TMP,GXcopy), OP(DST,SRC,GXxor), |
| 231 | OP(PAT,DST,GXxor), OP(SRC,DST,GXand), |
| 232 | OP(TMP,DST,GXequiv) }, /* 0x71 ~S^((S^D)&(P^D))*/ |
| 233 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXxor), |
| 234 | OP(SRC,DST,GXor), OP(TMP,DST,GXxor) }, /* 0x72 S^(D|(P^S)) */ |
| 235 | { OP(PAT,DST,GXorInverted), OP(SRC,DST,GXnand) },/* 0x73 ~(S&(D|~P)) */ |
| 236 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXxor), |
| 237 | OP(SRC,DST,GXor), OP(TMP,DST,GXxor) }, /* 0x74 D^(S|(P^D)) */ |
| 238 | { OP(PAT,SRC,GXorInverted), OP(SRC,DST,GXnand) },/* 0x75 ~(D&(S|~P)) */ |
| 239 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXandReverse), |
| 240 | OP(SRC,DST,GXor), OP(TMP,DST,GXxor) }, /* 0x76 S^(D|(P&~S)) */ |
| 241 | { OP(SRC,DST,GXnand) }, /* 0x77 ~(S&D) */ |
| 242 | { OP(SRC,DST,GXand), OP(PAT,DST,GXxor) }, /* 0x78 P^(D&S) */ |
| 243 | { OP(DST,TMP,GXcopy), OP(SRC,DST,GXor), |
| 244 | OP(PAT,DST,GXand), OP(SRC,DST,GXxor), |
| 245 | OP(TMP,DST,GXequiv) }, /* 0x79 ~D^S^(P&(D|S)) */ |
| 246 | { OP(DST,SRC,GXorInverted), OP(PAT,SRC,GXand), |
| 247 | OP(SRC,DST,GXxor) }, /* 0x7a D^(P&(S|~D)) */ |
| 248 | { OP(PAT,DST,GXequiv), OP(SRC,DST,GXnand) }, /* 0x7b ~(S&~(D^P)) */ |
| 249 | { OP(SRC,DST,GXorInverted), OP(PAT,DST,GXand), |
| 250 | OP(SRC,DST,GXxor) }, /* 0x7c S^(P&(D|~S)) */ |
| 251 | { OP(PAT,SRC,GXequiv), OP(SRC,DST,GXnand) }, /* 0x7d ~(D&~(P^S)) */ |
| 252 | { OP(SRC,DST,GXxor), OP(PAT,SRC,GXxor), |
| 253 | OP(SRC,DST,GXor) }, /* 0x7e (S^P)|(S^D) */ |
| 254 | { OP(PAT,SRC,GXand), OP(SRC,DST,GXnand) }, /* 0x7f ~(D&P&S) */ |
| 255 | { OP(PAT,SRC,GXand), OP(SRC,DST,GXand) }, /* 0x80 D&P&S */ |
| 256 | { OP(SRC,DST,GXxor), OP(PAT,SRC,GXxor), |
| 257 | OP(SRC,DST,GXnor) }, /* 0x81 ~((S^P)|(S^D)) */ |
| 258 | { OP(PAT,SRC,GXequiv), OP(SRC,DST,GXand) }, /* 0x82 D&~(P^S) */ |
| 259 | { OP(SRC,DST,GXorInverted), OP(PAT,DST,GXand), |
| 260 | OP(SRC,DST,GXequiv) }, /* 0x83 ~S^(P&(D|~S)) */ |
| 261 | { OP(PAT,DST,GXequiv), OP(SRC,DST,GXand) }, /* 0x84 S&~(D^P) */ |
| 262 | { OP(PAT,SRC,GXorInverted), OP(SRC,DST,GXand), |
| 263 | OP(PAT,DST,GXequiv) }, /* 0x85 ~P^(D&(S|~P)) */ |
| 264 | { OP(DST,TMP,GXcopy), OP(SRC,DST,GXor), |
| 265 | OP(PAT,DST,GXand), OP(SRC,DST,GXxor), |
| 266 | OP(TMP,DST,GXxor) }, /* 0x86 D^S^(P&(D|S)) */ |
| 267 | { OP(SRC,DST,GXand), OP(PAT,DST,GXequiv) }, /* 0x87 ~P^(D&S) */ |
| 268 | { OP(SRC,DST,GXand) }, /* 0x88 S&D */ |
| 269 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXandReverse), |
| 270 | OP(SRC,DST,GXor), OP(TMP,DST,GXequiv) }, /* 0x89 ~S^(D|(P&~S)) */ |
| 271 | { OP(PAT,SRC,GXorInverted), OP(SRC,DST,GXand) }, /* 0x8a D&(S|~P) */ |
| 272 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXxor), |
| 273 | OP(SRC,DST,GXor), OP(TMP,DST,GXequiv) }, /* 0x8b ~D^(S|(P^D)) */ |
| 274 | { OP(PAT,DST,GXorInverted), OP(SRC,DST,GXand) }, /* 0x8c S&(D|~P) */ |
| 275 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXxor), |
| 276 | OP(SRC,DST,GXor), OP(TMP,DST,GXequiv) }, /* 0x8d ~S^(D|(P^S)) */ |
| 277 | { OP(SRC,TMP,GXcopy), OP(DST,SRC,GXxor), |
| 278 | OP(PAT,DST,GXxor), OP(SRC,DST,GXand), |
| 279 | OP(TMP,DST,GXxor) }, /* 0x8e S^((S^D)&(P^D))*/ |
| 280 | { OP(SRC,DST,GXnand), OP(PAT,DST,GXnand) }, /* 0x8f ~(P&~(D&S)) */ |
| 281 | { OP(SRC,DST,GXequiv), OP(PAT,DST,GXand) }, /* 0x90 P&~(D^S) */ |
| 282 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXorReverse), |
| 283 | OP(SRC,DST,GXand), OP(TMP,DST,GXequiv) }, /* 0x91 ~S^(D&(P|~S)) */ |
| 284 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXor), |
| 285 | OP(SRC,DST,GXand), OP(PAT,DST,GXxor), |
| 286 | OP(TMP,DST,GXxor) }, /* 0x92 D^P^(S&(D|P)) */ |
| 287 | { OP(PAT,DST,GXand), OP(SRC,DST,GXequiv) }, /* 0x93 ~S^(P&D) */ |
| 288 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXor), |
| 289 | OP(SRC,DST,GXand), OP(PAT,DST,GXxor), |
| 290 | OP(TMP,DST,GXxor) }, /* 0x94 S^P^(D&(P|S)) */ |
| 291 | { OP(PAT,SRC,GXand), OP(SRC,DST,GXequiv) }, /* 0x95 ~D^(P&S) */ |
| 292 | { OP(PAT,SRC,GXxor), OP(SRC,DST,GXxor) }, /* 0x96 D^P^S */ |
| 293 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXnor), |
| 294 | OP(SRC,DST,GXor), OP(PAT,DST,GXxor), |
| 295 | OP(TMP,DST,GXxor) }, /* 0x97 S^P^(D|~(P|S)) */ |
| 296 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXnor), |
| 297 | OP(SRC,DST,GXor), OP(TMP,DST,GXequiv) }, /* 0x98 ~S^(D|~(P|S)) */ |
| 298 | { OP(SRC,DST,GXequiv) }, /* 0x99 ~S^D */ |
| 299 | { OP(PAT,SRC,GXandReverse), OP(SRC,DST,GXxor) }, /* 0x9a D^(P&~S) */ |
| 300 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXor), |
| 301 | OP(SRC,DST,GXand), OP(TMP,DST,GXequiv) }, /* 0x9b ~S^(D&(P|S)) */ |
| 302 | { OP(PAT,DST,GXandReverse), OP(SRC,DST,GXxor) }, /* 0x9c S^(P&~D) */ |
| 303 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXor), |
| 304 | OP(SRC,DST,GXand), OP(TMP,DST,GXequiv) }, /* 0x9d ~D^(S&(P|D)) */ |
| 305 | { OP(DST,TMP,GXcopy), OP(SRC,DST,GXand), |
| 306 | OP(PAT,DST,GXor), OP(SRC,DST,GXxor), |
| 307 | OP(TMP,DST,GXxor) }, /* 0x9e D^S^(P|(D&S)) */ |
| 308 | { OP(SRC,DST,GXxor), OP(PAT,DST,GXnand) }, /* 0x9f ~(P&(D^S)) */ |
| 309 | { OP(PAT,DST,GXand) }, /* 0xa0 D&P */ |
| 310 | { OP(PAT,SRC,GXandInverted), OP(SRC,DST,GXor), |
| 311 | OP(PAT,DST,GXequiv) }, /* 0xa1 ~P^(D|(S&~P)) */ |
| 312 | { OP(PAT,SRC,GXorReverse), OP(SRC,DST,GXand) }, /* 0xa2 D&(P|~S) */ |
| 313 | { OP(DST,SRC,GXxor), OP(PAT,SRC,GXor), |
| 314 | OP(SRC,DST,GXequiv) }, /* 0xa3 ~D^(P|(S^D)) */ |
| 315 | { OP(PAT,SRC,GXnor), OP(SRC,DST,GXor), |
| 316 | OP(PAT,DST,GXequiv) }, /* 0xa4 ~P^(D|~(S|P)) */ |
| 317 | { OP(PAT,DST,GXequiv) }, /* 0xa5 ~P^D */ |
| 318 | { OP(PAT,SRC,GXandInverted), OP(SRC,DST,GXxor) },/* 0xa6 D^(S&~P) */ |
| 319 | { OP(PAT,SRC,GXor), OP(SRC,DST,GXand), |
| 320 | OP(PAT,DST,GXequiv) }, /* 0xa7 ~P^(D&(S|P)) */ |
| 321 | { OP(PAT,SRC,GXor), OP(SRC,DST,GXand) }, /* 0xa8 D&(P|S) */ |
| 322 | { OP(PAT,SRC,GXor), OP(SRC,DST,GXequiv) }, /* 0xa9 ~D^(P|S) */ |
| 323 | { OP(SRC,DST,GXnoop) }, /* 0xaa D */ |
| 324 | { OP(PAT,SRC,GXnor), OP(SRC,DST,GXor) }, /* 0xab D|~(P|S) */ |
| 325 | { OP(SRC,DST,GXxor), OP(PAT,DST,GXand), |
| 326 | OP(SRC,DST,GXxor) }, /* 0xac S^(P&(D^S)) */ |
| 327 | { OP(DST,SRC,GXand), OP(PAT,SRC,GXor), |
| 328 | OP(SRC,DST,GXequiv) }, /* 0xad ~D^(P|(S&D)) */ |
| 329 | { OP(PAT,SRC,GXandInverted), OP(SRC,DST,GXor) }, /* 0xae D|(S&~P) */ |
| 330 | { OP(PAT,DST,GXorInverted) }, /* 0xaf D|~P */ |
| 331 | { OP(SRC,DST,GXorInverted), OP(PAT,DST,GXand) }, /* 0xb0 P&(D|~S) */ |
| 332 | { OP(PAT,SRC,GXxor), OP(SRC,DST,GXor), |
| 333 | OP(PAT,DST,GXequiv) }, /* 0xb1 ~P^(D|(S^P)) */ |
| 334 | { OP(SRC,TMP,GXcopy), OP(SRC,DST,GXxor), |
| 335 | OP(PAT,SRC,GXxor), OP(SRC,DST,GXor), |
| 336 | OP(TMP,DST,GXxor) }, /* 0xb2 S^((S^P)|(S^D))*/ |
| 337 | { OP(PAT,DST,GXnand), OP(SRC,DST,GXnand) }, /* 0xb3 ~(S&~(D&P)) */ |
| 338 | { OP(SRC,DST,GXandReverse), OP(PAT,DST,GXxor) }, /* 0xb4 P^(S&~D) */ |
| 339 | { OP(DST,SRC,GXor), OP(PAT,SRC,GXand), |
| 340 | OP(SRC,DST,GXequiv) }, /* 0xb5 ~D^(P&(S|D)) */ |
| 341 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXand), |
| 342 | OP(SRC,DST,GXor), OP(PAT,DST,GXxor), |
| 343 | OP(TMP,DST,GXxor) }, /* 0xb6 D^P^(S|(D&P)) */ |
| 344 | { OP(PAT,DST,GXxor), OP(SRC,DST,GXnand) }, /* 0xb7 ~(S&(D^P)) */ |
| 345 | { OP(PAT,DST,GXxor), OP(SRC,DST,GXand), |
| 346 | OP(PAT,DST,GXxor) }, /* 0xb8 P^(S&(D^P)) */ |
| 347 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXand), |
| 348 | OP(SRC,DST,GXor), OP(TMP,DST,GXequiv) }, /* 0xb9 ~D^(S|(P&D)) */ |
| 349 | { OP(PAT,SRC,GXandReverse), OP(SRC,DST,GXor) }, /* 0xba D|(P&~S) */ |
| 350 | { OP(SRC,DST,GXorInverted) }, /* 0xbb ~S|D */ |
| 351 | { OP(SRC,DST,GXnand), OP(PAT,DST,GXand), |
| 352 | OP(SRC,DST,GXxor) }, /* 0xbc S^(P&~(D&S)) */ |
| 353 | { OP(DST,SRC,GXxor), OP(PAT,DST,GXxor), |
| 354 | OP(SRC,DST,GXnand) }, /* 0xbd ~((S^D)&(P^D)) */ |
| 355 | { OP(PAT,SRC,GXxor), OP(SRC,DST,GXor) }, /* 0xbe D|(P^S) */ |
| 356 | { OP(PAT,SRC,GXnand), OP(SRC,DST,GXor) }, /* 0xbf D|~(P&S) */ |
| 357 | { OP(PAT,SRC,GXand) }, /* 0xc0 P&S */ |
| 358 | { OP(SRC,DST,GXandInverted), OP(PAT,DST,GXor), |
| 359 | OP(SRC,DST,GXequiv) }, /* 0xc1 ~S^(P|(D&~S)) */ |
| 360 | { OP(SRC,DST,GXnor), OP(PAT,DST,GXor), |
| 361 | OP(SRC,DST,GXequiv) }, /* 0xc2 ~S^(P|~(D|S)) */ |
| 362 | { OP(PAT,SRC,GXequiv) }, /* 0xc3 ~P^S */ |
| 363 | { OP(PAT,DST,GXorReverse), OP(SRC,DST,GXand) }, /* 0xc4 S&(P|~D) */ |
| 364 | { OP(SRC,DST,GXxor), OP(PAT,DST,GXor), |
| 365 | OP(SRC,DST,GXequiv) }, /* 0xc5 ~S^(P|(D^S)) */ |
| 366 | { OP(PAT,DST,GXandInverted), OP(SRC,DST,GXxor) },/* 0xc6 S^(D&~P) */ |
| 367 | { OP(PAT,DST,GXor), OP(SRC,DST,GXand), |
| 368 | OP(PAT,DST,GXequiv) }, /* 0xc7 ~P^(S&(D|P)) */ |
| 369 | { OP(PAT,DST,GXor), OP(SRC,DST,GXand) }, /* 0xc8 S&(D|P) */ |
| 370 | { OP(PAT,DST,GXor), OP(SRC,DST,GXequiv) }, /* 0xc9 ~S^(P|D) */ |
| 371 | { OP(DST,SRC,GXxor), OP(PAT,SRC,GXand), |
| 372 | OP(SRC,DST,GXxor) }, /* 0xca D^(P&(S^D)) */ |
| 373 | { OP(SRC,DST,GXand), OP(PAT,DST,GXor), |
| 374 | OP(SRC,DST,GXequiv) }, /* 0xcb ~S^(P|(D&S)) */ |
| 375 | { OP(SRC,DST,GXcopy) }, /* 0xcc S */ |
| 376 | { OP(PAT,DST,GXnor), OP(SRC,DST,GXor) }, /* 0xcd S|~(D|P) */ |
| 377 | { OP(PAT,DST,GXandInverted), OP(SRC,DST,GXor) }, /* 0xce S|(D&~P) */ |
| 378 | { OP(PAT,SRC,GXorInverted) }, /* 0xcf S|~P */ |
| 379 | { OP(SRC,DST,GXorReverse), OP(PAT,DST,GXand) }, /* 0xd0 P&(S|~D) */ |
| 380 | { OP(PAT,DST,GXxor), OP(SRC,DST,GXor), |
| 381 | OP(PAT,DST,GXequiv) }, /* 0xd1 ~P^(S|(D^P)) */ |
| 382 | { OP(SRC,DST,GXandInverted), OP(PAT,DST,GXxor) },/* 0xd2 P^(D&~S) */ |
| 383 | { OP(SRC,DST,GXor), OP(PAT,DST,GXand), |
| 384 | OP(SRC,DST,GXequiv) }, /* 0xd3 ~S^(P&(D|S)) */ |
| 385 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXxor), |
| 386 | OP(PAT,DST,GXxor), OP(SRC,DST,GXand), |
| 387 | OP(TMP,DST,GXxor) }, /* 0xd4 S^((S^P)&(D^P))*/ |
| 388 | { OP(PAT,SRC,GXnand), OP(SRC,DST,GXnand) }, /* 0xd5 ~(D&~(P&S)) */ |
| 389 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXand), |
| 390 | OP(SRC,DST,GXor), OP(PAT,DST,GXxor), |
| 391 | OP(TMP,DST,GXxor) }, /* 0xd6 S^P^(D|(P&S)) */ |
| 392 | { OP(PAT,SRC,GXxor), OP(SRC,DST,GXnand) }, /* 0xd7 ~(D&(P^S)) */ |
| 393 | { OP(PAT,SRC,GXxor), OP(SRC,DST,GXand), |
| 394 | OP(PAT,DST,GXxor) }, /* 0xd8 P^(D&(S^P)) */ |
| 395 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXand), |
| 396 | OP(SRC,DST,GXor), OP(TMP,DST,GXequiv) }, /* 0xd9 ~S^(D|(P&S)) */ |
| 397 | { OP(DST,SRC,GXnand), OP(PAT,SRC,GXand), |
| 398 | OP(SRC,DST,GXxor) }, /* 0xda D^(P&~(S&D)) */ |
| 399 | { OP(SRC,DST,GXxor), OP(PAT,SRC,GXxor), |
| 400 | OP(SRC,DST,GXnand) }, /* 0xdb ~((S^P)&(S^D)) */ |
| 401 | { OP(PAT,DST,GXandReverse), OP(SRC,DST,GXor) }, /* 0xdc S|(P&~D) */ |
| 402 | { OP(SRC,DST,GXorReverse) }, /* 0xdd S|~D */ |
| 403 | { OP(PAT,DST,GXxor), OP(SRC,DST,GXor) }, /* 0xde S|(D^P) */ |
| 404 | { OP(PAT,DST,GXnand), OP(SRC,DST,GXor) }, /* 0xdf S|~(D&P) */ |
| 405 | { OP(SRC,DST,GXor), OP(PAT,DST,GXand) }, /* 0xe0 P&(D|S) */ |
| 406 | { OP(SRC,DST,GXor), OP(PAT,DST,GXequiv) }, /* 0xe1 ~P^(D|S) */ |
| 407 | { OP(DST,TMP,GXcopy), OP(PAT,DST,GXxor), |
| 408 | OP(SRC,DST,GXand), OP(TMP,DST,GXxor) }, /* 0xe2 D^(S&(P^D)) */ |
| 409 | { OP(PAT,DST,GXand), OP(SRC,DST,GXor), |
| 410 | OP(PAT,DST,GXequiv) }, /* 0xe3 ~P^(S|(D&P)) */ |
| 411 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXxor), |
| 412 | OP(SRC,DST,GXand), OP(TMP,DST,GXxor) }, /* 0xe4 S^(D&(P^S)) */ |
| 413 | { OP(PAT,SRC,GXand), OP(SRC,DST,GXor), |
| 414 | OP(PAT,DST,GXequiv) }, /* 0xe5 ~P^(D|(S&P)) */ |
| 415 | { OP(SRC,TMP,GXcopy), OP(PAT,SRC,GXnand), |
| 416 | OP(SRC,DST,GXand), OP(TMP,DST,GXxor) }, /* 0xe6 S^(D&~(P&S)) */ |
| 417 | { OP(PAT,SRC,GXxor), OP(PAT,DST,GXxor), |
| 418 | OP(SRC,DST,GXnand) }, /* 0xe7 ~((S^P)&(D^P)) */ |
| 419 | { OP(SRC,TMP,GXcopy), OP(SRC,DST,GXxor), |
| 420 | OP(PAT,SRC,GXxor), OP(SRC,DST,GXand), |
| 421 | OP(TMP,DST,GXxor) }, /* 0xe8 S^((S^P)&(S^D))*/ |
| 422 | { OP(DST,TMP,GXcopy), OP(SRC,DST,GXnand), |
| 423 | OP(PAT,DST,GXand), OP(SRC,DST,GXxor), |
| 424 | OP(TMP,DST,GXequiv) }, /* 0xe9 ~D^S^(P&~(S&D))*/ |
| 425 | { OP(PAT,SRC,GXand), OP(SRC,DST,GXor) }, /* 0xea D|(P&S) */ |
| 426 | { OP(PAT,SRC,GXequiv), OP(SRC,DST,GXor) }, /* 0xeb D|~(P^S) */ |
| 427 | { OP(PAT,DST,GXand), OP(SRC,DST,GXor) }, /* 0xec S|(D&P) */ |
| 428 | { OP(PAT,DST,GXequiv), OP(SRC,DST,GXor) }, /* 0xed S|~(D^P) */ |
| 429 | { OP(SRC,DST,GXor) }, /* 0xee S|D */ |
| 430 | { OP(PAT,DST,GXorInverted), OP(SRC,DST,GXor) }, /* 0xef S|D|~P */ |
| 431 | { OP(PAT,DST,GXcopy) }, /* 0xf0 P */ |
| 432 | { OP(SRC,DST,GXnor), OP(PAT,DST,GXor) }, /* 0xf1 P|~(D|S) */ |
| 433 | { OP(SRC,DST,GXandInverted), OP(PAT,DST,GXor) }, /* 0xf2 P|(D&~S) */ |
| 434 | { OP(PAT,SRC,GXorReverse) }, /* 0xf3 P|~S */ |
| 435 | { OP(SRC,DST,GXandReverse), OP(PAT,DST,GXor) }, /* 0xf4 P|(S&~D) */ |
| 436 | { OP(PAT,DST,GXorReverse) }, /* 0xf5 P|~D */ |
| 437 | { OP(SRC,DST,GXxor), OP(PAT,DST,GXor) }, /* 0xf6 P|(D^S) */ |
| 438 | { OP(SRC,DST,GXnand), OP(PAT,DST,GXor) }, /* 0xf7 P|~(S&D) */ |
| 439 | { OP(SRC,DST,GXand), OP(PAT,DST,GXor) }, /* 0xf8 P|(D&S) */ |
| 440 | { OP(SRC,DST,GXequiv), OP(PAT,DST,GXor) }, /* 0xf9 P|~(D^S) */ |
| 441 | { OP(PAT,DST,GXor) }, /* 0xfa D|P */ |
| 442 | { OP(PAT,SRC,GXorReverse), OP(SRC,DST,GXor) }, /* 0xfb D|P|~S */ |
| 443 | { OP(PAT,SRC,GXor) }, /* 0xfc P|S */ |
| 444 | { OP(SRC,DST,GXorReverse), OP(PAT,DST,GXor) }, /* 0xfd P|S|~D */ |
| 445 | { OP(SRC,DST,GXor), OP(PAT,DST,GXor) }, /* 0xfe P|D|S */ |
| 446 | { OP(PAT,DST,GXset) } /* 0xff 1 */ |
| 447 | }; |
| 448 | |
| 449 | |
| 450 | #ifdef BITBLT_TEST /* Opcodes test */ |
| 451 | |
| 452 | static int do_bitop( int s, int d, int rop ) |
| 453 | { |
| 454 | int res; |
| 455 | switch(rop) |
| 456 | { |
| 457 | case GXclear: res = 0; break; |
| 458 | case GXand: res = s & d; break; |
| 459 | case GXandReverse: res = s & ~d; break; |
| 460 | case GXcopy: res = s; break; |
| 461 | case GXandInverted: res = ~s & d; break; |
| 462 | case GXnoop: res = d; break; |
| 463 | case GXxor: res = s ^ d; break; |
| 464 | case GXor: res = s | d; break; |
| 465 | case GXnor: res = ~(s | d); break; |
| 466 | case GXequiv: res = ~s ^ d; break; |
| 467 | case GXinvert: res = ~d; break; |
| 468 | case GXorReverse: res = s | ~d; break; |
| 469 | case GXcopyInverted: res = ~s; break; |
| 470 | case GXorInverted: res = ~s | d; break; |
| 471 | case GXnand: res = ~(s & d); break; |
| 472 | case GXset: res = 1; break; |
| 473 | } |
| 474 | return res & 1; |
| 475 | } |
| 476 | |
Patrik Stridvall | 3c0211f | 2001-09-11 00:32:32 +0000 | [diff] [blame] | 477 | int main() |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 478 | { |
| 479 | int rop, i, res, src, dst, pat, tmp, dstUsed; |
| 480 | const BYTE *opcode; |
| 481 | |
| 482 | for (rop = 0; rop < 256; rop++) |
| 483 | { |
| 484 | res = dstUsed = 0; |
| 485 | for (i = 0; i < 8; i++) |
| 486 | { |
| 487 | pat = (i >> 2) & 1; |
| 488 | src = (i >> 1) & 1; |
| 489 | dst = i & 1; |
| 490 | for (opcode = BITBLT_Opcodes[rop]; *opcode; opcode++) |
| 491 | { |
| 492 | switch(*opcode >> 4) |
| 493 | { |
| 494 | case OP_ARGS(DST,TMP): |
| 495 | tmp = do_bitop( dst, tmp, *opcode & 0xf ); |
| 496 | break; |
| 497 | case OP_ARGS(DST,SRC): |
| 498 | src = do_bitop( dst, src, *opcode & 0xf ); |
| 499 | break; |
| 500 | case OP_ARGS(SRC,TMP): |
| 501 | tmp = do_bitop( src, tmp, *opcode & 0xf ); |
| 502 | break; |
| 503 | case OP_ARGS(SRC,DST): |
| 504 | dst = do_bitop( src, dst, *opcode & 0xf ); |
| 505 | dstUsed = 1; |
| 506 | break; |
| 507 | case OP_ARGS(PAT,TMP): |
| 508 | tmp = do_bitop( pat, tmp, *opcode & 0xf ); |
| 509 | break; |
| 510 | case OP_ARGS(PAT,DST): |
| 511 | dst = do_bitop( pat, dst, *opcode & 0xf ); |
| 512 | dstUsed = 1; |
| 513 | break; |
| 514 | case OP_ARGS(PAT,SRC): |
| 515 | src = do_bitop( pat, src, *opcode & 0xf ); |
| 516 | break; |
| 517 | case OP_ARGS(TMP,DST): |
| 518 | dst = do_bitop( tmp, dst, *opcode & 0xf ); |
| 519 | dstUsed = 1; |
| 520 | break; |
| 521 | case OP_ARGS(TMP,SRC): |
| 522 | src = do_bitop( tmp, src, *opcode & 0xf ); |
| 523 | break; |
| 524 | default: |
| 525 | printf( "Invalid opcode %x\n", *opcode ); |
| 526 | } |
| 527 | } |
| 528 | if (!dstUsed) dst = src; |
| 529 | if (dst) res |= 1 << i; |
| 530 | } |
| 531 | if (res != rop) printf( "%02x: ERROR, res=%02x\n", rop, res ); |
| 532 | } |
Patrik Stridvall | 3c0211f | 2001-09-11 00:32:32 +0000 | [diff] [blame] | 533 | |
| 534 | return 0; |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 535 | } |
| 536 | |
| 537 | #endif /* BITBLT_TEST */ |
| 538 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 539 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 540 | /*********************************************************************** |
Alexandre Julliard | fe08568 | 2000-03-18 21:56:10 +0000 | [diff] [blame] | 541 | * perfect_graphics |
| 542 | * |
| 543 | * Favor correctness or speed? |
| 544 | */ |
Bill Medland | 25e44db | 2001-07-26 20:13:47 +0000 | [diff] [blame] | 545 | static int perfect_graphics(void) |
Alexandre Julliard | fe08568 | 2000-03-18 21:56:10 +0000 | [diff] [blame] | 546 | { |
| 547 | static int perfect = -1; |
Dmitry Timoshkov | de70d2b | 2001-06-19 03:32:44 +0000 | [diff] [blame] | 548 | if (perfect == -1) |
| 549 | { |
| 550 | HKEY hkey; |
| 551 | char buffer[20]; |
| 552 | /* default value */ |
| 553 | perfect = 0; |
| 554 | if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\x11drv", &hkey)) |
| 555 | { |
| 556 | DWORD type, count = sizeof(buffer); |
| 557 | if(!RegQueryValueExA(hkey, "PerfectGraphics", 0, &type, buffer, &count)) |
Alexandre Julliard | f899ef0 | 2001-07-23 00:04:00 +0000 | [diff] [blame] | 558 | { |
| 559 | char ch = buffer[0]; |
| 560 | perfect = (ch == 'y' || ch == 'Y' || ch == 't' || ch == 'T' || ch == '1'); |
| 561 | } |
Dmitry Timoshkov | de70d2b | 2001-06-19 03:32:44 +0000 | [diff] [blame] | 562 | RegCloseKey(hkey); |
| 563 | } |
| 564 | } |
Alexandre Julliard | fe08568 | 2000-03-18 21:56:10 +0000 | [diff] [blame] | 565 | return perfect; |
| 566 | } |
| 567 | |
| 568 | /*********************************************************************** |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 569 | * BITBLT_StretchRow |
| 570 | * |
| 571 | * Stretch a row of pixels. Helper function for BITBLT_StretchImage. |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 572 | */ |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 573 | static void BITBLT_StretchRow( int *rowSrc, int *rowDst, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 574 | INT startDst, INT widthDst, |
| 575 | INT xinc, INT xoff, WORD mode ) |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 576 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 577 | register INT xsrc = xinc * startDst + xoff; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 578 | rowDst += startDst; |
| 579 | switch(mode) |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 580 | { |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 581 | case STRETCH_ANDSCANS: |
| 582 | for(; widthDst > 0; widthDst--, xsrc += xinc) |
| 583 | *rowDst++ &= rowSrc[xsrc >> 16]; |
| 584 | break; |
| 585 | case STRETCH_ORSCANS: |
| 586 | for(; widthDst > 0; widthDst--, xsrc += xinc) |
| 587 | *rowDst++ |= rowSrc[xsrc >> 16]; |
| 588 | break; |
| 589 | case STRETCH_DELETESCANS: |
| 590 | for(; widthDst > 0; widthDst--, xsrc += xinc) |
| 591 | *rowDst++ = rowSrc[xsrc >> 16]; |
| 592 | break; |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 593 | } |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 594 | } |
| 595 | |
| 596 | |
| 597 | /*********************************************************************** |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 598 | * BITBLT_ShrinkRow |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 599 | * |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 600 | * Shrink a row of pixels. Helper function for BITBLT_StretchImage. |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 601 | */ |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 602 | static void BITBLT_ShrinkRow( int *rowSrc, int *rowDst, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 603 | INT startSrc, INT widthSrc, |
| 604 | INT xinc, INT xoff, WORD mode ) |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 605 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 606 | register INT xdst = xinc * startSrc + xoff; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 607 | rowSrc += startSrc; |
| 608 | switch(mode) |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 609 | { |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 610 | case STRETCH_ORSCANS: |
| 611 | for(; widthSrc > 0; widthSrc--, xdst += xinc) |
| 612 | rowDst[xdst >> 16] |= *rowSrc++; |
| 613 | break; |
| 614 | case STRETCH_ANDSCANS: |
| 615 | for(; widthSrc > 0; widthSrc--, xdst += xinc) |
| 616 | rowDst[xdst >> 16] &= *rowSrc++; |
| 617 | break; |
| 618 | case STRETCH_DELETESCANS: |
| 619 | for(; widthSrc > 0; widthSrc--, xdst += xinc) |
| 620 | rowDst[xdst >> 16] = *rowSrc++; |
| 621 | break; |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 622 | } |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 623 | } |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 624 | |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 625 | |
| 626 | /*********************************************************************** |
| 627 | * BITBLT_GetRow |
| 628 | * |
| 629 | * Retrieve a row from an image. Helper function for BITBLT_StretchImage. |
| 630 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 631 | static void BITBLT_GetRow( XImage *image, int *pdata, INT row, |
| 632 | INT start, INT width, INT depthDst, |
| 633 | int fg, int bg, BOOL swap) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 634 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 635 | register INT i; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 636 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 637 | assert( (row >= 0) && (row < image->height) ); |
| 638 | assert( (start >= 0) && (width <= image->width) ); |
| 639 | |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 640 | pdata += swap ? start+width-1 : start; |
Alexandre Julliard | a2f2e01 | 1995-06-06 16:40:35 +0000 | [diff] [blame] | 641 | if (image->depth == depthDst) /* color -> color */ |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 642 | { |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 643 | if (X11DRV_PALETTE_XPixelToPalette && (depthDst != 1)) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 644 | if (swap) for (i = 0; i < width; i++) |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 645 | *pdata-- = X11DRV_PALETTE_XPixelToPalette[XGetPixel( image, i, row )]; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 646 | else for (i = 0; i < width; i++) |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 647 | *pdata++ = X11DRV_PALETTE_XPixelToPalette[XGetPixel( image, i, row )]; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 648 | else |
| 649 | if (swap) for (i = 0; i < width; i++) |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 650 | *pdata-- = XGetPixel( image, i, row ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 651 | else for (i = 0; i < width; i++) |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 652 | *pdata++ = XGetPixel( image, i, row ); |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 653 | } |
| 654 | else |
| 655 | { |
Alexandre Julliard | a2f2e01 | 1995-06-06 16:40:35 +0000 | [diff] [blame] | 656 | if (image->depth == 1) /* monochrome -> color */ |
| 657 | { |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 658 | if (X11DRV_PALETTE_XPixelToPalette) |
Alexandre Julliard | a2f2e01 | 1995-06-06 16:40:35 +0000 | [diff] [blame] | 659 | { |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 660 | fg = X11DRV_PALETTE_XPixelToPalette[fg]; |
| 661 | bg = X11DRV_PALETTE_XPixelToPalette[bg]; |
Alexandre Julliard | a2f2e01 | 1995-06-06 16:40:35 +0000 | [diff] [blame] | 662 | } |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 663 | if (swap) for (i = 0; i < width; i++) |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 664 | *pdata-- = XGetPixel( image, i, row ) ? bg : fg; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 665 | else for (i = 0; i < width; i++) |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 666 | *pdata++ = XGetPixel( image, i, row ) ? bg : fg; |
Alexandre Julliard | a2f2e01 | 1995-06-06 16:40:35 +0000 | [diff] [blame] | 667 | } |
| 668 | else /* color -> monochrome */ |
| 669 | { |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 670 | if (swap) for (i = 0; i < width; i++) |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 671 | *pdata-- = (XGetPixel( image, i, row ) == bg) ? 1 : 0; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 672 | else for (i = 0; i < width; i++) |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 673 | *pdata++ = (XGetPixel( image, i, row ) == bg) ? 1 : 0; |
Alexandre Julliard | a2f2e01 | 1995-06-06 16:40:35 +0000 | [diff] [blame] | 674 | } |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 675 | } |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 676 | } |
| 677 | |
| 678 | |
| 679 | /*********************************************************************** |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 680 | * BITBLT_StretchImage |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 681 | * |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 682 | * Stretch an X image. |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 683 | * FIXME: does not work for full 32-bit coordinates. |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 684 | */ |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 685 | static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 686 | INT widthSrc, INT heightSrc, |
| 687 | INT widthDst, INT heightDst, |
| 688 | RECT *visRectSrc, RECT *visRectDst, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 689 | int foreground, int background, WORD mode ) |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 690 | { |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 691 | int *rowSrc, *rowDst, *pixel; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 692 | char *pdata; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 693 | INT xinc, xoff, yinc, ysrc, ydst; |
| 694 | register INT x, y; |
| 695 | BOOL hstretch, vstretch, hswap, vswap; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 696 | |
| 697 | hswap = ((int)widthSrc * widthDst) < 0; |
| 698 | vswap = ((int)heightSrc * heightDst) < 0; |
| 699 | widthSrc = abs(widthSrc); |
| 700 | heightSrc = abs(heightSrc); |
| 701 | widthDst = abs(widthDst); |
| 702 | heightDst = abs(heightDst); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 703 | |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 704 | if (!(rowSrc = (int *)HeapAlloc( GetProcessHeap(), 0, |
| 705 | (widthSrc+widthDst)*sizeof(int) ))) return; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 706 | rowDst = rowSrc + widthSrc; |
| 707 | |
| 708 | /* When stretching, all modes are the same, and DELETESCANS is faster */ |
| 709 | if ((widthSrc < widthDst) && (heightSrc < heightDst)) |
| 710 | mode = STRETCH_DELETESCANS; |
| 711 | |
Alexandre Julliard | 1850655 | 1995-01-24 16:21:01 +0000 | [diff] [blame] | 712 | if (mode != STRETCH_DELETESCANS) |
| 713 | memset( rowDst, (mode == STRETCH_ANDSCANS) ? 0xff : 0x00, |
| 714 | widthDst*sizeof(int) ); |
| 715 | |
Alexandre Julliard | 8cc3a5e | 1996-08-11 15:49:51 +0000 | [diff] [blame] | 716 | hstretch = (widthSrc < widthDst); |
| 717 | vstretch = (heightSrc < heightDst); |
| 718 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 719 | if (hstretch) |
| 720 | { |
| 721 | xinc = ((int)widthSrc << 16) / widthDst; |
| 722 | xoff = ((widthSrc << 16) - (xinc * widthDst)) / 2; |
| 723 | } |
| 724 | else |
| 725 | { |
| 726 | xinc = ((int)widthDst << 16) / widthSrc; |
| 727 | xoff = ((widthDst << 16) - (xinc * widthSrc)) / 2; |
| 728 | } |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 729 | |
| 730 | if (vstretch) |
| 731 | { |
| 732 | yinc = ((int)heightSrc << 16) / heightDst; |
| 733 | ydst = visRectDst->top; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 734 | if (vswap) |
| 735 | { |
| 736 | ysrc = yinc * (heightDst - ydst - 1); |
| 737 | yinc = -yinc; |
| 738 | } |
| 739 | else |
| 740 | ysrc = yinc * ydst; |
| 741 | |
| 742 | for ( ; (ydst < visRectDst->bottom); ysrc += yinc, ydst++) |
| 743 | { |
| 744 | if (((ysrc >> 16) < visRectSrc->top) || |
| 745 | ((ysrc >> 16) >= visRectSrc->bottom)) continue; |
| 746 | |
| 747 | /* Retrieve a source row */ |
| 748 | BITBLT_GetRow( srcImage, rowSrc, (ysrc >> 16) - visRectSrc->top, |
| 749 | hswap ? widthSrc - visRectSrc->right |
| 750 | : visRectSrc->left, |
| 751 | visRectSrc->right - visRectSrc->left, |
| 752 | dstImage->depth, foreground, background, hswap ); |
| 753 | |
| 754 | /* Stretch or shrink it */ |
| 755 | if (hstretch) |
| 756 | BITBLT_StretchRow( rowSrc, rowDst, visRectDst->left, |
| 757 | visRectDst->right - visRectDst->left, |
| 758 | xinc, xoff, mode ); |
| 759 | else BITBLT_ShrinkRow( rowSrc, rowDst, |
| 760 | hswap ? widthSrc - visRectSrc->right |
| 761 | : visRectSrc->left, |
| 762 | visRectSrc->right - visRectSrc->left, |
| 763 | xinc, xoff, mode ); |
| 764 | |
| 765 | /* Store the destination row */ |
| 766 | pixel = rowDst + visRectDst->right - 1; |
| 767 | y = ydst - visRectDst->top; |
| 768 | for (x = visRectDst->right-visRectDst->left-1; x >= 0; x--) |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 769 | XPutPixel( dstImage, x, y, *pixel-- ); |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 770 | if (mode != STRETCH_DELETESCANS) |
| 771 | memset( rowDst, (mode == STRETCH_ANDSCANS) ? 0xff : 0x00, |
| 772 | widthDst*sizeof(int) ); |
| 773 | |
| 774 | /* Make copies of the destination row */ |
| 775 | |
| 776 | pdata = dstImage->data + dstImage->bytes_per_line * y; |
| 777 | while (((ysrc + yinc) >> 16 == ysrc >> 16) && |
| 778 | (ydst < visRectDst->bottom-1)) |
| 779 | { |
| 780 | memcpy( pdata + dstImage->bytes_per_line, pdata, |
| 781 | dstImage->bytes_per_line ); |
| 782 | pdata += dstImage->bytes_per_line; |
| 783 | ysrc += yinc; |
| 784 | ydst++; |
| 785 | } |
| 786 | } |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 787 | } |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 788 | else /* Shrinking */ |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 789 | { |
| 790 | yinc = ((int)heightDst << 16) / heightSrc; |
| 791 | ysrc = visRectSrc->top; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 792 | ydst = ((heightDst << 16) - (yinc * heightSrc)) / 2; |
| 793 | if (vswap) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 794 | { |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 795 | ydst += yinc * (heightSrc - ysrc - 1); |
| 796 | yinc = -yinc; |
| 797 | } |
| 798 | else |
| 799 | ydst += yinc * ysrc; |
| 800 | |
| 801 | for( ; (ysrc < visRectSrc->bottom); ydst += yinc, ysrc++) |
| 802 | { |
| 803 | if (((ydst >> 16) < visRectDst->top) || |
| 804 | ((ydst >> 16) >= visRectDst->bottom)) continue; |
| 805 | |
| 806 | /* Retrieve a source row */ |
| 807 | BITBLT_GetRow( srcImage, rowSrc, ysrc - visRectSrc->top, |
| 808 | hswap ? widthSrc - visRectSrc->right |
| 809 | : visRectSrc->left, |
| 810 | visRectSrc->right - visRectSrc->left, |
| 811 | dstImage->depth, foreground, background, hswap ); |
| 812 | |
| 813 | /* Stretch or shrink it */ |
| 814 | if (hstretch) |
| 815 | BITBLT_StretchRow( rowSrc, rowDst, visRectDst->left, |
| 816 | visRectDst->right - visRectDst->left, |
| 817 | xinc, xoff, mode ); |
| 818 | else BITBLT_ShrinkRow( rowSrc, rowDst, |
| 819 | hswap ? widthSrc - visRectSrc->right |
| 820 | : visRectSrc->left, |
| 821 | visRectSrc->right - visRectSrc->left, |
| 822 | xinc, xoff, mode ); |
| 823 | |
| 824 | /* Merge several source rows into the destination */ |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 825 | if (mode == STRETCH_DELETESCANS) |
| 826 | { |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 827 | /* Simply skip the overlapping rows */ |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 828 | while (((ydst + yinc) >> 16 == ydst >> 16) && |
| 829 | (ysrc < visRectSrc->bottom-1)) |
| 830 | { |
| 831 | ydst += yinc; |
| 832 | ysrc++; |
| 833 | } |
| 834 | } |
| 835 | else if (((ydst + yinc) >> 16 == ydst >> 16) && |
| 836 | (ysrc < visRectSrc->bottom-1)) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 837 | continue; /* Restart loop for next overlapping row */ |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 838 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 839 | /* Store the destination row */ |
| 840 | pixel = rowDst + visRectDst->right - 1; |
| 841 | y = (ydst >> 16) - visRectDst->top; |
| 842 | for (x = visRectDst->right-visRectDst->left-1; x >= 0; x--) |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 843 | XPutPixel( dstImage, x, y, *pixel-- ); |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 844 | if (mode != STRETCH_DELETESCANS) |
| 845 | memset( rowDst, (mode == STRETCH_ANDSCANS) ? 0xff : 0x00, |
| 846 | widthDst*sizeof(int) ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 847 | } |
| 848 | } |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 849 | HeapFree( GetProcessHeap(), 0, rowSrc ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 850 | } |
| 851 | |
| 852 | |
| 853 | /*********************************************************************** |
| 854 | * BITBLT_GetSrcAreaStretch |
| 855 | * |
| 856 | * Retrieve an area from the source DC, stretching and mapping all the |
| 857 | * pixels to Windows colors. |
| 858 | */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 859 | static int BITBLT_GetSrcAreaStretch( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 860 | Pixmap pixmap, GC gc, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 861 | INT xSrc, INT ySrc, |
| 862 | INT widthSrc, INT heightSrc, |
| 863 | INT xDst, INT yDst, |
| 864 | INT widthDst, INT heightDst, |
| 865 | RECT *visRectSrc, RECT *visRectDst ) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 866 | { |
| 867 | XImage *imageSrc, *imageDst; |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 868 | DC *dcDst = physDevDst->dc; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 869 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 870 | RECT rectSrc = *visRectSrc; |
| 871 | RECT rectDst = *visRectDst; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 872 | |
| 873 | if (widthSrc < 0) xSrc += widthSrc; |
| 874 | if (widthDst < 0) xDst += widthDst; |
| 875 | if (heightSrc < 0) ySrc += heightSrc; |
| 876 | if (heightDst < 0) yDst += heightDst; |
Alexandre Julliard | 62f824f | 2000-03-18 22:12:33 +0000 | [diff] [blame] | 877 | rectSrc.left -= xSrc; |
| 878 | rectSrc.right -= xSrc; |
| 879 | rectSrc.top -= ySrc; |
| 880 | rectSrc.bottom -= ySrc; |
| 881 | rectDst.left -= xDst; |
| 882 | rectDst.right -= xDst; |
| 883 | rectDst.top -= yDst; |
| 884 | rectDst.bottom -= yDst; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 885 | |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 886 | /* FIXME: avoid BadMatch errors */ |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 887 | imageSrc = XGetImage( gdi_display, physDevSrc->drawable, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 888 | visRectSrc->left, visRectSrc->top, |
| 889 | visRectSrc->right - visRectSrc->left, |
| 890 | visRectSrc->bottom - visRectSrc->top, |
| 891 | AllPlanes, ZPixmap ); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 892 | imageDst = X11DRV_DIB_CreateXImage( rectDst.right - rectDst.left, |
| 893 | rectDst.bottom - rectDst.top, dcDst->bitsPerPixel ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 894 | BITBLT_StretchImage( imageSrc, imageDst, widthSrc, heightSrc, |
| 895 | widthDst, heightDst, &rectSrc, &rectDst, |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 896 | physDevDst->textPixel, dcDst->bitsPerPixel != 1 ? |
Huw D M Davies | 9c68faa | 1998-11-25 12:36:03 +0000 | [diff] [blame] | 897 | physDevDst->backgroundPixel : |
| 898 | physDevSrc->backgroundPixel, |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 899 | dcDst->stretchBltMode ); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 900 | XPutImage( gdi_display, pixmap, gc, imageDst, 0, 0, 0, 0, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 901 | rectDst.right - rectDst.left, rectDst.bottom - rectDst.top ); |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 902 | XDestroyImage( imageSrc ); |
| 903 | XDestroyImage( imageDst ); |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 904 | return 0; /* no exposure events generated */ |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 905 | } |
| 906 | |
| 907 | |
| 908 | /*********************************************************************** |
| 909 | * BITBLT_GetSrcArea |
| 910 | * |
| 911 | * Retrieve an area from the source DC, mapping all the |
| 912 | * pixels to Windows colors. |
| 913 | */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 914 | static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst, |
| 915 | Pixmap pixmap, GC gc, INT xSrc, INT ySrc, RECT *visRectSrc ) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 916 | { |
| 917 | XImage *imageSrc, *imageDst; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 918 | register INT x, y; |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 919 | int exposures = 0; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 920 | INT width = visRectSrc->right - visRectSrc->left; |
| 921 | INT height = visRectSrc->bottom - visRectSrc->top; |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 922 | DC *dcSrc = physDevSrc->dc; |
| 923 | DC *dcDst = physDevDst->dc; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 924 | |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 925 | if (dcSrc->bitsPerPixel == dcDst->bitsPerPixel) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 926 | { |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 927 | if (!X11DRV_PALETTE_XPixelToPalette || |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 928 | (dcDst->bitsPerPixel == 1)) /* monochrome -> monochrome */ |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 929 | { |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 930 | if (dcDst->bitsPerPixel == 1) |
Alexandre Julliard | 960dc90 | 2000-06-08 19:23:12 +0000 | [diff] [blame] | 931 | { |
| 932 | /* MSDN says if StretchBlt must convert a bitmap from monochrome |
| 933 | to color or vice versa, the forground and background color of |
| 934 | the device context are used. In fact, it also applies to the |
| 935 | case when it is converted from mono to mono. */ |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 936 | XSetBackground( gdi_display, gc, physDevDst->textPixel ); |
| 937 | XSetForeground( gdi_display, gc, physDevDst->backgroundPixel ); |
| 938 | XCopyPlane( gdi_display, physDevSrc->drawable, pixmap, gc, |
Alexandre Julliard | 960dc90 | 2000-06-08 19:23:12 +0000 | [diff] [blame] | 939 | visRectSrc->left, visRectSrc->top, |
| 940 | width, height, 0, 0, 1); |
| 941 | } |
| 942 | else |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 943 | XCopyArea( gdi_display, physDevSrc->drawable, pixmap, gc, |
| 944 | visRectSrc->left, visRectSrc->top, width, height, 0, 0); |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 945 | exposures++; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 946 | } |
| 947 | else /* color -> color */ |
| 948 | { |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 949 | if (dcSrc->flags & DC_MEMORY) |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 950 | imageSrc = XGetImage( gdi_display, physDevSrc->drawable, |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 951 | visRectSrc->left, visRectSrc->top, |
| 952 | width, height, AllPlanes, ZPixmap ); |
| 953 | else |
| 954 | { |
| 955 | /* Make sure we don't get a BadMatch error */ |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 956 | XCopyArea( gdi_display, physDevSrc->drawable, pixmap, gc, |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 957 | visRectSrc->left, visRectSrc->top, |
| 958 | width, height, 0, 0); |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 959 | exposures++; |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 960 | imageSrc = XGetImage( gdi_display, pixmap, 0, 0, width, height, |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 961 | AllPlanes, ZPixmap ); |
| 962 | } |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 963 | for (y = 0; y < height; y++) |
| 964 | for (x = 0; x < width; x++) |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 965 | XPutPixel(imageSrc, x, y, |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 966 | X11DRV_PALETTE_XPixelToPalette[XGetPixel(imageSrc, x, y)]); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 967 | XPutImage( gdi_display, pixmap, gc, imageSrc, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 968 | 0, 0, 0, 0, width, height ); |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 969 | XDestroyImage( imageSrc ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 970 | } |
| 971 | } |
| 972 | else |
| 973 | { |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 974 | if (dcSrc->bitsPerPixel == 1) /* monochrome -> color */ |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 975 | { |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 976 | if (X11DRV_PALETTE_XPixelToPalette) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 977 | { |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 978 | XSetBackground( gdi_display, gc, |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 979 | X11DRV_PALETTE_XPixelToPalette[physDevDst->textPixel] ); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 980 | XSetForeground( gdi_display, gc, |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 981 | X11DRV_PALETTE_XPixelToPalette[physDevDst->backgroundPixel]); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 982 | } |
| 983 | else |
| 984 | { |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 985 | XSetBackground( gdi_display, gc, physDevDst->textPixel ); |
| 986 | XSetForeground( gdi_display, gc, physDevDst->backgroundPixel ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 987 | } |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 988 | XCopyPlane( gdi_display, physDevSrc->drawable, pixmap, gc, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 989 | visRectSrc->left, visRectSrc->top, |
| 990 | width, height, 0, 0, 1 ); |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 991 | exposures++; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 992 | } |
| 993 | else /* color -> monochrome */ |
| 994 | { |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 995 | /* FIXME: avoid BadMatch error */ |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 996 | imageSrc = XGetImage( gdi_display, physDevSrc->drawable, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 997 | visRectSrc->left, visRectSrc->top, |
| 998 | width, height, AllPlanes, ZPixmap ); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 999 | imageDst = X11DRV_DIB_CreateXImage( width, height, dcDst->bitsPerPixel ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1000 | for (y = 0; y < height; y++) |
| 1001 | for (x = 0; x < width; x++) |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1002 | XPutPixel(imageDst, x, y, (XGetPixel(imageSrc,x,y) == |
Huw D M Davies | 9c68faa | 1998-11-25 12:36:03 +0000 | [diff] [blame] | 1003 | physDevSrc->backgroundPixel) ); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1004 | XPutImage( gdi_display, pixmap, gc, imageDst, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1005 | 0, 0, 0, 0, width, height ); |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1006 | XDestroyImage( imageSrc ); |
| 1007 | XDestroyImage( imageDst ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1008 | } |
| 1009 | } |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 1010 | return exposures; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1011 | } |
| 1012 | |
| 1013 | |
| 1014 | /*********************************************************************** |
| 1015 | * BITBLT_GetDstArea |
| 1016 | * |
| 1017 | * Retrieve an area from the destination DC, mapping all the |
| 1018 | * pixels to Windows colors. |
| 1019 | */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1020 | static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT *visRectDst) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1021 | { |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 1022 | int exposures = 0; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1023 | INT width = visRectDst->right - visRectDst->left; |
| 1024 | INT height = visRectDst->bottom - visRectDst->top; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1025 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1026 | if (!X11DRV_PALETTE_XPixelToPalette || (physDev->dc->bitsPerPixel == 1) || |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 1027 | (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) ) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1028 | { |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1029 | XCopyArea( gdi_display, physDev->drawable, pixmap, gc, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1030 | visRectDst->left, visRectDst->top, width, height, 0, 0 ); |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 1031 | exposures++; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1032 | } |
| 1033 | else |
| 1034 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1035 | register INT x, y; |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1036 | XImage *image; |
| 1037 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1038 | if (physDev->dc->flags & DC_MEMORY) |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1039 | image = XGetImage( gdi_display, physDev->drawable, |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1040 | visRectDst->left, visRectDst->top, |
| 1041 | width, height, AllPlanes, ZPixmap ); |
| 1042 | else |
| 1043 | { |
| 1044 | /* Make sure we don't get a BadMatch error */ |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1045 | XCopyArea( gdi_display, physDev->drawable, pixmap, gc, |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1046 | visRectDst->left, visRectDst->top, width, height, 0, 0); |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 1047 | exposures++; |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1048 | image = XGetImage( gdi_display, pixmap, 0, 0, width, height, |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1049 | AllPlanes, ZPixmap ); |
| 1050 | } |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1051 | for (y = 0; y < height; y++) |
| 1052 | for (x = 0; x < width; x++) |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1053 | XPutPixel( image, x, y, |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 1054 | X11DRV_PALETTE_XPixelToPalette[XGetPixel( image, x, y )]); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1055 | XPutImage( gdi_display, pixmap, gc, image, 0, 0, 0, 0, width, height ); |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1056 | XDestroyImage( image ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1057 | } |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 1058 | return exposures; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1059 | } |
| 1060 | |
| 1061 | |
| 1062 | /*********************************************************************** |
| 1063 | * BITBLT_PutDstArea |
| 1064 | * |
| 1065 | * Put an area back into the destination DC, mapping the pixel |
| 1066 | * colors to X pixels. |
| 1067 | */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1068 | static int BITBLT_PutDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, RECT *visRectDst) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1069 | { |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 1070 | int exposures = 0; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1071 | INT width = visRectDst->right - visRectDst->left; |
| 1072 | INT height = visRectDst->bottom - visRectDst->top; |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1073 | |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 1074 | /* !X11DRV_PALETTE_PaletteToXPixel is _NOT_ enough */ |
Alexandre Julliard | ac9c9b0 | 1996-07-28 18:50:11 +0000 | [diff] [blame] | 1075 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1076 | if (!X11DRV_PALETTE_PaletteToXPixel || (physDev->dc->bitsPerPixel == 1) || |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 1077 | (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) ) |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1078 | { |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1079 | XCopyArea( gdi_display, pixmap, physDev->drawable, physDev->gc, 0, 0, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1080 | width, height, visRectDst->left, visRectDst->top ); |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 1081 | exposures++; |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1082 | } |
| 1083 | else |
| 1084 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1085 | register INT x, y; |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1086 | XImage *image = XGetImage( gdi_display, pixmap, 0, 0, width, height, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1087 | AllPlanes, ZPixmap ); |
| 1088 | for (y = 0; y < height; y++) |
| 1089 | for (x = 0; x < width; x++) |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1090 | { |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1091 | XPutPixel( image, x, y, |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 1092 | X11DRV_PALETTE_PaletteToXPixel[XGetPixel( image, x, y )]); |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1093 | } |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1094 | XPutImage( gdi_display, physDev->drawable, physDev->gc, image, 0, 0, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1095 | visRectDst->left, visRectDst->top, width, height ); |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1096 | XDestroyImage( image ); |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1097 | } |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 1098 | return exposures; |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1099 | } |
| 1100 | |
| 1101 | |
| 1102 | /*********************************************************************** |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1103 | * BITBLT_GetVisRectangles |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1104 | * |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1105 | * Get the source and destination visible rectangles for StretchBlt(). |
| 1106 | * Return FALSE if one of the rectangles is empty. |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1107 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1108 | static BOOL BITBLT_GetVisRectangles( DC *dcDst, INT xDst, INT yDst, |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1109 | INT widthDst, INT heightDst, |
| 1110 | DC *dcSrc, INT xSrc, INT ySrc, |
| 1111 | INT widthSrc, INT heightSrc, |
| 1112 | RECT *visRectSrc, RECT *visRectDst ) |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1113 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1114 | RECT rect, clipRect; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1115 | |
| 1116 | /* Get the destination visible rectangle */ |
| 1117 | |
Alexandre Julliard | 62f824f | 2000-03-18 22:12:33 +0000 | [diff] [blame] | 1118 | rect.left = xDst; |
| 1119 | rect.top = yDst; |
| 1120 | rect.right = xDst + widthDst; |
| 1121 | rect.bottom = yDst + heightDst; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1122 | if (widthDst < 0) SWAP_INT32( &rect.left, &rect.right ); |
| 1123 | if (heightDst < 0) SWAP_INT32( &rect.top, &rect.bottom ); |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1124 | GetRgnBox( dcDst->hGCClipRgn, &clipRect ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1125 | if (!IntersectRect( visRectDst, &rect, &clipRect )) return FALSE; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1126 | |
| 1127 | /* Get the source visible rectangle */ |
| 1128 | |
| 1129 | if (!dcSrc) return TRUE; |
Alexandre Julliard | 62f824f | 2000-03-18 22:12:33 +0000 | [diff] [blame] | 1130 | rect.left = xSrc; |
| 1131 | rect.top = ySrc; |
| 1132 | rect.right = xSrc + widthSrc; |
| 1133 | rect.bottom = ySrc + heightSrc; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1134 | if (widthSrc < 0) SWAP_INT32( &rect.left, &rect.right ); |
| 1135 | if (heightSrc < 0) SWAP_INT32( &rect.top, &rect.bottom ); |
Ulrich Weigand | 27bb362 | 1998-10-14 18:06:44 +0000 | [diff] [blame] | 1136 | /* Apparently the clipping and visible regions are only for output, |
| 1137 | so just check against totalExtent here to avoid BadMatch errors */ |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1138 | if (!IntersectRect( visRectSrc, &rect, &dcSrc->totalExtent )) |
Ulrich Weigand | 27bb362 | 1998-10-14 18:06:44 +0000 | [diff] [blame] | 1139 | return FALSE; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1140 | |
| 1141 | /* Intersect the rectangles */ |
| 1142 | |
| 1143 | if ((widthSrc == widthDst) && (heightSrc == heightDst)) /* no stretching */ |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1144 | { |
Alexandre Julliard | 62f824f | 2000-03-18 22:12:33 +0000 | [diff] [blame] | 1145 | visRectSrc->left += xDst - xSrc; |
| 1146 | visRectSrc->right += xDst - xSrc; |
| 1147 | visRectSrc->top += yDst - ySrc; |
| 1148 | visRectSrc->bottom += yDst - ySrc; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1149 | if (!IntersectRect( &rect, visRectSrc, visRectDst )) return FALSE; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1150 | *visRectSrc = *visRectDst = rect; |
Alexandre Julliard | 62f824f | 2000-03-18 22:12:33 +0000 | [diff] [blame] | 1151 | visRectSrc->left += xSrc - xDst; |
| 1152 | visRectSrc->right += xSrc - xDst; |
| 1153 | visRectSrc->top += ySrc - yDst; |
| 1154 | visRectSrc->bottom += ySrc - yDst; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1155 | } |
| 1156 | else /* stretching */ |
| 1157 | { |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1158 | /* Map source rectangle into destination coordinates */ |
| 1159 | rect.left = xDst + (visRectSrc->left - xSrc)*widthDst/widthSrc; |
| 1160 | rect.top = yDst + (visRectSrc->top - ySrc)*heightDst/heightSrc; |
| 1161 | rect.right = xDst + ((visRectSrc->right - xSrc)*widthDst)/widthSrc; |
| 1162 | rect.bottom = yDst + ((visRectSrc->bottom - ySrc)*heightDst)/heightSrc; |
| 1163 | if (rect.left > rect.right) SWAP_INT32( &rect.left, &rect.right ); |
| 1164 | if (rect.top > rect.bottom) SWAP_INT32( &rect.top, &rect.bottom ); |
Alexandre Julliard | 62f824f | 2000-03-18 22:12:33 +0000 | [diff] [blame] | 1165 | |
| 1166 | /* Avoid rounding errors */ |
| 1167 | rect.left--; |
| 1168 | rect.top--; |
| 1169 | rect.right++; |
| 1170 | rect.bottom++; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1171 | if (!IntersectRect( visRectDst, &rect, visRectDst )) return FALSE; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1172 | |
| 1173 | /* Map destination rectangle back to source coordinates */ |
| 1174 | rect = *visRectDst; |
| 1175 | rect.left = xSrc + (visRectDst->left - xDst)*widthSrc/widthDst; |
| 1176 | rect.top = ySrc + (visRectDst->top - yDst)*heightSrc/heightDst; |
| 1177 | rect.right = xSrc + ((visRectDst->right - xDst)*widthSrc)/widthDst; |
| 1178 | rect.bottom = ySrc + ((visRectDst->bottom - yDst)*heightSrc)/heightDst; |
| 1179 | if (rect.left > rect.right) SWAP_INT32( &rect.left, &rect.right ); |
| 1180 | if (rect.top > rect.bottom) SWAP_INT32( &rect.top, &rect.bottom ); |
Alexandre Julliard | 62f824f | 2000-03-18 22:12:33 +0000 | [diff] [blame] | 1181 | |
| 1182 | /* Avoid rounding errors */ |
| 1183 | rect.left--; |
| 1184 | rect.top--; |
| 1185 | rect.right++; |
| 1186 | rect.bottom++; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1187 | if (!IntersectRect( visRectSrc, &rect, visRectSrc )) return FALSE; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1188 | } |
| 1189 | return TRUE; |
| 1190 | } |
| 1191 | |
| 1192 | |
| 1193 | /*********************************************************************** |
| 1194 | * BITBLT_InternalStretchBlt |
| 1195 | * |
| 1196 | * Implementation of PatBlt(), BitBlt() and StretchBlt(). |
| 1197 | */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1198 | static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, |
| 1199 | INT widthDst, INT heightDst, |
| 1200 | X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, |
| 1201 | INT widthSrc, INT heightSrc, |
| 1202 | DWORD rop ) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1203 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1204 | BOOL usePat, useSrc, useDst, destUsed, fStretch, fNullBrush; |
| 1205 | RECT visRectDst, visRectSrc; |
| 1206 | INT width, height; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1207 | const BYTE *opcode; |
| 1208 | Pixmap pixmaps[3] = { 0, 0, 0 }; /* pixmaps for DST, SRC, TMP */ |
| 1209 | GC tmpGC = 0; |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1210 | DC *dcSrc = physDevSrc ? physDevSrc->dc : NULL; |
| 1211 | DC *dcDst = physDevDst->dc; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1212 | |
Randy Weems | 0bc73c7 | 1999-03-25 15:49:11 +0000 | [diff] [blame] | 1213 | /* compensate for off-by-one shifting for negative widths and heights */ |
| 1214 | if (widthDst < 0) |
| 1215 | ++xDst; |
| 1216 | if (heightDst < 0) |
| 1217 | ++yDst; |
| 1218 | if (widthSrc < 0) |
| 1219 | ++xSrc; |
| 1220 | if (heightSrc < 0) |
| 1221 | ++ySrc; |
| 1222 | |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1223 | usePat = (((rop >> 4) & 0x0f0000) != (rop & 0x0f0000)); |
| 1224 | useSrc = (((rop >> 2) & 0x330000) != (rop & 0x330000)); |
| 1225 | useDst = (((rop >> 1) & 0x550000) != (rop & 0x550000)); |
| 1226 | if (!dcSrc && useSrc) return FALSE; |
| 1227 | |
| 1228 | /* Map the coordinates to device coords */ |
| 1229 | |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1230 | xDst = dcDst->DCOrgX + XLPTODP( dcDst, xDst ); |
| 1231 | yDst = dcDst->DCOrgY + YLPTODP( dcDst, yDst ); |
Pascal Lessard | dff30ac | 1999-08-15 14:18:59 +0000 | [diff] [blame] | 1232 | |
| 1233 | /* Here we have to round to integers, not truncate */ |
| 1234 | widthDst = MulDiv(widthDst, dcDst->vportExtX, dcDst->wndExtX); |
| 1235 | heightDst = MulDiv(heightDst, dcDst->vportExtY, dcDst->wndExtY); |
Alexandre Julliard | ded3038 | 1995-07-06 17:18:27 +0000 | [diff] [blame] | 1236 | |
Alexandre Julliard | 61fece0 | 1999-06-26 19:09:08 +0000 | [diff] [blame] | 1237 | TRACE(" vportdst=%d,%d-%d,%d wnddst=%d,%d-%d,%d\n", |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1238 | dcDst->vportOrgX, dcDst->vportOrgY, |
| 1239 | dcDst->vportExtX, dcDst->vportExtY, |
| 1240 | dcDst->wndOrgX, dcDst->wndOrgY, |
| 1241 | dcDst->wndExtX, dcDst->wndExtY ); |
Alexandre Julliard | 61fece0 | 1999-06-26 19:09:08 +0000 | [diff] [blame] | 1242 | TRACE(" rectdst=%d,%d-%d,%d orgdst=%d,%d\n", |
Alexandre Julliard | ded3038 | 1995-07-06 17:18:27 +0000 | [diff] [blame] | 1243 | xDst, yDst, widthDst, heightDst, |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1244 | dcDst->DCOrgX, dcDst->DCOrgY ); |
Alexandre Julliard | ded3038 | 1995-07-06 17:18:27 +0000 | [diff] [blame] | 1245 | |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1246 | if (useSrc) |
| 1247 | { |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1248 | xSrc = dcSrc->DCOrgX + XLPTODP( dcSrc, xSrc ); |
| 1249 | ySrc = dcSrc->DCOrgY + YLPTODP( dcSrc, ySrc ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1250 | widthSrc = widthSrc * dcSrc->vportExtX / dcSrc->wndExtX; |
| 1251 | heightSrc = heightSrc * dcSrc->vportExtY / dcSrc->wndExtY; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1252 | fStretch = (widthSrc != widthDst) || (heightSrc != heightDst); |
Alexandre Julliard | 61fece0 | 1999-06-26 19:09:08 +0000 | [diff] [blame] | 1253 | TRACE(" vportsrc=%d,%d-%d,%d wndsrc=%d,%d-%d,%d\n", |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1254 | dcSrc->vportOrgX, dcSrc->vportOrgY, |
| 1255 | dcSrc->vportExtX, dcSrc->vportExtY, |
| 1256 | dcSrc->wndOrgX, dcSrc->wndOrgY, |
| 1257 | dcSrc->wndExtX, dcSrc->wndExtY ); |
Alexandre Julliard | 61fece0 | 1999-06-26 19:09:08 +0000 | [diff] [blame] | 1258 | TRACE(" rectsrc=%d,%d-%d,%d orgsrc=%d,%d\n", |
Alexandre Julliard | ded3038 | 1995-07-06 17:18:27 +0000 | [diff] [blame] | 1259 | xSrc, ySrc, widthSrc, heightSrc, |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1260 | dcSrc->DCOrgX, dcSrc->DCOrgY ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1261 | if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, widthDst, heightDst, |
| 1262 | dcSrc, xSrc, ySrc, widthSrc, heightSrc, |
| 1263 | &visRectSrc, &visRectDst )) |
| 1264 | return TRUE; |
Alexandre Julliard | 61fece0 | 1999-06-26 19:09:08 +0000 | [diff] [blame] | 1265 | TRACE(" vissrc=%d,%d-%d,%d visdst=%d,%d-%d,%d\n", |
Alexandre Julliard | 59730ae | 1996-03-24 16:20:51 +0000 | [diff] [blame] | 1266 | visRectSrc.left, visRectSrc.top, |
| 1267 | visRectSrc.right, visRectSrc.bottom, |
| 1268 | visRectDst.left, visRectDst.top, |
| 1269 | visRectDst.right, visRectDst.bottom ); |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1270 | } |
| 1271 | else |
| 1272 | { |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1273 | fStretch = FALSE; |
| 1274 | if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, widthDst, heightDst, |
| 1275 | NULL, 0, 0, 0, 0, NULL, &visRectDst )) |
| 1276 | return TRUE; |
Alexandre Julliard | 61fece0 | 1999-06-26 19:09:08 +0000 | [diff] [blame] | 1277 | TRACE(" vissrc=none visdst=%d,%d-%d,%d\n", |
Alexandre Julliard | 59730ae | 1996-03-24 16:20:51 +0000 | [diff] [blame] | 1278 | visRectDst.left, visRectDst.top, |
| 1279 | visRectDst.right, visRectDst.bottom ); |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1280 | } |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1281 | |
| 1282 | width = visRectDst.right - visRectDst.left; |
| 1283 | height = visRectDst.bottom - visRectDst.top; |
| 1284 | |
| 1285 | if (!fStretch) switch(rop) /* A few optimisations */ |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1286 | { |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1287 | case BLACKNESS: /* 0x00 */ |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1288 | wine_tsx11_lock(); |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1289 | if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel) |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1290 | XSetFunction( gdi_display, physDevDst->gc, GXclear ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1291 | else |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1292 | { |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1293 | XSetFunction( gdi_display, physDevDst->gc, GXcopy ); |
| 1294 | XSetForeground( gdi_display, physDevDst->gc, X11DRV_PALETTE_PaletteToXPixel[0] ); |
| 1295 | XSetFillStyle( gdi_display, physDevDst->gc, FillSolid ); |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1296 | } |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1297 | XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1298 | visRectDst.left, visRectDst.top, width, height ); |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1299 | wine_tsx11_unlock(); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1300 | return TRUE; |
| 1301 | |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 1302 | case DSTINVERT: /* 0x55 */ |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1303 | if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel || |
Alexandre Julliard | fe08568 | 2000-03-18 21:56:10 +0000 | [diff] [blame] | 1304 | !perfect_graphics()) |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 1305 | { |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1306 | wine_tsx11_lock(); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1307 | XSetFunction( gdi_display, physDevDst->gc, GXinvert ); |
Alexandre Julliard | ac9c9b0 | 1996-07-28 18:50:11 +0000 | [diff] [blame] | 1308 | |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 1309 | if( X11DRV_PALETTE_PaletteFlags & (X11DRV_PALETTE_PRIVATE | X11DRV_PALETTE_VIRTUAL) ) |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1310 | XSetFunction( gdi_display, physDevDst->gc, GXinvert); |
Alexandre Julliard | ac9c9b0 | 1996-07-28 18:50:11 +0000 | [diff] [blame] | 1311 | else |
| 1312 | { |
| 1313 | /* Xor is much better when we do not have full colormap. */ |
| 1314 | /* Using white^black ensures that we invert at least black */ |
| 1315 | /* and white. */ |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1316 | Pixel xor_pix = (WhitePixel( gdi_display, DefaultScreen(gdi_display) ) ^ |
| 1317 | BlackPixel( gdi_display, DefaultScreen(gdi_display) )); |
| 1318 | XSetFunction( gdi_display, physDevDst->gc, GXxor ); |
| 1319 | XSetForeground( gdi_display, physDevDst->gc, xor_pix); |
| 1320 | XSetFillStyle( gdi_display, physDevDst->gc, FillSolid ); |
Alexandre Julliard | ac9c9b0 | 1996-07-28 18:50:11 +0000 | [diff] [blame] | 1321 | } |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1322 | XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 1323 | visRectDst.left, visRectDst.top, width, height ); |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1324 | wine_tsx11_unlock(); |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 1325 | return TRUE; |
| 1326 | } |
| 1327 | break; |
| 1328 | |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1329 | case PATINVERT: /* 0x5a */ |
Alexandre Julliard | fe08568 | 2000-03-18 21:56:10 +0000 | [diff] [blame] | 1330 | if (perfect_graphics()) break; |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1331 | if (X11DRV_SetupGCForBrush( physDevDst )) |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1332 | { |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1333 | wine_tsx11_lock(); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1334 | XSetFunction( gdi_display, physDevDst->gc, GXxor ); |
| 1335 | XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1336 | visRectDst.left, visRectDst.top, width, height ); |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1337 | wine_tsx11_unlock(); |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1338 | } |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1339 | return TRUE; |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 1340 | |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1341 | case 0xa50065: |
Alexandre Julliard | fe08568 | 2000-03-18 21:56:10 +0000 | [diff] [blame] | 1342 | if (perfect_graphics()) break; |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1343 | if (X11DRV_SetupGCForBrush( physDevDst )) |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1344 | { |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1345 | wine_tsx11_lock(); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1346 | XSetFunction( gdi_display, physDevDst->gc, GXequiv ); |
| 1347 | XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1348 | visRectDst.left, visRectDst.top, width, height ); |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1349 | wine_tsx11_unlock(); |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1350 | } |
| 1351 | return TRUE; |
| 1352 | |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1353 | case SRCCOPY: /* 0xcc */ |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1354 | if (dcSrc->bitsPerPixel == dcDst->bitsPerPixel) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1355 | { |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1356 | wine_tsx11_lock(); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1357 | XSetFunction( gdi_display, physDevDst->gc, GXcopy ); |
| 1358 | XCopyArea( gdi_display, physDevSrc->drawable, |
Huw D M Davies | 9c68faa | 1998-11-25 12:36:03 +0000 | [diff] [blame] | 1359 | physDevDst->drawable, physDevDst->gc, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1360 | visRectSrc.left, visRectSrc.top, |
| 1361 | width, height, visRectDst.left, visRectDst.top ); |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 1362 | physDevDst->exposures++; |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1363 | wine_tsx11_unlock(); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1364 | return TRUE; |
| 1365 | } |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1366 | if (dcSrc->bitsPerPixel == 1) |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1367 | { |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1368 | wine_tsx11_lock(); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1369 | XSetBackground( gdi_display, physDevDst->gc, physDevDst->textPixel ); |
| 1370 | XSetForeground( gdi_display, physDevDst->gc, physDevDst->backgroundPixel ); |
| 1371 | XSetFunction( gdi_display, physDevDst->gc, GXcopy ); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1372 | XCopyPlane( gdi_display, physDevSrc->drawable, |
Huw D M Davies | 9c68faa | 1998-11-25 12:36:03 +0000 | [diff] [blame] | 1373 | physDevDst->drawable, physDevDst->gc, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1374 | visRectSrc.left, visRectSrc.top, |
| 1375 | width, height, visRectDst.left, visRectDst.top, 1 ); |
Alexandre Julliard | 6d027e1 | 2001-06-11 20:24:57 +0000 | [diff] [blame] | 1376 | physDevDst->exposures++; |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1377 | wine_tsx11_unlock(); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1378 | return TRUE; |
| 1379 | } |
| 1380 | break; |
| 1381 | |
| 1382 | case PATCOPY: /* 0xf0 */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1383 | if (!X11DRV_SetupGCForBrush( physDevDst )) return TRUE; |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1384 | wine_tsx11_lock(); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1385 | XSetFunction( gdi_display, physDevDst->gc, GXcopy ); |
| 1386 | XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1387 | visRectDst.left, visRectDst.top, width, height ); |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1388 | wine_tsx11_unlock(); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1389 | return TRUE; |
| 1390 | |
| 1391 | case WHITENESS: /* 0xff */ |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1392 | wine_tsx11_lock(); |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1393 | if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel) |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1394 | XSetFunction( gdi_display, physDevDst->gc, GXset ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1395 | else |
| 1396 | { |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1397 | XSetFunction( gdi_display, physDevDst->gc, GXcopy ); |
| 1398 | XSetForeground( gdi_display, physDevDst->gc, |
| 1399 | WhitePixel( gdi_display, DefaultScreen(gdi_display) )); |
| 1400 | XSetFillStyle( gdi_display, physDevDst->gc, FillSolid ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1401 | } |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1402 | XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1403 | visRectDst.left, visRectDst.top, width, height ); |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1404 | wine_tsx11_unlock(); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1405 | return TRUE; |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1406 | } |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1407 | |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1408 | wine_tsx11_lock(); |
| 1409 | |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1410 | tmpGC = XCreateGC( gdi_display, physDevDst->drawable, 0, NULL ); |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1411 | XSetSubwindowMode( gdi_display, tmpGC, IncludeInferiors ); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1412 | XSetGraphicsExposures( gdi_display, tmpGC, False ); |
| 1413 | pixmaps[DST] = XCreatePixmap( gdi_display, root_window, width, height, |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1414 | dcDst->bitsPerPixel ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1415 | if (useSrc) |
| 1416 | { |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1417 | pixmaps[SRC] = XCreatePixmap( gdi_display, root_window, width, height, |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1418 | dcDst->bitsPerPixel ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1419 | if (fStretch) |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1420 | BITBLT_GetSrcAreaStretch( physDevSrc, physDevDst, pixmaps[SRC], tmpGC, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1421 | xSrc, ySrc, widthSrc, heightSrc, |
| 1422 | xDst, yDst, widthDst, heightDst, |
| 1423 | &visRectSrc, &visRectDst ); |
| 1424 | else |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1425 | BITBLT_GetSrcArea( physDevSrc, physDevDst, pixmaps[SRC], tmpGC, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1426 | xSrc, ySrc, &visRectSrc ); |
| 1427 | } |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1428 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1429 | if (useDst) BITBLT_GetDstArea( physDevDst, pixmaps[DST], tmpGC, &visRectDst ); |
| 1430 | if (usePat) fNullBrush = !X11DRV_SetupGCForPatBlt( physDevDst, tmpGC, TRUE ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1431 | else fNullBrush = FALSE; |
| 1432 | destUsed = FALSE; |
| 1433 | |
| 1434 | for (opcode = BITBLT_Opcodes[(rop >> 16) & 0xff]; *opcode; opcode++) |
| 1435 | { |
| 1436 | if (OP_DST(*opcode) == DST) destUsed = TRUE; |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1437 | XSetFunction( gdi_display, tmpGC, OP_ROP(*opcode) ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1438 | switch(OP_SRCDST(*opcode)) |
| 1439 | { |
| 1440 | case OP_ARGS(DST,TMP): |
| 1441 | case OP_ARGS(SRC,TMP): |
| 1442 | if (!pixmaps[TMP]) |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1443 | pixmaps[TMP] = XCreatePixmap( gdi_display, root_window, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1444 | width, height, |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1445 | dcDst->bitsPerPixel ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1446 | /* fall through */ |
| 1447 | case OP_ARGS(DST,SRC): |
| 1448 | case OP_ARGS(SRC,DST): |
| 1449 | case OP_ARGS(TMP,SRC): |
| 1450 | case OP_ARGS(TMP,DST): |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1451 | XCopyArea( gdi_display, pixmaps[OP_SRC(*opcode)], |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1452 | pixmaps[OP_DST(*opcode)], tmpGC, |
| 1453 | 0, 0, width, height, 0, 0 ); |
| 1454 | break; |
| 1455 | |
| 1456 | case OP_ARGS(PAT,TMP): |
| 1457 | if (!pixmaps[TMP] && !fNullBrush) |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1458 | pixmaps[TMP] = XCreatePixmap( gdi_display, root_window, |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1459 | width, height, |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 1460 | dcDst->bitsPerPixel ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1461 | /* fall through */ |
| 1462 | case OP_ARGS(PAT,DST): |
| 1463 | case OP_ARGS(PAT,SRC): |
| 1464 | if (!fNullBrush) |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1465 | XFillRectangle( gdi_display, pixmaps[OP_DST(*opcode)], |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 1466 | tmpGC, 0, 0, width, height ); |
| 1467 | break; |
| 1468 | } |
| 1469 | } |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1470 | XSetFunction( gdi_display, physDevDst->gc, GXcopy ); |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1471 | physDevDst->exposures += BITBLT_PutDstArea( physDevDst, pixmaps[destUsed ? DST : SRC], |
| 1472 | &visRectDst ); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 1473 | XFreePixmap( gdi_display, pixmaps[DST] ); |
| 1474 | if (pixmaps[SRC]) XFreePixmap( gdi_display, pixmaps[SRC] ); |
| 1475 | if (pixmaps[TMP]) XFreePixmap( gdi_display, pixmaps[TMP] ); |
| 1476 | XFreeGC( gdi_display, tmpGC ); |
Alexandre Julliard | 704d035 | 2001-07-12 02:49:31 +0000 | [diff] [blame] | 1477 | wine_tsx11_unlock(); |
Alexandre Julliard | 3a5816f | 1994-12-27 14:11:53 +0000 | [diff] [blame] | 1478 | return TRUE; |
| 1479 | } |
| 1480 | |
| 1481 | |
| 1482 | /*********************************************************************** |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1483 | * X11DRV_PatBlt |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1484 | */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1485 | BOOL X11DRV_PatBlt( X11DRV_PDEVICE *physDev, INT left, INT top, INT width, INT height, DWORD rop ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1486 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1487 | BOOL result; |
Patrik Stridvall | 0f8bc5b | 1999-04-22 16:27:50 +0000 | [diff] [blame] | 1488 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1489 | X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod, FALSE ); |
| 1490 | result = BITBLT_InternalStretchBlt( physDev, left, top, width, height, NULL, 0, 0, 0, 0, rop ); |
| 1491 | X11DRV_UnlockDIBSection( physDev, TRUE ); |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1492 | return result; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1493 | } |
| 1494 | |
| 1495 | |
| 1496 | /*********************************************************************** |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1497 | * X11DRV_BitBlt |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1498 | */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1499 | BOOL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, |
| 1500 | INT width, INT height, X11DRV_PDEVICE *physDevSrc, |
| 1501 | INT xSrc, INT ySrc, DWORD rop ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1502 | { |
Alexandre Julliard | 447ddfd | 2000-12-06 20:15:43 +0000 | [diff] [blame] | 1503 | BOOL result = FALSE; |
| 1504 | INT sSrc, sDst; |
Alexandre Julliard | 3f75eaa | 2000-12-22 01:07:57 +0000 | [diff] [blame] | 1505 | RECT visRectDst, visRectSrc; |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1506 | DC *dcSrc = physDevSrc->dc; |
| 1507 | DC *dcDst = physDevDst->dc; |
Alexandre Julliard | 447ddfd | 2000-12-06 20:15:43 +0000 | [diff] [blame] | 1508 | |
| 1509 | if (((rop >> 16) & 0x55) == ((rop >> 17) & 0x55)) { |
| 1510 | /* FIXME: seems the ROP doesn't include destination; |
| 1511 | * now if the destination area include the entire dcDst, |
| 1512 | * we can pass TRUE instead of FALSE to CoerceDIBSection(dcDst...), |
| 1513 | * which may avoid a copy in some situations */ |
| 1514 | } |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1515 | sDst = X11DRV_LockDIBSection( physDevDst, DIB_Status_None, FALSE ); |
| 1516 | sSrc = X11DRV_LockDIBSection( physDevSrc, DIB_Status_None, FALSE ); |
Alexandre Julliard | 3f75eaa | 2000-12-22 01:07:57 +0000 | [diff] [blame] | 1517 | |
Alexandre Julliard | 3c76b14 | 2001-10-03 18:45:41 +0000 | [diff] [blame] | 1518 | if ((sSrc == DIB_Status_AppMod) && (rop == SRCCOPY) && |
| 1519 | (dcSrc->bitsPerPixel == dcDst->bitsPerPixel)) |
| 1520 | { |
Alexandre Julliard | 3f75eaa | 2000-12-22 01:07:57 +0000 | [diff] [blame] | 1521 | /* do everything ourselves; map coordinates */ |
| 1522 | xSrc = dcSrc->DCOrgX + XLPTODP( dcSrc, xSrc ); |
| 1523 | ySrc = dcSrc->DCOrgY + YLPTODP( dcSrc, ySrc ); |
| 1524 | xDst = dcDst->DCOrgX + XLPTODP( dcDst, xDst ); |
| 1525 | yDst = dcDst->DCOrgY + YLPTODP( dcDst, yDst ); |
| 1526 | width = MulDiv(width, dcDst->vportExtX, dcDst->wndExtX); |
| 1527 | height = MulDiv(height, dcDst->vportExtY, dcDst->wndExtY); |
| 1528 | |
| 1529 | /* Perform basic clipping */ |
| 1530 | if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, width, height, |
| 1531 | dcSrc, xSrc, ySrc, width, height, |
| 1532 | &visRectSrc, &visRectDst )) |
| 1533 | goto END; |
Alexandre Julliard | 8efd454 | 2001-01-15 22:30:50 +0000 | [diff] [blame] | 1534 | |
Alexandre Julliard | 3f75eaa | 2000-12-22 01:07:57 +0000 | [diff] [blame] | 1535 | xSrc = visRectSrc.left; |
| 1536 | ySrc = visRectSrc.top; |
| 1537 | xDst = visRectDst.left; |
| 1538 | yDst = visRectDst.top; |
| 1539 | width = visRectDst.right - visRectDst.left; |
| 1540 | height = visRectDst.bottom - visRectDst.top; |
| 1541 | |
Alexandre Julliard | 447ddfd | 2000-12-06 20:15:43 +0000 | [diff] [blame] | 1542 | if (sDst == DIB_Status_AppMod) { |
| 1543 | FIXME("potential optimization - client-side DIB copy\n"); |
| 1544 | } |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1545 | X11DRV_CoerceDIBSection( physDevDst, DIB_Status_GdiMod, FALSE ); |
Alexandre Julliard | 447ddfd | 2000-12-06 20:15:43 +0000 | [diff] [blame] | 1546 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1547 | X11DRV_DIB_CopyDIBSection( physDevSrc, physDevDst, xSrc, ySrc, xDst, yDst, width, height ); |
Andreas Mohr | 7f6c84b | 2001-01-04 19:28:33 +0000 | [diff] [blame] | 1548 | result = TRUE; |
Alexandre Julliard | 3f75eaa | 2000-12-22 01:07:57 +0000 | [diff] [blame] | 1549 | goto END; |
Alexandre Julliard | 447ddfd | 2000-12-06 20:15:43 +0000 | [diff] [blame] | 1550 | } |
Patrik Stridvall | 0f8bc5b | 1999-04-22 16:27:50 +0000 | [diff] [blame] | 1551 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1552 | X11DRV_CoerceDIBSection( physDevDst, DIB_Status_GdiMod, FALSE ); |
| 1553 | X11DRV_CoerceDIBSection( physDevSrc, DIB_Status_GdiMod, FALSE ); |
James Abbatiello | b96c6e2 | 2000-02-13 16:08:19 +0000 | [diff] [blame] | 1554 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1555 | result = BITBLT_InternalStretchBlt( physDevDst, xDst, yDst, width, height, |
| 1556 | physDevSrc, xSrc, ySrc, width, height, rop ); |
Alexandre Julliard | 447ddfd | 2000-12-06 20:15:43 +0000 | [diff] [blame] | 1557 | |
| 1558 | END: |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1559 | X11DRV_UnlockDIBSection( physDevSrc, FALSE ); |
| 1560 | X11DRV_UnlockDIBSection( physDevDst, TRUE ); |
Alexandre Julliard | 447ddfd | 2000-12-06 20:15:43 +0000 | [diff] [blame] | 1561 | |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1562 | return result; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1563 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1564 | |
| 1565 | |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1566 | /*********************************************************************** |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1567 | * X11DRV_StretchBlt |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1568 | */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1569 | BOOL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, |
| 1570 | INT widthDst, INT heightDst, |
| 1571 | X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, |
| 1572 | INT widthSrc, INT heightSrc, DWORD rop ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1573 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1574 | BOOL result; |
Patrik Stridvall | 0f8bc5b | 1999-04-22 16:27:50 +0000 | [diff] [blame] | 1575 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1576 | X11DRV_LockDIBSection( physDevDst, DIB_Status_GdiMod, FALSE ); |
| 1577 | X11DRV_LockDIBSection( physDevSrc, DIB_Status_GdiMod, FALSE ); |
James Abbatiello | b96c6e2 | 2000-02-13 16:08:19 +0000 | [diff] [blame] | 1578 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1579 | result = BITBLT_InternalStretchBlt( physDevDst, xDst, yDst, widthDst, heightDst, |
| 1580 | physDevSrc, xSrc, ySrc, widthSrc, heightSrc, rop ); |
Alexandre Julliard | 447ddfd | 2000-12-06 20:15:43 +0000 | [diff] [blame] | 1581 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame^] | 1582 | X11DRV_UnlockDIBSection( physDevSrc, FALSE ); |
| 1583 | X11DRV_UnlockDIBSection( physDevDst, TRUE ); |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1584 | return result; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1585 | } |
Patrik Stridvall | ab121e7 | 1999-02-04 11:11:01 +0000 | [diff] [blame] | 1586 | |