diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-06-09 23:12:09 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-06-09 23:12:09 +0000 |
commit | e69390cee7c7a0526eac5189fc98a05c0a39ce85 (patch) | |
tree | b65f182a6cfd693b6b4e97ba7172b42fd099f154 /hw/cirrus_vga_rop2.h | |
parent | 7f647cf68f8da27a3d7b2436d545dded3d0f30dd (diff) |
pattern fill fixes and optimization
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@917 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/cirrus_vga_rop2.h')
-rw-r--r-- | hw/cirrus_vga_rop2.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/hw/cirrus_vga_rop2.h b/hw/cirrus_vga_rop2.h index c7514d3161..540e308e89 100644 --- a/hw/cirrus_vga_rop2.h +++ b/hw/cirrus_vga_rop2.h @@ -36,6 +36,49 @@ #error unsupported DEPTH #endif +static void +glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH) + (CirrusVGAState * s, uint8_t * dst, + const uint8_t * src, + int dstpitch, int srcpitch, + int bltwidth, int bltheight) +{ + uint8_t *d; + int x, y, pattern_y, pattern_pitch, pattern_x; + unsigned int col; + const uint8_t *src1; + +#if DEPTH == 8 + pattern_pitch = 8; +#elif DEPTH == 16 + pattern_pitch = 16; +#else + pattern_pitch = 32; +#endif + pattern_y = s->cirrus_blt_srcaddr & 7; + pattern_x = 0; + for(y = 0; y < bltheight; y++) { + d = dst; + src1 = src + pattern_y * pattern_pitch; + for (x = 0; x < bltwidth; x += (DEPTH / 8)) { +#if DEPTH == 8 + col = src1[pattern_x]; + pattern_x = (pattern_x + 1) & 7; +#elif DEPTH == 16 + col = ((uint16_t *)(src1 + pattern_x))[0]; + pattern_x = (pattern_x + 2) & 15; +#else + col = ((uint32_t *)(src1 + pattern_x))[0]; + pattern_x = (pattern_x + 4) & 31; +#endif + PUTPIXEL(); + d += (DEPTH / 8); + } + pattern_y = (pattern_y + 1) & 7; + dst += dstpitch; + } +} + /* NOTE: srcpitch is ignored */ static void glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) |