Working cairo VNC client.
This commit is contained in:
parent
be731b5900
commit
846c42c1cb
@ -93,11 +93,11 @@ void guac_vnc_cursor(rfbClient* client, int x, int y, int w, int h, int bpp) {
|
|||||||
/* Copy image data from VNC client to RGBA buffer */
|
/* Copy image data from VNC client to RGBA buffer */
|
||||||
for (dy = 0; dy<h; dy++) {
|
for (dy = 0; dy<h; dy++) {
|
||||||
|
|
||||||
unsigned char* buffer_current;
|
unsigned int* buffer_current;
|
||||||
unsigned char* fb_current;
|
unsigned char* fb_current;
|
||||||
|
|
||||||
/* Get current buffer row, advance to next */
|
/* Get current buffer row, advance to next */
|
||||||
buffer_current = buffer_row_current;
|
buffer_current = (unsigned int*) buffer_row_current;
|
||||||
buffer_row_current += stride;
|
buffer_row_current += stride;
|
||||||
|
|
||||||
/* Get current framebuffer row, advance to next */
|
/* Get current framebuffer row, advance to next */
|
||||||
@ -106,7 +106,7 @@ void guac_vnc_cursor(rfbClient* client, int x, int y, int w, int h, int bpp) {
|
|||||||
|
|
||||||
for (dx = 0; dx<w; dx++) {
|
for (dx = 0; dx<w; dx++) {
|
||||||
|
|
||||||
unsigned char alpha;
|
unsigned char alpha, red, green, blue;
|
||||||
unsigned int v;
|
unsigned int v;
|
||||||
|
|
||||||
/* Read current pixel value */
|
/* Read current pixel value */
|
||||||
@ -127,11 +127,13 @@ void guac_vnc_cursor(rfbClient* client, int x, int y, int w, int h, int bpp) {
|
|||||||
if (*(fb_mask++)) alpha = 0xFF;
|
if (*(fb_mask++)) alpha = 0xFF;
|
||||||
else alpha = 0x00;
|
else alpha = 0x00;
|
||||||
|
|
||||||
|
/* Translate value to RGB */
|
||||||
|
red = (v >> client->format.redShift) * 0x100 / (client->format.redMax + 1);
|
||||||
|
green = (v >> client->format.greenShift) * 0x100 / (client->format.greenMax+ 1);
|
||||||
|
blue = (v >> client->format.blueShift) * 0x100 / (client->format.blueMax + 1);
|
||||||
|
|
||||||
/* Output ARGB */
|
/* Output ARGB */
|
||||||
*(buffer_current++) = alpha;
|
*(buffer_current++) = (alpha << 24) | (red << 16) | (green << 8) | blue;
|
||||||
*(buffer_current++) = (v >> client->format.redShift) * 0x100 / (client->format.redMax + 1);
|
|
||||||
*(buffer_current++) = (v >> client->format.greenShift) * 0x100 / (client->format.greenMax+ 1);
|
|
||||||
*(buffer_current++) = (v >> client->format.blueShift) * 0x100 / (client->format.blueMax + 1);
|
|
||||||
|
|
||||||
/* Next VNC pixel */
|
/* Next VNC pixel */
|
||||||
fb_current += bpp;
|
fb_current += bpp;
|
||||||
@ -168,7 +170,6 @@ void guac_vnc_update(rfbClient* client, int x, int y, int w, int h) {
|
|||||||
unsigned int bpp = client->format.bitsPerPixel/8;
|
unsigned int bpp = client->format.bitsPerPixel/8;
|
||||||
unsigned int fb_stride = bpp * client->width;
|
unsigned int fb_stride = bpp * client->width;
|
||||||
unsigned char* fb_row_current = client->frameBuffer + (y * fb_stride) + (x * bpp);
|
unsigned char* fb_row_current = client->frameBuffer + (y * fb_stride) + (x * bpp);
|
||||||
unsigned int v;
|
|
||||||
|
|
||||||
/* Ignore extra update if already handled by copyrect */
|
/* Ignore extra update if already handled by copyrect */
|
||||||
if (((vnc_guac_client_data*) gc->data)->copy_rect_used) {
|
if (((vnc_guac_client_data*) gc->data)->copy_rect_used) {
|
||||||
@ -179,11 +180,11 @@ void guac_vnc_update(rfbClient* client, int x, int y, int w, int h) {
|
|||||||
/* Copy image data from VNC client to PNG */
|
/* Copy image data from VNC client to PNG */
|
||||||
for (dy = y; dy<y+h; dy++) {
|
for (dy = y; dy<y+h; dy++) {
|
||||||
|
|
||||||
unsigned char* buffer_current;
|
unsigned int* buffer_current;
|
||||||
unsigned char* fb_current;
|
unsigned char* fb_current;
|
||||||
|
|
||||||
/* Get current buffer row, advance to next */
|
/* Get current buffer row, advance to next */
|
||||||
buffer_current = buffer_row_current;
|
buffer_current = (unsigned int*) buffer_row_current;
|
||||||
buffer_row_current += stride;
|
buffer_row_current += stride;
|
||||||
|
|
||||||
/* Get current framebuffer row, advance to next */
|
/* Get current framebuffer row, advance to next */
|
||||||
@ -192,6 +193,9 @@ void guac_vnc_update(rfbClient* client, int x, int y, int w, int h) {
|
|||||||
|
|
||||||
for (dx = x; dx<x+w; dx++) {
|
for (dx = x; dx<x+w; dx++) {
|
||||||
|
|
||||||
|
unsigned char red, green, blue;
|
||||||
|
unsigned int v;
|
||||||
|
|
||||||
switch (bpp) {
|
switch (bpp) {
|
||||||
case 4:
|
case 4:
|
||||||
v = *((unsigned int*) fb_current);
|
v = *((unsigned int*) fb_current);
|
||||||
@ -205,12 +209,13 @@ void guac_vnc_update(rfbClient* client, int x, int y, int w, int h) {
|
|||||||
v = *((unsigned char*) fb_current);
|
v = *((unsigned char*) fb_current);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output RGB */
|
/* Translate value to RGB */
|
||||||
|
red = (v >> client->format.redShift) * 0x100 / (client->format.redMax + 1);
|
||||||
|
green = (v >> client->format.greenShift) * 0x100 / (client->format.greenMax+ 1);
|
||||||
|
blue = (v >> client->format.blueShift) * 0x100 / (client->format.blueMax + 1);
|
||||||
|
|
||||||
buffer_current++; /* High 8 bits unused in Cairo's RGB24 */
|
/* Output RGB */
|
||||||
*(buffer_current++) = (v >> client->format.redShift) * 0x100 / (client->format.redMax + 1);
|
*(buffer_current++) = (red << 16) | (green << 8) | blue;
|
||||||
*(buffer_current++) = (v >> client->format.greenShift) * 0x100 / (client->format.greenMax + 1);
|
|
||||||
*(buffer_current++) = (v >> client->format.blueShift) * 0x100 / (client->format.blueMax + 1);
|
|
||||||
|
|
||||||
fb_current += bpp;
|
fb_current += bpp;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user