Revision 5fafdf24 vnc.c

b/vnc.c
1 1
/*
2 2
 * QEMU VNC display driver
3
 * 
3
 *
4 4
 * Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>
5 5
 * Copyright (C) 2006 Fabrice Bellard
6
 * 
6
 *
7 7
 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 8
 * of this software and associated documentation files (the "Software"), to deal
9 9
 * in the Software without restriction, including without limitation the rights
......
68 68

  
69 69
typedef void VncSendHextileTile(VncState *vs,
70 70
                                int x, int y, int w, int h,
71
                                uint32_t *last_bg, 
71
                                uint32_t *last_bg,
72 72
                                uint32_t *last_fg,
73 73
                                int *has_bg, int *has_fg);
74 74

  
......
226 226
        d[j++] = -1;
227 227
        n -= 32;
228 228
    }
229
    if (n > 0) 
229
    if (n > 0)
230 230
        d[j++] = (1 << n) - 1;
231 231
    while (j < nb_words)
232 232
        d[j++] = 0;
......
237 237
    return (d[k >> 5] >> (k & 0x1f)) & 1;
238 238
}
239 239

  
240
static inline int vnc_and_bits(const uint32_t *d1, const uint32_t *d2, 
240
static inline int vnc_and_bits(const uint32_t *d1, const uint32_t *d2,
241 241
                               int nb_words)
242 242
{
243 243
    int i;
......
314 314
    r = (v >> vs->red_shift1) & vs->red_max;
315 315
    g = (v >> vs->green_shift1) & vs->green_max;
316 316
    b = (v >> vs->blue_shift1) & vs->blue_max;
317
    v = (r << vs->red_shift) | 
318
        (g << vs->green_shift) | 
317
    v = (r << vs->red_shift) |
318
        (g << vs->green_shift) |
319 319
        (b << vs->blue_shift);
320 320
    switch(vs->pix_bpp) {
321 321
    case 1:
......
409 409
    has_fg = has_bg = 0;
410 410
    for (j = y; j < (y + h); j += 16) {
411 411
	for (i = x; i < (x + w); i += 16) {
412
            vs->send_hextile_tile(vs, i, j, 
412
            vs->send_hextile_tile(vs, i, j,
413 413
                                  MIN(16, x + w - i), MIN(16, y + h - j),
414 414
                                  &last_bg32, &last_fg32, &has_bg, &has_fg);
415 415
	}
......
912 912
    int keycode;
913 913

  
914 914
    keycode = keysym2scancode(vs->kbd_layout, sym & 0xFFFF);
915
    
915
   
916 916
    /* QEMU console switch */
917 917
    switch(keycode) {
918 918
    case 0x2a:                          /* Left Shift */
......
926 926
        else
927 927
            vs->modifiers_state[keycode] = 0;
928 928
        break;
929
    case 0x02 ... 0x0a: /* '1' to '9' keys */ 
929
    case 0x02 ... 0x0a: /* '1' to '9' keys */
930 930
        if (down && vs->modifiers_state[0x1d] && vs->modifiers_state[0x38]) {
931 931
            /* Reset the modifiers sent to the current console */
932 932
            reset_keys(vs);
......
1015 1015
	char *old_row = vs->old_data + y_position * vs->ds->linesize;
1016 1016

  
1017 1017
	for (i = 0; i < h; i++) {
1018
            vnc_set_bits(vs->dirty_row[y_position + i], 
1018
            vnc_set_bits(vs->dirty_row[y_position + i],
1019 1019
                         (vs->ds->width / 16), VNC_DIRTY_WORDS);
1020 1020
	    memset(old_row, 42, vs->ds->width * vs->depth);
1021 1021
	    old_row += vs->ds->linesize;
......
1087 1087
	vnc_client_error(vs);
1088 1088
        return;
1089 1089
    }
1090
    if (bits_per_pixel == 32 && 
1090
    if (bits_per_pixel == 32 &&
1091 1091
        host_big_endian_flag == big_endian_flag &&
1092 1092
        red_max == 0xff && green_max == 0xff && blue_max == 0xff &&
1093 1093
        red_shift == 16 && green_shift == 8 && blue_shift == 0) {
1094 1094
        vs->depth = 4;
1095 1095
        vs->write_pixels = vnc_write_pixels_copy;
1096 1096
        vs->send_hextile_tile = send_hextile_tile_32;
1097
    } else 
1098
    if (bits_per_pixel == 16 && 
1097
    } else
1098
    if (bits_per_pixel == 16 &&
1099 1099
        host_big_endian_flag == big_endian_flag &&
1100 1100
        red_max == 31 && green_max == 63 && blue_max == 31 &&
1101 1101
        red_shift == 11 && green_shift == 5 && blue_shift == 0) {
1102 1102
        vs->depth = 2;
1103 1103
        vs->write_pixels = vnc_write_pixels_copy;
1104 1104
        vs->send_hextile_tile = send_hextile_tile_16;
1105
    } else 
1106
    if (bits_per_pixel == 8 && 
1105
    } else
1106
    if (bits_per_pixel == 8 &&
1107 1107
        red_max == 7 && green_max == 7 && blue_max == 3 &&
1108 1108
        red_shift == 5 && green_shift == 2 && blue_shift == 0) {
1109 1109
        vs->depth = 1;
1110 1110
        vs->write_pixels = vnc_write_pixels_copy;
1111 1111
        vs->send_hextile_tile = send_hextile_tile_8;
1112
    } else 
1112
    } else
1113 1113
    {
1114 1114
        /* generic and slower case */
1115 1115
        if (bits_per_pixel != 8 &&
......
1208 1208
	vnc_client_error(vs);
1209 1209
	break;
1210 1210
    }
1211
	
1211

  
1212 1212
    vnc_read_when(vs, protocol_client_msg, 1);
1213 1213
    return 0;
1214 1214
}
......
1259 1259
        vs->send_hextile_tile = send_hextile_tile_8;
1260 1260
    }
1261 1261
    vs->write_pixels = vnc_write_pixels_copy;
1262
	
1262

  
1263 1263
    vnc_write(vs, pad, 3);           /* padding */
1264 1264

  
1265 1265
    if (qemu_name)

Also available in: Unified diff