2018-07-27 16:55:06 +03:00
|
|
|
package rfb
|
2017-06-26 13:20:39 +03:00
|
|
|
|
|
|
|
import "encoding/binary"
|
|
|
|
|
|
|
|
type CopyRectEncoding struct {
|
|
|
|
SX, SY uint16
|
|
|
|
}
|
|
|
|
|
2017-07-14 02:01:24 +03:00
|
|
|
func (*CopyRectEncoding) Supported(Conn) bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*CopyRectEncoding) Type() EncodingType { return EncCopyRect }
|
2017-06-26 13:20:39 +03:00
|
|
|
|
|
|
|
func (enc *CopyRectEncoding) Read(c Conn, rect *Rectangle) error {
|
|
|
|
if err := binary.Read(c, binary.BigEndian, &enc.SX); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := binary.Read(c, binary.BigEndian, &enc.SY); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (enc *CopyRectEncoding) Write(c Conn, rect *Rectangle) error {
|
|
|
|
if err := binary.Write(c, binary.BigEndian, enc.SX); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := binary.Write(c, binary.BigEndian, enc.SY); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|