mirror of
https://github.com/amitbet/vncproxy.git
synced 2025-09-23 18:38:38 +00:00
refactored player code
This commit is contained in:
28
encodings/enc-cursor-pseudo.go
Normal file
28
encodings/enc-cursor-pseudo.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package encodings
|
||||
|
||||
import (
|
||||
"io"
|
||||
"math"
|
||||
"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.Encoding, 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
|
||||
}
|
Reference in New Issue
Block a user