mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:23:28 +02:00
Support variable bit depths. Fix color issues.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
var util = require('util')
|
||||
var os = require('os')
|
||||
|
||||
var EventEmitter = require('eventemitter3').EventEmitter
|
||||
var debug = require('debug')('vnc:connection')
|
||||
@@ -26,7 +27,7 @@ function VncConnection(conn, options) {
|
||||
this._serverPixelFormat = new PixelFormat({
|
||||
bitsPerPixel: 24
|
||||
, depth: 24
|
||||
, bigEndianFlag: 0
|
||||
, bigEndianFlag: os.endianness() == 'BE' ? 1 : 0
|
||||
, trueColorFlag: 1
|
||||
, redMax: 255
|
||||
, greenMax: 255
|
||||
@@ -35,7 +36,6 @@ function VncConnection(conn, options) {
|
||||
, greenShift: 8
|
||||
, blueShift: 0
|
||||
})
|
||||
this._requireServerPixelFormat = true
|
||||
this._serverName = this.options.name
|
||||
|
||||
this._clientVersion = null
|
||||
@@ -202,6 +202,7 @@ VncConnection.prototype._writeSecurityResult = function(result, reason) {
|
||||
}
|
||||
|
||||
VncConnection.prototype._writeServerInit = function() {
|
||||
debug('server pixel format', this._serverPixelFormat)
|
||||
var chunk = new Buffer(2 + 2 + 16 + 4 + this._serverName.length)
|
||||
chunk.writeUInt16BE(this._serverWidth, 0)
|
||||
chunk.writeUInt16BE(this._serverHeight, 2)
|
||||
@@ -318,12 +319,7 @@ VncConnection.prototype._read = function() {
|
||||
})
|
||||
// [16b, 19b) padding
|
||||
debug('client pixel format', this._clientPixelFormat)
|
||||
if (this._requireServerPixelFormat &&
|
||||
this._clientPixelFormat.bitsPerPixel <
|
||||
this._serverPixelFormat.bitsPerPixel) {
|
||||
this.end()
|
||||
return
|
||||
}
|
||||
this.emit('formatchange', this._clientPixelFormat)
|
||||
this._changeState(VncConnection.STATE_NEED_CLIENT_MESSAGE)
|
||||
}
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user