Revision 4c8732d7
b/hw/cirrus_vga.c | ||
---|---|---|
136 | 136 |
|
137 | 137 |
// control 0x33 |
138 | 138 |
#define CIRRUS_BLTMODEEXT_SOLIDFILL 0x04 |
139 |
#define CIRRUS_BLTMODEEXT_COLOREXPINV 0x02 |
|
139 | 140 |
#define CIRRUS_BLTMODEEXT_DWORDGRANULARITY 0x01 |
140 | 141 |
|
141 | 142 |
// memory-mapped IO |
... | ... | |
325 | 326 |
#include "cirrus_vga_rop.h" |
326 | 327 |
|
327 | 328 |
#define ROP_NAME 1 |
328 |
#define ROP_OP(d, s) d = 0xff
|
|
329 |
#define ROP_OP(d, s) d = ~0
|
|
329 | 330 |
#include "cirrus_vga_rop.h" |
330 | 331 |
|
331 | 332 |
#define ROP_NAME notsrc_and_dst |
... | ... | |
435 | 436 |
ROP2(cirrus_colorexpand_transp_notsrc_and_notdst), |
436 | 437 |
}; |
437 | 438 |
|
439 |
static const cirrus_bitblt_rop_t cirrus_colorexpand_transp_inv[16][4] = { |
|
440 |
ROP2(cirrus_colorexpand_transp_inv_0), |
|
441 |
ROP2(cirrus_colorexpand_transp_inv_src_and_dst), |
|
442 |
ROP_NOP2(cirrus_bitblt_rop_nop), |
|
443 |
ROP2(cirrus_colorexpand_transp_inv_src_and_notdst), |
|
444 |
ROP2(cirrus_colorexpand_transp_inv_notdst), |
|
445 |
ROP2(cirrus_colorexpand_transp_inv_src), |
|
446 |
ROP2(cirrus_colorexpand_transp_inv_1), |
|
447 |
ROP2(cirrus_colorexpand_transp_inv_notsrc_and_dst), |
|
448 |
ROP2(cirrus_colorexpand_transp_inv_src_xor_dst), |
|
449 |
ROP2(cirrus_colorexpand_transp_inv_src_or_dst), |
|
450 |
ROP2(cirrus_colorexpand_transp_inv_notsrc_or_notdst), |
|
451 |
ROP2(cirrus_colorexpand_transp_inv_src_notxor_dst), |
|
452 |
ROP2(cirrus_colorexpand_transp_inv_src_or_notdst), |
|
453 |
ROP2(cirrus_colorexpand_transp_inv_notsrc), |
|
454 |
ROP2(cirrus_colorexpand_transp_inv_notsrc_or_dst), |
|
455 |
ROP2(cirrus_colorexpand_transp_inv_notsrc_and_notdst), |
|
456 |
}; |
|
457 |
|
|
438 | 458 |
static const cirrus_bitblt_rop_t cirrus_colorexpand[16][4] = { |
439 | 459 |
ROP2(cirrus_colorexpand_0), |
440 | 460 |
ROP2(cirrus_colorexpand_src_and_dst), |
... | ... | |
820 | 840 |
CIRRUS_BLTMODE_COLOREXPAND) { |
821 | 841 |
|
822 | 842 |
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_TRANSPARENTCOMP) { |
823 |
cirrus_bitblt_fgcol(s); |
|
824 |
s->cirrus_rop = cirrus_colorexpand_transp[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1]; |
|
843 |
if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) { |
|
844 |
cirrus_bitblt_bgcol(s); |
|
845 |
s->cirrus_rop = cirrus_colorexpand_transp_inv[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1]; |
|
846 |
} else { |
|
847 |
cirrus_bitblt_fgcol(s); |
|
848 |
s->cirrus_rop = cirrus_colorexpand_transp[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1]; |
|
849 |
} |
|
825 | 850 |
} else { |
826 | 851 |
cirrus_bitblt_fgcol(s); |
827 | 852 |
cirrus_bitblt_bgcol(s); |
b/hw/cirrus_vga_rop2.h | ||
---|---|---|
36 | 36 |
#error unsupported DEPTH |
37 | 37 |
#endif |
38 | 38 |
|
39 |
/* NOTE: srcpitch is ignored */ |
|
39 | 40 |
static void |
40 | 41 |
glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) |
41 | 42 |
(CirrusVGAState * s, uint8_t * dst, |
42 |
const uint8_t * src1,
|
|
43 |
const uint8_t * src, |
|
43 | 44 |
int dstpitch, int srcpitch, |
44 | 45 |
int bltwidth, int bltheight) |
45 | 46 |
{ |
46 |
const uint8_t *src; |
|
47 | 47 |
uint8_t *d; |
48 | 48 |
int x, y; |
49 | 49 |
unsigned bits; |
... | ... | |
54 | 54 |
|
55 | 55 |
col = s->cirrus_blt_fgcol; |
56 | 56 |
for(y = 0; y < bltheight; y++) { |
57 |
src = src1; |
|
58 | 57 |
bitmask = 0x80 >> srcskipleft; |
59 | 58 |
bits = *src++; |
60 | 59 |
d = dst; |
... | ... | |
70 | 69 |
d += (DEPTH / 8); |
71 | 70 |
bitmask >>= 1; |
72 | 71 |
} |
73 |
src1 += srcpitch; |
|
72 |
dst += dstpitch; |
|
73 |
} |
|
74 |
} |
|
75 |
|
|
76 |
/* NOTE: srcpitch is ignored */ |
|
77 |
static void |
|
78 |
glue(glue(glue(cirrus_colorexpand_transp_inv_, ROP_NAME), _),DEPTH) |
|
79 |
(CirrusVGAState * s, uint8_t * dst, |
|
80 |
const uint8_t * src, |
|
81 |
int dstpitch, int srcpitch, |
|
82 |
int bltwidth, int bltheight) |
|
83 |
{ |
|
84 |
uint8_t *d; |
|
85 |
int x, y; |
|
86 |
unsigned bits; |
|
87 |
unsigned int col; |
|
88 |
unsigned bitmask; |
|
89 |
unsigned index; |
|
90 |
int srcskipleft = 0; |
|
91 |
|
|
92 |
col = s->cirrus_blt_bgcol; |
|
93 |
for(y = 0; y < bltheight; y++) { |
|
94 |
bitmask = 0x80 >> srcskipleft; |
|
95 |
bits = *src++; |
|
96 |
d = dst; |
|
97 |
for (x = 0; x < bltwidth; x += (DEPTH / 8)) { |
|
98 |
if ((bitmask & 0xff) == 0) { |
|
99 |
bitmask = 0x80; |
|
100 |
bits = *src++; |
|
101 |
} |
|
102 |
index = (bits & bitmask); |
|
103 |
if (!index) { |
|
104 |
PUTPIXEL(); |
|
105 |
} |
|
106 |
d += (DEPTH / 8); |
|
107 |
bitmask >>= 1; |
|
108 |
} |
|
74 | 109 |
dst += dstpitch; |
75 | 110 |
} |
76 | 111 |
} |
... | ... | |
78 | 113 |
static void |
79 | 114 |
glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH) |
80 | 115 |
(CirrusVGAState * s, uint8_t * dst, |
81 |
const uint8_t * src1,
|
|
116 |
const uint8_t * src, |
|
82 | 117 |
int dstpitch, int srcpitch, |
83 | 118 |
int bltwidth, int bltheight) |
84 | 119 |
{ |
85 |
const uint8_t *src; |
|
86 | 120 |
uint32_t colors[2]; |
87 | 121 |
uint8_t *d; |
88 | 122 |
int x, y; |
... | ... | |
94 | 128 |
colors[0] = s->cirrus_blt_bgcol; |
95 | 129 |
colors[1] = s->cirrus_blt_fgcol; |
96 | 130 |
for(y = 0; y < bltheight; y++) { |
97 |
src = src1; |
|
98 | 131 |
bitmask = 0x80 >> srcskipleft; |
99 | 132 |
bits = *src++; |
100 | 133 |
d = dst; |
... | ... | |
108 | 141 |
d += (DEPTH / 8); |
109 | 142 |
bitmask >>= 1; |
110 | 143 |
} |
111 |
src1 += srcpitch; |
|
112 | 144 |
dst += dstpitch; |
113 | 145 |
} |
114 | 146 |
} |
Also available in: Unified diff