Revision ffe8b821 console.c

b/console.c
1278 1278
{
1279 1279
    DisplaySurface *surface = (DisplaySurface*) qemu_mallocz(sizeof(DisplaySurface));
1280 1280

  
1281
    surface->width = width;
1282
    surface->height = height;
1283
    surface->linesize = width * 4;
1284
    surface->pf = qemu_default_pixelformat(32);
1285
#ifdef HOST_WORDS_BIGENDIAN
1286
    surface->flags = QEMU_ALLOCATED_FLAG | QEMU_BIG_ENDIAN_FLAG;
1287
#else
1288
    surface->flags = QEMU_ALLOCATED_FLAG;
1289
#endif
1290
    surface->data = (uint8_t*) qemu_mallocz(surface->linesize * surface->height);
1291

  
1281
    int linesize = width * 4;
1282
    qemu_alloc_display(surface, width, height, linesize,
1283
                       qemu_default_pixelformat(32), 0);
1292 1284
    return surface;
1293 1285
}
1294 1286

  
1295 1287
static DisplaySurface* defaultallocator_resize_displaysurface(DisplaySurface *surface,
1296 1288
                                          int width, int height)
1297 1289
{
1290
    int linesize = width * 4;
1291
    qemu_alloc_display(surface, width, height, linesize,
1292
                       qemu_default_pixelformat(32), 0);
1293
    return surface;
1294
}
1295

  
1296
void qemu_alloc_display(DisplaySurface *surface, int width, int height,
1297
                        int linesize, PixelFormat pf, int newflags)
1298
{
1299
    void *data;
1298 1300
    surface->width = width;
1299 1301
    surface->height = height;
1300
    surface->linesize = width * 4;
1301
    surface->pf = qemu_default_pixelformat(32);
1302
    if (surface->flags & QEMU_ALLOCATED_FLAG)
1303
        surface->data = (uint8_t*) qemu_realloc(surface->data, surface->linesize * surface->height);
1304
    else
1305
        surface->data = (uint8_t*) qemu_malloc(surface->linesize * surface->height);
1302
    surface->linesize = linesize;
1303
    surface->pf = pf;
1304
    if (surface->flags & QEMU_ALLOCATED_FLAG) {
1305
        data = qemu_realloc(surface->data,
1306
                            surface->linesize * surface->height);
1307
    } else {
1308
        data = qemu_malloc(surface->linesize * surface->height);
1309
    }
1310
    surface->data = (uint8_t *)data;
1311
    surface->flags = newflags | QEMU_ALLOCATED_FLAG;
1306 1312
#ifdef HOST_WORDS_BIGENDIAN
1307
    surface->flags = QEMU_ALLOCATED_FLAG | QEMU_BIG_ENDIAN_FLAG;
1308
#else
1309
    surface->flags = QEMU_ALLOCATED_FLAG;
1313
    surface->flags |= QEMU_BIG_ENDIAN_FLAG;
1310 1314
#endif
1311

  
1312
    return surface;
1313 1315
}
1314 1316

  
1315 1317
DisplaySurface* qemu_create_displaysurface_from(int width, int height, int bpp,

Also available in: Unified diff