Revision 7b5d76da console.c
b/console.c | ||
---|---|---|
1068 | 1068 |
DisplayState *ds = s->ds; |
1069 | 1069 |
active_console = s; |
1070 | 1070 |
if (ds_get_bits_per_pixel(s->ds)) { |
1071 |
ds->surface = qemu_resize_displaysurface(ds->surface, s->g_width, |
|
1072 |
s->g_height, 32, 4 * s->g_width); |
|
1071 |
ds->surface = qemu_resize_displaysurface(ds, s->g_width, s->g_height); |
|
1073 | 1072 |
} else { |
1074 | 1073 |
s->ds->surface->width = s->width; |
1075 | 1074 |
s->ds->surface->height = s->height; |
... | ... | |
1277 | 1276 |
DisplayState *ds; |
1278 | 1277 |
|
1279 | 1278 |
ds = (DisplayState *) qemu_mallocz(sizeof(DisplayState)); |
1280 |
ds->surface = qemu_create_displaysurface(640, 480, 32, 640 * 4); |
|
1279 |
ds->allocator = &default_allocator; |
|
1280 |
ds->surface = qemu_create_displaysurface(ds, 640, 480); |
|
1281 | 1281 |
|
1282 | 1282 |
s = new_console(ds, GRAPHIC_CONSOLE); |
1283 | 1283 |
if (s == NULL) { |
1284 |
qemu_free_displaysurface(ds->surface);
|
|
1284 |
qemu_free_displaysurface(ds); |
|
1285 | 1285 |
qemu_free(ds); |
1286 | 1286 |
return NULL; |
1287 | 1287 |
} |
... | ... | |
1429 | 1429 |
s->g_width = width; |
1430 | 1430 |
s->g_height = height; |
1431 | 1431 |
if (is_graphic_console()) { |
1432 |
ds->surface = qemu_resize_displaysurface(ds->surface, width, height, 32, 4 * width);
|
|
1432 |
ds->surface = qemu_resize_displaysurface(ds, width, height);
|
|
1433 | 1433 |
dpy_resize(ds); |
1434 | 1434 |
} |
1435 | 1435 |
} |
... | ... | |
1552 | 1552 |
return pf; |
1553 | 1553 |
} |
1554 | 1554 |
|
1555 |
DisplaySurface* qemu_create_displaysurface(int width, int height, int bpp, int linesize)
|
|
1555 |
DisplaySurface* defaultallocator_create_displaysurface(int width, int height)
|
|
1556 | 1556 |
{ |
1557 | 1557 |
DisplaySurface *surface = (DisplaySurface*) qemu_mallocz(sizeof(DisplaySurface)); |
1558 | 1558 |
|
1559 | 1559 |
surface->width = width; |
1560 | 1560 |
surface->height = height; |
1561 |
surface->linesize = linesize;
|
|
1562 |
surface->pf = qemu_default_pixelformat(bpp);
|
|
1561 |
surface->linesize = width * 4;
|
|
1562 |
surface->pf = qemu_default_pixelformat(32);
|
|
1563 | 1563 |
#ifdef WORDS_BIGENDIAN |
1564 | 1564 |
surface->flags = QEMU_ALLOCATED_FLAG | QEMU_BIG_ENDIAN_FLAG; |
1565 | 1565 |
#else |
... | ... | |
1570 | 1570 |
return surface; |
1571 | 1571 |
} |
1572 | 1572 |
|
1573 |
DisplaySurface* qemu_resize_displaysurface(DisplaySurface *surface,
|
|
1574 |
int width, int height, int bpp, int linesize)
|
|
1573 |
DisplaySurface* defaultallocator_resize_displaysurface(DisplaySurface *surface,
|
|
1574 |
int width, int height) |
|
1575 | 1575 |
{ |
1576 | 1576 |
surface->width = width; |
1577 | 1577 |
surface->height = height; |
1578 |
surface->linesize = linesize;
|
|
1579 |
surface->pf = qemu_default_pixelformat(bpp);
|
|
1578 |
surface->linesize = width * 4;
|
|
1579 |
surface->pf = qemu_default_pixelformat(32);
|
|
1580 | 1580 |
if (surface->flags & QEMU_ALLOCATED_FLAG) |
1581 | 1581 |
surface->data = (uint8_t*) qemu_realloc(surface->data, surface->linesize * surface->height); |
1582 | 1582 |
else |
... | ... | |
1607 | 1607 |
return surface; |
1608 | 1608 |
} |
1609 | 1609 |
|
1610 |
void qemu_free_displaysurface(DisplaySurface *surface)
|
|
1610 |
void defaultallocator_free_displaysurface(DisplaySurface *surface)
|
|
1611 | 1611 |
{ |
1612 | 1612 |
if (surface == NULL) |
1613 | 1613 |
return; |
Also available in: Unified diff