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
26 glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(CirrusVGAState *s,
27 uint8_t *dst,const uint8_t *src,
28 int dstpitch,int srcpitch,
29 int bltwidth,int bltheight)
35 if (dstpitch < 0 || srcpitch < 0) {
36 /* is 0 valid? srcpitch == 0 could be useful */
40 for (y = 0; y < bltheight; y++) {
41 for (x = 0; x < bltwidth; x++) {
52 glue(cirrus_bitblt_rop_bkwd_, ROP_NAME)(CirrusVGAState *s,
53 uint8_t *dst,const uint8_t *src,
54 int dstpitch,int srcpitch,
55 int bltwidth,int bltheight)
60 for (y = 0; y < bltheight; y++) {
61 for (x = 0; x < bltwidth; x++) {
72 glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_8)(CirrusVGAState *s,
73 uint8_t *dst,const uint8_t *src,
74 int dstpitch,int srcpitch,
75 int bltwidth,int bltheight)
81 for (y = 0; y < bltheight; y++) {
82 for (x = 0; x < bltwidth; x++) {
85 if (p != s->vga.gr[0x34]) *dst = p;
95 glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_8)(CirrusVGAState *s,
96 uint8_t *dst,const uint8_t *src,
97 int dstpitch,int srcpitch,
98 int bltwidth,int bltheight)
102 dstpitch += bltwidth;
103 srcpitch += bltwidth;
104 for (y = 0; y < bltheight; y++) {
105 for (x = 0; x < bltwidth; x++) {
108 if (p != s->vga.gr[0x34]) *dst = p;
118 glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_16)(CirrusVGAState *s,
119 uint8_t *dst,const uint8_t *src,
120 int dstpitch,int srcpitch,
121 int bltwidth,int bltheight)
125 dstpitch -= bltwidth;
126 srcpitch -= bltwidth;
127 for (y = 0; y < bltheight; y++) {
128 for (x = 0; x < bltwidth; x+=2) {
132 ROP_OP(p2, *(src+1));
133 if ((p1 != s->vga.gr[0x34]) || (p2 != s->vga.gr[0x35])) {
146 glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_16)(CirrusVGAState *s,
147 uint8_t *dst,const uint8_t *src,
148 int dstpitch,int srcpitch,
149 int bltwidth,int bltheight)
153 dstpitch += bltwidth;
154 srcpitch += bltwidth;
155 for (y = 0; y < bltheight; y++) {
156 for (x = 0; x < bltwidth; x+=2) {
159 ROP_OP(p1, *(src-1));
161 if ((p1 != s->vga.gr[0x34]) || (p2 != s->vga.gr[0x35])) {
174 #include "cirrus_vga_rop2.h"
177 #include "cirrus_vga_rop2.h"
180 #include "cirrus_vga_rop2.h"
183 #include "cirrus_vga_rop2.h"