Diff for /qemu/console.c between versions 1.1.1.6 and 1.1.1.7

version 1.1.1.6, 2018/04/24 16:50:31 version 1.1.1.7, 2018/04/24 17:20:35
Line 28 Line 28
 //#define DEBUG_CONSOLE  //#define DEBUG_CONSOLE
 #define DEFAULT_BACKSCROLL 512  #define DEFAULT_BACKSCROLL 512
 #define MAX_CONSOLES 12  #define MAX_CONSOLES 12
 #define DEFAULT_MONITOR_SIZE "800x600"  
   
 #define QEMU_RGBA(r, g, b, a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))  #define QEMU_RGBA(r, g, b, a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
 #define QEMU_RGB(r, g, b) QEMU_RGBA(r, g, b, 0xff)  #define QEMU_RGB(r, g, b) QEMU_RGBA(r, g, b, 0xff)
Line 1068  void console_select(unsigned int index) Line 1067  void console_select(unsigned int index)
         DisplayState *ds = s->ds;          DisplayState *ds = s->ds;
         active_console = s;          active_console = s;
         if (ds_get_bits_per_pixel(s->ds)) {          if (ds_get_bits_per_pixel(s->ds)) {
             ds->surface = qemu_resize_displaysurface(ds->surface, s->g_width,              ds->surface = qemu_resize_displaysurface(ds, s->g_width, s->g_height);
                     s->g_height, 32, 4 * s->g_width);  
         } else {          } else {
             s->ds->surface->width = s->width;              s->ds->surface->width = s->width;
             s->ds->surface->height = s->height;              s->ds->surface->height = s->height;
Line 1277  DisplayState *graphic_console_init(vga_h Line 1275  DisplayState *graphic_console_init(vga_h
     DisplayState *ds;      DisplayState *ds;
   
     ds = (DisplayState *) qemu_mallocz(sizeof(DisplayState));      ds = (DisplayState *) qemu_mallocz(sizeof(DisplayState));
     ds->surface = qemu_create_displaysurface(640, 480, 32, 640 * 4);      ds->allocator = &default_allocator; 
       ds->surface = qemu_create_displaysurface(ds, 640, 480);
   
     s = new_console(ds, GRAPHIC_CONSOLE);      s = new_console(ds, GRAPHIC_CONSOLE);
     if (s == NULL) {      if (s == NULL) {
         qemu_free_displaysurface(ds->surface);          qemu_free_displaysurface(ds);
         qemu_free(ds);          qemu_free(ds);
         return NULL;          return NULL;
     }      }
Line 1327  static void text_console_do_init(CharDri Line 1326  static void text_console_do_init(CharDri
     unsigned height;      unsigned height;
     static int color_inited;      static int color_inited;
   
     s = new_console(ds, (p == 0) ? TEXT_CONSOLE : TEXT_CONSOLE_FIXED_SIZE);      s = new_console(ds, (p == NULL) ? TEXT_CONSOLE : TEXT_CONSOLE_FIXED_SIZE);
     if (!s) {      if (!s) {
         free(chr);          free(chr);
         return;          return;
Line 1353  static void text_console_do_init(CharDri Line 1352  static void text_console_do_init(CharDri
     s->y = 0;      s->y = 0;
     width = ds_get_width(s->ds);      width = ds_get_width(s->ds);
     height = ds_get_height(s->ds);      height = ds_get_height(s->ds);
     if (p != 0) {      if (p != NULL) {
         width = strtoul(p, (char **)&p, 10);          width = strtoul(p, (char **)&p, 10);
         if (*p == 'C') {          if (*p == 'C') {
             p++;              p++;
Line 1429  void qemu_console_resize(DisplayState *d Line 1428  void qemu_console_resize(DisplayState *d
     s->g_width = width;      s->g_width = width;
     s->g_height = height;      s->g_height = height;
     if (is_graphic_console()) {      if (is_graphic_console()) {
         ds->surface = qemu_resize_displaysurface(ds->surface, width, height, 32, 4 * width);          ds->surface = qemu_resize_displaysurface(ds, width, height);
         dpy_resize(ds);          dpy_resize(ds);
     }      }
 }  }
Line 1552  PixelFormat qemu_default_pixelformat(int Line 1551  PixelFormat qemu_default_pixelformat(int
     return pf;      return pf;
 }  }
   
 DisplaySurface* qemu_create_displaysurface(int width, int height, int bpp, int linesize)  DisplaySurface* defaultallocator_create_displaysurface(int width, int height)
 {  {
     DisplaySurface *surface = (DisplaySurface*) qemu_mallocz(sizeof(DisplaySurface));      DisplaySurface *surface = (DisplaySurface*) qemu_mallocz(sizeof(DisplaySurface));
   
     surface->width = width;      surface->width = width;
     surface->height = height;      surface->height = height;
     surface->linesize = linesize;      surface->linesize = width * 4;
     surface->pf = qemu_default_pixelformat(bpp);      surface->pf = qemu_default_pixelformat(32);
 #ifdef WORDS_BIGENDIAN  #ifdef WORDS_BIGENDIAN
     surface->flags = QEMU_ALLOCATED_FLAG | QEMU_BIG_ENDIAN_FLAG;      surface->flags = QEMU_ALLOCATED_FLAG | QEMU_BIG_ENDIAN_FLAG;
 #else  #else
Line 1570  DisplaySurface* qemu_create_displaysurfa Line 1569  DisplaySurface* qemu_create_displaysurfa
     return surface;      return surface;
 }  }
   
 DisplaySurface* qemu_resize_displaysurface(DisplaySurface *surface,  DisplaySurface* defaultallocator_resize_displaysurface(DisplaySurface *surface,
                                           int width, int height, int bpp, int linesize)                                            int width, int height)
 {  {
     surface->width = width;      surface->width = width;
     surface->height = height;      surface->height = height;
     surface->linesize = linesize;      surface->linesize = width * 4;
     surface->pf = qemu_default_pixelformat(bpp);      surface->pf = qemu_default_pixelformat(32);
     if (surface->flags & QEMU_ALLOCATED_FLAG)      if (surface->flags & QEMU_ALLOCATED_FLAG)
         surface->data = (uint8_t*) qemu_realloc(surface->data, surface->linesize * surface->height);          surface->data = (uint8_t*) qemu_realloc(surface->data, surface->linesize * surface->height);
     else      else
Line 1607  DisplaySurface* qemu_create_displaysurfa Line 1606  DisplaySurface* qemu_create_displaysurfa
     return surface;      return surface;
 }  }
   
 void qemu_free_displaysurface(DisplaySurface *surface)  void defaultallocator_free_displaysurface(DisplaySurface *surface)
 {  {
     if (surface == NULL)      if (surface == NULL)
         return;          return;

Removed from v.1.1.1.6  
changed lines
  Added in v.1.1.1.7


unix.superglobalmegacorp.com