2 * QEMU Cirrus CLGD 54xx VGA Emulator.
4 * Copyright (c) 2004 Fabrice Bellard
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 static inline void glue(rop_8_
,ROP_NAME
)(uint8_t *dst
, uint8_t src
)
27 *dst
= ROP_FN(*dst
, src
);
30 static inline void glue(rop_16_
,ROP_NAME
)(uint16_t *dst
, uint16_t src
)
32 *dst
= ROP_FN(*dst
, src
);
35 static inline void glue(rop_32_
,ROP_NAME
)(uint32_t *dst
, uint32_t src
)
37 *dst
= ROP_FN(*dst
, src
);
40 #define ROP_OP(d, s) glue(rop_8_,ROP_NAME)(d, s)
41 #define ROP_OP_16(d, s) glue(rop_16_,ROP_NAME)(d, s)
42 #define ROP_OP_32(d, s) glue(rop_32_,ROP_NAME)(d, s)
46 glue(cirrus_bitblt_rop_fwd_
, ROP_NAME
)(CirrusVGAState
*s
,
47 uint8_t *dst
,const uint8_t *src
,
48 int dstpitch
,int srcpitch
,
49 int bltwidth
,int bltheight
)
55 if (bltheight
> 1 && (dstpitch
< 0 || srcpitch
< 0)) {
59 for (y
= 0; y
< bltheight
; y
++) {
60 for (x
= 0; x
< bltwidth
; x
++) {
71 glue(cirrus_bitblt_rop_bkwd_
, ROP_NAME
)(CirrusVGAState
*s
,
72 uint8_t *dst
,const uint8_t *src
,
73 int dstpitch
,int srcpitch
,
74 int bltwidth
,int bltheight
)
79 for (y
= 0; y
< bltheight
; y
++) {
80 for (x
= 0; x
< bltwidth
; x
++) {
91 glue(glue(cirrus_bitblt_rop_fwd_transp_
, ROP_NAME
),_8
)(CirrusVGAState
*s
,
92 uint8_t *dst
,const uint8_t *src
,
93 int dstpitch
,int srcpitch
,
94 int bltwidth
,int bltheight
)
100 for (y
= 0; y
< bltheight
; y
++) {
101 for (x
= 0; x
< bltwidth
; x
++) {
104 if (p
!= s
->vga
.gr
[0x34]) *dst
= p
;
114 glue(glue(cirrus_bitblt_rop_bkwd_transp_
, ROP_NAME
),_8
)(CirrusVGAState
*s
,
115 uint8_t *dst
,const uint8_t *src
,
116 int dstpitch
,int srcpitch
,
117 int bltwidth
,int bltheight
)
121 dstpitch
+= bltwidth
;
122 srcpitch
+= bltwidth
;
123 for (y
= 0; y
< bltheight
; y
++) {
124 for (x
= 0; x
< bltwidth
; x
++) {
127 if (p
!= s
->vga
.gr
[0x34]) *dst
= p
;
137 glue(glue(cirrus_bitblt_rop_fwd_transp_
, ROP_NAME
),_16
)(CirrusVGAState
*s
,
138 uint8_t *dst
,const uint8_t *src
,
139 int dstpitch
,int srcpitch
,
140 int bltwidth
,int bltheight
)
144 dstpitch
-= bltwidth
;
145 srcpitch
-= bltwidth
;
146 for (y
= 0; y
< bltheight
; y
++) {
147 for (x
= 0; x
< bltwidth
; x
+=2) {
151 ROP_OP(&p2
, *(src
+ 1));
152 if ((p1
!= s
->vga
.gr
[0x34]) || (p2
!= s
->vga
.gr
[0x35])) {
165 glue(glue(cirrus_bitblt_rop_bkwd_transp_
, ROP_NAME
),_16
)(CirrusVGAState
*s
,
166 uint8_t *dst
,const uint8_t *src
,
167 int dstpitch
,int srcpitch
,
168 int bltwidth
,int bltheight
)
172 dstpitch
+= bltwidth
;
173 srcpitch
+= bltwidth
;
174 for (y
= 0; y
< bltheight
; y
++) {
175 for (x
= 0; x
< bltwidth
; x
+=2) {
178 ROP_OP(&p1
, *(src
- 1));
180 if ((p1
!= s
->vga
.gr
[0x34]) || (p2
!= s
->vga
.gr
[0x35])) {
193 #include "cirrus_vga_rop2.h"
196 #include "cirrus_vga_rop2.h"
199 #include "cirrus_vga_rop2.h"
202 #include "cirrus_vga_rop2.h"