mirror of
https://github.com/lwch/natpass.git
synced 2026-10-21 11:54:20 +00:00
修改原始图像质量的传输方式
This commit is contained in:
@@ -101,6 +101,7 @@ func (v *VNC) localRead(ctx context.Context, local *websocket.Conn, remote *pool
|
||||
case "mouse":
|
||||
v.mouseEvent(remote, data)
|
||||
case "keyboard":
|
||||
v.keyboardEvent(remote, data)
|
||||
case "cad":
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,6 +165,11 @@ func (link *Link) sendAll(img *image.RGBA) {
|
||||
}
|
||||
rect := image.Rect(x, y, x+width, y+height)
|
||||
next := img.SubImage(rect)
|
||||
if link.quality == 100 {
|
||||
link.remote.SendVNCImage(link.target, link.targetIdx, link.id,
|
||||
screen, rect, network.VncImage_raw, next.(*image.RGBA).Pix)
|
||||
continue
|
||||
}
|
||||
buf.Reset()
|
||||
err := jpeg.Encode(&buf, next, &jpeg.Options{Quality: int(link.quality)})
|
||||
if err == nil {
|
||||
@@ -184,6 +189,11 @@ func (link *Link) sendDiff(img *image.RGBA) {
|
||||
var buf bytes.Buffer
|
||||
for _, block := range blocks {
|
||||
next := img.SubImage(block)
|
||||
if link.quality == 100 {
|
||||
link.remote.SendVNCImage(link.target, link.targetIdx, link.id,
|
||||
screen, block, network.VncImage_raw, next.(*image.RGBA).Pix)
|
||||
continue
|
||||
}
|
||||
buf.Reset()
|
||||
err := jpeg.Encode(&buf, next, &jpeg.Options{Quality: int(link.quality)})
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user