Revision 221bb2d5 hw/g364fb.c

b/hw/g364fb.c
36 36
    QEMUConsole *console;
37 37
    int graphic_mode;
38 38
    uint32_t scr_width, scr_height; /* in pixels */
39
    uint32_t last_scr_width, last_scr_height; /* in pixels */
40 39
} G364State;
41 40

  
42 41
/*
......
73 72

  
74 73
static void g364fb_draw_graphic(G364State *s, int full_update)
75 74
{
76
    if (s->scr_width == 0 || s->scr_height == 0)
77
        return;
78

  
79 75
    switch (s->ds->depth) {
80 76
        case 8:
81 77
            g364fb_draw_graphic8(s, full_update);
......
94 90
            return;
95 91
    }
96 92

  
97
    dpy_update(s->ds, 0, 0, s->last_scr_width, s->last_scr_height);
93
    dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height);
98 94
}
99 95

  
100 96
static void g364fb_draw_blank(G364State *s, int full_update)
......
104 100

  
105 101
    if (!full_update)
106 102
        return;
107
    if (s->last_scr_width <= 0 || s->last_scr_height <= 0)
108
        return;
109 103

  
110
    w = s->last_scr_width * ((s->ds->depth + 7) >> 3);
104
    w = s->scr_width * ((s->ds->depth + 7) >> 3);
111 105
    d = s->ds->data;
112
    for(i = 0; i < s->last_scr_height; i++) {
106
    for(i = 0; i < s->scr_height; i++) {
113 107
        memset(d, 0, w);
114 108
        d += s->ds->linesize;
115 109
    }
116
    dpy_update(s->ds, 0, 0,
117
               s->last_scr_width, s->last_scr_height);
110

  
111
    dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height);
118 112
}
119 113

  
120 114
#define GMODE_GRAPH 0
......
125 119
    G364State *s = opaque;
126 120
    int full_update, graphic_mode;
127 121

  
122
    if (s->scr_width == 0 || s->scr_height == 0)
123
        return;
124

  
128 125
    if (s->ctla & CTLA_FORCE_BLANK)
129 126
        graphic_mode = GMODE_BLANK;
130 127
    else
......
134 131
        s->graphic_mode = graphic_mode;
135 132
        full_update = 1;
136 133
    }
134
    if (s->scr_width != s->ds->width || s->scr_height != s->ds->height) {
135
        qemu_console_resize(s->console, s->scr_width, s->scr_height);
136
        full_update = 1;
137
    }
137 138
    switch(graphic_mode) {
138 139
        case GMODE_GRAPH:
139 140
            g364fb_draw_graphic(s, full_update);
......
158 159

  
159 160
    memset(s->palette, 0, sizeof(s->palette));
160 161
    s->scr_width = s->scr_height = 0;
161
    s->last_scr_width = s->last_scr_height = 0;
162 162
    memset(s->vram_buffer, 0, s->vram_size);
163 163
    s->graphic_mode = -1; /* force full update */
164 164
}
......
266 266
#endif
267 267
                break;
268 268
        }
269
        if (s->scr_width && s->scr_height)
270
            qemu_console_resize(s->console, s->scr_width, s->scr_height);
271 269
    }
272 270
    s->graphic_mode = -1; /* force full update */
273 271
}

Also available in: Unified diff