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 #define PUTPIXEL() ROP_OP(d[0], col)
28 #define PUTPIXEL() ROP_OP(((uint16_t *)d)[0], col);
30 #define PUTPIXEL() ROP_OP(d[0], col); \
31 ROP_OP(d[1], (col >> 8)); \
32 ROP_OP(d[2], (col >> 16))
34 #define PUTPIXEL() ROP_OP(((uint32_t *)d)[0], col)
36 #error unsupported DEPTH
39 /* NOTE: srcpitch is ignored */
41 glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
42 (CirrusVGAState * s, uint8_t * dst,
44 int dstpitch, int srcpitch,
45 int bltwidth, int bltheight)
55 col = s->cirrus_blt_fgcol;
56 for(y = 0; y < bltheight; y++) {
57 bitmask = 0x80 >> srcskipleft;
60 for (x = 0; x < bltwidth; x += (DEPTH / 8)) {
61 if ((bitmask & 0xff) == 0) {
65 index = (bits & bitmask);
76 /* NOTE: srcpitch is ignored */
78 glue(glue(glue(cirrus_colorexpand_transp_inv_, ROP_NAME), _),DEPTH)
79 (CirrusVGAState * s, uint8_t * dst,
81 int dstpitch, int srcpitch,
82 int bltwidth, int bltheight)
92 col = s->cirrus_blt_bgcol;
93 for(y = 0; y < bltheight; y++) {
94 bitmask = 0x80 >> srcskipleft;
97 for (x = 0; x < bltwidth; x += (DEPTH / 8)) {
98 if ((bitmask & 0xff) == 0) {
102 index = (bits & bitmask);
114 glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH)
115 (CirrusVGAState * s, uint8_t * dst,
117 int dstpitch, int srcpitch,
118 int bltwidth, int bltheight)
128 colors[0] = s->cirrus_blt_bgcol;
129 colors[1] = s->cirrus_blt_fgcol;
130 for(y = 0; y < bltheight; y++) {
131 bitmask = 0x80 >> srcskipleft;
134 for (x = 0; x < bltwidth; x += (DEPTH / 8)) {
135 if ((bitmask & 0xff) == 0) {
139 col = colors[!!(bits & bitmask)];
149 glue(glue(glue(cirrus_fill_, ROP_NAME), _),DEPTH)
151 uint8_t *dst, int dst_pitch,
152 int width, int height)
158 col = s->cirrus_blt_fgcol;
161 for(y = 0; y < height; y++) {
163 for(x = 0; x < width; x += (DEPTH / 8)) {