提交 68db6dc5 编写于 作者: G Gerd Hoffmann

console: use pixman for fill+blit

Zap homegrown pixel shuffeling code, use pixman calls instead.
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 b7627952
...@@ -213,36 +213,14 @@ static void vga_fill_rect(QemuConsole *con, ...@@ -213,36 +213,14 @@ static void vga_fill_rect(QemuConsole *con,
uint32_t color) uint32_t color)
{ {
DisplaySurface *surface = qemu_console_surface(con); DisplaySurface *surface = qemu_console_surface(con);
uint8_t *d, *d1; pixman_rectangle16_t rect = {
int x, y, bpp; .x = posx, .y = posy, .width = width, .height = height
};
pixman_color_t pcolor;
bpp = surface_bytes_per_pixel(surface); pcolor = qemu_pixman_color(&surface->pf, color);
d1 = surface_data(surface) + pixman_image_fill_rectangles(PIXMAN_OP_SRC, surface->image,
surface_stride(surface) * posy + bpp * posx; &pcolor, 1, &rect);
for (y = 0; y < height; y++) {
d = d1;
switch(bpp) {
case 1:
for (x = 0; x < width; x++) {
*((uint8_t *)d) = color;
d++;
}
break;
case 2:
for (x = 0; x < width; x++) {
*((uint16_t *)d) = color;
d += 2;
}
break;
case 4:
for (x = 0; x < width; x++) {
*((uint32_t *)d) = color;
d += 4;
}
break;
}
d1 += surface_stride(surface);
}
} }
/* copy from (xs, ys) to (xd, yd) a rectangle of size (w, h) */ /* copy from (xs, ys) to (xd, yd) a rectangle of size (w, h) */
...@@ -250,33 +228,10 @@ static void vga_bitblt(QemuConsole *con, ...@@ -250,33 +228,10 @@ static void vga_bitblt(QemuConsole *con,
int xs, int ys, int xd, int yd, int w, int h) int xs, int ys, int xd, int yd, int w, int h)
{ {
DisplaySurface *surface = qemu_console_surface(con); DisplaySurface *surface = qemu_console_surface(con);
const uint8_t *s;
uint8_t *d;
int wb, y, bpp;
bpp = surface_bytes_per_pixel(surface); pixman_image_composite(PIXMAN_OP_SRC,
wb = w * bpp; surface->image, NULL, surface->image,
if (yd <= ys) { xs, ys, 0, 0, xd, yd, w, h);
s = surface_data(surface) +
surface_stride(surface) * ys + bpp * xs;
d = surface_data(surface) +
surface_stride(surface) * yd + bpp * xd;
for (y = 0; y < h; y++) {
memmove(d, s, wb);
d += surface_stride(surface);
s += surface_stride(surface);
}
} else {
s = surface_data(surface) +
surface_stride(surface) * (ys + h - 1) + bpp * xs;
d = surface_data(surface) +
surface_stride(surface) * (yd + h - 1) + bpp * xd;
for (y = 0; y < h; y++) {
memmove(d, s, wb);
d -= surface_stride(surface);
s -= surface_stride(surface);
}
}
} }
/***********************************************************/ /***********************************************************/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册