Revision 0e1f5a0c vnc.c

b/vnc.c
321 321
    }
322 322

  
323 323
    memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row));
324
    memset(vs->old_data, 42, vs->ds->linesize * vs->ds->height);
324
    memset(vs->old_data, 42, ds_get_linesize(vs->ds) * ds_get_height(vs->ds));
325 325
}
326 326

  
327 327
/* fastest code */
......
414 414

  
415 415
    vnc_framebuffer_update(vs, x, y, w, h, 0);
416 416

  
417
    row = vs->ds->data + y * vs->ds->linesize + x * vs->depth;
417
    row = ds_get_data(vs->ds) + y * ds_get_linesize(vs->ds) + x * vs->depth;
418 418
    for (i = 0; i < h; i++) {
419 419
	vs->write_pixels(vs, row, w * vs->depth);
420
	row += vs->ds->linesize;
420
	row += ds_get_linesize(vs->ds);
421 421
    }
422 422
}
423 423

  
......
495 495
    uint8_t *dst_row;
496 496
    char *old_row;
497 497
    int y = 0;
498
    int pitch = ds->linesize;
498
    int pitch = ds_get_linesize(ds);
499 499
    VncState *vs = ds->opaque;
500 500

  
501 501
    vnc_update_client(vs);
......
505 505
	pitch = -pitch;
506 506
    }
507 507

  
508
    src = (ds->linesize * (src_y + y) + vs->depth * src_x);
509
    dst = (ds->linesize * (dst_y + y) + vs->depth * dst_x);
508
    src = (ds_get_linesize(ds) * (src_y + y) + vs->depth * src_x);
509
    dst = (ds_get_linesize(ds) * (dst_y + y) + vs->depth * dst_x);
510 510

  
511
    src_row = ds->data + src;
512
    dst_row = ds->data + dst;
511
    src_row = ds_get_data(ds) + src;
512
    dst_row = ds_get_data(ds) + dst;
513 513
    old_row = vs->old_data + dst;
514 514

  
515 515
    for (y = 0; y < h; y++) {
......
563 563

  
564 564
	/* Walk through the dirty map and eliminate tiles that
565 565
	   really aren't dirty */
566
	row = vs->ds->data;
566
	row = ds_get_data(vs->ds);
567 567
	old_row = vs->old_data;
568 568

  
569 569
	for (y = 0; y < vs->height; y++) {
......
575 575
		ptr = row;
576 576
		old_ptr = (char*)old_row;
577 577

  
578
		for (x = 0; x < vs->ds->width; x += 16) {
578
		for (x = 0; x < ds_get_width(vs->ds); x += 16) {
579 579
		    if (memcmp(old_ptr, ptr, 16 * vs->depth) == 0) {
580 580
			vnc_clear_bit(vs->dirty_row[y], (x / 16));
581 581
		    } else {
......
588 588
		}
589 589
	    }
590 590

  
591
	    row += vs->ds->linesize;
592
	    old_row += vs->ds->linesize;
591
	    row += ds_get_linesize(vs->ds);
592
	    old_row += ds_get_linesize(vs->ds);
593 593
	}
594 594

  
595 595
	if (!has_dirty) {
......
918 918
	vnc_write_u8(vs, 0);
919 919
	vnc_write_u16(vs, 1);
920 920
	vnc_framebuffer_update(vs, absolute, 0,
921
			       vs->ds->width, vs->ds->height, -257);
921
			       ds_get_width(vs->ds), ds_get_height(vs->ds), -257);
922 922
	vnc_flush(vs);
923 923
    }
924 924
    vs->absolute = absolute;
......
941 941
	dz = 1;
942 942

  
943 943
    if (vs->absolute) {
944
	kbd_mouse_event(x * 0x7FFF / (vs->ds->width - 1),
945
			y * 0x7FFF / (vs->ds->height - 1),
944
	kbd_mouse_event(x * 0x7FFF / (ds_get_width(vs->ds) - 1),
945
			y * 0x7FFF / (ds_get_height(vs->ds) - 1),
946 946
			dz, buttons);
947 947
    } else if (vs->has_pointer_type_change) {
948 948
	x -= 0x7FFF;
......
1106 1106
				       int x_position, int y_position,
1107 1107
				       int w, int h)
1108 1108
{
1109
    if (x_position > vs->ds->width)
1110
        x_position = vs->ds->width;
1111
    if (y_position > vs->ds->height)
1112
        y_position = vs->ds->height;
1113
    if (x_position + w >= vs->ds->width)
1114
        w = vs->ds->width  - x_position;
1115
    if (y_position + h >= vs->ds->height)
1116
        h = vs->ds->height - y_position;
1109
    if (x_position > ds_get_width(vs->ds))
1110
        x_position = ds_get_width(vs->ds);
1111
    if (y_position > ds_get_height(vs->ds))
1112
        y_position = ds_get_height(vs->ds);
1113
    if (x_position + w >= ds_get_width(vs->ds))
1114
        w = ds_get_width(vs->ds)  - x_position;
1115
    if (y_position + h >= ds_get_height(vs->ds))
1116
        h = ds_get_height(vs->ds) - y_position;
1117 1117

  
1118 1118
    int i;
1119 1119
    vs->need_update = 1;
1120 1120
    if (!incremental) {
1121
	char *old_row = vs->old_data + y_position * vs->ds->linesize;
1121
	char *old_row = vs->old_data + y_position * ds_get_linesize(vs->ds);
1122 1122

  
1123 1123
	for (i = 0; i < h; i++) {
1124 1124
            vnc_set_bits(vs->dirty_row[y_position + i],
1125
                         (vs->ds->width / 16), VNC_DIRTY_WORDS);
1126
	    memset(old_row, 42, vs->ds->width * vs->depth);
1127
	    old_row += vs->ds->linesize;
1125
                         (ds_get_width(vs->ds) / 16), VNC_DIRTY_WORDS);
1126
	    memset(old_row, 42, ds_get_width(vs->ds) * vs->depth);
1127
	    old_row += ds_get_linesize(vs->ds);
1128 1128
	}
1129 1129
    }
1130 1130
}
......
1134 1134
    vnc_write_u8(vs, 0);
1135 1135
    vnc_write_u8(vs, 0);
1136 1136
    vnc_write_u16(vs, 1);
1137
    vnc_framebuffer_update(vs, 0, 0, vs->ds->width, vs->ds->height, -258);
1137
    vnc_framebuffer_update(vs, 0, 0, ds_get_width(vs->ds), ds_get_height(vs->ds), -258);
1138 1138
    vnc_flush(vs);
1139 1139
}
1140 1140

  
......
1497 1497
    char buf[1024];
1498 1498
    int size;
1499 1499

  
1500
    vs->width = vs->ds->width;
1501
    vs->height = vs->ds->height;
1502
    vnc_write_u16(vs, vs->ds->width);
1503
    vnc_write_u16(vs, vs->ds->height);
1500
    vs->width = ds_get_width(vs->ds);
1501
    vs->height = ds_get_height(vs->ds);
1502
    vnc_write_u16(vs, ds_get_width(vs->ds));
1503
    vnc_write_u16(vs, ds_get_height(vs->ds));
1504 1504

  
1505 1505
    pixel_format_message(vs);
1506 1506

  
......
2116 2116
    vnc_write(vs, "RFB 003.008\n", 12);
2117 2117
    vnc_flush(vs);
2118 2118
    vnc_read_when(vs, protocol_version, 12);
2119
    memset(vs->old_data, 0, vs->ds->linesize * vs->ds->height);
2119
    memset(vs->old_data, 0, ds_get_linesize(vs->ds) * ds_get_height(vs->ds));
2120 2120
    memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row));
2121 2121
    vs->has_resize = 0;
2122 2122
    vs->has_hextile = 0;

Also available in: Unified diff