mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
Merge branch 'tickets/35' of ssh://guacamole.git.sourceforge.net/gitroot/guacamole/guacamole into releases/0.3.0
This commit is contained in:
@@ -293,8 +293,21 @@ public class VNCClient extends Client {
|
|||||||
log("Reading ServerInit...");
|
log("Reading ServerInit...");
|
||||||
frameBufferWidth = input.readUnsignedShort();
|
frameBufferWidth = input.readUnsignedShort();
|
||||||
frameBufferHeight = input.readUnsignedShort();
|
frameBufferHeight = input.readUnsignedShort();
|
||||||
byte[] pixelFormat = new byte[16];
|
|
||||||
input.readFully(pixelFormat);
|
// Pixel format
|
||||||
|
int bpp = input.read();
|
||||||
|
int depth = input.read();
|
||||||
|
boolean bigEndian = input.readBoolean();
|
||||||
|
boolean trueColor = input.readBoolean();
|
||||||
|
int redMax = input.readUnsignedShort();
|
||||||
|
int greenMax = input.readUnsignedShort();
|
||||||
|
int blueMax = input.readUnsignedShort();
|
||||||
|
int redShift = input.read();
|
||||||
|
int greenShift = input.read();
|
||||||
|
int blueShift = input.read();
|
||||||
|
byte[] padding = new byte[3];
|
||||||
|
input.readFully(padding);
|
||||||
|
|
||||||
int nameLength = input.readInt();
|
int nameLength = input.readInt();
|
||||||
byte[] nameBytes = new byte[nameLength];
|
byte[] nameBytes = new byte[nameLength];
|
||||||
input.readFully(nameBytes);
|
input.readFully(nameBytes);
|
||||||
@@ -312,11 +325,11 @@ public class VNCClient extends Client {
|
|||||||
// Set pixel format
|
// Set pixel format
|
||||||
VNCFullColorImageReader fullColorReader;
|
VNCFullColorImageReader fullColorReader;
|
||||||
if (colorBits == 8)
|
if (colorBits == 8)
|
||||||
fullColorReader = new VNCFullColorImageReader(3, 3, 2, 8);
|
fullColorReader = new VNCFullColorImageReader(bigEndian, 3, 3, 2, 8);
|
||||||
else if (colorBits == 16)
|
else if (colorBits == 16)
|
||||||
fullColorReader = new VNCFullColorImageReader(5, 6, 5, outputBPP);
|
fullColorReader = new VNCFullColorImageReader(bigEndian, 5, 6, 5, outputBPP);
|
||||||
else if (colorBits == 24)
|
else if (colorBits == 24)
|
||||||
fullColorReader = new VNCFullColorImageReader(8, 8, 8, outputBPP);
|
fullColorReader = new VNCFullColorImageReader(bigEndian, 8, 8, 8, outputBPP);
|
||||||
else
|
else
|
||||||
throw new VNCException("Color depth " + colorBits + " not supported. Only color depths of 8, 16, or 24 are allowed.");
|
throw new VNCException("Color depth " + colorBits + " not supported. Only color depths of 8, 16, or 24 are allowed.");
|
||||||
|
|
||||||
|
@@ -42,9 +42,10 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
|||||||
private int blueShift;
|
private int blueShift;
|
||||||
|
|
||||||
private boolean readAsIndexed;
|
private boolean readAsIndexed;
|
||||||
|
private boolean bigEndian;
|
||||||
|
|
||||||
public boolean isBigEndian() {
|
public boolean isBigEndian() {
|
||||||
return true;
|
return bigEndian;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBitsPerPixel() {
|
public int getBitsPerPixel() {
|
||||||
@@ -80,7 +81,7 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up BGR reader
|
// Set up BGR reader
|
||||||
public VNCFullColorImageReader(int redBits, int greenBits, int blueBits, int outputBPP) throws VNCException {
|
public VNCFullColorImageReader(boolean bigEndian, int redBits, int greenBits, int blueBits, int outputBPP) throws VNCException {
|
||||||
|
|
||||||
depth = redBits + greenBits + blueBits;
|
depth = redBits + greenBits + blueBits;
|
||||||
|
|
||||||
@@ -97,11 +98,11 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
|||||||
this.greenBits = greenBits;
|
this.greenBits = greenBits;
|
||||||
this.blueBits = blueBits;
|
this.blueBits = blueBits;
|
||||||
|
|
||||||
redMax = (1 << redBits) - 1;
|
|
||||||
greenMax = (1 << greenBits) - 1;
|
|
||||||
blueMax = (1 << blueBits) - 1;
|
blueMax = (1 << blueBits) - 1;
|
||||||
|
greenMax = (1 << greenBits) - 1;
|
||||||
|
redMax = (1 << redBits) - 1;
|
||||||
|
|
||||||
redShift = greenBits + blueBits;
|
redShift = greenBits + blueBits;
|
||||||
greenShift = blueBits;
|
greenShift = blueBits;
|
||||||
blueShift = 0;
|
blueShift = 0;
|
||||||
|
|
||||||
@@ -120,9 +121,20 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
|||||||
if (redBits != 8 || greenBits != 8 || blueBits != 8)
|
if (redBits != 8 || greenBits != 8 || blueBits != 8)
|
||||||
return readPixel(input);
|
return readPixel(input);
|
||||||
|
|
||||||
int red = input.read();
|
int red;
|
||||||
int green = input.read();
|
int green;
|
||||||
int blue = input.read();
|
int blue;
|
||||||
|
|
||||||
|
if (bigEndian) {
|
||||||
|
red = input.read();
|
||||||
|
green = input.read();
|
||||||
|
blue = input.read();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
blue = input.read();
|
||||||
|
green = input.read();
|
||||||
|
red = input.read();
|
||||||
|
}
|
||||||
|
|
||||||
int color = (red << 16) | (green << 8) | blue;
|
int color = (red << 16) | (green << 8) | blue;
|
||||||
return color;
|
return color;
|
||||||
@@ -136,10 +148,18 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
|||||||
value = input.read();
|
value = input.read();
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
value = input.readShort();
|
|
||||||
|
short inputShort = input.readShort();
|
||||||
|
if (!bigEndian) inputShort = Short.reverseBytes(inputShort);
|
||||||
|
|
||||||
|
value = inputShort;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
value = input.readInt();
|
|
||||||
|
int inputInt = input.readInt();
|
||||||
|
if (!bigEndian) inputInt = Integer.reverseBytes(inputInt);
|
||||||
|
|
||||||
|
value = inputInt;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IOException("Invalid BPP.");
|
throw new IOException("Invalid BPP.");
|
||||||
|
Reference in New Issue
Block a user