diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index d261e40eba..0d1ea3a51c 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -730,10 +730,10 @@ static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h) s->get_resolution((VGAState *)s, &width, &height); /* extra x, y */ - sx = (src % (width * depth)) / depth; - sy = (src / (width * depth)); - dx = (dst % (width *depth)) / depth; - dy = (dst / (width * depth)); + sx = (src % ABS(s->cirrus_blt_srcpitch)) / depth; + sy = (src / ABS(s->cirrus_blt_srcpitch)); + dx = (dst % ABS(s->cirrus_blt_dstpitch)) / depth; + dy = (dst / ABS(s->cirrus_blt_dstpitch)); /* normalize width */ w /= depth;