vncproxy/encodings/enc-cursor-pseudo.go
Yoan Blanc 11b1d45ce9
global: make the whole package go mod ready
Signed-off-by: Yoan Blanc <yoan.blanc@exoscale.ch>
2018-11-30 09:40:45 +01:00

29 lines
694 B
Go

package encodings
import (
"io"
"math"
"github.com/amitbet/vncproxy/common"
)
type EncCursorPseudo struct {
}
func (pe *EncCursorPseudo) Type() int32 {
return int32(common.EncCursorPseudo)
}
func (z *EncCursorPseudo) WriteTo(w io.Writer) (n int, err error) {
return 0, nil
}
func (pe *EncCursorPseudo) Read(pf *common.PixelFormat, rect *common.Rectangle, r *common.RfbReadHelper) (common.IEncoding, error) {
if rect.Width*rect.Height == 0 {
return pe, nil
}
bytesPixel := int(pf.BPP / 8) //calcTightBytePerPixel(pf)
r.ReadBytes(int(rect.Width*rect.Height) * bytesPixel)
mask := ((rect.Width + 7) / 8) * rect.Height
r.ReadBytes(int(math.Floor(float64(mask))))
return pe, nil
}