@@ -823,15 +823,15 @@ static void sm501_2d_operation(SM501State *s)
}
/* If reverse blit do simple check for overlaps */
if (rtl && src_base == dst_base && src_pitch == dst_pitch) {
- overlap = (src_x < dst_x + width && src_x + width > dst_x &&
- src_y < dst_y + height && src_y + height > dst_y);
+ overlap = (ranges_overlap(src_x, width, dst_x, width) &&
+ ranges_overlap(src_y, height, dst_y, height));
} else if (rtl) {
- unsigned int sb, se, db, de;
+ unsigned int sb, sl, db, dl;
sb = src_base + (src_x + src_y * src_pitch) * bypp;
- se = sb + (width + (height - 1) * src_pitch) * bypp;
+ sl = (width + (height - 1) * src_pitch) * bypp;
db = dst_base + (dst_x + dst_y * dst_pitch) * bypp;
- de = db + (width + (height - 1) * dst_pitch) * bypp;
- overlap = (db < se && sb < de);
+ dl = (width + (height - 1) * dst_pitch) * bypp;
+ overlap = ranges_overlap(sb, sl, db, dl);
}
#ifdef CONFIG_PIXMAN
if (overlap && (s->use_pixman & BIT(2))) {
use ranges_overlap() instead of open-coding the overlap check to improve the readability of the code. Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> --- hw/display/sm501.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)